UNPKG

@andrekorol/kollateral-contracts

Version:

Kollateral protocol, the flash loan building block

650 lines 273 kB
{ "contractName": "TestInvokable", "abi": [ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "sender", "type": "address" }, { "indexed": false, "internalType": "bytes32", "name": "dataHash", "type": "bytes32" }, { "indexed": false, "internalType": "address", "name": "currentTokenAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "currentTokenAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "currentRepaymentAmount", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "isCurrentTokenEther", "type": "bool" } ], "name": "HelperDump", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "bytes", "name": "swapData", "type": "bytes" } ], "name": "SwapDump", "type": "event" }, { "stateMutability": "payable", "type": "fallback" }, { "stateMutability": "payable", "type": "receive" }, { "inputs": [ { "internalType": "address", "name": "invokeAddress", "type": "address" }, { "internalType": "bytes", "name": "invokeData", "type": "bytes" } ], "name": "invoke", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "execute", "outputs": [], "stateMutability": "payable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.7.3+commit.9bfce1f6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"dataHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"currentTokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"currentTokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"currentRepaymentAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isCurrentTokenEther\",\"type\":\"bool\"}],\"name\":\"HelperDump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"swapData\",\"type\":\"bytes\"}],\"name\":\"SwapDump\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"invokeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"invokeData\",\"type\":\"bytes\"}],\"name\":\"invoke\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/testing/TestInvokable.sol\":\"TestInvokable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/common/invoke/IInvocationHook.sol\":{\"keccak256\":\"0x36fb31db8a8e7eed7038b37554582655826969a556005d8ee3ab5070fe034860\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://e0dde70be03ea1e086a5bce0d3a7bb1ac65549eab7ea2618343255332edddca7\",\"dweb:/ipfs/QmVaQG686g3tbgM3L3mtw4ei1WxzcDRcS9UxipSt4KCYs1\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/common/invoke/IInvokable.sol\":{\"keccak256\":\"0x372bca80a3e9d20439e9bf88cc026d6d1ec01556463e902511c67b6fc92e12d5\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://a5e6b5ef4246d03871bbd44b34e1212a9567d963f1b1e8e58e6273709442d4fb\",\"dweb:/ipfs/Qmb5Es45FLS4hhNGb9md3KU7L7hyMW7HHzumrVfsZZgxgC\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/common/invoke/KollateralInvokable.sol\":{\"keccak256\":\"0x4b02498b78045bba86ea077b47f9fc10714e0a8f17a9bca0498dac1b7b7dadac\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://beb241b55d91c474fb08119c4f4ddf92fa2fffb2a3f811d76511341880b70e8c\",\"dweb:/ipfs/QmdxtYC83A8Axn2XuJZcmE3RzEFxKXu7SSbvVoqCMydgYA\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/BalanceCarrier.sol\":{\"keccak256\":\"0x69e63e482d839c831c8c32f002e6454f6a8d9e602b39e9cdc1c0649451df3337\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://0a40661372b8f95cbed7714a16323b435ccbe85205178d32bc6012e47bfc0640\",\"dweb:/ipfs/QmTyHr1Ag4AkcyazzTT5GDcWabAMHPTrELoGhL85ZWDgBy\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/ExternalCaller.sol\":{\"keccak256\":\"0x54f88a1f0ac5dd7ab99a0519124cb09f1e19b4efb9baf240bc2500f8caa0b4ff\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://3170671378d20b47498224d065e33fccc223ae772d7f0af2c5ef314f94b75c98\",\"dweb:/ipfs/Qme8ZEEBnBG5Vvj8uyJCD2YVPcLx6funKsSSCpGkTyn1zi\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/testing/TestInvokable.sol\":{\"keccak256\":\"0x9aba95525b1f5f524ad1ba41d5e588fffeed3e9794ebcd9a8fce8a21da8b02e4\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://530cfc14f0b81f28bea433fe81efd18b1ca5f236f302be4108779b5efb2ba93d\",\"dweb:/ipfs/QmWUpQfequKdoGn4GZ53JLmjvukNHZDsGgxsoTQVcKY1dy\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0xba96bc371ba999f452985a98717cca1e4c4abb598dc038a9a9c3db08129b1ba4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://26e50e3f7b6482fb6f598f2e006994a74aa492687daa4b3eee7fd4fb5398ce7f\",\"dweb:/ipfs/QmZudqoPSkA4USLMFsBBmt19dDPZFS8aaAmL5R7pECXu6t\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xbd74f587ab9b9711801baf667db1426e4a03fd2d7f15af33e0e0d0394e7cef76\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2d0913dfbfce90d170df0d496ad7596c0778518e5fa7aba6c32562522546f66b\",\"dweb:/ipfs/QmR6B8nLj2PJf5e1JWD9Nk7ErkAwkqUwadCnvE82FJr1RU\"]}},\"version\":1}", "bytecode": "0x6080604052606460015534801561001557600080fd5b506001806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610fb9806100686000396000f3fe60806040526004361061002d5760003560e01c806309c5eabe146100365780639bb66b28146100af57610034565b3661003457005b005b6100ad6004803603602081101561004c57600080fd5b810190808035906020019064010000000081111561006957600080fd5b82018360208201111561007b57600080fd5b8035906020019184600183028401116401000000008311171561009d57600080fd5b9091929391929390505050610148565b005b610146600480360360408110156100c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561010257600080fd5b82018360208201111561011457600080fd5b8035906020019184600183028401116401000000008311171561013657600080fd5b90919293919293905050506103fb565b005b61019582828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061044f565b60008282905014156101ae576101a9610509565b6103f7565b60006060838360408110156101c257600080fd5b8101908080359060200190929190803590602001906401000000008111156101e957600080fd5b8201836020820111156101fb57600080fd5b8035906020019184600183028401116401000000008311171561021d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050509150915060018214156102b257600081806020019051602081101561028e57600080fd5b810190808051906020019092919050505090506102aa81610513565b5050506103f7565b60038214156103b057600060608280602001905160408110156102d457600080fd5b8101908080519060200190929190805160405193929190846401000000008211156102fe57600080fd5b8382019150602082018581111561031457600080fd5b825186600182028301116401000000008211171561033157600080fd5b8083526020830192505050908051906020019080838360005b8381101561036557808201518184015260208101905061034a565b50505050905090810190601f1680156103925780820380516001836020036101000a031916815260200191505b50604052505050915091506103a78282610529565b505050506103f7565b60048214156103f45760008180602001905160208110156103d057600080fd5b810190808051906020019092919050505090506103ec81610540565b5050506103f7565b50505b5050565b61044a833484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506105a3565b505050565b7f9586358b5895091f0ebfebde7118b5135333adbc7cad78410290244441e3bd2261047861070f565b8280519060200120610488610797565b61049061081f565b6104986108a7565b6104a061092f565b604051808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018215158152602001965050505050505060405180910390a150565b61051161096d565b565b61052561051e610797565b3383610a8b565b5050565b6105348234836105a3565b61053c61096d565b5050565b803414610598576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610f606024913960400191505060405180910390fd5b6105a061096d565b50565b600060608473ffffffffffffffffffffffffffffffffffffffff1684846040518082805190602001908083835b602083106105f357805182526020820191506020810190506020830392506105d0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610655576040519150601f19603f3d011682016040523d82523d6000602084013e61065a565b606091505b5091509150818190610707576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106cc5780820151818401526020810190506106b1565b50505050905090810190601f1680156106f95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff166370348f3e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075757600080fd5b505afa15801561076b573d6000803e3d6000fd5b505050506040513d602081101561078157600080fd5b8101908080519060200190929190505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff166311eefd5d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107df57600080fd5b505afa1580156107f3573d6000803e3d6000fd5b505050506040513d602081101561080957600080fd5b8101908080519060200190929190505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff1663ff69ac366040518163ffffffff1660e01b815260040160206040518083038186803b15801561086757600080fd5b505afa15801561087b573d6000803e3d6000fd5b505050506040513d602081101561089157600080fd5b8101908080519060200190929190505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff16636f27e9d86040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ef57600080fd5b505afa158015610903573d6000803e3d6000fd5b505050506040513d602081101561091957600080fd5b8101908080519060200190929190505050905090565b6000600173ffffffffffffffffffffffffffffffffffffffff16610951610797565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60006109bd61097a61081f565b6109af6127106109a161098b61081f565b6109936108a7565b610bab90919063ffffffff16565b610bf590919063ffffffff16565b610c7b90919063ffffffff16565b9050600154811115610a1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180610f11602e913960400191505060405180910390fd5b610a33610a25610797565b33610a2e6108a7565b610a8b565b610a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610ec36024913960400191505060405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610af557610aec8383610cc5565b60019050610ba4565b8373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b6657600080fd5b505af1158015610b7a573d6000803e3d6000fd5b505050506040513d6020811015610b9057600080fd5b810190808051906020019092919050505090505b9392505050565b6000610bed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d3c565b905092915050565b600080831415610c085760009050610c75565b6000828402905082848281610c1957fe5b0414610c70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610f3f6021913960400191505060405180910390fd5b809150505b92915050565b6000610cbd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610dfc565b905092915050565b80471015610d1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180610ee7602a913960400191505060405180910390fd5b610d388282604051806020016040528060008152506105a3565b5050565b6000838311158290610de9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610dae578082015181840152602081019050610d93565b50505050905090810190601f168015610ddb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290610ea8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e6d578082015181840152602081019050610e52565b50505050905090810190601f168015610e9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610eb457fe5b04905080915050939250505056fe4b6f6c6c61746572616c496e766f6b61626c653a206661696c656420746f20726570617945787465726e616c43616c6c65723a20696e73756666696369656e742065746865722062616c616e63654b6f6c6c61746572616c496e766f6b61626c653a2072657061796d656e742072657761726420746f6f2068696768536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7754657374496e766f6b61626c653a20646964206e6f7420666f72776172642076616c7565a26469706673582212209ae6940047b30f89593f76a752dd74ebabb22440c8e4f1c70c7fff05156e024b64736f6c63430007030033", "deployedBytecode": "0x60806040526004361061002d5760003560e01c806309c5eabe146100365780639bb66b28146100af57610034565b3661003457005b005b6100ad6004803603602081101561004c57600080fd5b810190808035906020019064010000000081111561006957600080fd5b82018360208201111561007b57600080fd5b8035906020019184600183028401116401000000008311171561009d57600080fd5b9091929391929390505050610148565b005b610146600480360360408110156100c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561010257600080fd5b82018360208201111561011457600080fd5b8035906020019184600183028401116401000000008311171561013657600080fd5b90919293919293905050506103fb565b005b61019582828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061044f565b60008282905014156101ae576101a9610509565b6103f7565b60006060838360408110156101c257600080fd5b8101908080359060200190929190803590602001906401000000008111156101e957600080fd5b8201836020820111156101fb57600080fd5b8035906020019184600183028401116401000000008311171561021d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050509150915060018214156102b257600081806020019051602081101561028e57600080fd5b810190808051906020019092919050505090506102aa81610513565b5050506103f7565b60038214156103b057600060608280602001905160408110156102d457600080fd5b8101908080519060200190929190805160405193929190846401000000008211156102fe57600080fd5b8382019150602082018581111561031457600080fd5b825186600182028301116401000000008211171561033157600080fd5b8083526020830192505050908051906020019080838360005b8381101561036557808201518184015260208101905061034a565b50505050905090810190601f1680156103925780820380516001836020036101000a031916815260200191505b50604052505050915091506103a78282610529565b505050506103f7565b60048214156103f45760008180602001905160208110156103d057600080fd5b810190808051906020019092919050505090506103ec81610540565b5050506103f7565b50505b5050565b61044a833484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506105a3565b505050565b7f9586358b5895091f0ebfebde7118b5135333adbc7cad78410290244441e3bd2261047861070f565b8280519060200120610488610797565b61049061081f565b6104986108a7565b6104a061092f565b604051808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018215158152602001965050505050505060405180910390a150565b61051161096d565b565b61052561051e610797565b3383610a8b565b5050565b6105348234836105a3565b61053c61096d565b5050565b803414610598576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610f606024913960400191505060405180910390fd5b6105a061096d565b50565b600060608473ffffffffffffffffffffffffffffffffffffffff1684846040518082805190602001908083835b602083106105f357805182526020820191506020810190506020830392506105d0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610655576040519150601f19603f3d011682016040523d82523d6000602084013e61065a565b606091505b5091509150818190610707576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106cc5780820151818401526020810190506106b1565b50505050905090810190601f1680156106f95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff166370348f3e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075757600080fd5b505afa15801561076b573d6000803e3d6000fd5b505050506040513d602081101561078157600080fd5b8101908080519060200190929190505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff166311eefd5d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107df57600080fd5b505afa1580156107f3573d6000803e3d6000fd5b505050506040513d602081101561080957600080fd5b8101908080519060200190929190505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff1663ff69ac366040518163ffffffff1660e01b815260040160206040518083038186803b15801561086757600080fd5b505afa15801561087b573d6000803e3d6000fd5b505050506040513d602081101561089157600080fd5b8101908080519060200190929190505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff16636f27e9d86040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ef57600080fd5b505afa158015610903573d6000803e3d6000fd5b505050506040513d602081101561091957600080fd5b8101908080519060200190929190505050905090565b6000600173ffffffffffffffffffffffffffffffffffffffff16610951610797565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60006109bd61097a61081f565b6109af6127106109a161098b61081f565b6109936108a7565b610bab90919063ffffffff16565b610bf590919063ffffffff16565b610c7b90919063ffffffff16565b9050600154811115610a1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180610f11602e913960400191505060405180910390fd5b610a33610a25610797565b33610a2e6108a7565b610a8b565b610a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610ec36024913960400191505060405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610af557610aec8383610cc5565b60019050610ba4565b8373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b6657600080fd5b505af1158015610b7a573d6000803e3d6000fd5b505050506040513d6020811015610b9057600080fd5b810190808051906020019092919050505090505b9392505050565b6000610bed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d3c565b905092915050565b600080831415610c085760009050610c75565b6000828402905082848281610c1957fe5b0414610c70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610f3f6021913960400191505060405180910390fd5b809150505b92915050565b6000610cbd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610dfc565b905092915050565b80471015610d1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180610ee7602a913960400191505060405180910390fd5b610d388282604051806020016040528060008152506105a3565b5050565b6000838311158290610de9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610dae578082015181840152602081019050610d93565b50505050905090810190601f168015610ddb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290610ea8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e6d578082015181840152602081019050610e52565b50505050905090810190601f168015610e9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610eb457fe5b04905080915050939250505056fe4b6f6c6c61746572616c496e766f6b61626c653a206661696c656420746f20726570617945787465726e616c43616c6c65723a20696e73756666696369656e742065746865722062616c616e63654b6f6c6c61746572616c496e766f6b61626c653a2072657061796d656e742072657761726420746f6f2068696768536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7754657374496e766f6b61626c653a20646964206e6f7420666f72776172642076616c7565a26469706673582212209ae6940047b30f89593f76a752dd74ebabb22440c8e4f1c70c7fff05156e024b64736f6c63430007030033", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "717:2235:30:-:0;;;957:3:5;922:38;;769:16:30;;;;;;;;;;1004:1:5;916:15:7;897:16;;:34;;;;;;;;;;;;;;;;;;850:88;717:2235:30;;;;;;", "deployedSourceMap": "717:2235:30:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1270:856;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;1094:170;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;1270:856;1344:16;1355:4;;1344:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:10;:16::i;:::-;1390:1;1375:4;;:11;;:16;1371:67;;;1414:13;:11;:13::i;:::-;1407:20;;1371:67;1449:16;1467:21;1516:4;;1492:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1448:112;;;;1586:1;1574:8;:13;1570:157;;;1603:23;1640:8;1629:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1603:57;;1681:35;1700:15;1681:18;:35::i;:::-;1674:42;;;;;1570:157;1752:1;1740:8;:13;1736:240;;;1770:21;1793:23;1848:8;1820:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1769:135;;;;1925:40;1939:13;1954:10;1925:13;:40::i;:::-;1918:47;;;;;;1736:240;2001:1;1989:8;:13;1985:135;;;2018:14;2046:8;2035:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2018:48;;2087:22;2102:6;2087:14;:22::i;:::-;2080:29;;;;;1985:135;1270:856;;;;;:::o;1094:170::-;1207:50;1220:13;1235:9;1246:10;;1207:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:12;:50::i;:::-;1094:170;;;:::o;2660:290::-;2723:220;2747:15;:13;:15::i;:::-;2786:4;2776:15;;;;;;2805:21;:19;:21::i;:::-;2840:20;:18;:20::i;:::-;2874:24;:22;:24::i;:::-;2912:21;:19;:21::i;:::-;2723:220;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2660:290;:::o;2132:56::-;2174:7;:5;:7::i;:::-;2132:56::o;2194:121::-;2257:51;2266:21;:19;:21::i;:::-;2289:10;2301:6;2257:8;:51::i;:::-;;2194:121;:::o;2321:176::-;2423:50;2436:13;2451:9;2462:10;2423:12;:50::i;:::-;2483:7;:5;:7::i;:::-;2321:176;;:::o;2503:151::-;2583:6;2570:9;:19;2562:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2640:7;:5;:7::i;:::-;2503:151;:::o;941:267:9:-;1062:12;1076:23;1103:3;:8;;1119:6;1140:5;1103:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1061:94;;;;1173:7;1189:10;1165:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;941:267;;;;;:::o;1369:124:5:-;1417:7;1459:10;1443:41;;;:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1436:50;;1369:124;:::o;1499:136::-;1553:7;1595:10;1579:47;;;:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1572:56;;1499:136;:::o;1641:134::-;1694:7;1736:10;1720:46;;;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1713:55;;1641:134;:::o;1781:142::-;1838:7;1880:10;1864:50;;;:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1857:59;;1781:142;:::o;1929:119::-;1983:4;2039:1;2006:35;;:21;:19;:21::i;:::-;:35;;;1999:42;;1929:119;:::o;1087:276::-;2094:23;2120:126;2225:20;:18;:20::i;:::-;2120:87;2201:5;2120:63;2162:20;:18;:20::i;:::-;2120:24;:22;:24::i;:::-;:41;;:63;;;;:::i;:::-;:80;;:87;;;;:::i;:::-;:104;;:126;;;;:::i;:::-;2094:152;;2297:15;;2278;:34;;2257:127;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1163:131:::1;1189:21;:19;:21::i;:::-;1228:10;1256:24;:22;:24::i;:::-;1163:8;:131::i;:::-;1142:214;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1087:276:::0;:::o;944:333:7:-;1060:4;1096:16;;;;;;;;;;;1080:32;;:12;:32;;;1076:195;;;1128:28;1145:2;1149:6;1128:16;:28::i;:::-;1177:4;1170:11;;;;1076:195;1226:12;1219:29;;;1249:2;1253:6;1219:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1212:48;;944:333;;;;;;:::o;1321:134:40:-;1379:7;1405:43;1409:1;1412;1405:43;;;;;;;;;;;;;;;;;:3;:43::i;:::-;1398:50;;1321:134;;;;:::o;2180:459::-;2238:7;2484:1;2479;:6;2475:45;;;2508:1;2501:8;;;;2475:45;2530:9;2546:1;2542;:5;2530:17;;2574:1;2569;2565;:5;;;;;;:10;2557:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2631:1;2624:8;;;2180:459;;;;;:::o;3101:130::-;3159:7;3185:39;3189:1;3192;3185:39;;;;;;;;;;;;;;;;;:3;:39::i;:::-;3178:46;;3101:130;;;;:::o;695:240:9:-;815:6;790:21;:31;;769:120;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;899:29;912:3;917:6;899:29;;;;;;;;;;;;:12;:29::i;:::-;695:240;;:::o;1746:187:40:-;1832:7;1864:1;1859;:6;;1867:12;1851:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1890:9;1906:1;1902;:5;1890:17;;1925:1;1918:8;;;1746:187;;;;;:::o;3713:272::-;3799:7;3830:1;3826;:5;3833:12;3818:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3856:9;3872:1;3868;:5;;;;;;3856:17;;3977:1;3970:8;;;3713:272;;;;;:::o", "source": "/*\n\n Copyright 2020 Kollateral LLC.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\n// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.7.0;\n\nimport \"../common/invoke/KollateralInvokable.sol\";\n\ncontract TestInvokable is KollateralInvokable {\n constructor() {}\n\n event HelperDump(\n address sender,\n bytes32 dataHash,\n address currentTokenAddress,\n uint256 currentTokenAmount,\n uint256 currentRepaymentAmount,\n bool isCurrentTokenEther\n );\n event SwapDump(bytes swapData);\n\n // To setup state for specific tests\n function invoke(address invokeAddress, bytes calldata invokeData)\n external\n payable\n {\n externalCall(invokeAddress, msg.value, invokeData);\n }\n\n function execute(bytes calldata data) external payable override {\n emitHelper(data);\n\n if (data.length == 0) {\n return executeNoop();\n }\n\n (uint256 testType, bytes memory testData) = abi.decode(\n data,\n (uint256, bytes)\n );\n if (testType == 1) {\n uint256 repaymentAmount = abi.decode(testData, (uint256));\n return executeRepayAmount(repaymentAmount);\n }\n if (testType == 3) {\n (address invokeAddress, bytes memory invokeData) = abi.decode(\n testData,\n (address, bytes)\n );\n return executeInvoke(invokeAddress, invokeData);\n }\n if (testType == 4) {\n uint256 amount = abi.decode(testData, (uint256));\n return executePayable(amount);\n }\n }\n\n function executeNoop() internal {\n repay();\n }\n\n function executeRepayAmount(uint256 amount) internal {\n transfer(currentTokenAddress(), msg.sender, amount);\n }\n\n function executeInvoke(address invokeAddress, bytes memory invokeData)\n internal\n {\n externalCall(invokeAddress, msg.value, invokeData);\n repay();\n }\n\n function executePayable(uint256 amount) internal {\n require(msg.value == amount, \"TestInvokable: did not forward value\");\n repay();\n }\n\n function emitHelper(bytes memory data) internal {\n emit HelperDump(\n currentSender(),\n keccak256(data),\n currentTokenAddress(),\n currentTokenAmount(),\n currentRepaymentAmount(),\n isCurrentTokenEther()\n );\n }\n}\n", "sourcePath": "/Users/andrekorol/src/kollateral/protocol/contracts/testing/TestInvokable.sol", "ast": { "absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/testing/TestInvokable.sol", "exportedSymbols": { "BalanceCarrier": [ 1464 ], "ExternalCaller": [ 1563 ], "IERC20": [ 6165 ], "IInvocationHook": [ 1170 ], "IInvokable": [ 1178 ], "KollateralInvokable": [ 1380 ], "SafeMath": [ 5584 ], "TestInvokable": [ 4333 ] }, "id": 4334, "license": "Apache-2.0", "nodeType": "SourceUnit", "nodes": [ { "id": 4118, "literals": [ "solidity", "^", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "640:23:30" }, { "absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/invoke/KollateralInvokable.sol", "file": "../common/invoke/KollateralInvokable.sol", "id": 4119, "nodeType": "ImportDirective", "scope": 4334, "sourceUnit": 1381, "src": "665:50:30", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "baseName": { "id": 4120, "name": "KollateralInvokable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1380, "src": "743:19:30", "typeDescriptions": { "typeIdentifier": "t_contract$_KollateralInvokable_$1380", "typeString": "contract KollateralInvokable" } }, "id": 4121, "nodeType": "InheritanceSpecifier", "src": "743:19:30" } ], "contractDependencies": [ 1178, 1380, 1464, 1563 ], "contractKind": "contract", "fullyImplemented": true, "id": 4333, "linearizedBaseContracts": [ 4333, 1380, 1464, 1563, 1178 ], "name": "TestInvokable", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 4124, "nodeType": "Block", "src": "783:2:30", "statements": [] }, "id": 4125, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 4122, "nodeType": "ParameterList", "parameters": [], "src": "780:2:30" }, "returnParameters": { "id": 4123, "nodeType": "ParameterList", "parameters": [], "src": "783:0:30" }, "scope": 4333, "src": "769:16:30", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "anonymous": false, "id": 4139, "name": "HelperDump", "nodeType": "EventDefinition", "parameters": { "id": 4138, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4127, "indexed": false, "mutability": "mutable", "name": "sender", "nodeType": "VariableDeclaration", "scope": 4139, "src": "817:14:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4126, "name": "address", "nodeType": "ElementaryTypeName", "src": "817:7:30", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 4129, "indexed": false, "mutability": "mutable", "name": "dataHash", "nodeType": "VariableDeclaration", "scope": 4139, "src": "841:16:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 4128, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "841:7:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "visibility": "internal" }, { "constant": false, "id": 4131, "indexed": false, "mutability": "mutable", "name": "currentTokenAddress", "nodeType": "VariableDeclaration", "scope": 4139, "src": "867:27:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4130, "name": "address", "nodeType": "ElementaryTypeName", "src": "867:7:30", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 4133, "indexed": false, "mutability": "mutable", "name": "currentTokenAmount", "nodeType": "VariableDeclaration", "scope": 4139, "src": "904:26:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4132, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "904:7:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 4135, "indexed": false, "mutability": "mutable", "name": "currentRepaymentAmount", "nodeType": "VariableDeclaration", "scope": 4139, "src": "940:30:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4134, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "940:7:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 4137, "indexed": false, "mutability": "mutable", "name": "isCurrentTokenEther", "nodeType": "VariableDeclaration", "scope": 4139, "src": "980:24:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 4136, "name": "bool", "nodeType": "ElementaryTypeName", "src": "980:4:30", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "visibility": "internal" } ], "src": "807:203:30" }, "src": "791:220:30" }, { "anonymous": false, "id": 4143, "name": "SwapDump", "nodeType": "EventDefinition", "parameters": { "id": 4142, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4141, "indexed": false, "mutability": "mutable", "name": "swapData", "nodeType": "VariableDeclaration", "scope": 4143, "src": "1031:14:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 4140, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "1031:5:30", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "visibility": "internal" } ], "src": "1030:16:30" }, "src": "1016:31:30" }, { "body": { "id": 4157, "nodeType": "Block", "src": "1197:67:30", "statements": [ { "expression": { "arguments": [ { "id": 4151, "name": "invokeAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4145, "src": "1220:13:30", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "expression": { "id": 4152, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, "src": "1235:3:30", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 4153, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "src": "1235:9:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "id": 4154, "name": "invokeData", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4147, "src": "1246:10:30", "typeDescriptions": { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } ], "id": 4150, "name": "externalCall", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1562, "src": "1207:12:30", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$__$", "typeString": "function (address,uint256,bytes memory)" } }, "id": 4155, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1207:50:30", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 4156, "nodeType": "ExpressionStatement", "src": "1207:50:30" } ] }, "functionSelector": "9bb66b28", "id": 4158, "implemented": true, "kind": "function", "modifiers": [], "name": "invoke", "nodeType": "FunctionDefinition", "parameters": { "id": 4148, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4145, "mutability": "mutable", "name": "invokeAddress", "nodeType": "VariableDeclaration", "scope": 4158, "src": "1110:21:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4144, "name": "address", "nodeType": "ElementaryTypeName", "src": "1110:7:30", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 4147, "mutability": "mutable", "name": "invokeData", "nodeType": "VariableDeclaration", "scope": 4158, "src": "1133:25:30", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes" }, "typeName": { "id": 4146, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "1133:5:30", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "visibility": "internal" } ], "src": "1109:50:30" }, "returnParameters": { "id": 4149, "nodeType": "ParameterList", "parameters": [], "src": "1197:0:30" }, "scope": 4333, "src": "1094:170:30", "stateMutability": "payable", "virtual": false, "visibility": "external" }, { "baseFunctions": [ 1177 ], "body": { "id": 4253, "nodeType": "B