Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/evm/contracts/safeguards/OperationsValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ contract OperationsValidator is
*/
function _isSafeguardValid(Operation memory operation, Safeguard memory safeguard) internal pure returns (bool) {
if (safeguard.mode == uint8(0)) revert OperationsValidatorNoneAllowed();
if (operation.opType == uint8(OpType.Swap)) return _isSwapOperationValid(operation, safeguard);
if (operation.opType == uint8(OpType.Swap) || operation.opType == uint8(OpType.CrossChainSwap)) {
return _isSwapOperationValid(operation, safeguard);
}
if (operation.opType == uint8(OpType.Transfer)) return _isTransferOperationValid(operation, safeguard);
if (operation.opType == uint8(OpType.Call)) return _isCallOperationValid(operation, safeguard);
revert OperationsValidatorUnknownOperationType(uint8(operation.opType));
Expand Down
3 changes: 2 additions & 1 deletion packages/evm/test/safeguards/OperationsValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { OperationsValidator } from '../../types/ethers-contracts/index.js'
import {
CallSafeguardMode,
createCallOperation,
createCrossChainSwapOperation,
createDeniedAccountSafeguard,
createDeniedChainSafeguard,
createDeniedSelectorSafeguard,
Expand Down Expand Up @@ -122,7 +123,7 @@ describe('OperationsValidator', () => {
})

context('TokenIn', () => {
const operation = createSwapOperation({ tokensIn: [{ token: token1, amount: 1n }], tokensOut: [] })
const operation = createCrossChainSwapOperation({ tokensIn: [{ token: token1, amount: 1n }], tokensOut: [] })

context('when the token in is allowed', () => {
const safeguard = createOnlyAccountSafeguard(SwapSafeguardMode.TokenIn, token1)
Expand Down
Loading