@ensuro/swaplibrary
Version:
Solidity Library that implements swap using different plaforms with a homogeneneous interface
202 lines (201 loc) • 10.5 kB
JSON
{
"_format": "hh-sol-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": "0x6080604052348015600f57600080fd5b506105c08061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063178fc642146100465780631922e4d71461005b578063d74018a71461006e575b600080fd5b6100596100543660046102b1565b610081565b005b6100596100693660046102b1565b61014e565b61005961007c366004610321565b61020b565b600061008c866103ce565b60405163581e517d60e01b815273__$6208b5e12e0bba0a75d52081aca1136159$__9163581e517d916100ca91908990899089908990600401610517565b602060405180830381865af41580156100e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010b9190610557565b90507f7d1251252437180878066577dd1c280db8feb2152d57a044f147003bd04ba4eb8160405161013e91815260200190565b60405180910390a1505050505050565b6000610159866103ce565b604051637756691560e01b815273__$6208b5e12e0bba0a75d52081aca1136159$__9163775669159161019791908990899089908990600401610517565b602060405180830381865af41580156101b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d89190610557565b90507f59fbbb51cc726a41bc000734e10c34b705550e4d5c75611780ec30c767064e488160405161013e91815260200190565b610214816103ce565b604051632cbf28cb60e21b815273__$6208b5e12e0bba0a75d52081aca1136159$__9163b2fca32c9161024a9190600401610570565b60006040518083038186803b15801561026257600080fd5b505af4158015610276573d6000803e3d6000fd5b5050505050565b60006060828403121561028f57600080fd5b50919050565b80356001600160a01b03811681146102ac57600080fd5b919050565b600080600080600060a086880312156102c957600080fd5b853567ffffffffffffffff8111156102e057600080fd5b6102ec8882890161027d565b9550506102fb60208701610295565b935061030960408701610295565b94979396509394606081013594506080013592915050565b60006020828403121561033357600080fd5b813567ffffffffffffffff81111561034a57600080fd5b6103568482850161027d565b949350505050565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156103975761039761035e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156103c6576103c661035e565b604052919050565b6000606082360312156103e057600080fd5b6103e8610374565b8235600381106103f757600080fd5b815260208381013590820152604083013567ffffffffffffffff81111561041d57600080fd5b830136601f82011261042e57600080fd5b803567ffffffffffffffff8111156104485761044861035e565b61045b601f8201601f191660200161039d565b81815236602083850101111561047057600080fd5b8160208401602083013760009181016020019190915260408301525092915050565b60008151600381106104b457634e487b7160e01b600052602160045260246000fd5b8084525060208201516020840152604082015160606040850152805180606086015260005b818110156104f657602081840181015160808884010152016104d9565b506000608082870101526080601f19601f8301168601019250505092915050565b60a08152600061052a60a0830188610492565b6001600160a01b039687166020840152949095166040820152606081019290925260809091015292915050565b60006020828403121561056957600080fd5b5051919050565b6020815260006105836020830184610492565b939250505056fea2646970667358221220cd7329872df600603629abd1b0b6be07e08ccceddb26418a89eef1193a8f83fd64736f6c634300081c0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063178fc642146100465780631922e4d71461005b578063d74018a71461006e575b600080fd5b6100596100543660046102b1565b610081565b005b6100596100693660046102b1565b61014e565b61005961007c366004610321565b61020b565b600061008c866103ce565b60405163581e517d60e01b815273__$6208b5e12e0bba0a75d52081aca1136159$__9163581e517d916100ca91908990899089908990600401610517565b602060405180830381865af41580156100e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010b9190610557565b90507f7d1251252437180878066577dd1c280db8feb2152d57a044f147003bd04ba4eb8160405161013e91815260200190565b60405180910390a1505050505050565b6000610159866103ce565b604051637756691560e01b815273__$6208b5e12e0bba0a75d52081aca1136159$__9163775669159161019791908990899089908990600401610517565b602060405180830381865af41580156101b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d89190610557565b90507f59fbbb51cc726a41bc000734e10c34b705550e4d5c75611780ec30c767064e488160405161013e91815260200190565b610214816103ce565b604051632cbf28cb60e21b815273__$6208b5e12e0bba0a75d52081aca1136159$__9163b2fca32c9161024a9190600401610570565b60006040518083038186803b15801561026257600080fd5b505af4158015610276573d6000803e3d6000fd5b5050505050565b60006060828403121561028f57600080fd5b50919050565b80356001600160a01b03811681146102ac57600080fd5b919050565b600080600080600060a086880312156102c957600080fd5b853567ffffffffffffffff8111156102e057600080fd5b6102ec8882890161027d565b9550506102fb60208701610295565b935061030960408701610295565b94979396509394606081013594506080013592915050565b60006020828403121561033357600080fd5b813567ffffffffffffffff81111561034a57600080fd5b6103568482850161027d565b949350505050565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156103975761039761035e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156103c6576103c661035e565b604052919050565b6000606082360312156103e057600080fd5b6103e8610374565b8235600381106103f757600080fd5b815260208381013590820152604083013567ffffffffffffffff81111561041d57600080fd5b830136601f82011261042e57600080fd5b803567ffffffffffffffff8111156104485761044861035e565b61045b601f8201601f191660200161039d565b81815236602083850101111561047057600080fd5b8160208401602083013760009181016020019190915260408301525092915050565b60008151600381106104b457634e487b7160e01b600052602160045260246000fd5b8084525060208201516020840152604082015160606040850152805180606086015260005b818110156104f657602081840181015160808884010152016104d9565b506000608082870101526080601f19601f8301168601019250505092915050565b60a08152600061052a60a0830188610492565b6001600160a01b039687166020840152949095166040820152606081019290925260809091015292915050565b60006020828403121561056957600080fd5b5051919050565b6020815260006105836020830184610492565b939250505056fea2646970667358221220cd7329872df600603629abd1b0b6be07e08ccceddb26418a89eef1193a8f83fd64736f6c634300081c0033",
"linkReferences": {
"contracts/SwapLibrary.sol": {
"SwapLibrary": [
{
"length": 20,
"start": 186
},
{
"length": 20,
"start": 391
},
{
"length": 20,
"start": 578
}
]
}
},
"deployedLinkReferences": {
"contracts/SwapLibrary.sol": {
"SwapLibrary": [
{
"length": 20,
"start": 155
},
{
"length": 20,
"start": 360
},
{
"length": 20,
"start": 547
}
]
}
}
}