From 44cf4363d3ea957ec250297c9e544cec79c1aa96 Mon Sep 17 00:00:00 2001 From: Amin Moghaddam Date: Tue, 23 Jan 2024 11:20:27 +0100 Subject: [PATCH] Rust improvement (#9) * Improved rust endpoints for liquidation marketplace * Update sample config.yaml * Add python requirements.txt * Fix pre-commit * Remove unused imports and improve readability * Use the built abi from the solidity folder * Rename order to opportunity * Remove prices field from python side * Store a single opportunity per permission key * Consistent naming --- .gitignore | 2 +- auction-server/config.sample.yaml | 2 +- auction-server/src/PERMulticall.json | 5664 --------------------- auction-server/src/api.rs | 39 +- auction-server/src/api/marketplace.rs | 232 + auction-server/src/api/rest.rs | 207 +- auction-server/src/auction.rs | 11 +- auction-server/src/liquidation_adapter.rs | 99 + auction-server/src/main.rs | 1 + auction-server/src/state.rs | 77 +- beacon/protocols/beacon_TokenVault.py | 62 +- beacon/searcher/searcherA.py | 21 +- beacon/surface_opportunities.py | 11 +- beacon/utils/endpoints.py | 6 +- beacon/utils/types_liquidation_adapter.py | 10 +- requirements.txt | 42 + 16 files changed, 553 insertions(+), 5933 deletions(-) delete mode 100644 auction-server/src/PERMulticall.json create mode 100644 auction-server/src/api/marketplace.rs create mode 100644 auction-server/src/liquidation_adapter.rs create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 5027da43..27fe92f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Python cache files __pycache__ *.pyc +venv # any config files config.yaml @@ -14,4 +15,3 @@ api_keys.py # env files *.env per_multicall/latestEnvironment.json - diff --git a/auction-server/config.sample.yaml b/auction-server/config.sample.yaml index d8abab5d..911841fe 100644 --- a/auction-server/config.sample.yaml +++ b/auction-server/config.sample.yaml @@ -1,5 +1,5 @@ chains: development: geth_rpc_addr: http://localhost:8545 - contract_addr: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 + contract_addr: 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 legacy_tx: false diff --git a/auction-server/src/PERMulticall.json b/auction-server/src/PERMulticall.json deleted file mode 100644 index 51b35e8b..00000000 --- a/auction-server/src/PERMulticall.json +++ /dev/null @@ -1,5664 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "perOperatorAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "defaultFee", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ReceivedETH", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "contractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "bid", - "type": "uint256" - } - ], - "name": "callWithBid", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "getPEROperator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "profitReceiver", - "type": "address" - }, - { - "internalType": "bytes", - "name": "message", - "type": "bytes" - } - ], - "name": "isPermissioned", - "outputs": [ - { - "internalType": "bool", - "name": "permissioned", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "permission", - "type": "bytes" - }, - { - "internalType": "address[]", - "name": "contracts", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - }, - { - "internalType": "uint256[]", - "name": "bids", - "type": "uint256[]" - } - ], - "name": "multicall", - "outputs": [ - { - "components": [ - { - "internalType": "bool", - "name": "externalSuccess", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "externalResult", - "type": "bytes" - }, - { - "internalType": "string", - "name": "multicallRevertReason", - "type": "string" - } - ], - "internalType": "struct MulticallStatus[]", - "name": "multicallStatuses", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeRecipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeSplit", - "type": "uint256" - } - ], - "name": "setFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "bytecode": { - "object": "0x60803461007c57601f610cc538819003918201601f19168301916001600160401b0383118484101761008157808492604094855283398101031261007c5780516001600160a01b038116919082900361007c5760200151600080546001600160a01b031916909217909155600355604051610c2d90816100988239f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe608080604052600436101561004c575b50361561001b57600080fd5b7f4103257eaac983ca79a70d28f90dfc4fa16b619bb0c17ee7cab0d4034c27962460408051338152346020820152a1005b600090813560e01c9081633242d9c91461096557508063403e96f6146108d1578063696e129014610249578063b9a0937f1461011f5763e55156b50361000f573461011c57604036600319011261011c576100a5610989565b81546001600160a01b039190821633036100cc571681526001602052602435604082205580f35b60405162461bcd60e51b815260206004820152602260248201527f6f6e6c7920504552206f70657261746f722063616e2073657420746865206665604482015261657360f01b6064820152608490fd5b80fd5b50606036600319011261011c57610134610989565b906024356001600160401b0381116102455781610156819236906004016109a4565b829591954796826040519384928337810182815203925af1903d1561023c573d9261018084610aa1565b9361018e6040519586610a6a565b8452823d83602087013e5b6101c2575b50506101be60405192839215158352604060208401526040830190610a24565b0390f35b47918183039083821161022857506044351115918261021d575b5050156101ea57388061019e565b60405162461bcd60e51b815260206004820152600b60248201526a1a5b9d985b1a5908189a5960aa1b6044820152606490fd5b1015905038806101dc565b634e487b7160e01b81526011600452602490fd5b60609282610199565b5080fd5b50608036600319011261011c576004356001600160401b038111610245576102759036906004016109a4565b906024356001600160401b0381116108cd576102959036906004016109d1565b92906044356001600160401b0381116108c9576102b69036906004016109d1565b906064356001600160401b03811161059e576102d69036906004016109d1565b88549092906001600160a01b03163303610873576014861061081a579693929190610302368789610abc565b602081519101208952600260205260408920600160ff1982541617905561032883610af3565b97610336604051998a610a6a565b83895261034284610af3565b8a5b601f19820181106107b557505089958a955b8587106105a6575050505050505061036f368385610abc565b90815182016040838203126105a25760208301516001600160a01b038116939084900361059e576040810151916001600160401b03831161059a576103bb926020809201920101610b30565b5081865260016020526040862054908115610590575b81810291818304149015171561057c578086916104a6575b505050906103fb919392933691610abc565b60208151910120815260026020526040812060ff1981541690556040519182916020830160208452825180915260408401602060408360051b870101940192905b82821061044b57505050500390f35b919360019193955060206104968192603f198a82030186528851906040610485606084511515845286850151908088860152840190610a24565b920151906040818403910152610a24565b960192019201859493919261043c565b670de0b6b3a76400009004823b63ffffffff161561054857823b156102455760405163fced708160e01b8152602060048201529283918290816104ed60248201898b610a49565b03925af1801561053d5761050c575b50906103fb915b909184386103e9565b6001600160401b03819592951161052957604052926103fb6104fc565b634e487b7160e01b82526041600452602482fd5b6040513d87823e3d90fd5b818093918192829796978215610573575bf115610568576103fb91610503565b6040513d85823e3d90fd5b506108fc610559565b634e487b7160e01b86526011600452602486fd5b60035491506103d1565b8880fd5b8780fd5b8680fd5b909192939495966105b8888484610b0a565b356001600160a01b03811681036107b1578860051b85013590601e19863603018212156107ad576001600160401b0382870135116107ad578d8287013536036020848901011361011c578a818f939461065595610616848e8e610b0a565b60405163b9a0937f60e01b81526001600160a01b0390921660048301526060602483015290968792839235919060648401908e01803590602001610a49565b906044830152038183305af180948395610746575b50610722575050505060018c60033d11610712575b6308c379a0146106db575b6106d0575b61069a888787610b0a565b3581018091116106bc579660001981146106bc57600101959493929190610356565b634e487b7160e01b8c52601160045260248cfd5b6040513d8d823e3d90fd5b8b8d8a6106e6610b89565b91826106f6575b5050505061068a565b9350909160409161070691610b75565b5101528b388a8f6106ed565b5060048d803e8c5160e01c61067f565b8261073e9261073383602096610b75565b519015159052610b75565b51015261068f565b9350935050508d3d8091833e61075c8183610a6a565b60408282810103126107a95781519081151582036107a5576020830151906001600160401b0382116107a0578f938d926107999282019101610b30565b933861066a565b508f80fd5b8f80fd5b8e80fd5b8d80fd5b8c80fd5b604097929394959697518060608101106001600160401b036060830111176108065790816020828f8f9060608497016040528452606083850152606060408501520101520196959493929196610344565b634e487b7160e01b8d52604160045260248dfd5b60405162461bcd60e51b815260206004820152602b60248201527f7065726d697373696f6e2073697a652073686f756c64206265206174206c656160448201526a737420323020627974657360a81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602860248201527f6f6e6c7920504552206f70657261746f722063616e2063616c6c207468697320604482015267333ab731ba34b7b760c11b6064820152608490fd5b8580fd5b8380fd5b503461011c57604036600319011261011c576108eb610989565b6024356001600160401b0381116109615760209260ff9261094b61091560409436906004016109a4565b61093d86939293519384928a84019660018060a01b0316875288808501526060840191610a49565b03601f198101835282610a6a565b5190208152600284522054166040519015158152f35b8280fd5b90503461024557816003193601126102455790546001600160a01b03168152602090f35b600435906001600160a01b038216820361099f57565b600080fd5b9181601f8401121561099f578235916001600160401b03831161099f576020838186019501011161099f57565b9181601f8401121561099f578235916001600160401b03831161099f576020808501948460051b01011161099f57565b60005b838110610a145750506000910152565b8181015183820152602001610a04565b90602091610a3d81518092818552858086019101610a01565b601f01601f1916010190565b908060209392818452848401376000828201840152601f01601f1916010190565b90601f801991011681019081106001600160401b03821117610a8b57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111610a8b57601f01601f191660200190565b929192610ac882610aa1565b91610ad66040519384610a6a565b82948184528183011161099f578281602093846000960137010152565b6001600160401b038111610a8b5760051b60200190565b9190811015610b1a5760051b0190565b634e487b7160e01b600052603260045260246000fd5b81601f8201121561099f578051610b4681610aa1565b92610b546040519485610a6a565b8184526020828401011161099f57610b729160208085019101610a01565b90565b8051821015610b1a5760209160051b010190565b600060443d10610b7257604051600319913d83016004833e81516001600160401b03918282113d602484011117610be657818401948551938411610bee573d85010160208487010111610be65750610b7292910160200190610a6a565b949350505050565b5094935050505056fea26469706673582212202f41143ce33f1092805e7edeaf66f8c392d4bde9a45c75d9746e9927894872af64736f6c63430008150033", - "sourceMap": "318:5243:37:-:0;;;;;;;;;;;;;-1:-1:-1;;318:5243:37;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;-1:-1:-1;318:5243:37;;-1:-1:-1;;;;;;318:5243:37;;;;;;;971:24;318:5243;;;;;;;;;;;-1:-1:-1;318:5243:37;;;;;;-1:-1:-1;318:5243:37;;;;;-1:-1:-1;318:5243:37", - "linkReferences": {} - }, - "deployedBytecode": { - "object": "0x608080604052600436101561004c575b50361561001b57600080fd5b7f4103257eaac983ca79a70d28f90dfc4fa16b619bb0c17ee7cab0d4034c27962460408051338152346020820152a1005b600090813560e01c9081633242d9c91461096557508063403e96f6146108d1578063696e129014610249578063b9a0937f1461011f5763e55156b50361000f573461011c57604036600319011261011c576100a5610989565b81546001600160a01b039190821633036100cc571681526001602052602435604082205580f35b60405162461bcd60e51b815260206004820152602260248201527f6f6e6c7920504552206f70657261746f722063616e2073657420746865206665604482015261657360f01b6064820152608490fd5b80fd5b50606036600319011261011c57610134610989565b906024356001600160401b0381116102455781610156819236906004016109a4565b829591954796826040519384928337810182815203925af1903d1561023c573d9261018084610aa1565b9361018e6040519586610a6a565b8452823d83602087013e5b6101c2575b50506101be60405192839215158352604060208401526040830190610a24565b0390f35b47918183039083821161022857506044351115918261021d575b5050156101ea57388061019e565b60405162461bcd60e51b815260206004820152600b60248201526a1a5b9d985b1a5908189a5960aa1b6044820152606490fd5b1015905038806101dc565b634e487b7160e01b81526011600452602490fd5b60609282610199565b5080fd5b50608036600319011261011c576004356001600160401b038111610245576102759036906004016109a4565b906024356001600160401b0381116108cd576102959036906004016109d1565b92906044356001600160401b0381116108c9576102b69036906004016109d1565b906064356001600160401b03811161059e576102d69036906004016109d1565b88549092906001600160a01b03163303610873576014861061081a579693929190610302368789610abc565b602081519101208952600260205260408920600160ff1982541617905561032883610af3565b97610336604051998a610a6a565b83895261034284610af3565b8a5b601f19820181106107b557505089958a955b8587106105a6575050505050505061036f368385610abc565b90815182016040838203126105a25760208301516001600160a01b038116939084900361059e576040810151916001600160401b03831161059a576103bb926020809201920101610b30565b5081865260016020526040862054908115610590575b81810291818304149015171561057c578086916104a6575b505050906103fb919392933691610abc565b60208151910120815260026020526040812060ff1981541690556040519182916020830160208452825180915260408401602060408360051b870101940192905b82821061044b57505050500390f35b919360019193955060206104968192603f198a82030186528851906040610485606084511515845286850151908088860152840190610a24565b920151906040818403910152610a24565b960192019201859493919261043c565b670de0b6b3a76400009004823b63ffffffff161561054857823b156102455760405163fced708160e01b8152602060048201529283918290816104ed60248201898b610a49565b03925af1801561053d5761050c575b50906103fb915b909184386103e9565b6001600160401b03819592951161052957604052926103fb6104fc565b634e487b7160e01b82526041600452602482fd5b6040513d87823e3d90fd5b818093918192829796978215610573575bf115610568576103fb91610503565b6040513d85823e3d90fd5b506108fc610559565b634e487b7160e01b86526011600452602486fd5b60035491506103d1565b8880fd5b8780fd5b8680fd5b909192939495966105b8888484610b0a565b356001600160a01b03811681036107b1578860051b85013590601e19863603018212156107ad576001600160401b0382870135116107ad578d8287013536036020848901011361011c578a818f939461065595610616848e8e610b0a565b60405163b9a0937f60e01b81526001600160a01b0390921660048301526060602483015290968792839235919060648401908e01803590602001610a49565b906044830152038183305af180948395610746575b50610722575050505060018c60033d11610712575b6308c379a0146106db575b6106d0575b61069a888787610b0a565b3581018091116106bc579660001981146106bc57600101959493929190610356565b634e487b7160e01b8c52601160045260248cfd5b6040513d8d823e3d90fd5b8b8d8a6106e6610b89565b91826106f6575b5050505061068a565b9350909160409161070691610b75565b5101528b388a8f6106ed565b5060048d803e8c5160e01c61067f565b8261073e9261073383602096610b75565b519015159052610b75565b51015261068f565b9350935050508d3d8091833e61075c8183610a6a565b60408282810103126107a95781519081151582036107a5576020830151906001600160401b0382116107a0578f938d926107999282019101610b30565b933861066a565b508f80fd5b8f80fd5b8e80fd5b8d80fd5b8c80fd5b604097929394959697518060608101106001600160401b036060830111176108065790816020828f8f9060608497016040528452606083850152606060408501520101520196959493929196610344565b634e487b7160e01b8d52604160045260248dfd5b60405162461bcd60e51b815260206004820152602b60248201527f7065726d697373696f6e2073697a652073686f756c64206265206174206c656160448201526a737420323020627974657360a81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602860248201527f6f6e6c7920504552206f70657261746f722063616e2063616c6c207468697320604482015267333ab731ba34b7b760c11b6064820152608490fd5b8580fd5b8380fd5b503461011c57604036600319011261011c576108eb610989565b6024356001600160401b0381116109615760209260ff9261094b61091560409436906004016109a4565b61093d86939293519384928a84019660018060a01b0316875288808501526060840191610a49565b03601f198101835282610a6a565b5190208152600284522054166040519015158152f35b8280fd5b90503461024557816003193601126102455790546001600160a01b03168152602090f35b600435906001600160a01b038216820361099f57565b600080fd5b9181601f8401121561099f578235916001600160401b03831161099f576020838186019501011161099f57565b9181601f8401121561099f578235916001600160401b03831161099f576020808501948460051b01011161099f57565b60005b838110610a145750506000910152565b8181015183820152602001610a04565b90602091610a3d81518092818552858086019101610a01565b601f01601f1916010190565b908060209392818452848401376000828201840152601f01601f1916010190565b90601f801991011681019081106001600160401b03821117610a8b57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111610a8b57601f01601f191660200190565b929192610ac882610aa1565b91610ad66040519384610a6a565b82948184528183011161099f578281602093846000960137010152565b6001600160401b038111610a8b5760051b60200190565b9190811015610b1a5760051b0190565b634e487b7160e01b600052603260045260246000fd5b81601f8201121561099f578051610b4681610aa1565b92610b546040519485610a6a565b8184526020828401011161099f57610b729160208085019101610a01565b90565b8051821015610b1a5760209160051b010190565b600060443d10610b7257604051600319913d83016004833e81516001600160401b03918282113d602484011117610be657818401948551938411610bee573d85010160208487010111610be65750610b7292910160200190610a6a565b949350505050565b5094935050505056fea26469706673582212202f41143ce33f1092805e7edeaf66f8c392d4bde9a45c75d9746e9927894872af64736f6c63430008150033", - "sourceMap": "318:5243:37:-:0;;;;;;;;;;-1:-1:-1;318:5243:37;;;;;;;;;5518:34;318:5243;;;5530:10;318:5243;;5542:9;318:5243;;;;5518:34;318:5243;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;318:5243:37;;;;;;:::i;:::-;;;-1:-1:-1;;;;;318:5243:37;;;;1755:10;:26;318:5243;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;;-1:-1:-1;318:5243:37;;-1:-1:-1;;318:5243:37;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;:::i;:::-;5049:21;;;;;318:5243;;;;;;;;;;;;;;5119:26;;;;;318:5243;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;;5156:271;;318:5243;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;5156:271;5209:21;318:5243;;;;;;;;;;;;;-1:-1:-1;5320:41:37;:80;;;;5156:271;318:5243;;;;;5156:271;;;;318:5243;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;5320:80;5367:32;5365:35;;-1:-1:-1;5320:80:37;;;;318:5243;-1:-1:-1;;;318:5243:37;;;;;;;;;;;;;;;;;;;-1:-1:-1;318:5243:37;;-1:-1:-1;;318:5243:37;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;:::i;:::-;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;318:5243:37;2864:10;:26;318:5243;;2974:2;2953:23;;318:5243;;;;;;;;;;;;:::i;:::-;;;;;;3047:21;318:5243;;3034:12;318:5243;;;;;3072:4;318:5243;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;-1:-1:-1;;318:5243:37;;;;;;3151:20;;;3186:13;;3181:548;3201:15;;;;;;318:5243;;;;;;;;;;;;:::i;:::-;;;;2171:33;;318:5243;;;;;;;;2171:33;;318:5243;-1:-1:-1;;;;;318:5243:37;;;2171:33;318:5243;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;2171:33;318:5243;2171:33;;;318:5243;;;;:::i;:::-;;;;;3072:4;318:5243;;;;;;3961:16;;;3957:72;;3181:548;318:5243;;;;;;;;;;;;;;4105:24;;;4101:377;;3181:548;318:5243;;;;;;;;;;;;:::i;:::-;;;;;;4500:21;318:5243;;3034:12;318:5243;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3072:4;318:5243;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;4101:377;4190:24;318:5243;;1973:59;;318:5243;;2049:8;318:5243;;4276:85;;;;;318:5243;;-1:-1:-1;;;4276:85:37;;318:5243;;4276:85;;318:5243;;;;;;;;;;;;;;:::i;:::-;4276:85;;;;;;;;;;4228:240;;;318:5243;4228:240;;4101:377;;;;;;4276:85;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;4276:85;;318:5243;-1:-1:-1;;;318:5243:37;;;;;;;;4276:85;318:5243;;;;;;;;;4228:240;4411:42;;;;;;;;;;;;;;4228:240;4411:42;;;;318:5243;4228:240;;;4411:42;318:5243;;;;;;;;;4411:42;;;;;318:5243;-1:-1:-1;;;318:5243:37;;;;;;;;3957:72;4007:11;318:5243;;-1:-1:-1;3957:72:37;;318:5243;;;;;;;;;;;;3218:3;3350:12;;;;;;;;;;;;:::i;:::-;318:5243;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;;;;;;;;;;3373:7;;;;;318:5243;3373:7;;;;;;:::i;:::-;318:5243;;-1:-1:-1;;;3333:48:37;;-1:-1:-1;;;;;318:5243:37;;;;3333:48;;318:5243;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;3333:48;:4;;;:48;;;;;;;;3218:3;-1:-1:-1;3329:357:37;;;;;;3072:4;3329:357;318:5243;;;;;3329:357;;;;;;;;;3711:7;;;;;:::i;:::-;318:5243;;;;;;;;3218:3;-1:-1:-1;;318:5243:37;;;;3072:4;318:5243;3186:13;;;;;;;;318:5243;-1:-1:-1;;;318:5243:37;;;;;;;;3329:357;318:5243;;;;;;;;;3329:357;3568:118;;;;;:::i;:::-;;;;;3329:357;;;;;;;3568:118;;-1:-1:-1;3568:118:37;;318:5243;;3620:20;;;:::i;:::-;;:42;:51;3568:118;;;;;;318:5243;;;;;;;;;;;;3329:357;3444:20;3508;3444;;;318:5243;3444:20;;:::i;:::-;;318:5243;;;;;3508:20;:::i;:::-;;:35;:44;3329:357;;3333:48;;;;;;;;;;;;;;;;;:::i;:::-;318:5243;3333:48;;;;318:5243;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;3333:48;;;;318:5243;3333:48;;;318:5243;;;:::i;:::-;3333:48;;;;318:5243;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;;;;;;;;-1:-1:-1;;;318:5243:37;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;318:5243:37;;;;;;:::i;:::-;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;1355:35;318:5243;;;;;;;;:::i;:::-;;;;;;;1355:35;;;;;;318:5243;;;;;;;;;;;;;;;;;;;:::i;:::-;1355:35;;;;;;;;;:::i;:::-;318:5243;1345:46;;318:5243;;1332:12;318:5243;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;-1:-1:-1;;318:5243:37;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;-1:-1:-1;;318:5243:37;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;318:5243:37;;;;;;;;-1:-1:-1;;318:5243:37;;;;:::o;:::-;;;1355:35;;318:5243;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;-1:-1:-1;;318:5243:37;;;;:::o;:::-;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;-1:-1:-1;318:5243:37;;;;;;:::o;:::-;-1:-1:-1;;;;;318:5243:37;;;;;;;;;:::o;:::-;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;-1:-1:-1;;318:5243:37;;;;;;;;;-1:-1:-1;;;;;318:5243:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;318:5243:37;;;;;;;;:::i;:::-;;;;;;;:::o;:::-;;;;;;;;:::o", - "linkReferences": {} - }, - "methodIdentifiers": { - "callWithBid(address,bytes,uint256)": "b9a0937f", - "getPEROperator()": "3242d9c9", - "isPermissioned(address,bytes)": "403e96f6", - "multicall(bytes,address[],bytes[],uint256[])": "696e1290", - "setFee(address,uint256)": "e55156b5" - }, - "rawMetadata": "{\"compiler\":{\"version\":\"0.8.21+commit.d9974bed\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"perOperatorAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"defaultFee\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ReceivedETH\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"bid\",\"type\":\"uint256\"}],\"name\":\"callWithBid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPEROperator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"profitReceiver\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"isPermissioned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"permissioned\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"permission\",\"type\":\"bytes\"},{\"internalType\":\"address[]\",\"name\":\"contracts\",\"type\":\"address[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"bids\",\"type\":\"uint256[]\"}],\"name\":\"multicall\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"externalSuccess\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"externalResult\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"multicallRevertReason\",\"type\":\"string\"}],\"internalType\":\"struct MulticallStatus[]\",\"name\":\"multicallStatuses\",\"type\":\"tuple[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeRecipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeSplit\",\"type\":\"uint256\"}],\"name\":\"setFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"callWithBid(address,bytes,uint256)\":{\"params\":{\"bid\":\": bid to be paid; call will fail if it does not pay PER operator at least bid,\",\"contractAddress\":\": contract address to call into\",\"data\":\": calldata to call with\"}},\"constructor\":{\"params\":{\"defaultFee\":\": default fee split to be paid to the protocol whose permissioning is being used\",\"perOperatorAddress\":\": address of PER operator EOA\"}},\"multicall(bytes,address[],bytes[],uint256[])\":{\"params\":{\"bids\":\": ordered list of bids; call i will fail if it does not pay PER operator at least bid i\",\"contracts\":\": ordered list of contracts to call into\",\"data\":\": ordered list of calldata to call with\",\"permission\":\": permission to allow for this call\"}},\"setFee(address,uint256)\":{\"params\":{\"feeRecipient\":\": address of the fee recipient for the contract being registered\",\"feeSplit\":\": amount of fee to be split with the protocol. 10**18 is 100%\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"callWithBid(address,bytes,uint256)\":{\"notice\":\"callWithBid function - contained call to function with check for bid invariant \"},\"constructor\":{\"notice\":\"PERMulticall constructor - Initializes a new multicall contract with given parameters \"},\"getPEROperator()\":{\"notice\":\"getPEROperator function - returns the address of the PER operator\"},\"multicall(bytes,address[],bytes[],uint256[])\":{\"notice\":\"multicall function - performs a number of calls to external contracts in order\"},\"setFee(address,uint256)\":{\"notice\":\"setFee function - sets the fee for a given fee recipient\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/PERMulticall.sol\":\"PERMulticall\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":@pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"],\"viaIR\":true},\"sources\":{\"lib/forge-std/src/console.sol\":{\"keccak256\":\"0x91d5413c2434ca58fd278b6e1e79fd98d10c83931cc2596a6038eee4daeb34ba\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://91ccea707361e48b9b7a161fe81f496b9932bc471e9c4e4e1e9c283f2453cc70\",\"dweb:/ipfs/QmcB66sZhQ6Kz7MUHcLE78YXRUZxoZnnxZjN6yATsbB2ec\"]},\"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://87a7a5d2f6f63f84598af02b8c50ca2df2631cb8ba2453e8d95fcb17e4be9824\",\"dweb:/ipfs/QmR76hqtAcRqoFj33tmNjcWTLrgNsAaakYwnKZ8zoJtKei\"]},\"lib/openzeppelin-contracts/contracts/utils/Strings.sol\":{\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8179c356adb19e70d6b31a1eedc8c5c7f0c00e669e2540f4099e3844c6074d30\",\"dweb:/ipfs/QmWFbivarEobbqhS1go64ootVuHfVohBseerYy9FTEd1W2\"]},\"src/Errors.sol\":{\"keccak256\":\"0x909c1cfaeabe8d6f2b56b5e853990eb2b1e419610cd30cb415e853ffc135684b\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://ef942c6c4a2abfc99c6ba8dcec977a11dc2302ba3c6aef31735962ba80ef7796\",\"dweb:/ipfs/QmRMcPGrVfnkmEGUMRbjgM2yGvmebLf9DFdv8LpaYMagXS\"]},\"src/PERFeeReceiver.sol\":{\"keccak256\":\"0x8b9fd67f53fcf9c675534f0a69a7afdac60a0dc6101fbc993b2799efd4c577a6\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://302b40ce4301605e99239fac2ec5bc9b0acd6236ee301149214110b17d470dd1\",\"dweb:/ipfs/QmcTaejc7EvB1DUeci6P9YRJiEDQhLh1GBhXrwwgZtcDx3\"]},\"src/PERMulticall.sol\":{\"keccak256\":\"0xa42966c7fc256d2ef6e5f155fd291e970acb7449aba3df011c3d771b60cb81e9\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://5c9d332b6f02c1849373ff107ebf06307c81c086293f90e5a9e42e27cd000690\",\"dweb:/ipfs/QmWVReswt14XK5USb5w54NhVu16x9sJuRF21X4uhit2uPP\"]},\"src/Structs.sol\":{\"keccak256\":\"0xc0ffe2c0ebad833cca97cacd4688f4877344fc3d09c7dacf2fe0d27a47374a2a\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://49534d0b7fd1d7ca1775748762fbceac6c5f292b522a3a66fba7d50ee0c9c1f2\",\"dweb:/ipfs/QmP9ZFDrcUEGsWE5NyYgWnWqSns3qRxYSxrVvNheAzdhuK\"]}},\"version\":1}", - "metadata": { - "compiler": { - "version": "0.8.21+commit.d9974bed" - }, - "language": "Solidity", - "output": { - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "perOperatorAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "defaultFee", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address", - "indexed": false - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - "indexed": false - } - ], - "type": "event", - "name": "ReceivedETH", - "anonymous": false - }, - { - "inputs": [ - { - "internalType": "address", - "name": "contractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "bid", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function", - "name": "callWithBid", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ] - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "getPEROperator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "profitReceiver", - "type": "address" - }, - { - "internalType": "bytes", - "name": "message", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function", - "name": "isPermissioned", - "outputs": [ - { - "internalType": "bool", - "name": "permissioned", - "type": "bool" - } - ] - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "permission", - "type": "bytes" - }, - { - "internalType": "address[]", - "name": "contracts", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - }, - { - "internalType": "uint256[]", - "name": "bids", - "type": "uint256[]" - } - ], - "stateMutability": "payable", - "type": "function", - "name": "multicall", - "outputs": [ - { - "internalType": "struct MulticallStatus[]", - "name": "multicallStatuses", - "type": "tuple[]", - "components": [ - { - "internalType": "bool", - "name": "externalSuccess", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "externalResult", - "type": "bytes" - }, - { - "internalType": "string", - "name": "multicallRevertReason", - "type": "string" - } - ] - } - ] - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeRecipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeSplit", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "setFee" - }, - { - "inputs": [], - "stateMutability": "payable", - "type": "receive" - } - ], - "devdoc": { - "kind": "dev", - "methods": { - "callWithBid(address,bytes,uint256)": { - "params": { - "bid": ": bid to be paid; call will fail if it does not pay PER operator at least bid,", - "contractAddress": ": contract address to call into", - "data": ": calldata to call with" - } - }, - "constructor": { - "params": { - "defaultFee": ": default fee split to be paid to the protocol whose permissioning is being used", - "perOperatorAddress": ": address of PER operator EOA" - } - }, - "multicall(bytes,address[],bytes[],uint256[])": { - "params": { - "bids": ": ordered list of bids; call i will fail if it does not pay PER operator at least bid i", - "contracts": ": ordered list of contracts to call into", - "data": ": ordered list of calldata to call with", - "permission": ": permission to allow for this call" - } - }, - "setFee(address,uint256)": { - "params": { - "feeRecipient": ": address of the fee recipient for the contract being registered", - "feeSplit": ": amount of fee to be split with the protocol. 10**18 is 100%" - } - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "callWithBid(address,bytes,uint256)": { - "notice": "callWithBid function - contained call to function with check for bid invariant " - }, - "constructor": { - "notice": "PERMulticall constructor - Initializes a new multicall contract with given parameters " - }, - "getPEROperator()": { - "notice": "getPEROperator function - returns the address of the PER operator" - }, - "multicall(bytes,address[],bytes[],uint256[])": { - "notice": "multicall function - performs a number of calls to external contracts in order" - }, - "setFee(address,uint256)": { - "notice": "setFee function - sets the fee for a given fee recipient" - } - }, - "version": 1 - } - }, - "settings": { - "remappings": [ - "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", - "@pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity/", - "ds-test/=lib/forge-std/lib/ds-test/src/", - "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", - "forge-std/=lib/forge-std/src/", - "openzeppelin-contracts/=lib/openzeppelin-contracts/" - ], - "optimizer": { - "enabled": true, - "runs": 200 - }, - "metadata": { - "bytecodeHash": "ipfs" - }, - "compilationTarget": { - "src/PERMulticall.sol": "PERMulticall" - }, - "libraries": {}, - "viaIR": true - }, - "sources": { - "lib/forge-std/src/console.sol": { - "keccak256": "0x91d5413c2434ca58fd278b6e1e79fd98d10c83931cc2596a6038eee4daeb34ba", - "urls": [ - "bzz-raw://91ccea707361e48b9b7a161fe81f496b9932bc471e9c4e4e1e9c283f2453cc70", - "dweb:/ipfs/QmcB66sZhQ6Kz7MUHcLE78YXRUZxoZnnxZjN6yATsbB2ec" - ], - "license": "MIT" - }, - "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": { - "keccak256": "0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2", - "urls": [ - "bzz-raw://87a7a5d2f6f63f84598af02b8c50ca2df2631cb8ba2453e8d95fcb17e4be9824", - "dweb:/ipfs/QmR76hqtAcRqoFj33tmNjcWTLrgNsAaakYwnKZ8zoJtKei" - ], - "license": "MIT" - }, - "lib/openzeppelin-contracts/contracts/utils/Strings.sol": { - "keccak256": "0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45", - "urls": [ - "bzz-raw://8179c356adb19e70d6b31a1eedc8c5c7f0c00e669e2540f4099e3844c6074d30", - "dweb:/ipfs/QmWFbivarEobbqhS1go64ootVuHfVohBseerYy9FTEd1W2" - ], - "license": "MIT" - }, - "src/Errors.sol": { - "keccak256": "0x909c1cfaeabe8d6f2b56b5e853990eb2b1e419610cd30cb415e853ffc135684b", - "urls": [ - "bzz-raw://ef942c6c4a2abfc99c6ba8dcec977a11dc2302ba3c6aef31735962ba80ef7796", - "dweb:/ipfs/QmRMcPGrVfnkmEGUMRbjgM2yGvmebLf9DFdv8LpaYMagXS" - ], - "license": "UNLICENSED" - }, - "src/PERFeeReceiver.sol": { - "keccak256": "0x8b9fd67f53fcf9c675534f0a69a7afdac60a0dc6101fbc993b2799efd4c577a6", - "urls": [ - "bzz-raw://302b40ce4301605e99239fac2ec5bc9b0acd6236ee301149214110b17d470dd1", - "dweb:/ipfs/QmcTaejc7EvB1DUeci6P9YRJiEDQhLh1GBhXrwwgZtcDx3" - ], - "license": "UNLICENSED" - }, - "src/PERMulticall.sol": { - "keccak256": "0xa42966c7fc256d2ef6e5f155fd291e970acb7449aba3df011c3d771b60cb81e9", - "urls": [ - "bzz-raw://5c9d332b6f02c1849373ff107ebf06307c81c086293f90e5a9e42e27cd000690", - "dweb:/ipfs/QmWVReswt14XK5USb5w54NhVu16x9sJuRF21X4uhit2uPP" - ], - "license": "UNLICENSED" - }, - "src/Structs.sol": { - "keccak256": "0xc0ffe2c0ebad833cca97cacd4688f4877344fc3d09c7dacf2fe0d27a47374a2a", - "urls": [ - "bzz-raw://49534d0b7fd1d7ca1775748762fbceac6c5f292b522a3a66fba7d50ee0c9c1f2", - "dweb:/ipfs/QmP9ZFDrcUEGsWE5NyYgWnWqSns3qRxYSxrVvNheAzdhuK" - ], - "license": "UNLICENSED" - } - }, - "version": 1 - }, - "ast": { - "absolutePath": "src/PERMulticall.sol", - "id": 48313, - "exportedSymbols": { - "ExpiredSignature": [47480], - "IERC20": [44053], - "InvalidBid": [47494], - "InvalidLiquidation": [47492], - "InvalidPERSignature": [47484], - "InvalidSearcherSignature": [47478], - "InvalidTimestamp": [47486], - "InvalidVaultUpdate": [47490], - "LiquidationCallFailed": [47498], - "LiquidationCallParams": [48752], - "MulticallStatus": [48731], - "NotPEROperator": [47474], - "NotRegistered": [47496], - "OracleState": [48702], - "PERFeeReceiver": [47910], - "PERMulticall": [48312], - "SignatureAlreadyUsed": [47482], - "Strings": [44822], - "TokenQty": [48724], - "Unauthorized": [47476], - "UncollateralizedVaultCreation": [47488], - "Vault": [48719], - "console": [22024] - }, - "nodeType": "SourceUnit", - "src": "39:5523:37", - "nodes": [ - { - "id": 47912, - "nodeType": "PragmaDirective", - "src": "39:24:37", - "nodes": [], - "literals": ["solidity", "^", "0.8", ".13"] - }, - { - "id": 47913, - "nodeType": "ImportDirective", - "src": "65:22:37", - "nodes": [], - "absolutePath": "src/Errors.sol", - "file": "./Errors.sol", - "nameLocation": "-1:-1:-1", - "scope": 48313, - "sourceUnit": 47499, - "symbolAliases": [], - "unitAlias": "" - }, - { - "id": 47914, - "nodeType": "ImportDirective", - "src": "88:23:37", - "nodes": [], - "absolutePath": "src/Structs.sol", - "file": "./Structs.sol", - "nameLocation": "-1:-1:-1", - "scope": 48313, - "sourceUnit": 48753, - "symbolAliases": [], - "unitAlias": "" - }, - { - "id": 47915, - "nodeType": "ImportDirective", - "src": "112:30:37", - "nodes": [], - "absolutePath": "src/PERFeeReceiver.sol", - "file": "./PERFeeReceiver.sol", - "nameLocation": "-1:-1:-1", - "scope": 48313, - "sourceUnit": 47911, - "symbolAliases": [], - "unitAlias": "" - }, - { - "id": 47916, - "nodeType": "ImportDirective", - "src": "144:31:37", - "nodes": [], - "absolutePath": "lib/forge-std/src/console.sol", - "file": "forge-std/console.sol", - "nameLocation": "-1:-1:-1", - "scope": 48313, - "sourceUnit": 22025, - "symbolAliases": [], - "unitAlias": "" - }, - { - "id": 47917, - "nodeType": "ImportDirective", - "src": "176:60:37", - "nodes": [], - "absolutePath": "lib/openzeppelin-contracts/contracts/utils/Strings.sol", - "file": "openzeppelin-contracts/contracts/utils/Strings.sol", - "nameLocation": "-1:-1:-1", - "scope": 48313, - "sourceUnit": 44823, - "symbolAliases": [], - "unitAlias": "" - }, - { - "id": 47919, - "nodeType": "ImportDirective", - "src": "237:79:37", - "nodes": [], - "absolutePath": "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol", - "file": "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol", - "nameLocation": "-1:-1:-1", - "scope": 48313, - "sourceUnit": 44054, - "symbolAliases": [ - { - "foreign": { - "id": 47918, - "name": "IERC20", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 44053, - "src": "245:6:37", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" - }, - { - "id": 48312, - "nodeType": "ContractDefinition", - "src": "318:5243:37", - "nodes": [ - { - "id": 47925, - "nodeType": "EventDefinition", - "src": "346:50:37", - "nodes": [], - "anonymous": false, - "eventSelector": "4103257eaac983ca79a70d28f90dfc4fa16b619bb0c17ee7cab0d4034c279624", - "name": "ReceivedETH", - "nameLocation": "352:11:37", - "parameters": { - "id": 47924, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 47921, - "indexed": false, - "mutability": "mutable", - "name": "sender", - "nameLocation": "372:6:37", - "nodeType": "VariableDeclaration", - "scope": 47925, - "src": "364:14:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 47920, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "364:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 47923, - "indexed": false, - "mutability": "mutable", - "name": "amount", - "nameLocation": "388:6:37", - "nodeType": "VariableDeclaration", - "scope": 47925, - "src": "380:14:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 47922, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "380:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "363:32:37" - } - }, - { - "id": 47927, - "nodeType": "VariableDeclaration", - "src": "402:20:37", - "nodes": [], - "constant": false, - "mutability": "mutable", - "name": "_perOperator", - "nameLocation": "410:12:37", - "scope": 48312, - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 47926, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "402:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "id": 47931, - "nodeType": "VariableDeclaration", - "src": "428:39:37", - "nodes": [], - "constant": false, - "mutability": "mutable", - "name": "_feeConfig", - "nameLocation": "457:10:37", - "scope": 48312, - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "typeName": { - "id": 47930, - "keyName": "", - "keyNameLocation": "-1:-1:-1", - "keyType": { - "id": 47928, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "437:7:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "428:28:37", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueName": "", - "valueNameLocation": "-1:-1:-1", - "valueType": { - "id": 47929, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "448:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - "visibility": "internal" - }, - { - "id": 47935, - "nodeType": "VariableDeclaration", - "src": "473:38:37", - "nodes": [], - "constant": false, - "mutability": "mutable", - "name": "_permissions", - "nameLocation": "499:12:37", - "scope": 48312, - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_bytes32_$_t_bool_$", - "typeString": "mapping(bytes32 => bool)" - }, - "typeName": { - "id": 47934, - "keyName": "", - "keyNameLocation": "-1:-1:-1", - "keyType": { - "id": 47932, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "482:7:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "nodeType": "Mapping", - "src": "473:25:37", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_bytes32_$_t_bool_$", - "typeString": "mapping(bytes32 => bool)" - }, - "valueName": "", - "valueNameLocation": "-1:-1:-1", - "valueType": { - "id": 47933, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "493:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - }, - "visibility": "internal" - }, - { - "id": 47937, - "nodeType": "VariableDeclaration", - "src": "517:19:37", - "nodes": [], - "constant": false, - "mutability": "mutable", - "name": "_defaultFee", - "nameLocation": "525:11:37", - "scope": 48312, - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 47936, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "517:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - }, - { - "id": 47954, - "nodeType": "FunctionDefinition", - "src": "835:167:37", - "nodes": [], - "body": { - "id": 47953, - "nodeType": "Block", - "src": "918:84:37", - "nodes": [], - "statements": [ - { - "expression": { - "id": 47947, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 47945, - "name": "_perOperator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47927, - "src": "928:12:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 47946, - "name": "perOperatorAddress", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47940, - "src": "943:18:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "928:33:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 47948, - "nodeType": "ExpressionStatement", - "src": "928:33:37" - }, - { - "expression": { - "id": 47951, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 47949, - "name": "_defaultFee", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47937, - "src": "971:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 47950, - "name": "defaultFee", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47942, - "src": "985:10:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "971:24:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 47952, - "nodeType": "ExpressionStatement", - "src": "971:24:37" - } - ] - }, - "documentation": { - "id": 47938, - "nodeType": "StructuredDocumentation", - "src": "543:287:37", - "text": " @notice PERMulticall constructor - Initializes a new multicall contract with given parameters\n \n @param perOperatorAddress: address of PER operator EOA\n @param defaultFee: default fee split to be paid to the protocol whose permissioning is being used" - }, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nameLocation": "-1:-1:-1", - "parameters": { - "id": 47943, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 47940, - "mutability": "mutable", - "name": "perOperatorAddress", - "nameLocation": "864:18:37", - "nodeType": "VariableDeclaration", - "scope": 47954, - "src": "856:26:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 47939, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "856:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 47942, - "mutability": "mutable", - "name": "defaultFee", - "nameLocation": "901:10:37", - "nodeType": "VariableDeclaration", - "scope": 47954, - "src": "893:18:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 47941, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "893:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "846:71:37" - }, - "returnParameters": { - "id": 47944, - "nodeType": "ParameterList", - "parameters": [], - "src": "918:0:37" - }, - "scope": 48312, - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - }, - { - "id": 47963, - "nodeType": "FunctionDefinition", - "src": "1105:92:37", - "nodes": [], - "body": { - "id": 47962, - "nodeType": "Block", - "src": "1161:36:37", - "nodes": [], - "statements": [ - { - "expression": { - "id": 47960, - "name": "_perOperator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47927, - "src": "1178:12:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "functionReturnParameters": 47959, - "id": 47961, - "nodeType": "Return", - "src": "1171:19:37" - } - ] - }, - "documentation": { - "id": 47955, - "nodeType": "StructuredDocumentation", - "src": "1008:92:37", - "text": " @notice getPEROperator function - returns the address of the PER operator" - }, - "functionSelector": "3242d9c9", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "getPEROperator", - "nameLocation": "1114:14:37", - "parameters": { - "id": 47956, - "nodeType": "ParameterList", - "parameters": [], - "src": "1128:2:37" - }, - "returnParameters": { - "id": 47959, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 47958, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 47963, - "src": "1152:7:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 47957, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1152:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "1151:9:37" - }, - "scope": 48312, - "stateMutability": "view", - "virtual": false, - "visibility": "public" - }, - { - "id": 47983, - "nodeType": "FunctionDefinition", - "src": "1203:196:37", - "nodes": [], - "body": { - "id": 47982, - "nodeType": "Block", - "src": "1315:84:37", - "nodes": [], - "statements": [ - { - "expression": { - "baseExpression": { - "id": 47972, - "name": "_permissions", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47935, - "src": "1332:12:37", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_bytes32_$_t_bool_$", - "typeString": "mapping(bytes32 => bool)" - } - }, - "id": 47980, - "indexExpression": { - "arguments": [ - { - "arguments": [ - { - "id": 47976, - "name": "profitReceiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47965, - "src": "1366:14:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "id": 47977, - "name": "message", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47967, - "src": "1382:7:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - ], - "expression": { - "id": 47974, - "name": "abi", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -1, - "src": "1355:3:37", - "typeDescriptions": { - "typeIdentifier": "t_magic_abi", - "typeString": "abi" - } - }, - "id": 47975, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "memberLocation": "1359:6:37", - "memberName": "encode", - "nodeType": "MemberAccess", - "src": "1355:10:37", - "typeDescriptions": { - "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", - "typeString": "function () pure returns (bytes memory)" - } - }, - "id": 47978, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1355:35:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - } - ], - "id": 47973, - "name": "keccak256", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -8, - "src": "1345:9:37", - "typeDescriptions": { - "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", - "typeString": "function (bytes memory) pure returns (bytes32)" - } - }, - "id": 47979, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1345:46:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1332:60:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "functionReturnParameters": 47971, - "id": 47981, - "nodeType": "Return", - "src": "1325:67:37" - } - ] - }, - "functionSelector": "403e96f6", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "isPermissioned", - "nameLocation": "1212:14:37", - "parameters": { - "id": 47968, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 47965, - "mutability": "mutable", - "name": "profitReceiver", - "nameLocation": "1235:14:37", - "nodeType": "VariableDeclaration", - "scope": 47983, - "src": "1227:22:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 47964, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1227:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 47967, - "mutability": "mutable", - "name": "message", - "nameLocation": "1266:7:37", - "nodeType": "VariableDeclaration", - "scope": 47983, - "src": "1251:22:37", - "stateVariable": false, - "storageLocation": "calldata", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes" - }, - "typeName": { - "id": 47966, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "1251:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "visibility": "internal" - } - ], - "src": "1226:48:37" - }, - "returnParameters": { - "id": 47971, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 47970, - "mutability": "mutable", - "name": "permissioned", - "nameLocation": "1301:12:37", - "nodeType": "VariableDeclaration", - "scope": 47983, - "src": "1296:17:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 47969, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1296:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "1295:19:37" - }, - "scope": 48312, - "stateMutability": "view", - "virtual": false, - "visibility": "public" - }, - { - "id": 48006, - "nodeType": "FunctionDefinition", - "src": "1675:197:37", - "nodes": [], - "body": { - "id": 48005, - "nodeType": "Block", - "src": "1737:135:37", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 47995, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "expression": { - "id": 47992, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "1755:3:37", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 47993, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "1759:6:37", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "1755:10:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "id": 47994, - "name": "_perOperator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47927, - "src": "1769:12:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "1755:26:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "hexValue": "6f6e6c7920504552206f70657261746f722063616e20736574207468652066656573", - "id": 47996, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1783:36:37", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_c7f8e4a7849652720486e4ab48726ce58c25fb7f0c839241cbcb422db035e10a", - "typeString": "literal_string \"only PER operator can set the fees\"" - }, - "value": "only PER operator can set the fees" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_c7f8e4a7849652720486e4ab48726ce58c25fb7f0c839241cbcb422db035e10a", - "typeString": "literal_string \"only PER operator can set the fees\"" - } - ], - "id": 47991, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [-18, -18], - "referencedDeclaration": -18, - "src": "1747:7:37", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 47997, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1747:73:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 47998, - "nodeType": "ExpressionStatement", - "src": "1747:73:37" - }, - { - "expression": { - "id": 48003, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "baseExpression": { - "id": 47999, - "name": "_feeConfig", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47931, - "src": "1830:10:37", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 48001, - "indexExpression": { - "id": 48000, - "name": "feeRecipient", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47986, - "src": "1841:12:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1830:24:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 48002, - "name": "feeSplit", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47988, - "src": "1857:8:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1830:35:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 48004, - "nodeType": "ExpressionStatement", - "src": "1830:35:37" - } - ] - }, - "documentation": { - "id": 47984, - "nodeType": "StructuredDocumentation", - "src": "1405:265:37", - "text": " @notice setFee function - sets the fee for a given fee recipient\n @param feeRecipient: address of the fee recipient for the contract being registered\n @param feeSplit: amount of fee to be split with the protocol. 10**18 is 100%" - }, - "functionSelector": "e55156b5", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "setFee", - "nameLocation": "1684:6:37", - "parameters": { - "id": 47989, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 47986, - "mutability": "mutable", - "name": "feeRecipient", - "nameLocation": "1699:12:37", - "nodeType": "VariableDeclaration", - "scope": 48006, - "src": "1691:20:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 47985, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1691:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 47988, - "mutability": "mutable", - "name": "feeSplit", - "nameLocation": "1720:8:37", - "nodeType": "VariableDeclaration", - "scope": 48006, - "src": "1712:16:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 47987, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1712:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "1690:39:37" - }, - "returnParameters": { - "id": 47990, - "nodeType": "ParameterList", - "parameters": [], - "src": "1737:0:37" - }, - "scope": 48312, - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - }, - { - "id": 48023, - "nodeType": "FunctionDefinition", - "src": "1878:187:37", - "nodes": [], - "body": { - "id": 48022, - "nodeType": "Block", - "src": "1942:123:37", - "nodes": [], - "statements": [ - { - "assignments": [48014], - "declarations": [ - { - "constant": false, - "id": 48014, - "mutability": "mutable", - "name": "size", - "nameLocation": "1959:4:37", - "nodeType": "VariableDeclaration", - "scope": 48022, - "src": "1952:11:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint32", - "typeString": "uint32" - }, - "typeName": { - "id": 48013, - "name": "uint32", - "nodeType": "ElementaryTypeName", - "src": "1952:6:37", - "typeDescriptions": { - "typeIdentifier": "t_uint32", - "typeString": "uint32" - } - }, - "visibility": "internal" - } - ], - "id": 48015, - "nodeType": "VariableDeclarationStatement", - "src": "1952:11:37" - }, - { - "AST": { - "nativeSrc": "1982:50:37", - "nodeType": "YulBlock", - "src": "1982:50:37", - "statements": [ - { - "nativeSrc": "1996:26:37", - "nodeType": "YulAssignment", - "src": "1996:26:37", - "value": { - "arguments": [ - { - "name": "_addr", - "nativeSrc": "2016:5:37", - "nodeType": "YulIdentifier", - "src": "2016:5:37" - } - ], - "functionName": { - "name": "extcodesize", - "nativeSrc": "2004:11:37", - "nodeType": "YulIdentifier", - "src": "2004:11:37" - }, - "nativeSrc": "2004:18:37", - "nodeType": "YulFunctionCall", - "src": "2004:18:37" - }, - "variableNames": [ - { - "name": "size", - "nativeSrc": "1996:4:37", - "nodeType": "YulIdentifier", - "src": "1996:4:37" - } - ] - } - ] - }, - "evmVersion": "paris", - "externalReferences": [ - { - "declaration": 48008, - "isOffset": false, - "isSlot": false, - "src": "2016:5:37", - "valueSize": 1 - }, - { - "declaration": 48014, - "isOffset": false, - "isSlot": false, - "src": "1996:4:37", - "valueSize": 1 - } - ], - "id": 48016, - "nodeType": "InlineAssembly", - "src": "1973:59:37" - }, - { - "expression": { - "components": [ - { - "commonType": { - "typeIdentifier": "t_uint32", - "typeString": "uint32" - }, - "id": 48019, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48017, - "name": "size", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48014, - "src": "2049:4:37", - "typeDescriptions": { - "typeIdentifier": "t_uint32", - "typeString": "uint32" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "hexValue": "30", - "id": 48018, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "2056:1:37", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "2049:8:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "id": 48020, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "2048:10:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "functionReturnParameters": 48012, - "id": 48021, - "nodeType": "Return", - "src": "2041:17:37" - } - ] - }, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "_isContract", - "nameLocation": "1887:11:37", - "parameters": { - "id": 48009, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48008, - "mutability": "mutable", - "name": "_addr", - "nameLocation": "1907:5:37", - "nodeType": "VariableDeclaration", - "scope": 48023, - "src": "1899:13:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 48007, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1899:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "1898:15:37" - }, - "returnParameters": { - "id": 48012, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48011, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 48023, - "src": "1936:4:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 48010, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1936:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "1935:6:37" - }, - "scope": 48312, - "stateMutability": "view", - "virtual": false, - "visibility": "private" - }, - { - "id": 48044, - "nodeType": "FunctionDefinition", - "src": "2071:140:37", - "nodes": [], - "body": { - "id": 48043, - "nodeType": "Block", - "src": "2150:61:37", - "nodes": [], - "statements": [ - { - "expression": { - "id": 48041, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "components": [ - { - "id": 48030, - "name": "addr", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48028, - "src": "2161:4:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - null - ], - "id": 48031, - "isConstant": false, - "isInlineArray": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "TupleExpression", - "src": "2160:8:37", - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_address_$__$", - "typeString": "tuple(address,)" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "arguments": [ - { - "id": 48034, - "name": "bys", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48025, - "src": "2182:3:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - } - }, - { - "components": [ - { - "id": 48036, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "2188:7:37", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_$", - "typeString": "type(address)" - }, - "typeName": { - "id": 48035, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2188:7:37", - "typeDescriptions": {} - } - }, - { - "id": 48038, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "2197:5:37", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", - "typeString": "type(bytes storage pointer)" - }, - "typeName": { - "id": 48037, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "2197:5:37", - "typeDescriptions": {} - } - } - ], - "id": 48039, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "2187:16:37", - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_type$_t_address_$_$_t_type$_t_bytes_storage_ptr_$_$", - "typeString": "tuple(type(address),type(bytes storage pointer))" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - }, - { - "typeIdentifier": "t_tuple$_t_type$_t_address_$_$_t_type$_t_bytes_storage_ptr_$_$", - "typeString": "tuple(type(address),type(bytes storage pointer))" - } - ], - "expression": { - "id": 48032, - "name": "abi", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -1, - "src": "2171:3:37", - "typeDescriptions": { - "typeIdentifier": "t_magic_abi", - "typeString": "abi" - } - }, - "id": 48033, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "memberLocation": "2175:6:37", - "memberName": "decode", - "nodeType": "MemberAccess", - "src": "2171:10:37", - "typeDescriptions": { - "typeIdentifier": "t_function_abidecode_pure$__$returns$__$", - "typeString": "function () pure" - } - }, - "id": 48040, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "2171:33:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_address_payable_$_t_bytes_memory_ptr_$", - "typeString": "tuple(address payable,bytes memory)" - } - }, - "src": "2160:44:37", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 48042, - "nodeType": "ExpressionStatement", - "src": "2160:44:37" - } - ] - }, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "_bytesToAddress", - "nameLocation": "2080:15:37", - "parameters": { - "id": 48026, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48025, - "mutability": "mutable", - "name": "bys", - "nameLocation": "2109:3:37", - "nodeType": "VariableDeclaration", - "scope": 48044, - "src": "2096:16:37", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes" - }, - "typeName": { - "id": 48024, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "2096:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "visibility": "internal" - } - ], - "src": "2095:18:37" - }, - "returnParameters": { - "id": 48029, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48028, - "mutability": "mutable", - "name": "addr", - "nameLocation": "2144:4:37", - "nodeType": "VariableDeclaration", - "scope": 48044, - "src": "2136:12:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 48027, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2136:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "2135:14:37" - }, - "scope": 48312, - "stateMutability": "pure", - "virtual": false, - "visibility": "private" - }, - { - "id": 48236, - "nodeType": "FunctionDefinition", - "src": "2622:1915:37", - "nodes": [], - "body": { - "id": 48235, - "nodeType": "Block", - "src": "2846:1691:37", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 48067, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "expression": { - "id": 48064, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "2864:3:37", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 48065, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "2868:6:37", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "2864:10:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "id": 48066, - "name": "_perOperator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47927, - "src": "2878:12:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "2864:26:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "hexValue": "6f6e6c7920504552206f70657261746f722063616e2063616c6c20746869732066756e6374696f6e", - "id": 48068, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "2892:42:37", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_9c16da403fa8069ce097abba2b137c749bf9fe3b75b0be234fad36509887a2bc", - "typeString": "literal_string \"only PER operator can call this function\"" - }, - "value": "only PER operator can call this function" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_9c16da403fa8069ce097abba2b137c749bf9fe3b75b0be234fad36509887a2bc", - "typeString": "literal_string \"only PER operator can call this function\"" - } - ], - "id": 48063, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [-18, -18], - "referencedDeclaration": -18, - "src": "2856:7:37", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 48069, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "2856:79:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 48070, - "nodeType": "ExpressionStatement", - "src": "2856:79:37" - }, - { - "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48075, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "expression": { - "id": 48072, - "name": "permission", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48047, - "src": "2953:10:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - }, - "id": 48073, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "2964:6:37", - "memberName": "length", - "nodeType": "MemberAccess", - "src": "2953:17:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">=", - "rightExpression": { - "hexValue": "3230", - "id": 48074, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "2974:2:37", - "typeDescriptions": { - "typeIdentifier": "t_rational_20_by_1", - "typeString": "int_const 20" - }, - "value": "20" - }, - "src": "2953:23:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "hexValue": "7065726d697373696f6e2073697a652073686f756c64206265206174206c65617374203230206279746573", - "id": 48076, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "2978:45:37", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_6519c6bc4a33d5af043dcb7e13d8d89703f9fffa3e00987879ca946adb1a38db", - "typeString": "literal_string \"permission size should be at least 20 bytes\"" - }, - "value": "permission size should be at least 20 bytes" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_6519c6bc4a33d5af043dcb7e13d8d89703f9fffa3e00987879ca946adb1a38db", - "typeString": "literal_string \"permission size should be at least 20 bytes\"" - } - ], - "id": 48071, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [-18, -18], - "referencedDeclaration": -18, - "src": "2945:7:37", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 48077, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "2945:79:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 48078, - "nodeType": "ExpressionStatement", - "src": "2945:79:37" - }, - { - "expression": { - "id": 48085, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "baseExpression": { - "id": 48079, - "name": "_permissions", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47935, - "src": "3034:12:37", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_bytes32_$_t_bool_$", - "typeString": "mapping(bytes32 => bool)" - } - }, - "id": 48083, - "indexExpression": { - "arguments": [ - { - "id": 48081, - "name": "permission", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48047, - "src": "3057:10:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - ], - "id": 48080, - "name": "keccak256", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -8, - "src": "3047:9:37", - "typeDescriptions": { - "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", - "typeString": "function (bytes memory) pure returns (bytes32)" - } - }, - "id": 48082, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "3047:21:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "3034:35:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "hexValue": "74727565", - "id": 48084, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "3072:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "src": "3034:42:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 48086, - "nodeType": "ExpressionStatement", - "src": "3034:42:37" - }, - { - "expression": { - "id": 48095, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 48087, - "name": "multicallStatuses", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48061, - "src": "3086:17:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr", - "typeString": "struct MulticallStatus memory[] memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "arguments": [ - { - "expression": { - "id": 48092, - "name": "data", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48053, - "src": "3128:4:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", - "typeString": "bytes calldata[] calldata" - } - }, - "id": 48093, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "3133:6:37", - "memberName": "length", - "nodeType": "MemberAccess", - "src": "3128:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 48091, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "NewExpression", - "src": "3106:21:37", - "typeDescriptions": { - "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr_$", - "typeString": "function (uint256) pure returns (struct MulticallStatus memory[] memory)" - }, - "typeName": { - "baseType": { - "id": 48089, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 48088, - "name": "MulticallStatus", - "nameLocations": ["3110:15:37"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 48731, - "src": "3110:15:37" - }, - "referencedDeclaration": 48731, - "src": "3110:15:37", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MulticallStatus_$48731_storage_ptr", - "typeString": "struct MulticallStatus" - } - }, - "id": 48090, - "nodeType": "ArrayTypeName", - "src": "3110:17:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_storage_$dyn_storage_ptr", - "typeString": "struct MulticallStatus[]" - } - } - }, - "id": 48094, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "3106:34:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr", - "typeString": "struct MulticallStatus memory[] memory" - } - }, - "src": "3086:54:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr", - "typeString": "struct MulticallStatus memory[] memory" - } - }, - "id": 48096, - "nodeType": "ExpressionStatement", - "src": "3086:54:37" - }, - { - "assignments": [48098], - "declarations": [ - { - "constant": false, - "id": 48098, - "mutability": "mutable", - "name": "totalBid", - "nameLocation": "3159:8:37", - "nodeType": "VariableDeclaration", - "scope": 48235, - "src": "3151:16:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48097, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "3151:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 48100, - "initialValue": { - "hexValue": "30", - "id": 48099, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "3170:1:37", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "nodeType": "VariableDeclarationStatement", - "src": "3151:20:37" - }, - { - "body": { - "id": 48164, - "nodeType": "Block", - "src": "3223:506:37", - "statements": [ - { - "clauses": [ - { - "block": { - "id": 48143, - "nodeType": "Block", - "src": "3426:141:37", - "statements": [ - { - "expression": { - "id": 48134, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "expression": { - "baseExpression": { - "id": 48129, - "name": "multicallStatuses", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48061, - "src": "3444:17:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr", - "typeString": "struct MulticallStatus memory[] memory" - } - }, - "id": 48131, - "indexExpression": { - "id": 48130, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3462:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3444:20:37", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MulticallStatus_$48731_memory_ptr", - "typeString": "struct MulticallStatus memory" - } - }, - "id": 48132, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberLocation": "3465:15:37", - "memberName": "externalSuccess", - "nodeType": "MemberAccess", - "referencedDeclaration": 48726, - "src": "3444:36:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 48133, - "name": "success", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48125, - "src": "3483:7:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "src": "3444:46:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 48135, - "nodeType": "ExpressionStatement", - "src": "3444:46:37" - }, - { - "expression": { - "id": 48141, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "expression": { - "baseExpression": { - "id": 48136, - "name": "multicallStatuses", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48061, - "src": "3508:17:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr", - "typeString": "struct MulticallStatus memory[] memory" - } - }, - "id": 48138, - "indexExpression": { - "id": 48137, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3526:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3508:20:37", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MulticallStatus_$48731_memory_ptr", - "typeString": "struct MulticallStatus memory" - } - }, - "id": 48139, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberLocation": "3529:14:37", - "memberName": "externalResult", - "nodeType": "MemberAccess", - "referencedDeclaration": 48728, - "src": "3508:35:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 48140, - "name": "result", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48127, - "src": "3546:6:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - } - }, - "src": "3508:44:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - } - }, - "id": 48142, - "nodeType": "ExpressionStatement", - "src": "3508:44:37" - } - ] - }, - "errorName": "", - "id": 48144, - "nodeType": "TryCatchClause", - "parameters": { - "id": 48128, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48125, - "mutability": "mutable", - "name": "success", - "nameLocation": "3396:7:37", - "nodeType": "VariableDeclaration", - "scope": 48144, - "src": "3391:12:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 48124, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "3391:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48127, - "mutability": "mutable", - "name": "result", - "nameLocation": "3418:6:37", - "nodeType": "VariableDeclaration", - "scope": 48144, - "src": "3405:19:37", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes" - }, - "typeName": { - "id": 48126, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "3405:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "visibility": "internal" - } - ], - "src": "3390:35:37" - }, - "src": "3382:185:37" - }, - { - "block": { - "id": 48155, - "nodeType": "Block", - "src": "3602:84:37", - "statements": [ - { - "expression": { - "id": 48153, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "expression": { - "baseExpression": { - "id": 48148, - "name": "multicallStatuses", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48061, - "src": "3620:17:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr", - "typeString": "struct MulticallStatus memory[] memory" - } - }, - "id": 48150, - "indexExpression": { - "id": 48149, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3638:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3620:20:37", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MulticallStatus_$48731_memory_ptr", - "typeString": "struct MulticallStatus memory" - } - }, - "id": 48151, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberLocation": "3641:21:37", - "memberName": "multicallRevertReason", - "nodeType": "MemberAccess", - "referencedDeclaration": 48730, - "src": "3620:42:37", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 48152, - "name": "reason", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48146, - "src": "3665:6:37", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - "src": "3620:51:37", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - "id": 48154, - "nodeType": "ExpressionStatement", - "src": "3620:51:37" - } - ] - }, - "errorName": "Error", - "id": 48156, - "nodeType": "TryCatchClause", - "parameters": { - "id": 48147, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48146, - "mutability": "mutable", - "name": "reason", - "nameLocation": "3594:6:37", - "nodeType": "VariableDeclaration", - "scope": 48156, - "src": "3580:20:37", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string" - }, - "typeName": { - "id": 48145, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "3580:6:37", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "visibility": "internal" - } - ], - "src": "3579:22:37" - }, - "src": "3568:118:37" - } - ], - "externalCall": { - "arguments": [ - { - "baseExpression": { - "id": 48114, - "name": "contracts", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48050, - "src": "3350:9:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", - "typeString": "address[] calldata" - } - }, - "id": 48116, - "indexExpression": { - "id": 48115, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3360:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3350:12:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "baseExpression": { - "id": 48117, - "name": "data", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48053, - "src": "3364:4:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", - "typeString": "bytes calldata[] calldata" - } - }, - "id": 48119, - "indexExpression": { - "id": 48118, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3369:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3364:7:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - }, - { - "baseExpression": { - "id": 48120, - "name": "bids", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48056, - "src": "3373:4:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_calldata_ptr", - "typeString": "uint256[] calldata" - } - }, - "id": 48122, - "indexExpression": { - "id": 48121, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3378:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3373:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "id": 48112, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -28, - "src": "3333:4:37", - "typeDescriptions": { - "typeIdentifier": "t_contract$_PERMulticall_$48312", - "typeString": "contract PERMulticall" - } - }, - "id": 48113, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "3338:11:37", - "memberName": "callWithBid", - "nodeType": "MemberAccess", - "referencedDeclaration": 48300, - "src": "3333:16:37", - "typeDescriptions": { - "typeIdentifier": "t_function_external_payable$_t_address_$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bool_$_t_bytes_memory_ptr_$", - "typeString": "function (address,bytes memory,uint256) payable external returns (bool,bytes memory)" - } - }, - "id": 48123, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "3333:48:37", - "tryCall": true, - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", - "typeString": "tuple(bool,bytes memory)" - } - }, - "id": 48157, - "nodeType": "TryStatement", - "src": "3329:357:37" - }, - { - "expression": { - "id": 48162, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 48158, - "name": "totalBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48098, - "src": "3699:8:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "baseExpression": { - "id": 48159, - "name": "bids", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48056, - "src": "3711:4:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_calldata_ptr", - "typeString": "uint256[] calldata" - } - }, - "id": 48161, - "indexExpression": { - "id": 48160, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3716:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3711:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3699:19:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 48163, - "nodeType": "ExpressionStatement", - "src": "3699:19:37" - } - ] - }, - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48108, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48105, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3201:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "expression": { - "id": 48106, - "name": "data", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48053, - "src": "3205:4:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", - "typeString": "bytes calldata[] calldata" - } - }, - "id": 48107, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "3210:6:37", - "memberName": "length", - "nodeType": "MemberAccess", - "src": "3205:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3201:15:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 48165, - "initializationExpression": { - "assignments": [48102], - "declarations": [ - { - "constant": false, - "id": 48102, - "mutability": "mutable", - "name": "i", - "nameLocation": "3194:1:37", - "nodeType": "VariableDeclaration", - "scope": 48165, - "src": "3186:9:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48101, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "3186:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 48104, - "initialValue": { - "hexValue": "30", - "id": 48103, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "3198:1:37", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "nodeType": "VariableDeclarationStatement", - "src": "3186:13:37" - }, - "loopExpression": { - "expression": { - "id": 48110, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "3218:3:37", - "subExpression": { - "id": 48109, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48102, - "src": "3218:1:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 48111, - "nodeType": "ExpressionStatement", - "src": "3218:3:37" - }, - "nodeType": "ForStatement", - "src": "3181:548:37" - }, - { - "assignments": [48167], - "declarations": [ - { - "constant": false, - "id": 48167, - "mutability": "mutable", - "name": "feeReceiver", - "nameLocation": "3811:11:37", - "nodeType": "VariableDeclaration", - "scope": 48235, - "src": "3803:19:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 48166, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "3803:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "id": 48171, - "initialValue": { - "arguments": [ - { - "id": 48169, - "name": "permission", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48047, - "src": "3841:10:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - ], - "id": 48168, - "name": "_bytesToAddress", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48044, - "src": "3825:15:37", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_address_$", - "typeString": "function (bytes memory) pure returns (address)" - } - }, - "id": 48170, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "3825:27:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "3803:49:37" - }, - { - "assignments": [48173], - "declarations": [ - { - "constant": false, - "id": 48173, - "mutability": "mutable", - "name": "protocolFee", - "nameLocation": "3910:11:37", - "nodeType": "VariableDeclaration", - "scope": 48235, - "src": "3902:19:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48172, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "3902:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 48177, - "initialValue": { - "baseExpression": { - "id": 48174, - "name": "_feeConfig", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47931, - "src": "3924:10:37", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 48176, - "indexExpression": { - "id": 48175, - "name": "feeReceiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48167, - "src": "3935:11:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "3924:23:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "3902:45:37" - }, - { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48180, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48178, - "name": "protocolFee", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48173, - "src": "3961:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "hexValue": "30", - "id": 48179, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "3976:1:37", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "3961:16:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 48186, - "nodeType": "IfStatement", - "src": "3957:72:37", - "trueBody": { - "id": 48185, - "nodeType": "Block", - "src": "3979:50:37", - "statements": [ - { - "expression": { - "id": 48183, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 48181, - "name": "protocolFee", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48173, - "src": "3993:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 48182, - "name": "_defaultFee", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47937, - "src": "4007:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "3993:25:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 48184, - "nodeType": "ExpressionStatement", - "src": "3993:25:37" - } - ] - } - }, - { - "assignments": [48188], - "declarations": [ - { - "constant": false, - "id": 48188, - "mutability": "mutable", - "name": "feeProtocolNumerator", - "nameLocation": "4046:20:37", - "nodeType": "VariableDeclaration", - "scope": 48235, - "src": "4038:28:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48187, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4038:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 48192, - "initialValue": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48191, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48189, - "name": "totalBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48098, - "src": "4069:8:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "*", - "rightExpression": { - "id": 48190, - "name": "protocolFee", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48173, - "src": "4080:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "4069:22:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "4038:53:37" - }, - { - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48195, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48193, - "name": "feeProtocolNumerator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48188, - "src": "4105:20:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "hexValue": "30", - "id": 48194, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "4128:1:37", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "4105:24:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 48226, - "nodeType": "IfStatement", - "src": "4101:377:37", - "trueBody": { - "id": 48225, - "nodeType": "Block", - "src": "4131:347:37", - "statements": [ - { - "assignments": [48197], - "declarations": [ - { - "constant": false, - "id": 48197, - "mutability": "mutable", - "name": "feeProtocol", - "nameLocation": "4153:11:37", - "nodeType": "VariableDeclaration", - "scope": 48225, - "src": "4145:19:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48196, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4145:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 48201, - "initialValue": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48200, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48198, - "name": "feeProtocolNumerator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48188, - "src": "4167:20:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "/", - "rightExpression": { - "hexValue": "313030305f3030305f3030305f3030305f3030305f303030", - "id": 48199, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "4190:24:37", - "typeDescriptions": { - "typeIdentifier": "t_rational_1000000000000000000_by_1", - "typeString": "int_const 1000000000000000000" - }, - "value": "1000_000_000_000_000_000" - }, - "src": "4167:47:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "4145:69:37" - }, - { - "condition": { - "arguments": [ - { - "id": 48203, - "name": "feeReceiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48167, - "src": "4244:11:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 48202, - "name": "_isContract", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48023, - "src": "4232:11:37", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$", - "typeString": "function (address) view returns (bool)" - } - }, - "id": 48204, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "4232:24:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": { - "id": 48223, - "nodeType": "Block", - "src": "4393:75:37", - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 48220, - "name": "feeProtocol", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48197, - "src": "4441:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "arguments": [ - { - "id": 48217, - "name": "feeReceiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48167, - "src": "4419:11:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 48216, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "4411:8:37", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_payable_$", - "typeString": "type(address payable)" - }, - "typeName": { - "id": 48215, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "4411:8:37", - "stateMutability": "payable", - "typeDescriptions": {} - } - }, - "id": 48218, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "4411:20:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "id": 48219, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "4432:8:37", - "memberName": "transfer", - "nodeType": "MemberAccess", - "src": "4411:29:37", - "typeDescriptions": { - "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256)" - } - }, - "id": 48221, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "4411:42:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 48222, - "nodeType": "ExpressionStatement", - "src": "4411:42:37" - } - ] - }, - "id": 48224, - "nodeType": "IfStatement", - "src": "4228:240:37", - "trueBody": { - "id": 48214, - "nodeType": "Block", - "src": "4258:118:37", - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 48211, - "name": "permission", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48047, - "src": "4350:10:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - ], - "expression": { - "arguments": [ - { - "id": 48206, - "name": "feeReceiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48167, - "src": "4291:11:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 48205, - "name": "PERFeeReceiver", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47910, - "src": "4276:14:37", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_PERFeeReceiver_$47910_$", - "typeString": "type(contract PERFeeReceiver)" - } - }, - "id": 48207, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "4276:27:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_contract$_PERFeeReceiver_$47910", - "typeString": "contract PERFeeReceiver" - } - }, - "id": 48208, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "4304:25:37", - "memberName": "receiveAuctionProceedings", - "nodeType": "MemberAccess", - "referencedDeclaration": 47909, - "src": "4276:53:37", - "typeDescriptions": { - "typeIdentifier": "t_function_external_payable$_t_bytes_memory_ptr_$returns$__$", - "typeString": "function (bytes memory) payable external" - } - }, - "id": 48210, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "names": ["value"], - "nodeType": "FunctionCallOptions", - "options": [ - { - "id": 48209, - "name": "feeProtocol", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48197, - "src": "4337:11:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "src": "4276:73:37", - "typeDescriptions": { - "typeIdentifier": "t_function_external_payable$_t_bytes_memory_ptr_$returns$__$value", - "typeString": "function (bytes memory) payable external" - } - }, - "id": 48212, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "4276:85:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 48213, - "nodeType": "ExpressionStatement", - "src": "4276:85:37" - } - ] - } - } - ] - } - }, - { - "expression": { - "id": 48233, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "baseExpression": { - "id": 48227, - "name": "_permissions", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47935, - "src": "4487:12:37", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_bytes32_$_t_bool_$", - "typeString": "mapping(bytes32 => bool)" - } - }, - "id": 48231, - "indexExpression": { - "arguments": [ - { - "id": 48229, - "name": "permission", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48047, - "src": "4510:10:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - ], - "id": 48228, - "name": "keccak256", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -8, - "src": "4500:9:37", - "typeDescriptions": { - "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", - "typeString": "function (bytes memory) pure returns (bytes32)" - } - }, - "id": 48230, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "4500:21:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "4487:35:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "hexValue": "66616c7365", - "id": 48232, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "4525:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "false" - }, - "src": "4487:43:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 48234, - "nodeType": "ExpressionStatement", - "src": "4487:43:37" - } - ] - }, - "documentation": { - "id": 48045, - "nodeType": "StructuredDocumentation", - "src": "2217:400:37", - "text": " @notice multicall function - performs a number of calls to external contracts in order\n @param permission: permission to allow for this call\n @param contracts: ordered list of contracts to call into\n @param data: ordered list of calldata to call with\n @param bids: ordered list of bids; call i will fail if it does not pay PER operator at least bid i" - }, - "functionSelector": "696e1290", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "multicall", - "nameLocation": "2631:9:37", - "parameters": { - "id": 48057, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48047, - "mutability": "mutable", - "name": "permission", - "nameLocation": "2665:10:37", - "nodeType": "VariableDeclaration", - "scope": 48236, - "src": "2650:25:37", - "stateVariable": false, - "storageLocation": "calldata", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes" - }, - "typeName": { - "id": 48046, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "2650:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48050, - "mutability": "mutable", - "name": "contracts", - "nameLocation": "2698:9:37", - "nodeType": "VariableDeclaration", - "scope": 48236, - "src": "2679:28:37", - "stateVariable": false, - "storageLocation": "calldata", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", - "typeString": "address[]" - }, - "typeName": { - "baseType": { - "id": 48048, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2679:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 48049, - "nodeType": "ArrayTypeName", - "src": "2679:9:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", - "typeString": "address[]" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48053, - "mutability": "mutable", - "name": "data", - "nameLocation": "2734:4:37", - "nodeType": "VariableDeclaration", - "scope": 48236, - "src": "2717:21:37", - "stateVariable": false, - "storageLocation": "calldata", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", - "typeString": "bytes[]" - }, - "typeName": { - "baseType": { - "id": 48051, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "2717:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "id": 48052, - "nodeType": "ArrayTypeName", - "src": "2717:7:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", - "typeString": "bytes[]" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48056, - "mutability": "mutable", - "name": "bids", - "nameLocation": "2767:4:37", - "nodeType": "VariableDeclaration", - "scope": 48236, - "src": "2748:23:37", - "stateVariable": false, - "storageLocation": "calldata", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_calldata_ptr", - "typeString": "uint256[]" - }, - "typeName": { - "baseType": { - "id": 48054, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "2748:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 48055, - "nodeType": "ArrayTypeName", - "src": "2748:9:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", - "typeString": "uint256[]" - } - }, - "visibility": "internal" - } - ], - "src": "2640:137:37" - }, - "returnParameters": { - "id": 48062, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48061, - "mutability": "mutable", - "name": "multicallStatuses", - "nameLocation": "2827:17:37", - "nodeType": "VariableDeclaration", - "scope": 48236, - "src": "2802:42:37", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_memory_ptr_$dyn_memory_ptr", - "typeString": "struct MulticallStatus[]" - }, - "typeName": { - "baseType": { - "id": 48059, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 48058, - "name": "MulticallStatus", - "nameLocations": ["2802:15:37"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 48731, - "src": "2802:15:37" - }, - "referencedDeclaration": 48731, - "src": "2802:15:37", - "typeDescriptions": { - "typeIdentifier": "t_struct$_MulticallStatus_$48731_storage_ptr", - "typeString": "struct MulticallStatus" - } - }, - "id": 48060, - "nodeType": "ArrayTypeName", - "src": "2802:17:37", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_struct$_MulticallStatus_$48731_storage_$dyn_storage_ptr", - "typeString": "struct MulticallStatus[]" - } - }, - "visibility": "internal" - } - ], - "src": "2801:44:37" - }, - "scope": 48312, - "stateMutability": "payable", - "virtual": false, - "visibility": "public" - }, - { - "id": 48300, - "nodeType": "FunctionDefinition", - "src": "4860:608:37", - "nodes": [], - "body": { - "id": 48299, - "nodeType": "Block", - "src": "5014:454:37", - "nodes": [], - "statements": [ - { - "assignments": [48251], - "declarations": [ - { - "constant": false, - "id": 48251, - "mutability": "mutable", - "name": "balanceInitEth", - "nameLocation": "5032:14:37", - "nodeType": "VariableDeclaration", - "scope": 48299, - "src": "5024:22:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48250, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5024:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 48257, - "initialValue": { - "expression": { - "arguments": [ - { - "id": 48254, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -28, - "src": "5057:4:37", - "typeDescriptions": { - "typeIdentifier": "t_contract$_PERMulticall_$48312", - "typeString": "contract PERMulticall" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_contract$_PERMulticall_$48312", - "typeString": "contract PERMulticall" - } - ], - "id": 48253, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "5049:7:37", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_$", - "typeString": "type(address)" - }, - "typeName": { - "id": 48252, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "5049:7:37", - "typeDescriptions": {} - } - }, - "id": 48255, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "5049:13:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 48256, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "5063:7:37", - "memberName": "balance", - "nodeType": "MemberAccess", - "src": "5049:21:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "5024:46:37" - }, - { - "assignments": [48259, 48261], - "declarations": [ - { - "constant": false, - "id": 48259, - "mutability": "mutable", - "name": "success", - "nameLocation": "5087:7:37", - "nodeType": "VariableDeclaration", - "scope": 48299, - "src": "5082:12:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 48258, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "5082:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48261, - "mutability": "mutable", - "name": "result", - "nameLocation": "5109:6:37", - "nodeType": "VariableDeclaration", - "scope": 48299, - "src": "5096:19:37", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes" - }, - "typeName": { - "id": 48260, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "5096:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "visibility": "internal" - } - ], - "id": 48266, - "initialValue": { - "arguments": [ - { - "id": 48264, - "name": "data", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48241, - "src": "5140:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes calldata" - } - ], - "expression": { - "id": 48262, - "name": "contractAddress", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48239, - "src": "5119:15:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 48263, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "5135:4:37", - "memberName": "call", - "nodeType": "MemberAccess", - "src": "5119:20:37", - "typeDescriptions": { - "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", - "typeString": "function (bytes memory) payable returns (bool,bytes memory)" - } - }, - "id": 48265, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "5119:26:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", - "typeString": "tuple(bool,bytes memory)" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "5081:64:37" - }, - { - "condition": { - "id": 48267, - "name": "success", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48259, - "src": "5160:7:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 48294, - "nodeType": "IfStatement", - "src": "5156:271:37", - "trueBody": { - "id": 48293, - "nodeType": "Block", - "src": "5169:258:37", - "statements": [ - { - "assignments": [48269], - "declarations": [ - { - "constant": false, - "id": 48269, - "mutability": "mutable", - "name": "balanceFinalEth", - "nameLocation": "5191:15:37", - "nodeType": "VariableDeclaration", - "scope": 48293, - "src": "5183:23:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48268, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "5183:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 48275, - "initialValue": { - "expression": { - "arguments": [ - { - "id": 48272, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -28, - "src": "5217:4:37", - "typeDescriptions": { - "typeIdentifier": "t_contract$_PERMulticall_$48312", - "typeString": "contract PERMulticall" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_contract$_PERMulticall_$48312", - "typeString": "contract PERMulticall" - } - ], - "id": 48271, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "5209:7:37", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_$", - "typeString": "type(address)" - }, - "typeName": { - "id": 48270, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "5209:7:37", - "typeDescriptions": {} - } - }, - "id": 48273, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "5209:13:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 48274, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "5223:7:37", - "memberName": "balance", - "nodeType": "MemberAccess", - "src": "5209:21:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "5183:47:37" - }, - { - "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "id": 48289, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48283, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "!", - "prefix": true, - "src": "5320:41:37", - "subExpression": { - "components": [ - { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48281, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48279, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48277, - "name": "balanceFinalEth", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48269, - "src": "5322:15:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "-", - "rightExpression": { - "id": 48278, - "name": "balanceInitEth", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48251, - "src": "5340:14:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "5322:32:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "id": 48280, - "name": "bid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48243, - "src": "5357:3:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "5322:38:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "id": 48282, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "5321:40:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "BinaryOperation", - "operator": "&&", - "rightExpression": { - "id": 48288, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "!", - "prefix": true, - "src": "5365:35:37", - "subExpression": { - "components": [ - { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 48286, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 48284, - "name": "balanceFinalEth", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48269, - "src": "5367:15:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "id": 48285, - "name": "balanceInitEth", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48251, - "src": "5385:14:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "5367:32:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "id": 48287, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "5366:34:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "src": "5320:80:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "hexValue": "696e76616c696420626964", - "id": 48290, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "5402:13:37", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_052f0198aaf8011197f0a587485e4d2f99657c8be10e5b76b291c1d9edf43881", - "typeString": "literal_string \"invalid bid\"" - }, - "value": "invalid bid" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_052f0198aaf8011197f0a587485e4d2f99657c8be10e5b76b291c1d9edf43881", - "typeString": "literal_string \"invalid bid\"" - } - ], - "id": 48276, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [-18, -18], - "referencedDeclaration": -18, - "src": "5311:7:37", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 48291, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "5311:105:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 48292, - "nodeType": "ExpressionStatement", - "src": "5311:105:37" - } - ] - } - }, - { - "expression": { - "components": [ - { - "id": 48295, - "name": "success", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48259, - "src": "5445:7:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "id": 48296, - "name": "result", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 48261, - "src": "5454:6:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes memory" - } - } - ], - "id": 48297, - "isConstant": false, - "isInlineArray": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "TupleExpression", - "src": "5444:17:37", - "typeDescriptions": { - "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", - "typeString": "tuple(bool,bytes memory)" - } - }, - "functionReturnParameters": 48249, - "id": 48298, - "nodeType": "Return", - "src": "5437:24:37" - } - ] - }, - "documentation": { - "id": 48237, - "nodeType": "StructuredDocumentation", - "src": "4543:312:37", - "text": " @notice callWithBid function - contained call to function with check for bid invariant\n \n @param contractAddress: contract address to call into\n @param data: calldata to call with\n @param bid: bid to be paid; call will fail if it does not pay PER operator at least bid," - }, - "functionSelector": "b9a0937f", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "callWithBid", - "nameLocation": "4869:11:37", - "parameters": { - "id": 48244, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48239, - "mutability": "mutable", - "name": "contractAddress", - "nameLocation": "4898:15:37", - "nodeType": "VariableDeclaration", - "scope": 48300, - "src": "4890:23:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 48238, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "4890:7:37", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48241, - "mutability": "mutable", - "name": "data", - "nameLocation": "4938:4:37", - "nodeType": "VariableDeclaration", - "scope": 48300, - "src": "4923:19:37", - "stateVariable": false, - "storageLocation": "calldata", - "typeDescriptions": { - "typeIdentifier": "t_bytes_calldata_ptr", - "typeString": "bytes" - }, - "typeName": { - "id": 48240, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "4923:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48243, - "mutability": "mutable", - "name": "bid", - "nameLocation": "4960:3:37", - "nodeType": "VariableDeclaration", - "scope": 48300, - "src": "4952:11:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 48242, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "4952:7:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "4880:89:37" - }, - "returnParameters": { - "id": 48249, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 48246, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 48300, - "src": "4994:4:37", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 48245, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "4994:4:37", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 48248, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 48300, - "src": "5000:12:37", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_bytes_memory_ptr", - "typeString": "bytes" - }, - "typeName": { - "id": 48247, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "5000:5:37", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "visibility": "internal" - } - ], - "src": "4993:20:37" - }, - "scope": 48312, - "stateMutability": "payable", - "virtual": false, - "visibility": "public" - }, - { - "id": 48311, - "nodeType": "FunctionDefinition", - "src": "5474:85:37", - "nodes": [], - "body": { - "id": 48310, - "nodeType": "Block", - "src": "5502:57:37", - "nodes": [], - "statements": [ - { - "eventCall": { - "arguments": [ - { - "expression": { - "id": 48304, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "5530:3:37", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 48305, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "5534:6:37", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "5530:10:37", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "expression": { - "id": 48306, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "5542:3:37", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 48307, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "5546:5:37", - "memberName": "value", - "nodeType": "MemberAccess", - "src": "5542:9:37", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 48303, - "name": "ReceivedETH", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 47925, - "src": "5518:11:37", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,uint256)" - } - }, - "id": 48308, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "5518:34:37", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 48309, - "nodeType": "EmitStatement", - "src": "5513:39:37" - } - ] - }, - "implemented": true, - "kind": "receive", - "modifiers": [], - "name": "", - "nameLocation": "-1:-1:-1", - "parameters": { - "id": 48301, - "nodeType": "ParameterList", - "parameters": [], - "src": "5481:2:37" - }, - "returnParameters": { - "id": 48302, - "nodeType": "ParameterList", - "parameters": [], - "src": "5502:0:37" - }, - "scope": 48312, - "stateMutability": "payable", - "virtual": false, - "visibility": "external" - } - ], - "abstract": false, - "baseContracts": [], - "canonicalName": "PERMulticall", - "contractDependencies": [], - "contractKind": "contract", - "fullyImplemented": true, - "linearizedBaseContracts": [48312], - "name": "PERMulticall", - "nameLocation": "327:12:37", - "scope": 48313, - "usedErrors": [], - "usedEvents": [47925] - } - ], - "license": "UNLICENSED" - }, - "id": 37 -} diff --git a/auction-server/src/api.rs b/auction-server/src/api.rs index 89386dac..cd1d314e 100644 --- a/auction-server/src/api.rs +++ b/auction-server/src/api.rs @@ -1,6 +1,13 @@ use { crate::{ - api::rest::Bid, + api::{ + marketplace::{ + LiquidationOpportunity, + OpportunityBid, + TokenQty, + }, + rest::Bid, + }, auction::run_submission_loop, config::{ ChainId, @@ -9,6 +16,7 @@ use { }, state::{ ChainStore, + LiquidationStore, Store, }, }, @@ -39,7 +47,6 @@ use { LocalWallet, Signer, }, - types::Address, }, futures::future::join_all, std::{ @@ -73,6 +80,7 @@ async fn root() -> String { format!("PER Auction Server API {}", crate_version!()) } +pub(crate) mod marketplace; mod rest; #[derive(ToResponse, ToSchema)] @@ -82,6 +90,8 @@ pub enum RestError { BadParameters(String), /// The chain id is not supported InvalidChainId, + /// The order was not found + OpportunityNotFound, /// The server cannot currently communicate with the blockchain, so is not able to verify /// which random values have been requested. TemporarilyUnavailable, @@ -98,6 +108,11 @@ impl IntoResponse for RestError { RestError::InvalidChainId => { (StatusCode::BAD_REQUEST, "The chain id is not supported").into_response() } + RestError::OpportunityNotFound => ( + StatusCode::NOT_FOUND, + "Order with the specified id was not found", + ) + .into_response(), RestError::TemporarilyUnavailable => ( StatusCode::SERVICE_UNAVAILABLE, @@ -125,9 +140,11 @@ pub async fn start_server(run_options: RunOptions) -> Result<()> { #[openapi( paths( rest::bid, + marketplace::submit_opportunity, + marketplace::fetch_opportunities, ), components( - schemas(Bid), responses(RestError) + schemas(Bid),schemas(LiquidationOpportunity),schemas(OpportunityBid), schemas(TokenQty),responses(RestError) ), tags( (name = "PER Auction", description = "Pyth Express Relay Auction Server") @@ -165,7 +182,6 @@ pub async fn start_server(run_options: RunOptions) -> Result<()> { network_id: id, bids: Default::default(), config: chain_config.clone(), - opps: Default::default(), }, )) }, @@ -175,8 +191,9 @@ pub async fn start_server(run_options: RunOptions) -> Result<()> { .collect(); let store = Arc::new(Store { - chains: chain_store?, - per_operator: wallet, + chains: chain_store?, + liquidation_store: LiquidationStore::default(), + per_operator: wallet, }); let server_store = store.clone(); @@ -187,8 +204,14 @@ pub async fn start_server(run_options: RunOptions) -> Result<()> { .merge(SwaggerUi::new("/docs").url("/docs/openapi.json", ApiDoc::openapi())) .route("/", get(root)) .route("/bid", post(rest::bid)) - .route("/surface", post(rest::surface)) - .route("/getOpps", get(rest::get_opps)) + .route( + "/liquidation/submit_opportunity", + post(marketplace::submit_opportunity), + ) + .route( + "/liquidation/fetch_opportunities", + get(marketplace::fetch_opportunities), + ) .layer(CorsLayer::permissive()) .with_state(server_store); diff --git a/auction-server/src/api/marketplace.rs b/auction-server/src/api/marketplace.rs new file mode 100644 index 00000000..b16ef2fb --- /dev/null +++ b/auction-server/src/api/marketplace.rs @@ -0,0 +1,232 @@ +use { + crate::{ + api::{ + rest::handle_bid, + RestError, + }, + liquidation_adapter::make_liquidator_calldata, + state::Store, + }, + axum::{ + extract::State, + Json, + }, + ethers::{ + abi::Address, + core::types::Signature, + types::{ + Bytes, + U256, + }, + }, + serde::{ + Deserialize, + Serialize, + }, + std::sync::Arc, + utoipa::ToSchema, + uuid::Uuid, +}; + +#[derive(Serialize, Deserialize, ToSchema, Clone)] +pub struct TokenQty { + /// Token contract address + #[schema(example = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",value_type=String)] + contract: Address, + /// Token amount + #[schema(example = "1000")] + amount: String, +} + +/// A liquidation opportunity ready to be executed. +/// If a searcher signs the opportunity and have approved enough tokens to liquidation adapter, by calling this contract with the given calldata and structures, they will receive the tokens specified in the receipt_tokens field, and will send the tokens specified in the repay_tokens field. +#[derive(Serialize, Deserialize, ToSchema, Clone)] +pub struct LiquidationOpportunity { + /// The permission key required for succesful execution of the liquidation. + #[schema(example = "0xdeadbeefcafe", value_type=String)] + permission_key: Bytes, + /// The chain id where the liquidation will be executed. + #[schema(example = "sepolia")] + chain_id: String, + /// The contract address to call for execution of the liquidation. + #[schema(example = "0xcA11bde05977b3631167028862bE2a173976CA11", value_type=String)] + contract: Address, + /// Calldata for the contract call. + #[schema(example = "0xdeadbeef", value_type=String)] + calldata: Bytes, + + repay_tokens: Vec, + receipt_tokens: Vec, +} + +impl From<(Address, U256)> for TokenQty { + fn from(token: (Address, U256)) -> Self { + TokenQty { + contract: token.0, + amount: token.1.to_string(), + } + } +} + +impl TryFrom for (Address, U256) { + type Error = RestError; + + fn try_from(token: TokenQty) -> Result { + let amount = U256::from_dec_str(token.amount.as_str()) + .map_err(|_| RestError::BadParameters("Invalid token amount".to_string()))?; + Ok((token.contract, amount)) + } +} + +fn parse_tokens(tokens: Vec) -> Result, RestError> { + tokens.into_iter().map(|token| token.try_into()).collect() +} + +/// Submit a liquidation opportunity ready to be executed. +/// +/// The opportunity will be verified by the server. If the opportunity is valid, it will be stored in the database and will be available for bidding. +#[utoipa::path(post, path = "/liquidation/submit_opportunity", request_body = LiquidationOpportunity, responses( + (status = 200, description = "Opportunity was stored succesfuly", body = String), + (status = 400, response=RestError) +),)] +pub async fn submit_opportunity( + State(store): State>, + Json(opportunity): Json, +) -> Result { + store + .chains + .get(&opportunity.chain_id) + .ok_or(RestError::InvalidChainId)?; + + let repay_tokens = parse_tokens(opportunity.repay_tokens)?; + let receipt_tokens = parse_tokens(opportunity.receipt_tokens)?; + + //TODO: Verify if the call actually works + + store.liquidation_store.opportunities.write().await.insert( + opportunity.permission_key.clone(), + crate::state::VerifiedLiquidationOpportunity { + id: Uuid::new_v4(), + chain_id: opportunity.chain_id.clone(), + permission_key: opportunity.permission_key, + contract: opportunity.contract, + calldata: opportunity.calldata, + repay_tokens, + receipt_tokens, + }, + ); + + Ok("OK".to_string()) +} + +/// Fetch all liquidation opportunities ready to be exectued. +#[utoipa::path(get, path = "/liquidation/fetch_opportunities", responses( + (status = 200, description = "Array of liquidation opportunities ready for bidding", body = Vec), + (status = 400, response=RestError) +),)] +pub async fn fetch_opportunities( + State(store): State>, +) -> Result>, RestError> { + let opportunities: Vec = store + .liquidation_store + .opportunities + .read() + .await + .values() + .cloned() + .map(|opportunity| LiquidationOpportunity { + permission_key: opportunity.permission_key, + chain_id: opportunity.chain_id, + contract: opportunity.contract, + calldata: opportunity.calldata, + repay_tokens: opportunity + .repay_tokens + .into_iter() + .map(TokenQty::from) + .collect(), + receipt_tokens: opportunity + .receipt_tokens + .into_iter() + .map(TokenQty::from) + .collect(), + }) + .collect(); + + Ok(opportunities.into()) +} + +#[derive(Serialize, Deserialize, ToSchema, Clone)] +pub struct OpportunityBid { + /// The opportunity id to bid on. + #[schema(example = "f47ac10b-58cc-4372-a567-0e02b2c3d479",value_type=String)] + opportunity_id: Uuid, + /// The opportunity permission key + #[schema(example = "0xdeadbeefcafe", value_type=String)] + permission_key: Bytes, + /// The bid amount in wei. + #[schema(example = "1000000000000000000")] + bid_amount: String, + /// How long the bid will be valid for. + #[schema(example = "1000000000000000000")] + valid_until: String, + /// Liquidator address + #[schema(example = "0x5FbDB2315678afecb367f032d93F642f64180aa2", value_type=String)] + liquidator: Address, + #[schema( + example = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12" + ,value_type=String)] + signature: Signature, +} + +#[derive(Clone, Copy)] +pub struct VerifiedOpportunityBid { + pub opportunity_id: Uuid, + pub bid_amount: U256, + pub valid_until: U256, + pub liquidator: Address, + pub signature: Signature, +} + +pub async fn bid_opportunity( + store: Arc, + Json(opportunity_bid): Json, +) -> Result { + let opportunities = store.liquidation_store.opportunities.read().await; + + let liquidation = opportunities + .get(&opportunity_bid.permission_key) + .ok_or(RestError::OpportunityNotFound)?; + + if liquidation.id != opportunity_bid.opportunity_id { + return Err(RestError::BadParameters( + "Invalid opportunity_id".to_string(), + )); + } + let bid_amount = U256::from_dec_str(opportunity_bid.bid_amount.as_str()) + .map_err(|_| RestError::BadParameters("Invalid bid_amount".to_string()))?; + let valid_until = U256::from_dec_str(opportunity_bid.valid_until.as_str()) + .map_err(|_| RestError::BadParameters("Invalid valid_until".to_string()))?; + + let verified_liquidation_bid = VerifiedOpportunityBid { + opportunity_id: opportunity_bid.opportunity_id, + bid_amount, + valid_until, + liquidator: opportunity_bid.liquidator, + signature: opportunity_bid.signature, + }; + + let per_calldata = make_liquidator_calldata(liquidation.clone(), verified_liquidation_bid) + .map_err(|e| RestError::BadParameters(e.to_string()))?; + + handle_bid( + store.clone(), + crate::api::rest::ParsedBid { + permission_key: liquidation.permission_key.clone(), + chain_id: liquidation.chain_id.clone(), + contract: liquidation.contract, + calldata: per_calldata, + bid_amount: verified_liquidation_bid.bid_amount, + }, + ) + .await +} diff --git a/auction-server/src/api/rest.rs b/auction-server/src/api/rest.rs index 6861d30f..4bfdc92c 100644 --- a/auction-server/src/api/rest.rs +++ b/auction-server/src/api/rest.rs @@ -6,17 +6,12 @@ use { simulate_bids, }, state::{ - GetOppsParams, - Opportunity, SimulatedBid, Store, }, }, axum::{ - extract::{ - Query, - State, - }, + extract::State, Json, }, ethers::{ @@ -28,7 +23,6 @@ use { Bytes, U256, }, - utils::hex::FromHex, }, serde::{ Deserialize, @@ -41,80 +35,61 @@ use { #[derive(Serialize, Deserialize, ToSchema, Clone)] pub struct Bid { /// The permission key to bid on. - #[schema(example = "0xdeadbeef")] - permission_key: String, + #[schema(example = "0xdeadbeef", value_type=String)] + permission_key: Bytes, /// The chain id to bid on. #[schema(example = "sepolia")] chain_id: String, /// The contract address to call. - #[schema(example = "0xcA11bde05977b3631167028862bE2a173976CA11")] - contract: String, + #[schema(example = "0xcA11bde05977b3631167028862bE2a173976CA11",value_type = String)] + contract: Address, /// Calldata for the contract call. - #[schema(example = "0xdeadbeef")] - calldata: String, + #[schema(example = "0xdeadbeef", value_type=String)] + calldata: Bytes, /// Amount of bid in wei. #[schema(example = "1000000000000000000")] bid: String, } -/// Bid on a specific permission key for a specific chain. -/// -/// Your bid will be simulated and verified by the server. Depending on the outcome of the auction, a transaction containing the contract call will be sent to the blockchain expecting the bid amount to be paid after the call. -#[utoipa::path(post, path = "/bid", request_body = Bid, responses( - (status = 200, description = "Bid was placed succesfully", body = String), - (status = 400, response=RestError) -),)] -pub async fn bid( - State(store): State>, - Json(bid): Json, -) -> Result { +pub struct ParsedBid { + pub permission_key: Bytes, + pub chain_id: String, + pub contract: Address, + pub calldata: Bytes, + pub bid_amount: U256, +} + +pub async fn handle_bid(store: Arc, bid: ParsedBid) -> Result { let chain_store = store .chains .get(&bid.chain_id) .ok_or(RestError::InvalidChainId)?; - - let permission = Bytes::from_hex(bid.permission_key) - .map_err(|_| RestError::BadParameters("Invalid permission key".to_string()))?; - let calldata = Bytes::from_hex(bid.calldata) - .map_err(|_| RestError::BadParameters("Invalid calldata".to_string()))?; - - let contract = bid - .contract - .parse::
() - .map_err(|_| RestError::BadParameters("Invalid contract address".to_string()))?; - - let bid_amount = bid - .bid - .parse::() - .map_err(|_| RestError::BadParameters("Invalid bid amount".to_string()))?; - let call = simulate_bids( store.per_operator.address(), chain_store.provider.clone(), chain_store.config.clone(), - permission.clone(), - vec![contract], - vec![calldata.clone()], - vec![bid_amount], + bid.permission_key.clone(), + vec![bid.contract], + vec![bid.calldata.clone()], + vec![bid.bid_amount], ); match call.await { - Ok(multicall_results) => match multicall_results.first() { - Some(first_result) => { - if !multicall_results.iter().all(|x| x.external_success) { - return Err(RestError::BadParameters(format!( - "Call Revert: Result:{} - Reason:{}", - first_result.external_result.clone(), - first_result.multicall_revert_reason.clone() - ))); - } - } - None => { - return Err(RestError::BadParameters( - "No results from multicall".to_string(), - )) + Ok(result) => { + let multicall_results: Vec = result; + if !multicall_results.iter().all(|x| x.external_success) { + let first_reason = multicall_results + .first() + .cloned() + .unwrap() + .multicall_revert_reason; + let first_result = multicall_results.first().cloned().unwrap().external_result; + return Err(RestError::BadParameters(format!( + "Call Revert: {}, {}", + first_result, first_reason + ))); } - }, + } Err(e) => { return match e { ContractError::Revert(reason) => Err(RestError::BadParameters(format!( @@ -133,105 +108,43 @@ pub async fn bid( .bids .write() .await - .entry(permission.clone()) + .entry(bid.permission_key.clone()) .or_default() .push(SimulatedBid { - contract, - calldata: calldata.clone(), - bid: bid_amount, + contract: bid.contract, + calldata: bid.calldata.clone(), + bid: bid.bid_amount, }); - Ok(contract.to_string()) + Ok("OK".to_string()) } -/// Post liquidation opportunities. +/// Bid on a specific permission key for a specific chain. /// -/// Can only be called by permissioned operator of the beacon, with their permission key -// #[axum_macros::debug_handler] -#[utoipa::path(post, path = "/surface", request_body = Vec, responses( - (status = 200, description = "Posted opportunities successfully", body = String), +/// Your bid will be simulated and verified by the server. Depending on the outcome of the auction, a transaction containing the contract call will be sent to the blockchain expecting the bid amount to be paid after the call. +#[utoipa::path(post, path = "/bid", request_body = Bid, responses( + (status = 200, description = "Bid was placed succesfully", body = String), (status = 400, response=RestError) ),)] -pub async fn surface( +pub async fn bid( State(store): State>, - Json(opps): Json>, + Json(bid): Json, ) -> Result { - for opp in &opps { - let chain_store = store - .chains - .get(&opp.chain_id) - .ok_or(RestError::InvalidChainId)?; - - let contract = opp - .contract - .parse::
() - .map_err(|_| RestError::BadParameters("Invalid contract address".to_string()))?; - - chain_store - .opps - .write() - .await - .entry(contract.clone()) - .or_default() - .push(opp.clone()); - } - Ok(opps.len().to_string()) -} - -/// Get liquidation opportunities -/// -// #[axum_macros::debug_handler] -#[utoipa::path(get, path = "/getOpps", - params( - ("chain_id" = String, Query, description = "Chain ID to retrieve opportunities for"), - ("contract" = Option, Query, description = "Contract address to filter by") - ), - responses( - (status = 200, description = "Got opportunities successfully", body = String), - (status = 400, response=RestError) - ) -,)] -pub async fn get_opps( - State(store): State>, - Query(params): Query, -) -> Result>, RestError> { - let chain_id = params.chain_id; - let contract = params.contract; - - let chain_store = store + store .chains - .get(&chain_id) + .get(&bid.chain_id) .ok_or(RestError::InvalidChainId)?; - let mut opps: Vec = Default::default(); - - match contract { - Some(ref x) => { - let key = x - .parse::
() - .map_err(|_| RestError::BadParameters("Invalid contract address".to_string()))?; - - opps = chain_store - .opps - .write() - .await - .entry(key) - .or_default() - .to_vec(); - } - None => { - let opps_dict = chain_store.opps.write().await; - - for key in opps_dict.keys() { - let opps_key = chain_store - .opps - .write() - .await - .entry(key.clone()) - .or_default() - .clone(); - opps.extend(opps_key); - } - } - } - Ok(Json(opps)) + let bid_amount = U256::from_dec_str(bid.bid.as_str()) + .map_err(|_| RestError::BadParameters("Invalid bid amount".to_string()))?; + handle_bid( + store, + ParsedBid { + permission_key: bid.permission_key, + chain_id: bid.chain_id, + contract: bid.contract, + calldata: bid.calldata, + bid_amount, + }, + ) + .await } diff --git a/auction-server/src/auction.rs b/auction-server/src/auction.rs index 44cb0521..efe9a243 100644 --- a/auction-server/src/auction.rs +++ b/auction-server/src/auction.rs @@ -45,7 +45,10 @@ use { }, }; -abigen!(PER, "src/PERMulticall.json"); +abigen!( + PER, + "../per_multicall/out/PERMulticall.sol/PERMulticall.json" +); pub type PERContract = PER>; pub type SignableProvider = TransformerMiddleware, LocalWallet>, LegacyTxTransformer>; @@ -139,10 +142,6 @@ pub async fn run_submission_loop(store: Arc) { chain_id = chain_id, auction_len = permission_bids.len() ); - tracing::info!( - "Chain store: {n} contracts' vaults surfaced", - n = (chain_store.opps.write().await.keys().len()) - ); for (permission_key, bids) in permission_bids.iter() { let mut cloned_bids = bids.clone(); let thread_store = store.clone(); @@ -175,7 +174,7 @@ pub async fn run_submission_loop(store: Arc) { permission_key.clone(), cloned_bids.iter().map(|b| b.contract).collect(), cloned_bids.iter().map(|b| b.calldata.clone()).collect(), - cloned_bids.iter().map(|b| b.bid.into()).collect(), + cloned_bids.iter().map(|b| b.bid).collect(), ) .await; match submission { diff --git a/auction-server/src/liquidation_adapter.rs b/auction-server/src/liquidation_adapter.rs new file mode 100644 index 00000000..0ddaa117 --- /dev/null +++ b/auction-server/src/liquidation_adapter.rs @@ -0,0 +1,99 @@ +use { + crate::{ + api::marketplace::VerifiedOpportunityBid, + state::VerifiedLiquidationOpportunity, + }, + anyhow::{ + anyhow, + Result, + }, + ethers::{ + abi::{ + AbiEncode, + Tokenizable, + }, + contract::abigen, + core::{ + abi, + utils::keccak256, + }, + types::{ + Address, + Bytes, + RecoveryMessage, + Signature, + H256, + U256, + }, + }, +}; + +abigen!( + LiquidationAdapter, + "../per_multicall/out/LiquidationAdapter.sol/LiquidationAdapter.json" +); +impl From<(Address, U256)> for TokenQty { + fn from(token: (Address, U256)) -> Self { + TokenQty { + token: token.0, + amount: token.1, + } + } +} + + +pub fn verify_signature(params: liquidation_adapter::LiquidationCallParams) -> Result<()> { + // this should reflect the verifyCalldata function in the LiquidationAdapter contract + let data = abi::encode(&[ + params.repay_tokens.into_token(), + params.expected_receipt_tokens.into_token(), + params.contract_address.into_token(), + params.data.into_token(), + params.bid.into_token(), + ]); + let nonce = params.valid_until; + let digest = H256(keccak256(abi::encode_packed(&[ + data.into_token(), + nonce.into_token(), + ])?)); + let signature = Signature::try_from(params.signature_liquidator.to_vec().as_slice()) + .map_err(|_x| anyhow!("Error reading signature"))?; + let signer = signature + .recover(RecoveryMessage::Hash(digest)) + .map_err(|x| anyhow!(x.to_string()))?; + let is_matched = signer == params.liquidator; + is_matched.then_some(()).ok_or_else(|| { + anyhow!(format!( + "Invalid signature. Expected: {}, Got: {}", + params.liquidator, signer + )) + }) +} + +pub fn make_liquidator_calldata( + opportunity: VerifiedLiquidationOpportunity, + bid: VerifiedOpportunityBid, +) -> Result { + let params = liquidation_adapter::LiquidationCallParams { + repay_tokens: opportunity + .repay_tokens + .into_iter() + .map(TokenQty::from) + .collect(), + expected_receipt_tokens: opportunity + .receipt_tokens + .into_iter() + .map(TokenQty::from) + .collect(), + liquidator: bid.liquidator, + contract_address: opportunity.contract, + data: opportunity.calldata, + valid_until: bid.valid_until, + bid: bid.bid_amount, + signature_liquidator: bid.signature.to_vec().into(), + }; + match verify_signature(params.clone()) { + Ok(_) => Ok(params.encode().into()), + Err(e) => Err(e), + } +} diff --git a/auction-server/src/main.rs b/auction-server/src/main.rs index de7c4c8a..d7492b4c 100644 --- a/auction-server/src/main.rs +++ b/auction-server/src/main.rs @@ -9,6 +9,7 @@ use { mod api; mod auction; mod config; +mod liquidation_adapter; mod state; #[tokio::main] diff --git a/auction-server/src/state.rs b/auction-server/src/state.rs index 4a5f80ed..f247c81d 100644 --- a/auction-server/src/state.rs +++ b/auction-server/src/state.rs @@ -15,66 +15,12 @@ use { U256, }, }, - serde::{ - Deserialize, - Serialize, - }, std::collections::HashMap, tokio::sync::RwLock, - utoipa::ToSchema, + uuid::Uuid, }; pub type PermissionKey = Bytes; -pub type Contract = Address; - - -#[derive(Serialize, Deserialize, ToSchema, Clone)] -pub struct Opportunity { - /// The chain id to bid on. - #[schema(example = "sepolia")] - pub chain_id: String, - /// The contract address to call. - #[schema(example = "0xcA11bde05977b3631167028862bE2a173976CA11")] - pub contract: String, - /// Calldata for the contract call. - #[schema(example = "0xdeadbeef")] - calldata: String, - /// The permission key to bid on. - #[schema(example = "0xdeadbeef")] - permission_key: String, - /// The ID of the account/vault that is eligible for liquidation - #[schema(example = "4")] - account: String, - /// A list of repay tokens with amount - // #[schema(example = vec![("0x6B175474E89094C44Da98b954EedeAC495271d0F", 1_000_000)])] - repay_tokens: Vec<(String, U256)>, - /// A list of receipt tokens with amount - // #[schema(example = vec![("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 500)])] - receipt_tokens: Vec<(String, U256)>, - /// A list of prices in the format of PriceFeed - // #[schema(example = [("0xdeadbeef", (100, 2, 0, 1_700_000_000), (101, 1, 0, 1_700_000_000), "0xdeadbeef")])] - prices: Vec<( - String, - (U256, U256, U256, U256), - (U256, U256, U256, U256), - String, - )>, -} - -#[derive(Deserialize)] -pub struct GetOppsParams { - pub chain_id: String, - pub contract: Option, -} - -impl Default for GetOppsParams { - fn default() -> Self { - Self { - chain_id: "development".to_string(), - contract: None, - } - } -} #[derive(Clone)] pub struct SimulatedBid { @@ -84,16 +30,31 @@ pub struct SimulatedBid { // simulation_time: } +#[derive(Clone)] +pub struct VerifiedLiquidationOpportunity { + pub id: Uuid, + pub chain_id: ChainId, + pub permission_key: PermissionKey, + pub contract: Address, + pub calldata: Bytes, + pub repay_tokens: Vec<(Address, U256)>, + pub receipt_tokens: Vec<(Address, U256)>, +} pub struct ChainStore { pub provider: Provider, pub network_id: u64, pub config: EthereumConfig, pub bids: RwLock>>, - pub opps: RwLock>>, } +#[derive(Default)] +pub struct LiquidationStore { + pub opportunities: RwLock>, +} + pub struct Store { - pub chains: HashMap, - pub per_operator: LocalWallet, + pub chains: HashMap, + pub liquidation_store: LiquidationStore, + pub per_operator: LocalWallet, } diff --git a/beacon/protocols/beacon_TokenVault.py b/beacon/protocols/beacon_TokenVault.py index 1ba19c86..71bc3d88 100644 --- a/beacon/protocols/beacon_TokenVault.py +++ b/beacon/protocols/beacon_TokenVault.py @@ -81,19 +81,23 @@ async def get_accounts() -> list[LiquidationAccount]: def create_liquidation_opp( - account: LiquidationAccount, - prices: list[PriceFeed]) -> LiquidationOpportunity: + account: LiquidationAccount, prices: list[PriceFeed] +) -> LiquidationOpportunity: # [bytes.fromhex(update['vaa']) for update in prices] ## TODO: uncomment this, to add back price updates price_updates = [] function_signature = web3.Web3.solidity_keccak( - ["string"], ["liquidateWithPriceUpdate(uint256,bytes[])"])[:4].hex() - calldata = function_signature + \ - encode(['uint256', 'bytes[]'], [ - account["account_number"], price_updates]).hex() + ["string"], ["liquidateWithPriceUpdate(uint256,bytes[])"] + )[:4].hex() + calldata = ( + function_signature + + encode( + ["uint256", "bytes[]"], [account["account_number"], price_updates] + ).hex() + ) msg = encode(["uint256"], [account["account_number"]]) - permission = '0x' + \ - encode(['address', 'bytes'], [TOKEN_VAULT_ADDRESS, msg]).hex() + permission = "0x" + encode(["address", "bytes"], + [TOKEN_VAULT_ADDRESS, msg]).hex() opp: LiquidationOpportunity = { "chain_id": "development", @@ -102,18 +106,17 @@ def create_liquidation_opp( "permission_key": permission, "account": str(account["account_number"]), "repay_tokens": [ - ( - account["token_address_debt"], - hex(account["amount_debt"]) - ) + { + "contract": account["token_address_debt"], + "amount": str(account["amount_debt"]), + } ], "receipt_tokens": [ - ( - account["token_address_collateral"], - hex(account["amount_collateral"]) - ) - ], - "prices": price_updates, + { + "contract": account["token_address_collateral"], + "amount": str(account["amount_collateral"]), + } + ] } # TODO: figure out best interface to show partial liquidation possibility? Is this even important? @@ -133,24 +136,29 @@ def create_liquidation_opp( """ -def get_liquidatable(accounts: list[LiquidationAccount], - prices: dict[str, - PriceFeed]) -> (list[LiquidationOpportunity]): +def get_liquidatable( + accounts: list[LiquidationAccount], prices: dict[str, PriceFeed] +) -> list[LiquidationOpportunity]: liquidatable = [] for account in accounts: price_collateral = prices[account["token_id_collateral"]] price_debt = prices[account["token_id_debt"]] - value_collateral = int( - price_collateral['price']['price']) * account["amount_collateral"] - value_debt = int(price_debt['price']['price']) * account["amount_debt"] + value_collateral = ( + int(price_collateral["price"]["price"]) * + account["amount_collateral"] + ) + value_debt = int(price_debt["price"]["price"]) * account["amount_debt"] if value_debt * int(account["min_health_ratio"]) > value_collateral * 10**18: + print("unhealthy vault") + print( + value_debt * int(account["min_health_ratio"]), + value_collateral * 10**18, + ) price_updates = [price_collateral, price_debt] - liquidatable.append( - create_liquidation_opp( - account, price_updates)) + liquidatable.append(create_liquidation_opp(account, price_updates)) return liquidatable diff --git a/beacon/searcher/searcherA.py b/beacon/searcher/searcherA.py index d0538d5b..8070739d 100644 --- a/beacon/searcher/searcherA.py +++ b/beacon/searcher/searcherA.py @@ -17,20 +17,19 @@ def create_liquidation_intent( - opp: LiquidationOpportunity, - sk_liquidator: str, - valid_until: int, - bid: int + opp: LiquidationOpportunity, + sk_liquidator: str, + valid_until: int, + bid: int ) -> LiquidationAdapterIntent: - repay_tokens = [(opp['repay_tokens'][0][0], - int(opp['repay_tokens'][0][1], 16))] - receipt_tokens = [(opp['receipt_tokens'][0][0], - int(opp['receipt_tokens'][0][1], 16))] + repay_tokens = [(opp['repay_tokens'][0]['contract'], + int(opp['repay_tokens'][0]['amount']))] + receipt_tokens = [(opp['receipt_tokens'][0]['contract'], + int(opp['receipt_tokens'][0]['amount']))] account: LocalAccount = Account.from_key(sk_liquidator) liquidator = account.address - liq_calldata = bytes.fromhex( - opp['calldata'][2:]) if opp['calldata'][:2] == "0x" else bytes.fromhex(opp['calldata']) + liq_calldata = bytes.fromhex(opp['calldata'].replace('0x', '')) signature_liquidator = construct_signature_liquidator( repay_tokens, receipt_tokens, opp['contract'], liq_calldata, bid, valid_until, sk_liquidator) @@ -50,7 +49,7 @@ def create_liquidation_intent( tuple(liquidation_adapter_calldata.values())]).hex() intent: LiquidationAdapterIntent = { - "bid": hex(bid), + "bid": str(bid), "calldata": calldata, "chain_id": opp["chain_id"], "contract": LIQUIDATION_ADAPTER_ADDRESS, diff --git a/beacon/surface_opportunities.py b/beacon/surface_opportunities.py index 2dd4905a..0aad9b0d 100644 --- a/beacon/surface_opportunities.py +++ b/beacon/surface_opportunities.py @@ -33,12 +33,13 @@ async def main(): CLIENT = httpx.AsyncClient() - resp = await CLIENT.post( - f"{BEACON_SERVER_ENDPOINT_SURFACE}", - json=liquidatable - ) + for item in liquidatable: + resp = await CLIENT.post( + f"{BEACON_SERVER_ENDPOINT_SURFACE}", + json=item + ) + print(f"Response PER post: {resp.text}") - print(f"Response PER post: {resp.text}") if __name__ == "__main__": asyncio.run(main()) diff --git a/beacon/utils/endpoints.py b/beacon/utils/endpoints.py index b0c71992..bd969fd6 100644 --- a/beacon/utils/endpoints.py +++ b/beacon/utils/endpoints.py @@ -1,5 +1,7 @@ BEACON_SERVER_ENDPOINT = "http://localhost:9000" AUCTION_SERVER_ENDPOINT = f"http://localhost:9000/bid" -BEACON_SERVER_ENDPOINT_SURFACE = f"{BEACON_SERVER_ENDPOINT}/surface" -BEACON_SERVER_ENDPOINT_GETOPPS = f"{BEACON_SERVER_ENDPOINT}/getOpps" +BEACON_SERVER_ENDPOINT_SURFACE = f"{ + BEACON_SERVER_ENDPOINT}/liquidation/submit_opportunity" +BEACON_SERVER_ENDPOINT_GETOPPS = f"{ + BEACON_SERVER_ENDPOINT}/liquidation/fetch_opportunities" diff --git a/beacon/utils/types_liquidation_adapter.py b/beacon/utils/types_liquidation_adapter.py index bdf61728..27cbd3d9 100644 --- a/beacon/utils/types_liquidation_adapter.py +++ b/beacon/utils/types_liquidation_adapter.py @@ -6,6 +6,11 @@ LIQUIDATION_ADAPTER_ADDRESS = "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6" +class TokenQty(TypedDict): + contract: str + amount: str + + class LiquidationOpportunity(TypedDict): chain_id: str # Address of the contract where the liquidation method is called @@ -15,10 +20,9 @@ class LiquidationOpportunity(TypedDict): permission_key: str account: str # A list of tokens that can be used to repay this account's debt. Each entry in the list is a tuple (token address, hex string of repay amount) - repay_tokens: list[(str, str)] + repay_tokens: list[TokenQty] # A list of tokens that ought to be received by the liquidator in exchange for the repay tokens. Each entry in the list is a tuple (token address, hex string of receipt amount) - receipt_tokens: list[(str, str)] - prices: list[PriceFeed] + receipt_tokens: list[TokenQty] LIQUIDATION_ADAPTER_CALLDATA_TYPES = '((address,uint256)[],(address,uint256)[],address,address,bytes,uint256,uint256,bytes)' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..d950de37 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,42 @@ +aiohttp==3.9.1 +aiosignal==1.3.1 +anyio==4.2.0 +attrs==23.2.0 +bitarray==2.9.2 +certifi==2023.11.17 +charset-normalizer==3.3.2 +cytoolz==0.12.2 +eth-account==0.10.0 +eth-hash==0.6.0 +eth-keyfile==0.7.0 +eth-keys==0.5.0 +eth-rlp==1.0.0 +eth-typing==4.0.0 +eth-utils==3.0.0 +eth_abi==5.0.0 +frozenlist==1.4.1 +h11==0.14.0 +hexbytes==0.3.1 +httpcore==1.0.2 +httpx==0.26.0 +idna==3.6 +jsonschema==4.20.0 +jsonschema-specifications==2023.12.1 +lru-dict==1.2.0 +multidict==6.0.4 +parsimonious==0.9.0 +protobuf==4.25.2 +pycryptodome==3.20.0 +pyunormalize==15.1.0 +referencing==0.32.1 +regex==2023.12.25 +requests==2.31.0 +rlp==4.0.0 +rpds-py==0.16.2 +sniffio==1.3.0 +toolz==0.12.0 +typing_extensions==4.9.0 +urllib3==2.1.0 +web3==6.14.0 +websockets==12.0 +yarl==1.9.4