UNPKG

@ensuro/swaplibrary

Version:

Solidity Library that implements swap using different plaforms with a homogeneneous interface

204 lines 10.4 kB
{ "_format": "hh3-artifact-1", "contractName": "SwapTesterMock", "sourceName": "contracts/mocks/SwapTesterMock.sol", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "input", "type": "uint256" } ], "name": "ExactInputResult", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "output", "type": "uint256" } ], "name": "ExactOutputResult", "type": "event" }, { "inputs": [ { "components": [ { "internalType": "enum SwapLibrary.SwapProtocol", "name": "protocol", "type": "uint8" }, { "internalType": "uint256", "name": "maxSlippage", "type": "uint256" }, { "internalType": "bytes", "name": "customParams", "type": "bytes" } ], "internalType": "struct SwapLibrary.SwapConfig", "name": "swapConfig", "type": "tuple" }, { "internalType": "address", "name": "tokenIn", "type": "address" }, { "internalType": "address", "name": "tokenOut", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }, { "internalType": "uint256", "name": "price", "type": "uint256" } ], "name": "executeExactInput", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "enum SwapLibrary.SwapProtocol", "name": "protocol", "type": "uint8" }, { "internalType": "uint256", "name": "maxSlippage", "type": "uint256" }, { "internalType": "bytes", "name": "customParams", "type": "bytes" } ], "internalType": "struct SwapLibrary.SwapConfig", "name": "swapConfig", "type": "tuple" }, { "internalType": "address", "name": "tokenIn", "type": "address" }, { "internalType": "address", "name": "tokenOut", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }, { "internalType": "uint256", "name": "price", "type": "uint256" } ], "name": "executeExactOutput", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "enum SwapLibrary.SwapProtocol", "name": "protocol", "type": "uint8" }, { "internalType": "uint256", "name": "maxSlippage", "type": "uint256" }, { "internalType": "bytes", "name": "customParams", "type": "bytes" } ], "internalType": "struct SwapLibrary.SwapConfig", "name": "swapConfig", "type": "tuple" } ], "name": "validateConfig", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x6080604052348015600e575f5ffd5b506105808061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063178fc642146100435780631922e4d714610058578063d74018a71461006b575b5f5ffd5b6100566100513660046102a1565b61007e565b005b6100566100663660046102a1565b610148565b61005661007936600461030c565b610202565b5f610088866103b4565b60405163581e517d60e01b815273__$3f37f428d493a3ca053e6c24f20e8f2e94$__9163581e517d916100c6919089908990899089906004016104db565b602060405180830381865af41580156100e1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610105919061051a565b90507f7d1251252437180878066577dd1c280db8feb2152d57a044f147003bd04ba4eb8160405161013891815260200190565b60405180910390a1505050505050565b5f610152866103b4565b604051637756691560e01b815273__$3f37f428d493a3ca053e6c24f20e8f2e94$__91637756691591610190919089908990899089906004016104db565b602060405180830381865af41580156101ab573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101cf919061051a565b90507f59fbbb51cc726a41bc000734e10c34b705550e4d5c75611780ec30c767064e488160405161013891815260200190565b61020b816103b4565b604051632cbf28cb60e21b815273__$3f37f428d493a3ca053e6c24f20e8f2e94$__9163b2fca32c916102419190600401610531565b5f6040518083038186803b158015610257575f5ffd5b505af4158015610269573d5f5f3e3d5ffd5b5050505050565b5f60608284031215610280575f5ffd5b50919050565b80356001600160a01b038116811461029c575f5ffd5b919050565b5f5f5f5f5f60a086880312156102b5575f5ffd5b853567ffffffffffffffff8111156102cb575f5ffd5b6102d788828901610270565b9550506102e660208701610286565b93506102f460408701610286565b94979396509394606081013594506080013592915050565b5f6020828403121561031c575f5ffd5b813567ffffffffffffffff811115610332575f5ffd5b61033e84828501610270565b949350505050565b634e487b7160e01b5f52604160045260245ffd5b6040516060810167ffffffffffffffff8111828210171561037d5761037d610346565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156103ac576103ac610346565b604052919050565b5f606082360312156103c4575f5ffd5b6103cc61035a565b8235600381106103da575f5ffd5b815260208381013590820152604083013567ffffffffffffffff8111156103ff575f5ffd5b830136601f82011261040f575f5ffd5b803567ffffffffffffffff81111561042957610429610346565b61043c601f8201601f1916602001610383565b818152366020838501011115610450575f5ffd5b816020840160208301375f9181016020019190915260408301525092915050565b5f81516003811061049057634e487b7160e01b5f52602160045260245ffd5b808452506020820151602084015260408201516060604085015280518060608601528060208301608087015e5f608082870101526080601f19601f8301168601019250505092915050565b60a081525f6104ed60a0830188610471565b6001600160a01b039687166020840152949095166040820152606081019290925260809091015292915050565b5f6020828403121561052a575f5ffd5b5051919050565b602081525f6105436020830184610471565b939250505056fea2646970667358221220e24ed1b306844b0327599399d421dd453080080ed5404d4c8137374e46645f7964736f6c63430008230033", "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063178fc642146100435780631922e4d714610058578063d74018a71461006b575b5f5ffd5b6100566100513660046102a1565b61007e565b005b6100566100663660046102a1565b610148565b61005661007936600461030c565b610202565b5f610088866103b4565b60405163581e517d60e01b815273__$3f37f428d493a3ca053e6c24f20e8f2e94$__9163581e517d916100c6919089908990899089906004016104db565b602060405180830381865af41580156100e1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610105919061051a565b90507f7d1251252437180878066577dd1c280db8feb2152d57a044f147003bd04ba4eb8160405161013891815260200190565b60405180910390a1505050505050565b5f610152866103b4565b604051637756691560e01b815273__$3f37f428d493a3ca053e6c24f20e8f2e94$__91637756691591610190919089908990899089906004016104db565b602060405180830381865af41580156101ab573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101cf919061051a565b90507f59fbbb51cc726a41bc000734e10c34b705550e4d5c75611780ec30c767064e488160405161013891815260200190565b61020b816103b4565b604051632cbf28cb60e21b815273__$3f37f428d493a3ca053e6c24f20e8f2e94$__9163b2fca32c916102419190600401610531565b5f6040518083038186803b158015610257575f5ffd5b505af4158015610269573d5f5f3e3d5ffd5b5050505050565b5f60608284031215610280575f5ffd5b50919050565b80356001600160a01b038116811461029c575f5ffd5b919050565b5f5f5f5f5f60a086880312156102b5575f5ffd5b853567ffffffffffffffff8111156102cb575f5ffd5b6102d788828901610270565b9550506102e660208701610286565b93506102f460408701610286565b94979396509394606081013594506080013592915050565b5f6020828403121561031c575f5ffd5b813567ffffffffffffffff811115610332575f5ffd5b61033e84828501610270565b949350505050565b634e487b7160e01b5f52604160045260245ffd5b6040516060810167ffffffffffffffff8111828210171561037d5761037d610346565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156103ac576103ac610346565b604052919050565b5f606082360312156103c4575f5ffd5b6103cc61035a565b8235600381106103da575f5ffd5b815260208381013590820152604083013567ffffffffffffffff8111156103ff575f5ffd5b830136601f82011261040f575f5ffd5b803567ffffffffffffffff81111561042957610429610346565b61043c601f8201601f1916602001610383565b818152366020838501011115610450575f5ffd5b816020840160208301375f9181016020019190915260408301525092915050565b5f81516003811061049057634e487b7160e01b5f52602160045260245ffd5b808452506020820151602084015260408201516060604085015280518060608601528060208301608087015e5f608082870101526080601f19601f8301168601019250505092915050565b60a081525f6104ed60a0830188610471565b6001600160a01b039687166020840152949095166040820152606081019290925260809091015292915050565b5f6020828403121561052a575f5ffd5b5051919050565b602081525f6105436020830184610471565b939250505056fea2646970667358221220e24ed1b306844b0327599399d421dd453080080ed5404d4c8137374e46645f7964736f6c63430008230033", "linkReferences": { "project/contracts/SwapLibrary.sol": { "SwapLibrary": [ { "length": 20, "start": 179 }, { "length": 20, "start": 381 }, { "length": 20, "start": 566 } ] } }, "deployedLinkReferences": { "project/contracts/SwapLibrary.sol": { "SwapLibrary": [ { "length": 20, "start": 151 }, { "length": 20, "start": 353 }, { "length": 20, "start": 538 } ] } }, "immutableReferences": {}, "inputSourceName": "project/contracts/mocks/SwapTesterMock.sol", "buildInfoId": "solc-0_8_35-3c6720e352a8805a57f3d5d8111ba91dcd52bec9" }