UNPKG

@robertprp/intents-sdk

Version:

Shogun Network Intent-based cross-chain swaps SDK

1,717 lines (1,716 loc) 34.3 kB
// NOTE: this ABI file only contains some of the functions to use by the SDK export const SOURCE_CHAIN_GUARD_ABI = [ { inputs: [ { internalType: 'contract ISignatureTransfer', name: '_permit2', type: 'address', }, { internalType: 'address', name: 'initialOwner', type: 'address', }, { internalType: 'address', name: '_auctioneer', type: 'address', }, { internalType: 'contract IERC20', name: '_stakeToken', type: 'address', }, { internalType: 'contract IERC20', name: '_stablecoin', type: 'address', }, { internalType: 'uint32', name: '_withdrawalDelay', type: 'uint32', }, ], stateMutability: 'nonpayable', type: 'constructor', }, { inputs: [], name: 'AlreadyInitialized', type: 'error', }, { inputs: [], name: 'AlreadyPenalized', type: 'error', }, { inputs: [], name: 'AlreadySwapped', type: 'error', }, { inputs: [ { internalType: 'uint256', name: '', type: 'uint256', }, ], name: 'BelowMinStablecoinsAmount', type: 'error', }, { inputs: [], name: 'FeeOnTransferTokensNotSupported', type: 'error', }, { inputs: [], name: 'InitiateAndWaitForDeadline', type: 'error', }, { inputs: [], name: 'InvalidAddress', type: 'error', }, { inputs: [], name: 'InvalidAuctioneerSignature', type: 'error', }, { inputs: [], name: 'InvalidObligation', type: 'error', }, { inputs: [], name: 'InvalidOrder', type: 'error', }, { inputs: [], name: 'InvalidPermission', type: 'error', }, { inputs: [], name: 'InvalidShortString', type: 'error', }, { inputs: [], name: 'InvalidSignature', type: 'error', }, { inputs: [], name: 'InvalidSolverDeadline', type: 'error', }, { inputs: [], name: 'InvalidStakingContract', type: 'error', }, { inputs: [], name: 'InvalidSuccessConfirmation', type: 'error', }, { inputs: [], name: 'NoReentrancy', type: 'error', }, { inputs: [], name: 'NotAllowed', type: 'error', }, { inputs: [], name: 'NotAuctioneer', type: 'error', }, { inputs: [], name: 'NotSolver', type: 'error', }, { inputs: [], name: 'NotUser', type: 'error', }, { inputs: [], name: 'OrderIsBeingProcessed', type: 'error', }, { inputs: [], name: 'OrderIsNotActive', type: 'error', }, { inputs: [], name: 'OverMaxWithdrawalDelay', type: 'error', }, { inputs: [], name: 'OverdueDeadline', type: 'error', }, { inputs: [ { internalType: 'address', name: 'owner', type: 'address', }, ], name: 'OwnableInvalidOwner', type: 'error', }, { inputs: [ { internalType: 'address', name: 'account', type: 'address', }, ], name: 'OwnableUnauthorizedAccount', type: 'error', }, { inputs: [ { internalType: 'address', name: 'token', type: 'address', }, ], name: 'SafeERC20FailedOperation', type: 'error', }, { inputs: [], name: 'StakeAmountIsTooLow', type: 'error', }, { inputs: [], name: 'StakingContractIsNotApproved', type: 'error', }, { inputs: [ { internalType: 'string', name: 'str', type: 'string', }, ], name: 'StringTooLong', type: 'error', }, { inputs: [], name: 'SwapIsNotAllowed', type: 'error', }, { inputs: [], name: 'ZeroAmount', type: 'error', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'address', name: '', type: 'address', }, ], name: 'AuctioneerSet', type: 'event', }, { anonymous: false, inputs: [], name: 'EIP712DomainChanged', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { indexed: true, internalType: 'address', name: 'solver', type: 'address', }, { indexed: false, internalType: 'uint32', name: 'deadline', type: 'uint32', }, { indexed: false, internalType: 'uint128', name: 'protocolFee', type: 'uint128', }, { indexed: false, internalType: 'uint128', name: 'collateralAmount', type: 'uint128', }, ], name: 'ExecutionStart', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { indexed: true, internalType: 'address', name: 'user', type: 'address', }, { indexed: false, internalType: 'address', name: 'tokenIn', type: 'address', }, { indexed: false, internalType: 'uint32', name: 'deadline', type: 'uint32', }, { indexed: false, internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { indexed: false, internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { indexed: false, internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { indexed: false, internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], name: 'NewOrder', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, ], name: 'OrderCancelledByUser', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, ], name: 'OrderClosedByUser', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { indexed: true, internalType: 'address', name: 'solver', type: 'address', }, { indexed: false, internalType: 'address', name: 'recoverTokensReceiver', type: 'address', }, ], name: 'OrderSuccessfullyFulfilled', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'previousOwner', type: 'address', }, { indexed: true, internalType: 'address', name: 'newOwner', type: 'address', }, ], name: 'OwnershipTransferStarted', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'previousOwner', type: 'address', }, { indexed: true, internalType: 'address', name: 'newOwner', type: 'address', }, ], name: 'OwnershipTransferred', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'address', name: 'receiver', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256', }, ], name: 'ProtocolFeesCollected', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'address', name: 'solver', type: 'address', }, { indexed: false, internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { indexed: false, internalType: 'uint128', name: 'protocolFee', type: 'uint128', }, { indexed: false, internalType: 'uint128', name: 'userCompensation', type: 'uint128', }, ], name: 'SolverPenalized', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'account', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256', }, ], name: 'Stake', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'stakingContract', type: 'address', }, { indexed: true, internalType: 'address', name: 'account', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256', }, ], name: 'StakeMigration', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'account', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256', }, ], name: 'StakeUnlocked', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'address', name: 'stakingContract', type: 'address', }, { indexed: false, internalType: 'bool', name: 'approved', type: 'bool', }, ], name: 'StakingContractApproved', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { indexed: false, internalType: 'uint256', name: 'stablecoinsAmount', type: 'uint256', }, ], name: 'SwappedToStablecoins', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'account', type: 'address', }, { indexed: false, internalType: 'address', name: 'receiver', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256', }, ], name: 'Withdrawal', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'uint32', name: '', type: 'uint32', }, ], name: 'WithdrawalDelaySet', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'account', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256', }, ], name: 'WithdrawalInitiated', type: 'event', }, { inputs: [], name: 'acceptOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'auctioneer', outputs: [ { internalType: 'address', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, ], name: 'cancelOrder', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'cancelWithdrawalOrMigration', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, { components: [ { internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { internalType: 'address', name: 'solver', type: 'address', }, ], internalType: 'struct SuccessConfirmation', name: 'successConfirmation', type: 'tuple', }, { internalType: 'bytes', name: 'successConfirmationSignature', type: 'bytes', }, { internalType: 'address', name: 'recoverTokensReceiver', type: 'address', }, ], name: 'claimTokens', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'receiver', type: 'address', }, ], name: 'collectProtocolFees', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'collectedProtocolFees', outputs: [ { internalType: 'uint128', name: '', type: 'uint128', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, ], name: 'createOrder', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'eip712Domain', outputs: [ { internalType: 'bytes1', name: 'fields', type: 'bytes1', }, { internalType: 'string', name: 'name', type: 'string', }, { internalType: 'string', name: 'version', type: 'string', }, { internalType: 'uint256', name: 'chainId', type: 'uint256', }, { internalType: 'address', name: 'verifyingContract', type: 'address', }, { internalType: 'bytes32', name: 'salt', type: 'bytes32', }, { internalType: 'uint256[]', name: 'extensions', type: 'uint256[]', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, ], name: 'getOrderHash', outputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], stateMutability: 'pure', type: 'function', }, { inputs: [ { internalType: 'uint96', name: 'amount', type: 'uint96', }, ], name: 'initiateWithdrawalOrMigration', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: '', type: 'address', }, ], name: 'isApprovedForMigrationStakingContract', outputs: [ { internalType: 'bool', name: '', type: 'bool', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], name: 'lockedStablecoins', outputs: [ { internalType: 'uint256', name: '', type: 'uint256', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'contract IStakingV1', name: 'newStaking', type: 'address', }, { internalType: 'address', name: 'account', type: 'address', }, ], name: 'migrateStake', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], name: 'orderData', outputs: [ { internalType: 'bool', name: 'initialized', type: 'bool', }, { internalType: 'bool', name: 'deactivated', type: 'bool', }, { internalType: 'bool', name: 'tokensInWereSwappedToStablecoins', type: 'bool', }, { internalType: 'uint128', name: 'lockedCollateral', type: 'uint128', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint32', name: 'latestExecutionStart', type: 'uint32', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'owner', outputs: [ { internalType: 'address', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, { components: [ { internalType: 'uint256', name: 'signTimestamp', type: 'uint256', }, { internalType: 'uint256', name: 'startDeadline', type: 'uint256', }, { internalType: 'uint256', name: 'executionDeadline', type: 'uint256', }, { internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { internalType: 'uint128', name: 'protocolFee', type: 'uint128', }, { internalType: 'uint128', name: 'userCompensation', type: 'uint128', }, { internalType: 'string', name: 'destinationChainSolverAddress', type: 'string', }, { internalType: 'bool', name: 'willSwapTokensInToStablecoins', type: 'bool', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, ], internalType: 'struct SolverObligation', name: 'obligation', type: 'tuple', }, { internalType: 'bytes', name: 'solverSignature', type: 'bytes', }, ], name: 'penalizeSolver', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], name: 'penalized', outputs: [ { internalType: 'bool', name: '', type: 'bool', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'pendingOwner', outputs: [ { internalType: 'address', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'permit2', outputs: [ { internalType: 'contract ISignatureTransfer', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, ], name: 'recoverTokens', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'renounceOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'stakingContract', type: 'address', }, { internalType: 'bool', name: 'approve', type: 'bool', }, ], name: 'setApprovedStakingContractForMigration', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'newAuctioneer', type: 'address', }, ], name: 'setAuctioneer', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint32', name: '_withdrawalDelay', type: 'uint32', }, ], name: 'setWithdrawalDelay', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'stablecoin', outputs: [ { internalType: 'contract IERC20', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'address', name: 'account', type: 'address', }, { internalType: 'uint128', name: 'amount', type: 'uint128', }, ], name: 'stake', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: '', type: 'address', }, ], name: 'stakeData', outputs: [ { internalType: 'uint128', name: 'stakedAmount', type: 'uint128', }, { internalType: 'uint96', name: 'pendingWithdrawalAmount', type: 'uint96', }, { internalType: 'uint32', name: 'initiateWithdrawalTime', type: 'uint32', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'stakeToken', outputs: [ { internalType: 'contract IERC20', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, { internalType: 'bytes', name: 'userSignature', type: 'bytes', }, { components: [ { internalType: 'address', name: 'solver', type: 'address', }, { internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { internalType: 'uint128', name: 'collateralAmount', type: 'uint128', }, { internalType: 'uint128', name: 'protocolFee', type: 'uint128', }, { internalType: 'bool', name: 'allowSwap', type: 'bool', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, ], internalType: 'struct SourceChainSolverPermission', name: 'solverPermission', type: 'tuple', }, { internalType: 'bytes', name: 'auctioneerSignature', type: 'bytes', }, ], name: 'startOrderExecution', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { components: [ { internalType: 'address', name: 'user', type: 'address', }, { internalType: 'address', name: 'tokenIn', type: 'address', }, { internalType: 'uint32', name: 'srcChainId', type: 'uint32', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, { internalType: 'uint128', name: 'amountIn', type: 'uint128', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'bytes32', name: 'executionDetailsHash', type: 'bytes32', }, { internalType: 'uint256', name: 'nonce', type: 'uint256', }, ], internalType: 'struct OrderInfo', name: 'orderInfo', type: 'tuple', }, { internalType: 'bytes', name: 'userSignature', type: 'bytes', }, { components: [ { internalType: 'address', name: 'solver', type: 'address', }, { internalType: 'bytes32', name: 'orderHash', type: 'bytes32', }, { internalType: 'uint128', name: 'collateralAmount', type: 'uint128', }, { internalType: 'uint128', name: 'protocolFee', type: 'uint128', }, { internalType: 'bool', name: 'allowSwap', type: 'bool', }, { internalType: 'uint128', name: 'minStablecoinsAmount', type: 'uint128', }, { internalType: 'uint32', name: 'deadline', type: 'uint32', }, ], internalType: 'struct SourceChainSolverPermission', name: 'solverPermission', type: 'tuple', }, { internalType: 'bytes', name: 'auctioneerSignature', type: 'bytes', }, { internalType: 'contract ISourceChainSwapper', name: 'swapper', type: 'address', }, { internalType: 'bytes', name: 'swapData', type: 'bytes', }, ], name: 'startOrderExecutionWithSwap', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'newOwner', type: 'address', }, ], name: 'transferOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'receiver', type: 'address', }, ], name: 'withdrawStake', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'withdrawalDelay', outputs: [ { internalType: 'uint32', name: '', type: 'uint32', }, ], stateMutability: 'view', type: 'function', }, ] as const;