diff --git a/crates/contracts/artifacts/Solver.json b/crates/contracts/artifacts/Solver.json index d501e9a697..8248b515c2 100644 --- a/crates/contracts/artifacts/Solver.json +++ b/crates/contracts/artifacts/Solver.json @@ -1 +1 @@ -{"abi":[{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"bool","name":"countGas","type":"bool"}],"name":"storeBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISettlement","name":"settlementContract","type":"address"},{"internalType":"address payable","name":"trader","type":"address"},{"internalType":"address","name":"sellToken","type":"address"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"address","name":"buyToken","type":"address"},{"internalType":"address","name":"nativeToken","type":"address"},{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"bytes","name":"settlementCall","type":"bytes"}],"name":"swap","outputs":[{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256[]","name":"queriedBalances","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"}],"bytecode":"0x608060405234801561001057600080fd5b50610908806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806329055e4f1461003b5780633bbb2e1d14610065575b600080fd5b61004e6100493660046106ce565b61007a565b60405161005c9291906107ba565b60405180910390f35b610078610073366004610808565b6104d9565b005b60006060333014610111576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f6f6e6c792073696d756c6174696f6e206c6f67696320697320616c6c6f77656460448201527f20746f2063616c6c202773776170272066756e6374696f6e0000000000000000606482015260840160405180910390fd5b6040517f66b00f6800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c811660048301528a81166024830152604482018a9052878116606483015286811660848301528b16906366b00f689060a401600060405180830381600087803b15801561019957600080fd5b505af11580156101ad573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808d1660048301528e16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b15801561022757600080fd5b505af115801561023b573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808b1660048301528e16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b1580156102b557600080fd5b505af11580156102c9573d6000803e3d6000fd5b5050505060005a905061033f85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d73ffffffffffffffffffffffffffffffffffffffff1661060e90919063ffffffff16565b506000545a61034e9083610887565b6103589190610887565b6040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c811660048301528e166024820152600060448201529093503090633bbb2e1d90606401600060405180830381600087803b1580156103d157600080fd5b505af11580156103e5573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b811660048301528f16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b5050505060018054806020026020016040519081016040528092919081815260200182805480156104c357602002820191906000526020600020905b8154815260200190600101908083116104af575b5050505050915050995099975050505050505050565b60005a9050600173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff8616146105a6576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528616906370a0823190602401602060405180830381865afa15801561057d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a191906108a0565b6105bf565b8373ffffffffffffffffffffffffffffffffffffffff16315b815460018101835560009283526020909220909101558115610608575a6105e69082610887565b6105f29061116c6108b9565b60008082825461060291906108b9565b90915550505b50505050565b606061061c83600084610623565b9392505050565b606060008473ffffffffffffffffffffffffffffffffffffffff16848460405161064d91906108cc565b60006040518083038185875af1925050503d806000811461068a576040519150601f19603f3d011682016040523d82523d6000602084013e61068f565b606091505b5092509050806106a157815160208301fd5b509392505050565b73ffffffffffffffffffffffffffffffffffffffff811681146106cb57600080fd5b50565b60008060008060008060008060006101008a8c0312156106ed57600080fd5b89356106f8816106a9565b985060208a0135610708816106a9565b975060408a0135610718816106a9565b965060608a0135955060808a013561072f816106a9565b945060a08a013561073f816106a9565b935060c08a013561074f816106a9565b925060e08a013567ffffffffffffffff8082111561076c57600080fd5b818c0191508c601f83011261078057600080fd5b81358181111561078f57600080fd5b8d60208285010111156107a157600080fd5b6020830194508093505050509295985092959850929598565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156107fb578451835293830193918301916001016107df565b5090979650505050505050565b60008060006060848603121561081d57600080fd5b8335610828816106a9565b92506020840135610838816106a9565b91506040840135801515811461084d57600080fd5b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561089a5761089a610858565b92915050565b6000602082840312156108b257600080fd5b5051919050565b8082018082111561089a5761089a610858565b6000825160005b818110156108ed57602081860181015185830152016108d3565b50600092019182525091905056fea164736f6c6343000811000a","deployedBytecode":"0x608060405234801561001057600080fd5b50600436106100365760003560e01c806329055e4f1461003b5780633bbb2e1d14610065575b600080fd5b61004e6100493660046106ce565b61007a565b60405161005c9291906107ba565b60405180910390f35b610078610073366004610808565b6104d9565b005b60006060333014610111576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f6f6e6c792073696d756c6174696f6e206c6f67696320697320616c6c6f77656460448201527f20746f2063616c6c202773776170272066756e6374696f6e0000000000000000606482015260840160405180910390fd5b6040517f66b00f6800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c811660048301528a81166024830152604482018a9052878116606483015286811660848301528b16906366b00f689060a401600060405180830381600087803b15801561019957600080fd5b505af11580156101ad573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808d1660048301528e16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b15801561022757600080fd5b505af115801561023b573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808b1660048301528e16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b1580156102b557600080fd5b505af11580156102c9573d6000803e3d6000fd5b5050505060005a905061033f85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d73ffffffffffffffffffffffffffffffffffffffff1661060e90919063ffffffff16565b506000545a61034e9083610887565b6103589190610887565b6040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c811660048301528e166024820152600060448201529093503090633bbb2e1d90606401600060405180830381600087803b1580156103d157600080fd5b505af11580156103e5573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b811660048301528f16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b5050505060018054806020026020016040519081016040528092919081815260200182805480156104c357602002820191906000526020600020905b8154815260200190600101908083116104af575b5050505050915050995099975050505050505050565b60005a9050600173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff8616146105a6576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528616906370a0823190602401602060405180830381865afa15801561057d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a191906108a0565b6105bf565b8373ffffffffffffffffffffffffffffffffffffffff16315b815460018101835560009283526020909220909101558115610608575a6105e69082610887565b6105f29061116c6108b9565b60008082825461060291906108b9565b90915550505b50505050565b606061061c83600084610623565b9392505050565b606060008473ffffffffffffffffffffffffffffffffffffffff16848460405161064d91906108cc565b60006040518083038185875af1925050503d806000811461068a576040519150601f19603f3d011682016040523d82523d6000602084013e61068f565b606091505b5092509050806106a157815160208301fd5b509392505050565b73ffffffffffffffffffffffffffffffffffffffff811681146106cb57600080fd5b50565b60008060008060008060008060006101008a8c0312156106ed57600080fd5b89356106f8816106a9565b985060208a0135610708816106a9565b975060408a0135610718816106a9565b965060608a0135955060808a013561072f816106a9565b945060a08a013561073f816106a9565b935060c08a013561074f816106a9565b925060e08a013567ffffffffffffffff8082111561076c57600080fd5b818c0191508c601f83011261078057600080fd5b81358181111561078f57600080fd5b8d60208285010111156107a157600080fd5b6020830194508093505050509295985092959850929598565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156107fb578451835293830193918301916001016107df565b5090979650505050505050565b60008060006060848603121561081d57600080fd5b8335610828816106a9565b92506020840135610838816106a9565b91506040840135801515811461084d57600080fd5b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561089a5761089a610858565b92915050565b6000602082840312156108b257600080fd5b5051919050565b8082018082111561089a5761089a610858565b6000825160005b818110156108ed57602081860181015185830152016108d3565b50600092019182525091905056fea164736f6c6343000811000a","devdoc":{"methods":{}},"userdoc":{"methods":{}}} +{"abi":[{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"bool","name":"countGas","type":"bool"}],"name":"storeBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISettlement","name":"settlementContract","type":"address"},{"internalType":"address payable","name":"trader","type":"address"},{"internalType":"address","name":"sellToken","type":"address"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"address","name":"buyToken","type":"address"},{"internalType":"address","name":"nativeToken","type":"address"},{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"bytes","name":"settlementCall","type":"bytes"},{"internalType":"bool","name":"mockPreconditions","type":"bool"}],"name":"swap","outputs":[{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256[]","name":"queriedBalances","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"}],"bytecode":"0x608060405234801561001057600080fd5b50610992806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633bbb2e1d1461003b5780639efde0c214610050575b600080fd5b61004e61004936600461074f565b61007a565b005b61006361005e366004610796565b6101af565b604051610071929190610894565b60405180910390f35b60005a9050600173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff861614610147576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528616906370a0823190602401602060405180830381865afa15801561011e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014291906108e2565b610160565b8373ffffffffffffffffffffffffffffffffffffffff16315b8154600181018355600092835260209092209091015581156101a9575a610187908261092a565b6101939061116c610943565b6000808282546101a39190610943565b90915550505b50505050565b60006060333014610246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f6f6e6c792073696d756c6174696f6e206c6f67696320697320616c6c6f77656460448201527f20746f2063616c6c202773776170272066756e6374696f6e0000000000000000606482015260840160405180910390fd5b82156102e5576040517f57d5a1d300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d811660048301528b81166024830152604482018b905288811660648301528c16906357d5a1d390608401600060405180830381600087803b1580156102cc57600080fd5b505af11580156102e0573d6000803e3d6000fd5b505050505b60405173ffffffffffffffffffffffffffffffffffffffff8716906000908181818181875af1925050503d806000811461033b576040519150601f19603f3d011682016040523d82523d6000602084013e610340565b606091505b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c811660048301528e16602482015260006044820152309150633bbb2e1d90606401600060405180830381600087803b1580156103b957600080fd5b505af11580156103cd573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b811660048301528f16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b15801561044757600080fd5b505af115801561045b573d6000803e3d6000fd5b5050505060005a90506104d186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e73ffffffffffffffffffffffffffffffffffffffff1661067a90919063ffffffff16565b506000545a6104e0908361092a565b6104ea919061092a565b6040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d811660048301528f166024820152600060448201529093503090633bbb2e1d90606401600060405180830381600087803b15801561056357600080fd5b505af1158015610577573d6000803e3d6000fd5b505050503073ffffffffffffffffffffffffffffffffffffffff16633bbb2e1d8a8f60006040518463ffffffff1660e01b81526004016105e59392919073ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152901515604082015260600190565b600060405180830381600087803b1580156105ff57600080fd5b505af1158015610613573d6000803e3d6000fd5b50505050600180548060200260200160405190810160405280929190818152602001828054801561066357602002820191906000526020600020905b81548152602001906001019080831161064f575b50505050509150509a509a98505050505050505050565b60606106888360008461068f565b9392505050565b606060008473ffffffffffffffffffffffffffffffffffffffff1684846040516106b99190610956565b60006040518083038185875af1925050503d80600081146106f6576040519150601f19603f3d011682016040523d82523d6000602084013e6106fb565b606091505b50925090508061070d57815160208301fd5b509392505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461073757600080fd5b50565b8035801515811461074a57600080fd5b919050565b60008060006060848603121561076457600080fd5b833561076f81610715565b9250602084013561077f81610715565b915061078d6040850161073a565b90509250925092565b6000806000806000806000806000806101208b8d0312156107b657600080fd5b8a356107c181610715565b995060208b01356107d181610715565b985060408b01356107e181610715565b975060608b0135965060808b01356107f881610715565b955060a08b013561080881610715565b945060c08b013561081881610715565b935060e08b013567ffffffffffffffff8082111561083557600080fd5b818d0191508d601f83011261084957600080fd5b81358181111561085857600080fd5b8e602082850101111561086a57600080fd5b6020830195508094505050506108836101008c0161073a565b90509295989b9194979a5092959850565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156108d5578451835293830193918301916001016108b9565b5090979650505050505050565b6000602082840312156108f457600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561093d5761093d6108fb565b92915050565b8082018082111561093d5761093d6108fb565b6000825160005b81811015610977576020818601810151858301520161095d565b50600092019182525091905056fea164736f6c6343000811000a","deployedBytecode":"0x608060405234801561001057600080fd5b50600436106100365760003560e01c80633bbb2e1d1461003b5780639efde0c214610050575b600080fd5b61004e61004936600461074f565b61007a565b005b61006361005e366004610796565b6101af565b604051610071929190610894565b60405180910390f35b60005a9050600173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff861614610147576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528616906370a0823190602401602060405180830381865afa15801561011e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014291906108e2565b610160565b8373ffffffffffffffffffffffffffffffffffffffff16315b8154600181018355600092835260209092209091015581156101a9575a610187908261092a565b6101939061116c610943565b6000808282546101a39190610943565b90915550505b50505050565b60006060333014610246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f6f6e6c792073696d756c6174696f6e206c6f67696320697320616c6c6f77656460448201527f20746f2063616c6c202773776170272066756e6374696f6e0000000000000000606482015260840160405180910390fd5b82156102e5576040517f57d5a1d300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d811660048301528b81166024830152604482018b905288811660648301528c16906357d5a1d390608401600060405180830381600087803b1580156102cc57600080fd5b505af11580156102e0573d6000803e3d6000fd5b505050505b60405173ffffffffffffffffffffffffffffffffffffffff8716906000908181818181875af1925050503d806000811461033b576040519150601f19603f3d011682016040523d82523d6000602084013e610340565b606091505b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c811660048301528e16602482015260006044820152309150633bbb2e1d90606401600060405180830381600087803b1580156103b957600080fd5b505af11580156103cd573d6000803e3d6000fd5b50506040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b811660048301528f16602482015260006044820152309250633bbb2e1d9150606401600060405180830381600087803b15801561044757600080fd5b505af115801561045b573d6000803e3d6000fd5b5050505060005a90506104d186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e73ffffffffffffffffffffffffffffffffffffffff1661067a90919063ffffffff16565b506000545a6104e0908361092a565b6104ea919061092a565b6040517f3bbb2e1d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d811660048301528f166024820152600060448201529093503090633bbb2e1d90606401600060405180830381600087803b15801561056357600080fd5b505af1158015610577573d6000803e3d6000fd5b505050503073ffffffffffffffffffffffffffffffffffffffff16633bbb2e1d8a8f60006040518463ffffffff1660e01b81526004016105e59392919073ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152901515604082015260600190565b600060405180830381600087803b1580156105ff57600080fd5b505af1158015610613573d6000803e3d6000fd5b50505050600180548060200260200160405190810160405280929190818152602001828054801561066357602002820191906000526020600020905b81548152602001906001019080831161064f575b50505050509150509a509a98505050505050505050565b60606106888360008461068f565b9392505050565b606060008473ffffffffffffffffffffffffffffffffffffffff1684846040516106b99190610956565b60006040518083038185875af1925050503d80600081146106f6576040519150601f19603f3d011682016040523d82523d6000602084013e6106fb565b606091505b50925090508061070d57815160208301fd5b509392505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461073757600080fd5b50565b8035801515811461074a57600080fd5b919050565b60008060006060848603121561076457600080fd5b833561076f81610715565b9250602084013561077f81610715565b915061078d6040850161073a565b90509250925092565b6000806000806000806000806000806101208b8d0312156107b657600080fd5b8a356107c181610715565b995060208b01356107d181610715565b985060408b01356107e181610715565b975060608b0135965060808b01356107f881610715565b955060a08b013561080881610715565b945060c08b013561081881610715565b935060e08b013567ffffffffffffffff8082111561083557600080fd5b818d0191508d601f83011261084957600080fd5b81358181111561085857600080fd5b8e602082850101111561086a57600080fd5b6020830195508094505050506108836101008c0161073a565b90509295989b9194979a5092959850565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156108d5578451835293830193918301916001016108b9565b5090979650505050505050565b6000602082840312156108f457600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561093d5761093d6108fb565b92915050565b8082018082111561093d5761093d6108fb565b6000825160005b81811015610977576020818601810151858301520161095d565b50600092019182525091905056fea164736f6c6343000811000a","devdoc":{"methods":{}},"userdoc":{"methods":{}}} diff --git a/crates/contracts/artifacts/Trader.json b/crates/contracts/artifacts/Trader.json index 79c1267c16..f2a600e845 100644 --- a/crates/contracts/artifacts/Trader.json +++ b/crates/contracts/artifacts/Trader.json @@ -1 +1 @@ -{"abi":[{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract ISettlement","name":"settlementContract","type":"address"},{"internalType":"address","name":"sellToken","type":"address"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"address","name":"nativeToken","type":"address"},{"internalType":"address payable","name":"receiver","type":"address"}],"name":"prepareSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}],"bytecode":"0x608060405234801561001057600080fd5b50610c29806100206000396000f3fe60806040526004361061002d5760003560e01c80631626ba7e1461008657806366b00f68146100fe57610034565b3661003457005b600061007c6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525062010000939250506101209050565b9050805160208201f35b34801561009257600080fd5b506100c96100a13660046109ea565b7f1626ba7e000000000000000000000000000000000000000000000000000000009392505050565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b34801561010a57600080fd5b5061011e610119366004610a8b565b6101a2565b005b606060008373ffffffffffffffffffffffffffffffffffffffff16836040516101499190610b17565b600060405180830381855af49150503d8060008114610184576040519150601f19603f3d011682016040523d82523d6000602084013e610189565b606091505b50925090508061019b57815160208301fd5b5092915050565b6101aa6107de565b1561023c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f70726570617265537761702063616e206f6e6c792062652063616c6c6564206f60448201527f6e6365000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036103e7576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156102dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103009190610b33565b9050838110156103e55760006103168286610b4c565b905080471015610382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f7420656e6f7567682045544820746f2077726170000000000000000000006044820152606401610233565b8373ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156103ca57600080fd5b505af11580156103de573d6000803e3d6000fd5b5050505050505b505b60008473ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e308873ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610451573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104759190610b8c565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa1580156104e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105099190610b33565b905083811015610654576105a48673ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105859190610b8c565b73ffffffffffffffffffffffffffffffffffffffff8716906000610819565b6106548673ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106169190610b8c565b73ffffffffffffffffffffffffffffffffffffffff8716907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610819565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e59190610b33565b905084811015610777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f74726164657220646f6573206e6f74206861766520656e6f7567682073656c6c60448201527f5f746f6b656e00000000000000000000000000000000000000000000000000006064820152608401610233565b60405173ffffffffffffffffffffffffffffffffffffffff8416906000908181818181875af1925050503d80600081146107cd576040519150601f19603f3d011682016040523d82523d6000602084013e6107d2565b606091505b50505050505050505050565b60008061080c60017f7f36ecad6e52bbe2ff70badce94360882c890b7877b16131c08eabfc635c9735610b4c565b8054600190915592915050565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092019092526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052906000906108ac908616836108f4565b90506108ed816040518060400160405280601a81526020017f5361666545524332303a20617070726f76616c206661696c6564000000000000815250610909565b5050505050565b606061090283600084610964565b9392505050565b815115806109265750818060200190518101906109269190610ba9565b819061095f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102339190610bcb565b505050565b606060008473ffffffffffffffffffffffffffffffffffffffff16848460405161098e9190610b17565b60006040518083038185875af1925050503d80600081146109cb576040519150601f19603f3d011682016040523d82523d6000602084013e6109d0565b606091505b5092509050806109e257815160208301fd5b509392505050565b6000806000604084860312156109ff57600080fd5b83359250602084013567ffffffffffffffff80821115610a1e57600080fd5b818601915086601f830112610a3257600080fd5b813581811115610a4157600080fd5b876020828501011115610a5357600080fd5b6020830194508093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff81168114610a8857600080fd5b50565b600080600080600060a08688031215610aa357600080fd5b8535610aae81610a66565b94506020860135610abe81610a66565b9350604086013592506060860135610ad581610a66565b91506080860135610ae581610a66565b809150509295509295909350565b60005b83811015610b0e578181015183820152602001610af6565b50506000910152565b60008251610b29818460208701610af3565b9190910192915050565b600060208284031215610b4557600080fd5b5051919050565b81810381811115610b86577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b600060208284031215610b9e57600080fd5b815161090281610a66565b600060208284031215610bbb57600080fd5b8151801515811461090257600080fd5b6020815260008251806020840152610bea816040850160208701610af3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea164736f6c6343000811000a","deployedBytecode":"0x60806040526004361061002d5760003560e01c80631626ba7e1461008657806366b00f68146100fe57610034565b3661003457005b600061007c6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525062010000939250506101209050565b9050805160208201f35b34801561009257600080fd5b506100c96100a13660046109ea565b7f1626ba7e000000000000000000000000000000000000000000000000000000009392505050565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b34801561010a57600080fd5b5061011e610119366004610a8b565b6101a2565b005b606060008373ffffffffffffffffffffffffffffffffffffffff16836040516101499190610b17565b600060405180830381855af49150503d8060008114610184576040519150601f19603f3d011682016040523d82523d6000602084013e610189565b606091505b50925090508061019b57815160208301fd5b5092915050565b6101aa6107de565b1561023c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f70726570617265537761702063616e206f6e6c792062652063616c6c6564206f60448201527f6e6365000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036103e7576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156102dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103009190610b33565b9050838110156103e55760006103168286610b4c565b905080471015610382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f7420656e6f7567682045544820746f2077726170000000000000000000006044820152606401610233565b8373ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156103ca57600080fd5b505af11580156103de573d6000803e3d6000fd5b5050505050505b505b60008473ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e308873ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610451573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104759190610b8c565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa1580156104e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105099190610b33565b905083811015610654576105a48673ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105859190610b8c565b73ffffffffffffffffffffffffffffffffffffffff8716906000610819565b6106548673ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106169190610b8c565b73ffffffffffffffffffffffffffffffffffffffff8716907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610819565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e59190610b33565b905084811015610777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f74726164657220646f6573206e6f74206861766520656e6f7567682073656c6c60448201527f5f746f6b656e00000000000000000000000000000000000000000000000000006064820152608401610233565b60405173ffffffffffffffffffffffffffffffffffffffff8416906000908181818181875af1925050503d80600081146107cd576040519150601f19603f3d011682016040523d82523d6000602084013e6107d2565b606091505b50505050505050505050565b60008061080c60017f7f36ecad6e52bbe2ff70badce94360882c890b7877b16131c08eabfc635c9735610b4c565b8054600190915592915050565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092019092526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052906000906108ac908616836108f4565b90506108ed816040518060400160405280601a81526020017f5361666545524332303a20617070726f76616c206661696c6564000000000000815250610909565b5050505050565b606061090283600084610964565b9392505050565b815115806109265750818060200190518101906109269190610ba9565b819061095f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102339190610bcb565b505050565b606060008473ffffffffffffffffffffffffffffffffffffffff16848460405161098e9190610b17565b60006040518083038185875af1925050503d80600081146109cb576040519150601f19603f3d011682016040523d82523d6000602084013e6109d0565b606091505b5092509050806109e257815160208301fd5b509392505050565b6000806000604084860312156109ff57600080fd5b83359250602084013567ffffffffffffffff80821115610a1e57600080fd5b818601915086601f830112610a3257600080fd5b813581811115610a4157600080fd5b876020828501011115610a5357600080fd5b6020830194508093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff81168114610a8857600080fd5b50565b600080600080600060a08688031215610aa357600080fd5b8535610aae81610a66565b94506020860135610abe81610a66565b9350604086013592506060860135610ad581610a66565b91506080860135610ae581610a66565b809150509295509295909350565b60005b83811015610b0e578181015183820152602001610af6565b50506000910152565b60008251610b29818460208701610af3565b9190910192915050565b600060208284031215610b4557600080fd5b5051919050565b81810381811115610b86577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b600060208284031215610b9e57600080fd5b815161090281610a66565b600060208284031215610bbb57600080fd5b8151801515811461090257600080fd5b6020815260008251806020840152610bea816040850160208701610af3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea164736f6c6343000811000a","devdoc":{"methods":{}},"userdoc":{"methods":{}}} +{"abi":[{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract ISettlement","name":"settlementContract","type":"address"},{"internalType":"address","name":"sellToken","type":"address"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"address","name":"nativeToken","type":"address"}],"name":"prepareSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}],"bytecode":"0x608060405234801561001057600080fd5b50610bb5806100206000396000f3fe60806040526004361061002d5760003560e01c80631626ba7e1461008657806357d5a1d3146100fe57610034565b3661003457005b600061007c6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525062010000939250506101209050565b9050805160208201f35b34801561009257600080fd5b506100c96100a136600461098b565b7f1626ba7e000000000000000000000000000000000000000000000000000000009392505050565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b34801561010a57600080fd5b5061011e610119366004610a2c565b6101a2565b005b606060008373ffffffffffffffffffffffffffffffffffffffff16836040516101499190610aa3565b600060405180830381855af49150503d8060008114610184576040519150601f19603f3d011682016040523d82523d6000602084013e610189565b606091505b50925090508061019b57815160208301fd5b5092915050565b6101aa61077f565b1561023c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f70726570617265537761702063616e206f6e6c792062652063616c6c6564206f60448201527f6e6365000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036103e7576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa1580156102dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103009190610abf565b9050828110156103e55760006103168285610ad8565b905080471015610382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f7420656e6f7567682045544820746f2077726170000000000000000000006044820152606401610233565b8273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156103ca57600080fd5b505af11580156103de573d6000803e3d6000fd5b5050505050505b505b60008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e308773ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610451573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104759190610b18565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa1580156104e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105099190610abf565b905082811015610654576105a48573ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105859190610b18565b73ffffffffffffffffffffffffffffffffffffffff86169060006107ba565b6106548573ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106169190610b18565b73ffffffffffffffffffffffffffffffffffffffff8616907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6107ba565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e59190610abf565b905083811015610777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f74726164657220646f6573206e6f74206861766520656e6f7567682073656c6c60448201527f5f746f6b656e00000000000000000000000000000000000000000000000000006064820152608401610233565b505050505050565b6000806107ad60017f7f36ecad6e52bbe2ff70badce94360882c890b7877b16131c08eabfc635c9735610ad8565b8054600190915592915050565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092019092526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529060009061084d90861683610895565b905061088e816040518060400160405280601a81526020017f5361666545524332303a20617070726f76616c206661696c65640000000000008152506108aa565b5050505050565b60606108a383600084610905565b9392505050565b815115806108c75750818060200190518101906108c79190610b35565b8190610900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102339190610b57565b505050565b606060008473ffffffffffffffffffffffffffffffffffffffff16848460405161092f9190610aa3565b60006040518083038185875af1925050503d806000811461096c576040519150601f19603f3d011682016040523d82523d6000602084013e610971565b606091505b50925090508061098357815160208301fd5b509392505050565b6000806000604084860312156109a057600080fd5b83359250602084013567ffffffffffffffff808211156109bf57600080fd5b818601915086601f8301126109d357600080fd5b8135818111156109e257600080fd5b8760208285010111156109f457600080fd5b6020830194508093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff81168114610a2957600080fd5b50565b60008060008060808587031215610a4257600080fd5b8435610a4d81610a07565b93506020850135610a5d81610a07565b9250604085013591506060850135610a7481610a07565b939692955090935050565b60005b83811015610a9a578181015183820152602001610a82565b50506000910152565b60008251610ab5818460208701610a7f565b9190910192915050565b600060208284031215610ad157600080fd5b5051919050565b81810381811115610b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b600060208284031215610b2a57600080fd5b81516108a381610a07565b600060208284031215610b4757600080fd5b815180151581146108a357600080fd5b6020815260008251806020840152610b76816040850160208701610a7f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea164736f6c6343000811000a","deployedBytecode":"0x60806040526004361061002d5760003560e01c80631626ba7e1461008657806357d5a1d3146100fe57610034565b3661003457005b600061007c6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525062010000939250506101209050565b9050805160208201f35b34801561009257600080fd5b506100c96100a136600461098b565b7f1626ba7e000000000000000000000000000000000000000000000000000000009392505050565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b34801561010a57600080fd5b5061011e610119366004610a2c565b6101a2565b005b606060008373ffffffffffffffffffffffffffffffffffffffff16836040516101499190610aa3565b600060405180830381855af49150503d8060008114610184576040519150601f19603f3d011682016040523d82523d6000602084013e610189565b606091505b50925090508061019b57815160208301fd5b5092915050565b6101aa61077f565b1561023c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f70726570617265537761702063616e206f6e6c792062652063616c6c6564206f60448201527f6e6365000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036103e7576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa1580156102dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103009190610abf565b9050828110156103e55760006103168285610ad8565b905080471015610382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f6e6f7420656e6f7567682045544820746f2077726170000000000000000000006044820152606401610233565b8273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156103ca57600080fd5b505af11580156103de573d6000803e3d6000fd5b5050505050505b505b60008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e308773ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610451573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104759190610b18565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa1580156104e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105099190610abf565b905082811015610654576105a48573ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105859190610b18565b73ffffffffffffffffffffffffffffffffffffffff86169060006107ba565b6106548573ffffffffffffffffffffffffffffffffffffffff16639b552cc26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106169190610b18565b73ffffffffffffffffffffffffffffffffffffffff8616907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6107ba565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e59190610abf565b905083811015610777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f74726164657220646f6573206e6f74206861766520656e6f7567682073656c6c60448201527f5f746f6b656e00000000000000000000000000000000000000000000000000006064820152608401610233565b505050505050565b6000806107ad60017f7f36ecad6e52bbe2ff70badce94360882c890b7877b16131c08eabfc635c9735610ad8565b8054600190915592915050565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092019092526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529060009061084d90861683610895565b905061088e816040518060400160405280601a81526020017f5361666545524332303a20617070726f76616c206661696c65640000000000008152506108aa565b5050505050565b60606108a383600084610905565b9392505050565b815115806108c75750818060200190518101906108c79190610b35565b8190610900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102339190610b57565b505050565b606060008473ffffffffffffffffffffffffffffffffffffffff16848460405161092f9190610aa3565b60006040518083038185875af1925050503d806000811461096c576040519150601f19603f3d011682016040523d82523d6000602084013e610971565b606091505b50925090508061098357815160208301fd5b509392505050565b6000806000604084860312156109a057600080fd5b83359250602084013567ffffffffffffffff808211156109bf57600080fd5b818601915086601f8301126109d357600080fd5b8135818111156109e257600080fd5b8760208285010111156109f457600080fd5b6020830194508093505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff81168114610a2957600080fd5b50565b60008060008060808587031215610a4257600080fd5b8435610a4d81610a07565b93506020850135610a5d81610a07565b9250604085013591506060850135610a7481610a07565b939692955090935050565b60005b83811015610a9a578181015183820152602001610a82565b50506000910152565b60008251610ab5818460208701610a7f565b9190910192915050565b600060208284031215610ad157600080fd5b5051919050565b81810381811115610b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b600060208284031215610b2a57600080fd5b81516108a381610a07565b600060208284031215610b4757600080fd5b815180151581146108a357600080fd5b6020815260008251806020840152610b76816040850160208701610a7f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea164736f6c6343000811000a","devdoc":{"methods":{}},"userdoc":{"methods":{}}} diff --git a/crates/contracts/solidity/Solver.sol b/crates/contracts/solidity/Solver.sol index 5d0e3e7cca..8e9236b20a 100644 --- a/crates/contracts/solidity/Solver.sol +++ b/crates/contracts/solidity/Solver.sol @@ -35,6 +35,10 @@ contract Solver { /// @param nativeToken - ERC20 version of the chain's token /// @param receiver - address receiving the bought tokens /// @param settlementCall - the calldata of the `settle()` call + /// @param mockPreconditions - controls whether things like ETH wrapping + /// or setting allowance should be done on behalf of the + /// user to support quote verification even if the user didn't + /// wrap their ETH or set the necessary allowances yet. /// /// @return gasUsed - gas used for the `settle()` call /// @return queriedBalances - list of balances stored during the simulation @@ -46,19 +50,35 @@ contract Solver { address buyToken, address nativeToken, address payable receiver, - bytes calldata settlementCall + bytes calldata settlementCall, + bool mockPreconditions ) external returns ( uint256 gasUsed, uint256[] memory queriedBalances ) { require(msg.sender == address(this), "only simulation logic is allowed to call 'swap' function"); + // Prepare the trade in the context of the trader so we are allowed // to set approvals and things like that. - Trader(trader).prepareSwap(settlementContract, sellToken, sellAmount, nativeToken, receiver); + if (mockPreconditions) { + Trader(trader) + .prepareSwap( + settlementContract, + sellToken, + sellAmount, + nativeToken + ); + } + + // Warm the storage for sending ETH to smart contract addresses. + // We allow this call to revert becaues it was either unnecessary in the first place + // or failing to send `ETH` to the `receiver` will cause a revert in the settlement + // contract. + receiver.call{value: 0}(""); + this.storeBalance(sellToken, address(settlementContract), false); this.storeBalance(buyToken, address(settlementContract), false); uint256 gasStart = gasleft(); - // TODO can we assume the overhead of this function call to be negligible due to inlining? address(settlementContract).doCall(settlementCall); gasUsed = gasStart - gasleft() - _simulationOverhead; this.storeBalance(sellToken, address(settlementContract), false); @@ -69,7 +89,7 @@ contract Solver { /// @dev Helper function that reads the `owner`s balance for a given `token` and /// stores it. These stored balances will be returned as part of the simulation /// `Summary`. - /// @param token - which token's we read the balance from + /// @param token - which token we read the balance from /// @param owner - whos balance we are reading /// @param countGas - controls whether this gas cost should be discounted from the settlement gas. function storeBalance(address token, address owner, bool countGas) external { diff --git a/crates/contracts/solidity/Trader.sol b/crates/contracts/solidity/Trader.sol index 9d4a691761..d1354cb982 100644 --- a/crates/contracts/solidity/Trader.sol +++ b/crates/contracts/solidity/Trader.sol @@ -61,21 +61,18 @@ contract Trader { // settlement contract anyway. receive() external payable {} - /// @dev Prepares everything needed by the trader for successfully executing the swap. - /// This includes giving the required approval, wrapping the required ETH (if needed) - /// and warming the needed storage for sending native ETH to smart contracts. + /// @dev Executes needed actions on behalf of the trader to make the trade possible. + /// (e.g. wrapping ETH and setting approvals) /// @param settlementContract - pass in settlement contract because it does not have /// a stable address in tests. /// @param sellToken - token being sold by the trade /// @param sellAmount - expected amount to be sold according to the quote /// @param nativeToken - ERC20 version of the chain's native token - /// @param receiver - address that will receive the bought tokens function prepareSwap( ISettlement settlementContract, address sellToken, uint256 sellAmount, - address nativeToken, - address payable receiver + address nativeToken ) external { require(!alreadyCalled(), "prepareSwap can only be called once"); @@ -105,11 +102,6 @@ contract Trader { uint256 availableSellToken = IERC20(sellToken).balanceOf(address(this)); require(availableSellToken >= sellAmount, "trader does not have enough sell_token"); - // Warm the storage for sending ETH to smart contract addresses. - // We allow this call to revert becaues it was either unnecessary in the first place - // or failing to send `ETH` to the `receiver` will cause a revert in the settlement - // contract. - receiver.call{value: 0}(""); } /// @dev Validate all signature requests. This makes "signing" CoW protocol diff --git a/crates/shared/src/price_estimation/trade_verifier.rs b/crates/shared/src/price_estimation/trade_verifier.rs index 22c8c2506b..258e928ef3 100644 --- a/crates/shared/src/price_estimation/trade_verifier.rs +++ b/crates/shared/src/price_estimation/trade_verifier.rs @@ -131,6 +131,11 @@ impl TradeVerifier { self.native_token, verification.receiver, Bytes(settlement.data.unwrap().0), + // only if the user did not provide pre-interactions is it safe + // to set up the trade's pre-conditions on behalf of the user. + // if the user provided pre-interactions it's reasonable to assume + // that they will set up all the necessary details for the trade. + verification.pre_interactions.is_empty(), ) .tx;