diff --git a/README.md b/README.md index a4b18ba..2081465 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,37 @@ The audit is provided as development matures. The latest audit report can be fou - Create staking proxy instance on [Launch](https://launch.olas.network/); - Vote for staking contracts on [Govern](https://govern.olas.network/). +## Contribute Architecture +```mermaid +--- +title: Contribute Architecture +--- +flowchart LR + DAO -- changeManager --> ContributorsProxy + DAO -- setContributeServiceStatuses --> ContributorsProxy + DAO -- changeOwner --> ContributorsProxy + User -- createAndStake --> ContributeManager + User -- stake --> ContributeManager + User -- unstake --> ContributeManager + User -- claim --> ContributeManager + ContributeService -- checkpoint --> StakingInstance -- getNonces --> ContributeActivityChecker + User -- approve --> OLAS + ContributeManager -- create --> StakingRegistryL2 + StakingRegistryL2 -- mint --> ERC721 + ContributeManager -- stake --> StakingInstance + ContributeManager -- unstake --> StakingInstance + ContributeManager -- claim --> StakingInstance + subgraph Service registry contracts + StakingInstance + StakingRegistryL2 + end + subgraph Contribute contracts + ContributeService -- increaseActivity --> ContributorsProxy + ContributorsProxy -- delegatecall --> Contributors + ContributeManager -- setServiceInfoForId --> ContributorsProxy + ContributeActivityChecker -- mapMutisigActivities --> ContributorsProxy + end +``` ## Acknowledgements The staking programmes contracts were inspired and based on the following sources: diff --git a/abis/0.8.28/ContributeActivityChecker.json b/abis/0.8.28/ContributeActivityChecker.json new file mode 100644 index 0000000..759492c --- /dev/null +++ b/abis/0.8.28/ContributeActivityChecker.json @@ -0,0 +1,111 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ContributeActivityChecker", + "sourceName": "contracts/contribute/ContributeActivityChecker.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_contributorsProxy", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_livenessRatio", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroValue", + "type": "error" + }, + { + "inputs": [], + "name": "contributorsProxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "multisig", + "type": "address" + } + ], + "name": "getMultisigNonces", + "outputs": [ + { + "internalType": "uint256[]", + "name": "nonces", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "curNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "lastNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "isRatioPass", + "outputs": [ + { + "internalType": "bool", + "name": "ratioPass", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "livenessRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60c060405234801561000f575f5ffd5b506040516106a53803806106a583398101604081905261002e9161008b565b6001600160a01b0382166100555760405163d92e233d60e01b815260040160405180910390fd5b805f0361007557604051637c946ed760e01b815260040160405180910390fd5b6001600160a01b0390911660a0526080526100c2565b5f5f6040838503121561009c575f5ffd5b82516001600160a01b03811681146100b2575f5ffd5b6020939093015192949293505050565b60805160a0516105b66100ef5f395f818160b0015261024f01525f8181607b01526101bb01526105b65ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb14610076578063cf449c8c146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046103c4565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610432565b6101e7565b60405161006d9190610465565b5f5f821180156101585750825f81518110610134576101346104a7565b6020026020010151845f8151811061014e5761014e6104a7565b6020026020010151115b156101e0575f82845f81518110610171576101716104a7565b6020026020010151865f8151811061018b5761018b6104a7565b602002602001015161019d9190610501565b6101af90670de0b6b3a764000061051a565b6101b99190610531565b7f000000000000000000000000000000000000000000000000000000000000000011159150505b9392505050565b60408051600180825281830190925260609160208083019080368337019050506040517f4990408f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301529192507f000000000000000000000000000000000000000000000000000000000000000090911690634990408f90602401602060405180830381865afa158015610296573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ba9190610569565b815f815181106102cc576102cc6104a7565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f830112610319575f5ffd5b813567ffffffffffffffff811115610333576103336102dd565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff8211171561037e5761037e6102dd565b60405291825260208185018101929081018684111561039b575f5ffd5b6020860192505b838310156103ba5782358152602092830192016103a2565b5095945050505050565b5f5f5f606084860312156103d6575f5ffd5b833567ffffffffffffffff8111156103ec575f5ffd5b6103f88682870161030a565b935050602084013567ffffffffffffffff811115610414575f5ffd5b6104208682870161030a565b93969395505050506040919091013590565b5f60208284031215610442575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff811681146101e0575f5ffd5b602080825282518282018190525f918401906040840190835b8181101561049c57835183526020938401939092019160010161047e565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610514576105146104d4565b92915050565b8082028115828204841417610514576105146104d4565b5f82610564577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f60208284031215610579575f5ffd5b505191905056fea2646970667358221220c7556e84f3cf30fb114d0400ba7bbbdec815e69ed36086ee40e0e334d4a7720064736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb14610076578063cf449c8c146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046103c4565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610432565b6101e7565b60405161006d9190610465565b5f5f821180156101585750825f81518110610134576101346104a7565b6020026020010151845f8151811061014e5761014e6104a7565b6020026020010151115b156101e0575f82845f81518110610171576101716104a7565b6020026020010151865f8151811061018b5761018b6104a7565b602002602001015161019d9190610501565b6101af90670de0b6b3a764000061051a565b6101b99190610531565b7f000000000000000000000000000000000000000000000000000000000000000011159150505b9392505050565b60408051600180825281830190925260609160208083019080368337019050506040517f4990408f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301529192507f000000000000000000000000000000000000000000000000000000000000000090911690634990408f90602401602060405180830381865afa158015610296573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ba9190610569565b815f815181106102cc576102cc6104a7565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f830112610319575f5ffd5b813567ffffffffffffffff811115610333576103336102dd565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff8211171561037e5761037e6102dd565b60405291825260208185018101929081018684111561039b575f5ffd5b6020860192505b838310156103ba5782358152602092830192016103a2565b5095945050505050565b5f5f5f606084860312156103d6575f5ffd5b833567ffffffffffffffff8111156103ec575f5ffd5b6103f88682870161030a565b935050602084013567ffffffffffffffff811115610414575f5ffd5b6104208682870161030a565b93969395505050506040919091013590565b5f60208284031215610442575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff811681146101e0575f5ffd5b602080825282518282018190525f918401906040840190835b8181101561049c57835183526020938401939092019160010161047e565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610514576105146104d4565b92915050565b8082028115828204841417610514576105146104d4565b5f82610564577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f60208284031215610579575f5ffd5b505191905056fea2646970667358221220c7556e84f3cf30fb114d0400ba7bbbdec815e69ed36086ee40e0e334d4a7720064736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/ContributeManager.json b/abis/0.8.28/ContributeManager.json new file mode 100644 index 0000000..383293d --- /dev/null +++ b/abis/0.8.28/ContributeManager.json @@ -0,0 +1,535 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ContributeManager", + "sourceName": "contracts/contribute/ContributeManager.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_contributorsProxy", + "type": "address" + }, + { + "internalType": "address", + "name": "_serviceManager", + "type": "address" + }, + { + "internalType": "address", + "name": "_olas", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingFactory", + "type": "address" + }, + { + "internalType": "address", + "name": "_safeMultisig", + "type": "address" + }, + { + "internalType": "address", + "name": "_fallbackHandler", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_agentId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_configHash", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ReentrancyGuard", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "multisig", + "type": "address" + } + ], + "name": "ServiceAlreadyStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + } + ], + "name": "ServiceNotDefined", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "multisig", + "type": "address" + } + ], + "name": "WrongServiceSetup", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "WrongStakingInstance", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroValue", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "multisig", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "multisig", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "CreatedAndStaked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "multisig", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "multisig", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "Unstaked", + "type": "event" + }, + { + "inputs": [], + "name": "NUM_AGENT_INSTANCES", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "THRESHOLD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "agentId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claim", + "outputs": [ + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "configHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contributorsProxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "createAndStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "fallbackHandler", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "olas", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "safeMultisig", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "serviceManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "serviceRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "serviceRegistryTokenUtility", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakingFactory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unstake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x6101c060405260018055348015610014575f5ffd5b506040516128413803806128418339810160408190526100339161022c565b6001600160a01b038816158061005057506001600160a01b038716155b8061006257506001600160a01b038616155b8061007457506001600160a01b038516155b8061008657506001600160a01b038416155b8061009857506001600160a01b038316155b156100b65760405163d92e233d60e01b815260040160405180910390fd5b8115806100c1575080155b156100df57604051637c946ed760e01b815260040160405180910390fd5b608082905260a08190526001600160a01b0380891660c05287811660e08190528782166101005286821661016052858216610180529084166101a052604080516365e7929560e11b8152905163cbcf252a9160048082019260209290919082900301815f875af1158015610155573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061017991906102af565b6001600160a01b0316610120816001600160a01b03168152505060e0516001600160a01b031663287140516040518163ffffffff1660e01b81526004016020604051808303815f875af11580156101d2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101f691906102af565b6001600160a01b031661014052506102cf9650505050505050565b80516001600160a01b0381168114610227575f5ffd5b919050565b5f5f5f5f5f5f5f5f610100898b031215610244575f5ffd5b61024d89610211565b975061025b60208a01610211565b965061026960408a01610211565b955061027760608a01610211565b945061028560808a01610211565b935061029360a08a01610211565b60c08a015160e0909a0151989b979a5095989497939692505050565b5f602082840312156102bf575f5ffd5b6102c882610211565b9392505050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a05161245b6103e65f395f81816104050152611a8e01525f818161036c0152611bb901525f81816102220152610bb401525f81816101ef015261104f01525f81816103060152818161062f0152818161130e015281816115a30152611d4401525f818161011d01528181610cdd01528181610f920152818161107e01526110ee01525f818161026b015281816117f4015281816118dd015281816119890152611b8a01525f81816103390152818161049e015281816106e20152818161082801528181610aa1015281816111fc0152611ca301525f818161039f015261182701525f81816103d2015261172c015261245b5ff3fe608060405260043610610108575f3560e01c80637628a37d116100a1578063d67f743d11610071578063e1f1176d11610057578063e1f1176d1461038e578063e84f43b7146103c1578063eed2f252146103f4575f5ffd5b8063d67f743d146102e1578063df1f77431461035b575f5ffd5b80637628a37d146102c2578063785ffb37146102e1578063cbcf252a146102f5578063cf449c8c14610328575f5ffd5b80632def6620116100dc5780632def6620146102445780633998fdd31461025a5780634e71d92d1461028d5780636000cadf146102af575f5ffd5b806231d1151461010c578063150b7a021461016957806328714051146101de5780632913476814610211575b5f5ffd5b348015610117575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b348015610174575f5ffd5b506101ad610183366004611e42565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610160565b3480156101e9575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561021c575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561024f575f5ffd5b50610258610427565b005b348015610265575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610298575f5ffd5b506102a16107b0565b604051908152602001610160565b6102586102bd366004611edb565b6109df565b3480156102cd575f5ffd5b506102586102dc366004611f09565b611189565b3480156102ec575f5ffd5b506102a1600181565b348015610300575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610333575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610366575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610399575f5ffd5b506102a17f000000000000000000000000000000000000000000000000000000000000000081565b3480156103cc575f5ffd5b506102a17f000000000000000000000000000000000000000000000000000000000000000081565b3480156103ff575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b600180541115610463576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001556040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f908190819081907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638b494a3990602401608060405180830381865afa1580156104f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051c9190611f4f565b9350935093509350825f03610565576040517fe2e8d5b5000000000000000000000000000000000000000000000000000000008152600481018590526024015b60405180910390fd5b6040517f2e17de780000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff821690632e17de78906024016020604051808303815f875af11580156105cf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105f39190611f98565b506040517f23b872dd000000000000000000000000000000000000000000000000000000008152306004820152336024820152604481018490527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064015f604051808303815f87803b158015610685575f5ffd5b505af1158015610697573d5f5f3e3d5ffd5b50506040517f5078690b0000000000000000000000000000000000000000000000000000000081523360048201525f60248201819052604482018190526064820181905260848201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169250635078690b915060a4015f604051808303815f87803b15801561073a575f5ffd5b505af115801561074c573d5f5f3e3d5ffd5b50506040805186815273ffffffffffffffffffffffffffffffffffffffff85811660208301528616935033925087917f102557fcd0cecdd74a9640a69bd331464531d49cf1584a864e6a8bf139b37e00910160405180910390a45050600180555050565b5f6001805411156107ed576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001556040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f908190819081907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638b494a3990602401608060405180830381865afa158015610882573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a69190611f4f565b9350935093509350825f036108ea576040517fe2e8d5b50000000000000000000000000000000000000000000000000000000081526004810185905260240161055c565b6040517f379607f50000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff82169063379607f5906024016020604051808303815f875af1158015610954573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109789190611f98565b6040805185815273ffffffffffffffffffffffffffffffffffffffff848116602083015292975091841691339187917fe14b5e030aa5b458c65a405e8cf88687ddc2dc52b7253577ec01edad49236bd7910160405180910390a45050600180555090919050565b600180541115610a1b576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001555f829003610a5a576040517f7c946ed700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f90819073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690638b494a3990602401608060405180830381865afa158015610ae6573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b0a9190611f4f565b509093509150508115610b6f576040517f78612641000000000000000000000000000000000000000000000000000000008152600481018590526024810183905273ffffffffffffffffffffffffffffffffffffffff8216604482015260640161055c565b6040517f479e372e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063479e372e90602401602060405180830381865afa158015610bf9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c1d9190611faf565b610c6b576040517f080ae8fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161055c565b5f8373ffffffffffffffffffffffffffffffffffffffff166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cb5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cd99190611fd5565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610d78576040517f080ae8fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161055c565b5f8473ffffffffffffffffffffffffffffffffffffffff1663e77cdcc96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de69190611f98565b90505f8573ffffffffffffffffffffffffffffffffffffffff16635829c5ec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e32573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e569190611f98565b90505f8673ffffffffffffffffffffffffffffffffffffffff166342cde4e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ec69190611f98565b90505f82118015610ed8575060018214155b80610eee57505f81118015610eee575060018114155b15610f3d576040517f080ae8fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816600482015260240161055c565b5f83610f4a60018061201d565b610f549190612036565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018290529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303815f875af1158015610fed573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110119190611faf565b506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303815f875af11580156110c4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110e89190611faf565b506111137f00000000000000000000000000000000000000000000000000000000000000008561167e565b90975095506111248988888b611c42565b6040805188815273ffffffffffffffffffffffffffffffffffffffff8a8116602083015288169133918c917ff1c69b12e526d2d4145f47d216fa261c6f468d177601c9081a0bcd86a4fa744f910160405180910390a450506001805550505050505050565b6001805411156111c5576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001556040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f9081907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638b494a3990602401608060405180830381865afa158015611256573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061127a9190611f4f565b5090935091505081156112df576040517f78612641000000000000000000000000000000000000000000000000000000008152600481018690526024810183905273ffffffffffffffffffffffffffffffffffffffff8216604482015260640161055c565b6040517f4236aff8000000000000000000000000000000000000000000000000000000008152600481018590527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690634236aff89060240160e060405180830381865afa158015611368573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061138c9190612060565b5050604080517f5829c5ec00000000000000000000000000000000000000000000000000000000815290519496505f955073ffffffffffffffffffffffffffffffffffffffff891694635829c5ec9450600480830194506020935090918290030181865afa158015611400573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114249190611f98565b90505f8273ffffffffffffffffffffffffffffffffffffffff1663a0e67e2b6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561146f573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526114b49190810190612126565b905081815114158061150b57503373ffffffffffffffffffffffffffffffffffffffff16815f815181106114ea576114ea61220f565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15611568576040517f9e5b6c93000000000000000000000000000000000000000000000000000000008152600481018890526024810187905273ffffffffffffffffffffffffffffffffffffffff8416604482015260640161055c565b6040517f42842e0e000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906342842e0e906064015f604051808303815f87803b1580156115f9575f5ffd5b505af115801561160b573d5f5f3e3d5ffd5b5050505061161b87878588611c42565b6040805187815273ffffffffffffffffffffffffffffffffffffffff878116602083015285169133918a917f2214e1dc25e1fb063be46520c4b1e3bba2c25de96b7de8bdd2b1e35f871200e5910160405180910390a45050600180555050505050565b6040805160018082528183019092525f9182918291816020015b604080518082019091525f80825260208201528152602001906001900390816116985790505090506040518060400160405280600163ffffffff168152602001856bffffffffffffffffffffffff16815250815f815181106116fc576116fc61220f565b60209081029190910101526040805160018082528183019092525f918160200160208202803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000815f8151811061175d5761175d61220f565b63ffffffff92909216602092830291909101909101526040805160018082528183019092525f9181602001602082028036833701905050905033815f815181106117a9576117a961220f565b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526040517fe42cdd7c0000000000000000000000000000000000000000000000000000000081527f00000000000000000000000000000000000000000000000000000000000000009091169063e42cdd7c906118569030908b907f00000000000000000000000000000000000000000000000000000000000000009088908a9060019060040161227c565b6020604051808303815f875af1158015611872573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118969190611f98565b6040517f4d5a58270000000000000000000000000000000000000000000000000000000081526004810182905290955073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690634d5a58279060019060240160206040518083038185885af1158015611926573d5f5f3e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061194b9190611faf565b506040517fd03ca40a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063d03ca40a906001906119c590899086908890600401612343565b60206040518083038185885af11580156119e1573d5f5f3e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190611a069190611faf565b505f8054604080514260208201527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b169181019190915260548101829052909190607401604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529082905280516020918201205f9183018290527f000000000000000000000000000000000000000000000000000000000000000060601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016603484015260488301829052605c830182905260708301829052609083018190527f307800000000000000000000000000000000000000000000000000000000000060b084015292509060b201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f0d0d57a8000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690630d0d57a890611be3908b907f00000000000000000000000000000000000000000000000000000000000000009086906004016123ae565b6020604051808303815f875af1158015611bff573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c239190611fd5565b9650611c3083600161201d565b5f819055505050505050509250929050565b6040517f5078690b000000000000000000000000000000000000000000000000000000008152336004820152602481018590526044810184905273ffffffffffffffffffffffffffffffffffffffff838116606483015282811660848301527f00000000000000000000000000000000000000000000000000000000000000001690635078690b9060a4015f604051808303815f87803b158015611ce4575f5ffd5b505af1158015611cf6573d5f5f3e3d5ffd5b50506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018790527f000000000000000000000000000000000000000000000000000000000000000016925063095ea7b391506044015f604051808303815f87803b158015611d87575f5ffd5b505af1158015611d99573d5f5f3e3d5ffd5b50506040517fa694fc3a0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8416925063a694fc3a91506024015f604051808303815f87803b158015611e02575f5ffd5b505af1158015611e14573d5f5f3e3d5ffd5b5050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81168114611e3f575f5ffd5b50565b5f5f5f5f5f60808688031215611e56575f5ffd5b8535611e6181611e1e565b94506020860135611e7181611e1e565b935060408601359250606086013567ffffffffffffffff811115611e93575f5ffd5b8601601f81018813611ea3575f5ffd5b803567ffffffffffffffff811115611eb9575f5ffd5b886020828401011115611eca575f5ffd5b959894975092955050506020019190565b5f5f60408385031215611eec575f5ffd5b823591506020830135611efe81611e1e565b809150509250929050565b5f5f5f60608486031215611f1b575f5ffd5b83359250602084013591506040840135611f3481611e1e565b809150509250925092565b8051611f4a81611e1e565b919050565b5f5f5f5f60808587031215611f62575f5ffd5b8451602086015160408701519195509350611f7c81611e1e565b6060860151909250611f8d81611e1e565b939692955090935050565b5f60208284031215611fa8575f5ffd5b5051919050565b5f60208284031215611fbf575f5ffd5b81518015158114611fce575f5ffd5b9392505050565b5f60208284031215611fe5575f5ffd5b8151611fce81611e1e565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082018082111561203057612030611ff0565b92915050565b808202811582820484141761203057612030611ff0565b805163ffffffff81168114611f4a575f5ffd5b5f5f5f5f5f5f5f60e0888a031215612076575f5ffd5b87516bffffffffffffffffffffffff81168114612091575f5ffd5b60208901519097506120a281611e1e565b604089015190965094506120b86060890161204d565b93506120c66080890161204d565b92506120d460a0890161204d565b915060c088015160ff811681146120e9575f5ffd5b8091505092959891949750929550565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f60208284031215612136575f5ffd5b815167ffffffffffffffff81111561214c575f5ffd5b8201601f8101841361215c575f5ffd5b805167ffffffffffffffff811115612176576121766120f9565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff821117156121c1576121c16120f9565b6040529182526020818401810192908101878411156121de575f5ffd5b6020850194505b83851015612204576121f685611f3f565b8152602094850194016121e5565b509695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151808452602084019350602083015f5b8281101561227257815163ffffffff1686526020958601959091019060010161224e565b5093949350505050565b73ffffffffffffffffffffffffffffffffffffffff8716815273ffffffffffffffffffffffffffffffffffffffff8616602082015284604082015260c060608201525f6122cc60c083018661223c565b8281036080840152845180825260208087019201905f5b81811015612321578351805163ffffffff1684526020908101516bffffffffffffffffffffffff1681850152909301926040909201916001016122e3565b505063ffffffff851660a085015291506123389050565b979650505050505050565b5f60608201858352606060208401528085518083526080850191506020870192505f5b8181101561239a57835173ffffffffffffffffffffffffffffffffffffffff16835260209384019390920191600101612366565b50508381036040850152612338818661223c565b83815273ffffffffffffffffffffffffffffffffffffffff83166020820152606060408201525f82518060608401528060208501608085015e5f6080828501015260807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505094935050505056fea26469706673582212207ff48b8af930ebb6ad0d321727d12caf7894c47586ab97ef7759af2803601a7664736f6c634300081c0033", + "deployedBytecode": "0x608060405260043610610108575f3560e01c80637628a37d116100a1578063d67f743d11610071578063e1f1176d11610057578063e1f1176d1461038e578063e84f43b7146103c1578063eed2f252146103f4575f5ffd5b8063d67f743d146102e1578063df1f77431461035b575f5ffd5b80637628a37d146102c2578063785ffb37146102e1578063cbcf252a146102f5578063cf449c8c14610328575f5ffd5b80632def6620116100dc5780632def6620146102445780633998fdd31461025a5780634e71d92d1461028d5780636000cadf146102af575f5ffd5b806231d1151461010c578063150b7a021461016957806328714051146101de5780632913476814610211575b5f5ffd5b348015610117575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b348015610174575f5ffd5b506101ad610183366004611e42565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610160565b3480156101e9575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561021c575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561024f575f5ffd5b50610258610427565b005b348015610265575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610298575f5ffd5b506102a16107b0565b604051908152602001610160565b6102586102bd366004611edb565b6109df565b3480156102cd575f5ffd5b506102586102dc366004611f09565b611189565b3480156102ec575f5ffd5b506102a1600181565b348015610300575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610333575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610366575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b348015610399575f5ffd5b506102a17f000000000000000000000000000000000000000000000000000000000000000081565b3480156103cc575f5ffd5b506102a17f000000000000000000000000000000000000000000000000000000000000000081565b3480156103ff575f5ffd5b5061013f7f000000000000000000000000000000000000000000000000000000000000000081565b600180541115610463576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001556040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f908190819081907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638b494a3990602401608060405180830381865afa1580156104f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051c9190611f4f565b9350935093509350825f03610565576040517fe2e8d5b5000000000000000000000000000000000000000000000000000000008152600481018590526024015b60405180910390fd5b6040517f2e17de780000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff821690632e17de78906024016020604051808303815f875af11580156105cf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105f39190611f98565b506040517f23b872dd000000000000000000000000000000000000000000000000000000008152306004820152336024820152604481018490527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064015f604051808303815f87803b158015610685575f5ffd5b505af1158015610697573d5f5f3e3d5ffd5b50506040517f5078690b0000000000000000000000000000000000000000000000000000000081523360048201525f60248201819052604482018190526064820181905260848201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169250635078690b915060a4015f604051808303815f87803b15801561073a575f5ffd5b505af115801561074c573d5f5f3e3d5ffd5b50506040805186815273ffffffffffffffffffffffffffffffffffffffff85811660208301528616935033925087917f102557fcd0cecdd74a9640a69bd331464531d49cf1584a864e6a8bf139b37e00910160405180910390a45050600180555050565b5f6001805411156107ed576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001556040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f908190819081907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638b494a3990602401608060405180830381865afa158015610882573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a69190611f4f565b9350935093509350825f036108ea576040517fe2e8d5b50000000000000000000000000000000000000000000000000000000081526004810185905260240161055c565b6040517f379607f50000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff82169063379607f5906024016020604051808303815f875af1158015610954573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109789190611f98565b6040805185815273ffffffffffffffffffffffffffffffffffffffff848116602083015292975091841691339187917fe14b5e030aa5b458c65a405e8cf88687ddc2dc52b7253577ec01edad49236bd7910160405180910390a45050600180555090919050565b600180541115610a1b576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001555f829003610a5a576040517f7c946ed700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f90819073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690638b494a3990602401608060405180830381865afa158015610ae6573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b0a9190611f4f565b509093509150508115610b6f576040517f78612641000000000000000000000000000000000000000000000000000000008152600481018590526024810183905273ffffffffffffffffffffffffffffffffffffffff8216604482015260640161055c565b6040517f479e372e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063479e372e90602401602060405180830381865afa158015610bf9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c1d9190611faf565b610c6b576040517f080ae8fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161055c565b5f8373ffffffffffffffffffffffffffffffffffffffff166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cb5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cd99190611fd5565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610d78576040517f080ae8fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161055c565b5f8473ffffffffffffffffffffffffffffffffffffffff1663e77cdcc96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de69190611f98565b90505f8573ffffffffffffffffffffffffffffffffffffffff16635829c5ec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e32573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e569190611f98565b90505f8673ffffffffffffffffffffffffffffffffffffffff166342cde4e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ec69190611f98565b90505f82118015610ed8575060018214155b80610eee57505f81118015610eee575060018114155b15610f3d576040517f080ae8fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816600482015260240161055c565b5f83610f4a60018061201d565b610f549190612036565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018290529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303815f875af1158015610fed573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110119190611faf565b506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303815f875af11580156110c4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110e89190611faf565b506111137f00000000000000000000000000000000000000000000000000000000000000008561167e565b90975095506111248988888b611c42565b6040805188815273ffffffffffffffffffffffffffffffffffffffff8a8116602083015288169133918c917ff1c69b12e526d2d4145f47d216fa261c6f468d177601c9081a0bcd86a4fa744f910160405180910390a450506001805550505050505050565b6001805411156111c5576040517f8beb9d1600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001556040517f8b494a390000000000000000000000000000000000000000000000000000000081523360048201525f9081907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638b494a3990602401608060405180830381865afa158015611256573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061127a9190611f4f565b5090935091505081156112df576040517f78612641000000000000000000000000000000000000000000000000000000008152600481018690526024810183905273ffffffffffffffffffffffffffffffffffffffff8216604482015260640161055c565b6040517f4236aff8000000000000000000000000000000000000000000000000000000008152600481018590527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690634236aff89060240160e060405180830381865afa158015611368573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061138c9190612060565b5050604080517f5829c5ec00000000000000000000000000000000000000000000000000000000815290519496505f955073ffffffffffffffffffffffffffffffffffffffff891694635829c5ec9450600480830194506020935090918290030181865afa158015611400573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114249190611f98565b90505f8273ffffffffffffffffffffffffffffffffffffffff1663a0e67e2b6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561146f573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526114b49190810190612126565b905081815114158061150b57503373ffffffffffffffffffffffffffffffffffffffff16815f815181106114ea576114ea61220f565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15611568576040517f9e5b6c93000000000000000000000000000000000000000000000000000000008152600481018890526024810187905273ffffffffffffffffffffffffffffffffffffffff8416604482015260640161055c565b6040517f42842e0e000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906342842e0e906064015f604051808303815f87803b1580156115f9575f5ffd5b505af115801561160b573d5f5f3e3d5ffd5b5050505061161b87878588611c42565b6040805187815273ffffffffffffffffffffffffffffffffffffffff878116602083015285169133918a917f2214e1dc25e1fb063be46520c4b1e3bba2c25de96b7de8bdd2b1e35f871200e5910160405180910390a45050600180555050505050565b6040805160018082528183019092525f9182918291816020015b604080518082019091525f80825260208201528152602001906001900390816116985790505090506040518060400160405280600163ffffffff168152602001856bffffffffffffffffffffffff16815250815f815181106116fc576116fc61220f565b60209081029190910101526040805160018082528183019092525f918160200160208202803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000815f8151811061175d5761175d61220f565b63ffffffff92909216602092830291909101909101526040805160018082528183019092525f9181602001602082028036833701905050905033815f815181106117a9576117a961220f565b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526040517fe42cdd7c0000000000000000000000000000000000000000000000000000000081527f00000000000000000000000000000000000000000000000000000000000000009091169063e42cdd7c906118569030908b907f00000000000000000000000000000000000000000000000000000000000000009088908a9060019060040161227c565b6020604051808303815f875af1158015611872573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118969190611f98565b6040517f4d5a58270000000000000000000000000000000000000000000000000000000081526004810182905290955073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690634d5a58279060019060240160206040518083038185885af1158015611926573d5f5f3e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061194b9190611faf565b506040517fd03ca40a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063d03ca40a906001906119c590899086908890600401612343565b60206040518083038185885af11580156119e1573d5f5f3e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190611a069190611faf565b505f8054604080514260208201527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b169181019190915260548101829052909190607401604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529082905280516020918201205f9183018290527f000000000000000000000000000000000000000000000000000000000000000060601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016603484015260488301829052605c830182905260708301829052609083018190527f307800000000000000000000000000000000000000000000000000000000000060b084015292509060b201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f0d0d57a8000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690630d0d57a890611be3908b907f00000000000000000000000000000000000000000000000000000000000000009086906004016123ae565b6020604051808303815f875af1158015611bff573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c239190611fd5565b9650611c3083600161201d565b5f819055505050505050509250929050565b6040517f5078690b000000000000000000000000000000000000000000000000000000008152336004820152602481018590526044810184905273ffffffffffffffffffffffffffffffffffffffff838116606483015282811660848301527f00000000000000000000000000000000000000000000000000000000000000001690635078690b9060a4015f604051808303815f87803b158015611ce4575f5ffd5b505af1158015611cf6573d5f5f3e3d5ffd5b50506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018790527f000000000000000000000000000000000000000000000000000000000000000016925063095ea7b391506044015f604051808303815f87803b158015611d87575f5ffd5b505af1158015611d99573d5f5f3e3d5ffd5b50506040517fa694fc3a0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8416925063a694fc3a91506024015f604051808303815f87803b158015611e02575f5ffd5b505af1158015611e14573d5f5f3e3d5ffd5b5050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81168114611e3f575f5ffd5b50565b5f5f5f5f5f60808688031215611e56575f5ffd5b8535611e6181611e1e565b94506020860135611e7181611e1e565b935060408601359250606086013567ffffffffffffffff811115611e93575f5ffd5b8601601f81018813611ea3575f5ffd5b803567ffffffffffffffff811115611eb9575f5ffd5b886020828401011115611eca575f5ffd5b959894975092955050506020019190565b5f5f60408385031215611eec575f5ffd5b823591506020830135611efe81611e1e565b809150509250929050565b5f5f5f60608486031215611f1b575f5ffd5b83359250602084013591506040840135611f3481611e1e565b809150509250925092565b8051611f4a81611e1e565b919050565b5f5f5f5f60808587031215611f62575f5ffd5b8451602086015160408701519195509350611f7c81611e1e565b6060860151909250611f8d81611e1e565b939692955090935050565b5f60208284031215611fa8575f5ffd5b5051919050565b5f60208284031215611fbf575f5ffd5b81518015158114611fce575f5ffd5b9392505050565b5f60208284031215611fe5575f5ffd5b8151611fce81611e1e565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082018082111561203057612030611ff0565b92915050565b808202811582820484141761203057612030611ff0565b805163ffffffff81168114611f4a575f5ffd5b5f5f5f5f5f5f5f60e0888a031215612076575f5ffd5b87516bffffffffffffffffffffffff81168114612091575f5ffd5b60208901519097506120a281611e1e565b604089015190965094506120b86060890161204d565b93506120c66080890161204d565b92506120d460a0890161204d565b915060c088015160ff811681146120e9575f5ffd5b8091505092959891949750929550565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f60208284031215612136575f5ffd5b815167ffffffffffffffff81111561214c575f5ffd5b8201601f8101841361215c575f5ffd5b805167ffffffffffffffff811115612176576121766120f9565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff821117156121c1576121c16120f9565b6040529182526020818401810192908101878411156121de575f5ffd5b6020850194505b83851015612204576121f685611f3f565b8152602094850194016121e5565b509695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151808452602084019350602083015f5b8281101561227257815163ffffffff1686526020958601959091019060010161224e565b5093949350505050565b73ffffffffffffffffffffffffffffffffffffffff8716815273ffffffffffffffffffffffffffffffffffffffff8616602082015284604082015260c060608201525f6122cc60c083018661223c565b8281036080840152845180825260208087019201905f5b81811015612321578351805163ffffffff1684526020908101516bffffffffffffffffffffffff1681850152909301926040909201916001016122e3565b505063ffffffff851660a085015291506123389050565b979650505050505050565b5f60608201858352606060208401528085518083526080850191506020870192505f5b8181101561239a57835173ffffffffffffffffffffffffffffffffffffffff16835260209384019390920191600101612366565b50508381036040850152612338818661223c565b83815273ffffffffffffffffffffffffffffffffffffffff83166020820152606060408201525f82518060608401528060208501608085015e5f6080828501015260807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505094935050505056fea26469706673582212207ff48b8af930ebb6ad0d321727d12caf7894c47586ab97ef7759af2803601a7664736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/Contributors.json b/abis/0.8.28/Contributors.json new file mode 100644 index 0000000..3230ddf --- /dev/null +++ b/abis/0.8.28/Contributors.json @@ -0,0 +1,439 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "Contributors", + "sourceName": "contracts/contribute/Contributors.sol", + "abi": [ + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "ManagerOnly", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnerOnly", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "UnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "numValues1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "numValues2", + "type": "uint256" + } + ], + "name": "WrongArrayLength", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "ImplementationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "manager", + "type": "address" + } + ], + "name": "ManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "senderAgent", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "multisigs", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "activityChanges", + "type": "uint256[]" + } + ], + "name": "MultisigActivityChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address[]", + "name": "contributeServices", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "bool[]", + "name": "statuses", + "type": "bool[]" + } + ], + "name": "SetContributeServiceStatuses", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "multisig", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "SetServiceInfoForId", + "type": "event" + }, + { + "inputs": [], + "name": "CONTRIBUTORS_PROXY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "changeImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newManager", + "type": "address" + } + ], + "name": "changeManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "changeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "multisigs", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "activityChanges", + "type": "uint256[]" + } + ], + "name": "increaseActivity", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mapAccountServiceInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "multisig", + "type": "address" + }, + { + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mapContributeAgents", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mapMutisigActivities", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "contributeServices", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "statuses", + "type": "bool[]" + } + ], + "name": "setContributeServiceStatuses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "socialId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "serviceId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "multisig", + "type": "address" + }, + { + "internalType": "address", + "name": "stakingInstance", + "type": "address" + } + ], + "name": "setServiceInfoForId", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x6080604052348015600e575f5ffd5b506111088061001c5f395ff3fe608060405234801561000f575f5ffd5b50600436106100e5575f3560e01c80636859d1d8116100885780638da5cb5b116100635780638da5cb5b1461029a578063a3fbbaae146102b9578063a6f9dae1146102cc578063ffa1ad74146102df575f5ffd5b80636859d1d8146101d55780638129fc1c146102075780638b494a391461020f575f5ffd5b806341c952a4116100c357806341c952a41461014b578063481c6a751461015e5780634990408f146101a35780635078690b146101c2575f5ffd5b80630223b1dc146100e957806317a68dd8146100fe5780633db25aab14610111575b5f5ffd5b6100fc6100f7366004610d30565b610328565b005b6100fc61010c366004610dfb565b61054c565b6101387f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c781565b6040519081526020015b60405180910390f35b6100fc610159366004610e1b565b610671565b60015461017e9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610142565b6101386101b1366004610dfb565b60036020525f908152604090205481565b6100fc6101d0366004610ecb565b6107fa565b6101f76101e3366004610dfb565b60046020525f908152604090205460ff1681565b6040519015158152602001610142565b6100fc610928565b61025e61021d366004610dfb565b600260208190525f9182526040909120805460018201549282015460039092015490929173ffffffffffffffffffffffffffffffffffffffff908116911684565b60408051948552602085019390935273ffffffffffffffffffffffffffffffffffffffff91821692840192909252166060820152608001610142565b5f5461017e9073ffffffffffffffffffffffffffffffffffffffff1681565b6100fc6102c7366004610dfb565b6109a2565b6100fc6102da366004610dfb565b610ace565b61031b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516101429190610f1e565b5f5473ffffffffffffffffffffffffffffffffffffffff16331461039e575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff90911660248201526044015b60405180910390fd5b815115806103ae57508051825114155b156103f257815181516040517f8151c11000000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610395565b5f5b825181101561050e575f73ffffffffffffffffffffffffffffffffffffffff1683828151811061042657610426610f71565b602002602001015173ffffffffffffffffffffffffffffffffffffffff160361047b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81818151811061048d5761048d610f71565b602002602001015160045f8584815181106104aa576104aa610f71565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff1682528101919091526040015f2080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016103f4565b507fafc178bdde9ecf8a42dd2be4f8ac43dd8f06ab6909716d130d9e8d1d9688d1078282604051610540929190610fee565b60405180910390a15050565b5f5473ffffffffffffffffffffffffffffffffffffffff1633146105bd575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff811661060a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c781905560405173ffffffffffffffffffffffffffffffffffffffff8216907f310ba5f1d2ed074b51e2eccd052a47ae9ab7c6b800d1fca3db3999d6a592ca03905f90a250565b335f9081526004602052604090205460ff166106bb576040517f32b2baa3000000000000000000000000000000000000000000000000000000008152336004820152602401610395565b815115806106cb57508051825114155b1561070f57815181516040517f8151c11000000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610395565b5f5b82518110156107a55781818151811061072c5761072c610f71565b602002602001015160035f85848151811061074957610749610f71565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546107989190611048565b9091555050600101610711565b503373ffffffffffffffffffffffffffffffffffffffff167fa979bfa637f10d403f5b074e0ee52626618f5969e71d33fa0f5daf0caa22065683836040516107ee929190611086565b60405180910390a25050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461086d576001546040517f625a43fe00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff8581165f818152600260208181526040928390208981556001810189905591820180548887167fffffffffffffffffffffffff000000000000000000000000000000000000000091821681179092556003840180549789169790911687179055835190815290810194909452928692889290917f2c50df9a1dea57a91edc18dc7b7d135675e66bca942cb9ab6009bc7647f09c64910160405180910390a4505050505050565b5f5473ffffffffffffffffffffffffffffffffffffffff1615610977576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80547fffffffffffffffffffffffff00000000000000000000000000000000000000001633179055565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610a13575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff8116610a60576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f2c1c11af44aa5608f1dca38c00275c30ea091e02417d36e70e9a1538689c433d905f90a250565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610b3f575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff8116610b8c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917f4ffd725fc4a22075e9ec71c59edf9c38cdeb588a91b24fc5b61388c5be41282b91a250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610c6c57610c6c610bf8565b604052919050565b5f67ffffffffffffffff821115610c8d57610c8d610bf8565b5060051b60200190565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cba575f5ffd5b919050565b5f82601f830112610cce575f5ffd5b8135610ce1610cdc82610c74565b610c25565b8082825260208201915060208360051b860101925085831115610d02575f5ffd5b602085015b83811015610d2657610d1881610c97565b835260209283019201610d07565b5095945050505050565b5f5f60408385031215610d41575f5ffd5b823567ffffffffffffffff811115610d57575f5ffd5b610d6385828601610cbf565b925050602083013567ffffffffffffffff811115610d7f575f5ffd5b8301601f81018513610d8f575f5ffd5b8035610d9d610cdc82610c74565b8082825260208201915060208360051b850101925087831115610dbe575f5ffd5b6020840193505b82841015610ded5783358015158114610ddc575f5ffd5b825260209384019390910190610dc5565b809450505050509250929050565b5f60208284031215610e0b575f5ffd5b610e1482610c97565b9392505050565b5f5f60408385031215610e2c575f5ffd5b823567ffffffffffffffff811115610e42575f5ffd5b610e4e85828601610cbf565b925050602083013567ffffffffffffffff811115610e6a575f5ffd5b8301601f81018513610e7a575f5ffd5b8035610e88610cdc82610c74565b8082825260208201915060208360051b850101925087831115610ea9575f5ffd5b6020840193505b82841015610ded578335825260209384019390910190610eb0565b5f5f5f5f5f60a08688031215610edf575f5ffd5b610ee886610c97565b94506020860135935060408601359250610f0460608701610c97565b9150610f1260808701610c97565b90509295509295909350565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151808452602084019350602083015f5b82811015610fe457815173ffffffffffffffffffffffffffffffffffffffff16865260209586019590910190600101610fb0565b5093949350505050565b604081525f6110006040830185610f9e565b82810360208401528084518083526020830191506020860192505f5b8181101561103c578351151583526020938401939092019160010161101c565b50909695505050505050565b80820180821115611080577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b92915050565b604081525f6110986040830185610f9e565b82810360208401528084518083526020830191506020860192505f5b8181101561103c5783518352602093840193909201916001016110b456fea2646970667358221220aa4b096d4c82cdef343b82e1bb0e47ef78e32e9a2e77460363bc4172cbf4f92764736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b50600436106100e5575f3560e01c80636859d1d8116100885780638da5cb5b116100635780638da5cb5b1461029a578063a3fbbaae146102b9578063a6f9dae1146102cc578063ffa1ad74146102df575f5ffd5b80636859d1d8146101d55780638129fc1c146102075780638b494a391461020f575f5ffd5b806341c952a4116100c357806341c952a41461014b578063481c6a751461015e5780634990408f146101a35780635078690b146101c2575f5ffd5b80630223b1dc146100e957806317a68dd8146100fe5780633db25aab14610111575b5f5ffd5b6100fc6100f7366004610d30565b610328565b005b6100fc61010c366004610dfb565b61054c565b6101387f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c781565b6040519081526020015b60405180910390f35b6100fc610159366004610e1b565b610671565b60015461017e9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610142565b6101386101b1366004610dfb565b60036020525f908152604090205481565b6100fc6101d0366004610ecb565b6107fa565b6101f76101e3366004610dfb565b60046020525f908152604090205460ff1681565b6040519015158152602001610142565b6100fc610928565b61025e61021d366004610dfb565b600260208190525f9182526040909120805460018201549282015460039092015490929173ffffffffffffffffffffffffffffffffffffffff908116911684565b60408051948552602085019390935273ffffffffffffffffffffffffffffffffffffffff91821692840192909252166060820152608001610142565b5f5461017e9073ffffffffffffffffffffffffffffffffffffffff1681565b6100fc6102c7366004610dfb565b6109a2565b6100fc6102da366004610dfb565b610ace565b61031b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516101429190610f1e565b5f5473ffffffffffffffffffffffffffffffffffffffff16331461039e575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff90911660248201526044015b60405180910390fd5b815115806103ae57508051825114155b156103f257815181516040517f8151c11000000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610395565b5f5b825181101561050e575f73ffffffffffffffffffffffffffffffffffffffff1683828151811061042657610426610f71565b602002602001015173ffffffffffffffffffffffffffffffffffffffff160361047b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81818151811061048d5761048d610f71565b602002602001015160045f8584815181106104aa576104aa610f71565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff1682528101919091526040015f2080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016103f4565b507fafc178bdde9ecf8a42dd2be4f8ac43dd8f06ab6909716d130d9e8d1d9688d1078282604051610540929190610fee565b60405180910390a15050565b5f5473ffffffffffffffffffffffffffffffffffffffff1633146105bd575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff811661060a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c781905560405173ffffffffffffffffffffffffffffffffffffffff8216907f310ba5f1d2ed074b51e2eccd052a47ae9ab7c6b800d1fca3db3999d6a592ca03905f90a250565b335f9081526004602052604090205460ff166106bb576040517f32b2baa3000000000000000000000000000000000000000000000000000000008152336004820152602401610395565b815115806106cb57508051825114155b1561070f57815181516040517f8151c11000000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610395565b5f5b82518110156107a55781818151811061072c5761072c610f71565b602002602001015160035f85848151811061074957610749610f71565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546107989190611048565b9091555050600101610711565b503373ffffffffffffffffffffffffffffffffffffffff167fa979bfa637f10d403f5b074e0ee52626618f5969e71d33fa0f5daf0caa22065683836040516107ee929190611086565b60405180910390a25050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461086d576001546040517f625a43fe00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff8581165f818152600260208181526040928390208981556001810189905591820180548887167fffffffffffffffffffffffff000000000000000000000000000000000000000091821681179092556003840180549789169790911687179055835190815290810194909452928692889290917f2c50df9a1dea57a91edc18dc7b7d135675e66bca942cb9ab6009bc7647f09c64910160405180910390a4505050505050565b5f5473ffffffffffffffffffffffffffffffffffffffff1615610977576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80547fffffffffffffffffffffffff00000000000000000000000000000000000000001633179055565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610a13575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff8116610a60576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f2c1c11af44aa5608f1dca38c00275c30ea091e02417d36e70e9a1538689c433d905f90a250565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610b3f575f546040517fa43d6ada00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091166024820152604401610395565b73ffffffffffffffffffffffffffffffffffffffff8116610b8c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117825560405190917f4ffd725fc4a22075e9ec71c59edf9c38cdeb588a91b24fc5b61388c5be41282b91a250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610c6c57610c6c610bf8565b604052919050565b5f67ffffffffffffffff821115610c8d57610c8d610bf8565b5060051b60200190565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cba575f5ffd5b919050565b5f82601f830112610cce575f5ffd5b8135610ce1610cdc82610c74565b610c25565b8082825260208201915060208360051b860101925085831115610d02575f5ffd5b602085015b83811015610d2657610d1881610c97565b835260209283019201610d07565b5095945050505050565b5f5f60408385031215610d41575f5ffd5b823567ffffffffffffffff811115610d57575f5ffd5b610d6385828601610cbf565b925050602083013567ffffffffffffffff811115610d7f575f5ffd5b8301601f81018513610d8f575f5ffd5b8035610d9d610cdc82610c74565b8082825260208201915060208360051b850101925087831115610dbe575f5ffd5b6020840193505b82841015610ded5783358015158114610ddc575f5ffd5b825260209384019390910190610dc5565b809450505050509250929050565b5f60208284031215610e0b575f5ffd5b610e1482610c97565b9392505050565b5f5f60408385031215610e2c575f5ffd5b823567ffffffffffffffff811115610e42575f5ffd5b610e4e85828601610cbf565b925050602083013567ffffffffffffffff811115610e6a575f5ffd5b8301601f81018513610e7a575f5ffd5b8035610e88610cdc82610c74565b8082825260208201915060208360051b850101925087831115610ea9575f5ffd5b6020840193505b82841015610ded578335825260209384019390910190610eb0565b5f5f5f5f5f60a08688031215610edf575f5ffd5b610ee886610c97565b94506020860135935060408601359250610f0460608701610c97565b9150610f1260808701610c97565b90509295509295909350565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151808452602084019350602083015f5b82811015610fe457815173ffffffffffffffffffffffffffffffffffffffff16865260209586019590910190600101610fb0565b5093949350505050565b604081525f6110006040830185610f9e565b82810360208401528084518083526020830191506020860192505f5b8181101561103c578351151583526020938401939092019160010161101c565b50909695505050505050565b80820180821115611080577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b92915050565b604081525f6110986040830185610f9e565b82810360208401528084518083526020830191506020860192505f5b8181101561103c5783518352602093840193909201916001016110b456fea2646970667358221220aa4b096d4c82cdef343b82e1bb0e47ef78e32e9a2e77460363bc4172cbf4f92764736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/ContributorsProxy.json b/abis/0.8.28/ContributorsProxy.json new file mode 100644 index 0000000..04517e8 --- /dev/null +++ b/abis/0.8.28/ContributorsProxy.json @@ -0,0 +1,59 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ContributorsProxy", + "sourceName": "contracts/contribute/ContributorsProxy.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "contributorsData", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InitializationFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroContributorsData", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroImplementationAddress", + "type": "error" + }, + { + "stateMutability": "nonpayable", + "type": "fallback" + }, + { + "inputs": [], + "name": "CONTRIBUTORS_PROXY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x608060405234801561000f575f5ffd5b506040516102f23803806102f283398101604081905261002e9161012d565b6001600160a01b0382166100555760405163d02c623d60e01b815260040160405180910390fd5b80515f0361007657604051636ac8756160e01b815260040160405180910390fd5b817f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7555f826001600160a01b0316826040516100b291906101fc565b5f60405180830381855af49150503d805f81146100ea576040519150601f19603f3d011682016040523d82523d5f602084013e6100ef565b606091505b505090508061011157604051630337323560e31b815260040160405180910390fd5b505050610212565b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561013e575f5ffd5b82516001600160a01b0381168114610154575f5ffd5b60208401519092506001600160401b0381111561016f575f5ffd5b8301601f8101851361017f575f5ffd5b80516001600160401b0381111561019857610198610119565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101c6576101c6610119565b6040528181528282016020018710156101dd575f5ffd5b8160208401602083015e5f602083830101528093505050509250929050565b5f82518060208501845e5f920191825250919050565b60d48061021e5f395ff3fe6080604052348015600e575f5ffd5b50600436106026575f3560e01c80633db25aab146066575b7f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c754365f5f375f5f365f845af490503d5f5f3e806061573d5ffd5b503d5ff35b608c7f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c781565b60405190815260200160405180910390f3fea26469706673582212209210556d97be336c48db73e448de839c62e80e98479698d4d5db3532e918887c64736f6c634300081c0033", + "deployedBytecode": "0x6080604052348015600e575f5ffd5b50600436106026575f3560e01c80633db25aab146066575b7f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c754365f5f375f5f365f845af490503d5f5f3e806061573d5ffd5b503d5ff35b608c7f8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c781565b60405190815260200160405180910390f3fea26469706673582212209210556d97be336c48db73e448de839c62e80e98479698d4d5db3532e918887c64736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/MechActivityChecker.json b/abis/0.8.28/MechActivityChecker.json new file mode 100644 index 0000000..8ddd781 --- /dev/null +++ b/abis/0.8.28/MechActivityChecker.json @@ -0,0 +1,111 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "MechActivityChecker", + "sourceName": "contracts/mech_usage/MechActivityChecker.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_mechMarketplace", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_livenessRatio", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "multisig", + "type": "address" + } + ], + "name": "getMultisigNonces", + "outputs": [ + { + "internalType": "uint256[]", + "name": "nonces", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "curNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "lastNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "isRatioPass", + "outputs": [ + { + "internalType": "bool", + "name": "ratioPass", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "livenessRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mechMarketplace", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60c060405234801561000f575f5ffd5b506040516107ba3803806107ba83398101604081905261002e9161008b565b80805f0361004f57604051637c946ed760e01b815260040160405180910390fd5b6080526001600160a01b0382166100795760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660a0526100c2565b5f5f6040838503121561009c575f5ffd5b82516001600160a01b03811681146100b2575f5ffd5b6020939093015192949293505050565b60805160a0516106cb6100ef5f395f818160b0015261036501525f8181607b015261024701526106cb5ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb146100765780639c5e9590146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046104d9565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610547565b610276565b60405161006d919061057a565b5f5f821180156101585750825f81518110610134576101346105bc565b6020026020010151845f8151811061014e5761014e6105bc565b6020026020010151115b8015610197575082600181518110610172576101726105bc565b60200260200101518460018151811061018d5761018d6105bc565b6020026020010151115b1561026f575f835f815181106101af576101af6105bc565b6020026020010151855f815181106101c9576101c96105bc565b60200260200101516101db9190610616565b90505f846001815181106101f1576101f16105bc565b60200260200101518660018151811061020c5761020c6105bc565b602002602001015161021e9190610616565b905081811161026c575f8461023b83670de0b6b3a764000061062f565b6102459190610646565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610303919061067e565b815f81518110610315576103156105bc565b60209081029190910101526040517f60b24e0a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f000000000000000000000000000000000000000000000000000000000000000016906360b24e0a90602401602060405180830381865afa1580156103aa573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce919061067e565b816001815181106103e1576103e16105bc565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f5ffd5b813567ffffffffffffffff811115610448576104486103f2565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff82111715610493576104936103f2565b6040529182526020818501810192908101868411156104b0575f5ffd5b6020860192505b838310156104cf5782358152602092830192016104b7565b5095945050505050565b5f5f5f606084860312156104eb575f5ffd5b833567ffffffffffffffff811115610501575f5ffd5b61050d8682870161041f565b935050602084013567ffffffffffffffff811115610529575f5ffd5b6105358682870161041f565b93969395505050506040919091013590565b5f60208284031215610557575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f5ffd5b602080825282518282018190525f918401906040840190835b818110156105b1578351835260209384019390920191600101610593565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610629576106296105e9565b92915050565b8082028115828204841417610629576106296105e9565b5f82610679577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561068e575f5ffd5b505191905056fea2646970667358221220a4b65f235444a057943da15aae7b669c6fe74ff70742fde48fd78f9c7850e87064736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb146100765780639c5e9590146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046104d9565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610547565b610276565b60405161006d919061057a565b5f5f821180156101585750825f81518110610134576101346105bc565b6020026020010151845f8151811061014e5761014e6105bc565b6020026020010151115b8015610197575082600181518110610172576101726105bc565b60200260200101518460018151811061018d5761018d6105bc565b6020026020010151115b1561026f575f835f815181106101af576101af6105bc565b6020026020010151855f815181106101c9576101c96105bc565b60200260200101516101db9190610616565b90505f846001815181106101f1576101f16105bc565b60200260200101518660018151811061020c5761020c6105bc565b602002602001015161021e9190610616565b905081811161026c575f8461023b83670de0b6b3a764000061062f565b6102459190610646565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610303919061067e565b815f81518110610315576103156105bc565b60209081029190910101526040517f60b24e0a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f000000000000000000000000000000000000000000000000000000000000000016906360b24e0a90602401602060405180830381865afa1580156103aa573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce919061067e565b816001815181106103e1576103e16105bc565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f5ffd5b813567ffffffffffffffff811115610448576104486103f2565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff82111715610493576104936103f2565b6040529182526020818501810192908101868411156104b0575f5ffd5b6020860192505b838310156104cf5782358152602092830192016104b7565b5095945050505050565b5f5f5f606084860312156104eb575f5ffd5b833567ffffffffffffffff811115610501575f5ffd5b61050d8682870161041f565b935050602084013567ffffffffffffffff811115610529575f5ffd5b6105358682870161041f565b93969395505050506040919091013590565b5f60208284031215610557575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f5ffd5b602080825282518282018190525f918401906040840190835b818110156105b1578351835260209384019390920191600101610593565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610629576106296105e9565b92915050565b8082028115828204841417610629576106296105e9565b5f82610679577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561068e575f5ffd5b505191905056fea2646970667358221220a4b65f235444a057943da15aae7b669c6fe74ff70742fde48fd78f9c7850e87064736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/RequesterActivityChecker.json b/abis/0.8.28/RequesterActivityChecker.json new file mode 100644 index 0000000..ec9eba1 --- /dev/null +++ b/abis/0.8.28/RequesterActivityChecker.json @@ -0,0 +1,111 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "RequesterActivityChecker", + "sourceName": "contracts/mech_usage/RequesterActivityChecker.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_mechMarketplace", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_livenessRatio", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "multisig", + "type": "address" + } + ], + "name": "getMultisigNonces", + "outputs": [ + { + "internalType": "uint256[]", + "name": "nonces", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "curNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "lastNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "isRatioPass", + "outputs": [ + { + "internalType": "bool", + "name": "ratioPass", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "livenessRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mechMarketplace", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60c060405234801561000f575f5ffd5b506040516107ba3803806107ba83398101604081905261002e9161008b565b80805f0361004f57604051637c946ed760e01b815260040160405180910390fd5b6080526001600160a01b0382166100795760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660a0526100c2565b5f5f6040838503121561009c575f5ffd5b82516001600160a01b03811681146100b2575f5ffd5b6020939093015192949293505050565b60805160a0516106cb6100ef5f395f818160b0015261036501525f8181607b015261024701526106cb5ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb146100765780639c5e9590146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046104d9565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610547565b610276565b60405161006d919061057a565b5f5f821180156101585750825f81518110610134576101346105bc565b6020026020010151845f8151811061014e5761014e6105bc565b6020026020010151115b8015610197575082600181518110610172576101726105bc565b60200260200101518460018151811061018d5761018d6105bc565b6020026020010151115b1561026f575f835f815181106101af576101af6105bc565b6020026020010151855f815181106101c9576101c96105bc565b60200260200101516101db9190610616565b90505f846001815181106101f1576101f16105bc565b60200260200101518660018151811061020c5761020c6105bc565b602002602001015161021e9190610616565b905081811161026c575f8461023b83670de0b6b3a764000061062f565b6102459190610646565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610303919061067e565b815f81518110610315576103156105bc565b60209081029190910101526040517f7af7347300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f00000000000000000000000000000000000000000000000000000000000000001690637af7347390602401602060405180830381865afa1580156103aa573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce919061067e565b816001815181106103e1576103e16105bc565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f5ffd5b813567ffffffffffffffff811115610448576104486103f2565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff82111715610493576104936103f2565b6040529182526020818501810192908101868411156104b0575f5ffd5b6020860192505b838310156104cf5782358152602092830192016104b7565b5095945050505050565b5f5f5f606084860312156104eb575f5ffd5b833567ffffffffffffffff811115610501575f5ffd5b61050d8682870161041f565b935050602084013567ffffffffffffffff811115610529575f5ffd5b6105358682870161041f565b93969395505050506040919091013590565b5f60208284031215610557575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f5ffd5b602080825282518282018190525f918401906040840190835b818110156105b1578351835260209384019390920191600101610593565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610629576106296105e9565b92915050565b8082028115828204841417610629576106296105e9565b5f82610679577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561068e575f5ffd5b505191905056fea264697066735822122074b29301db1025d7ed7f3ebeef7aaee8fcbbd74948b97fab996b5770677d17d464736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb146100765780639c5e9590146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046104d9565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610547565b610276565b60405161006d919061057a565b5f5f821180156101585750825f81518110610134576101346105bc565b6020026020010151845f8151811061014e5761014e6105bc565b6020026020010151115b8015610197575082600181518110610172576101726105bc565b60200260200101518460018151811061018d5761018d6105bc565b6020026020010151115b1561026f575f835f815181106101af576101af6105bc565b6020026020010151855f815181106101c9576101c96105bc565b60200260200101516101db9190610616565b90505f846001815181106101f1576101f16105bc565b60200260200101518660018151811061020c5761020c6105bc565b602002602001015161021e9190610616565b905081811161026c575f8461023b83670de0b6b3a764000061062f565b6102459190610646565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610303919061067e565b815f81518110610315576103156105bc565b60209081029190910101526040517f7af7347300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f00000000000000000000000000000000000000000000000000000000000000001690637af7347390602401602060405180830381865afa1580156103aa573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce919061067e565b816001815181106103e1576103e16105bc565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f5ffd5b813567ffffffffffffffff811115610448576104486103f2565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff82111715610493576104936103f2565b6040529182526020818501810192908101868411156104b0575f5ffd5b6020860192505b838310156104cf5782358152602092830192016104b7565b5095945050505050565b5f5f5f606084860312156104eb575f5ffd5b833567ffffffffffffffff811115610501575f5ffd5b61050d8682870161041f565b935050602084013567ffffffffffffffff811115610529575f5ffd5b6105358682870161041f565b93969395505050506040919091013590565b5f60208284031215610557575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f5ffd5b602080825282518282018190525f918401906040840190835b818110156105b1578351835260209384019390920191600101610593565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610629576106296105e9565b92915050565b8082028115828204841417610629576106296105e9565b5f82610679577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561068e575f5ffd5b505191905056fea264697066735822122074b29301db1025d7ed7f3ebeef7aaee8fcbbd74948b97fab996b5770677d17d464736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/SingleMechActivityChecker.json b/abis/0.8.28/SingleMechActivityChecker.json new file mode 100644 index 0000000..9bdfaad --- /dev/null +++ b/abis/0.8.28/SingleMechActivityChecker.json @@ -0,0 +1,111 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "SingleMechActivityChecker", + "sourceName": "contracts/mech_usage/SingleMechActivityChecker.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_agentMech", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_livenessRatio", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ZeroMechAgentAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroValue", + "type": "error" + }, + { + "inputs": [], + "name": "agentMech", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "multisig", + "type": "address" + } + ], + "name": "getMultisigNonces", + "outputs": [ + { + "internalType": "uint256[]", + "name": "nonces", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "curNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "lastNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "isRatioPass", + "outputs": [ + { + "internalType": "bool", + "name": "ratioPass", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "livenessRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60c060405234801561000f575f5ffd5b506040516107b93803806107b983398101604081905261002e9161008a565b80805f0361004f57604051637c946ed760e01b815260040160405180910390fd5b6080526001600160a01b0382166100785760405162ca95f960e81b815260040160405180910390fd5b506001600160a01b031660a0526100c1565b5f5f6040838503121561009b575f5ffd5b82516001600160a01b03811681146100b1575f5ffd5b6020939093015192949293505050565b60805160a0516106cb6100ee5f395f818160b0015261036501525f8181607b015261024701526106cb5ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb1461007657806375af4b6d146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046104d9565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610547565b610276565b60405161006d919061057a565b5f5f821180156101585750825f81518110610134576101346105bc565b6020026020010151845f8151811061014e5761014e6105bc565b6020026020010151115b8015610197575082600181518110610172576101726105bc565b60200260200101518460018151811061018d5761018d6105bc565b6020026020010151115b1561026f575f835f815181106101af576101af6105bc565b6020026020010151855f815181106101c9576101c96105bc565b60200260200101516101db9190610616565b90505f846001815181106101f1576101f16105bc565b60200260200101518660018151811061020c5761020c6105bc565b602002602001015161021e9190610616565b905081811161026c575f8461023b83670de0b6b3a764000061062f565b6102459190610646565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610303919061067e565b815f81518110610315576103156105bc565b60209081029190910101526040517f7af7347300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f00000000000000000000000000000000000000000000000000000000000000001690637af7347390602401602060405180830381865afa1580156103aa573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce919061067e565b816001815181106103e1576103e16105bc565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f5ffd5b813567ffffffffffffffff811115610448576104486103f2565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff82111715610493576104936103f2565b6040529182526020818501810192908101868411156104b0575f5ffd5b6020860192505b838310156104cf5782358152602092830192016104b7565b5095945050505050565b5f5f5f606084860312156104eb575f5ffd5b833567ffffffffffffffff811115610501575f5ffd5b61050d8682870161041f565b935050602084013567ffffffffffffffff811115610529575f5ffd5b6105358682870161041f565b93969395505050506040919091013590565b5f60208284031215610557575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f5ffd5b602080825282518282018190525f918401906040840190835b818110156105b1578351835260209384019390920191600101610593565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610629576106296105e9565b92915050565b8082028115828204841417610629576106296105e9565b5f82610679577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561068e575f5ffd5b505191905056fea2646970667358221220057345ac6a25ac32cc0d95415a11dc9a912df7d48c3601a7bcae867c41b12d5e64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb1461007657806375af4b6d146100ab578063d564c4bf146100f7575b5f5ffd5b61006161005c3660046104d9565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610547565b610276565b60405161006d919061057a565b5f5f821180156101585750825f81518110610134576101346105bc565b6020026020010151845f8151811061014e5761014e6105bc565b6020026020010151115b8015610197575082600181518110610172576101726105bc565b60200260200101518460018151811061018d5761018d6105bc565b6020026020010151115b1561026f575f835f815181106101af576101af6105bc565b6020026020010151855f815181106101c9576101c96105bc565b60200260200101516101db9190610616565b90505f846001815181106101f1576101f16105bc565b60200260200101518660018151811061020c5761020c6105bc565b602002602001015161021e9190610616565b905081811161026c575f8461023b83670de0b6b3a764000061062f565b6102459190610646565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610303919061067e565b815f81518110610315576103156105bc565b60209081029190910101526040517f7af7347300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f00000000000000000000000000000000000000000000000000000000000000001690637af7347390602401602060405180830381865afa1580156103aa573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce919061067e565b816001815181106103e1576103e16105bc565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f5ffd5b813567ffffffffffffffff811115610448576104486103f2565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff82111715610493576104936103f2565b6040529182526020818501810192908101868411156104b0575f5ffd5b6020860192505b838310156104cf5782358152602092830192016104b7565b5095945050505050565b5f5f5f606084860312156104eb575f5ffd5b833567ffffffffffffffff811115610501575f5ffd5b61050d8682870161041f565b935050602084013567ffffffffffffffff811115610529575f5ffd5b6105358682870161041f565b93969395505050506040919091013590565b5f60208284031215610557575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f5ffd5b602080825282518282018190525f918401906040840190835b818110156105b1578351835260209384019390920191600101610593565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610629576106296105e9565b92915050565b8082028115828204841417610629576106296105e9565b5f82610679577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561068e575f5ffd5b505191905056fea2646970667358221220057345ac6a25ac32cc0d95415a11dc9a912df7d48c3601a7bcae867c41b12d5e64736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/abis/0.8.28/StakingActivityChecker.json b/abis/0.8.28/StakingActivityChecker.json new file mode 100644 index 0000000..39dacd0 --- /dev/null +++ b/abis/0.8.28/StakingActivityChecker.json @@ -0,0 +1,88 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "StakingActivityChecker", + "sourceName": "lib/autonolas-registries/contracts/staking/StakingActivityChecker.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_livenessRatio", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ZeroValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "multisig", + "type": "address" + } + ], + "name": "getMultisigNonces", + "outputs": [ + { + "internalType": "uint256[]", + "name": "nonces", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "curNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "lastNonces", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "isRatioPass", + "outputs": [ + { + "internalType": "bool", + "name": "ratioPass", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "livenessRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60a0604052348015600e575f5ffd5b506040516105a03803806105a0833981016040819052602b916051565b805f03604a57604051637c946ed760e01b815260040160405180910390fd5b6080526067565b5f602082840312156060575f5ffd5b5051919050565b60805161051b6100855f395f818160700152610164015261051b5ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063184023a514610043578063592cf3fb1461006b578063d564c4bf146100a0575b5f5ffd5b610056610051366004610329565b6100c0565b60405190151581526020015b60405180910390f35b6100927f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610062565b6100b36100ae366004610397565b610190565b60405161006291906103ca565b5f5f821180156101015750825f815181106100dd576100dd61040c565b6020026020010151845f815181106100f7576100f761040c565b6020026020010151115b15610189575f82845f8151811061011a5761011a61040c565b6020026020010151865f815181106101345761013461040c565b60200260200101516101469190610466565b61015890670de0b6b3a764000061047f565b6101629190610496565b7f000000000000000000000000000000000000000000000000000000000000000011159150505b9392505050565b604080516001808252818301909252606091602080830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101fb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061021f91906104ce565b815f815181106102315761023161040c565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261027e575f5ffd5b813567ffffffffffffffff81111561029857610298610242565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff821117156102e3576102e3610242565b604052918252602081850181019290810186841115610300575f5ffd5b6020860192505b8383101561031f578235815260209283019201610307565b5095945050505050565b5f5f5f6060848603121561033b575f5ffd5b833567ffffffffffffffff811115610351575f5ffd5b61035d8682870161026f565b935050602084013567ffffffffffffffff811115610379575f5ffd5b6103858682870161026f565b93969395505050506040919091013590565b5f602082840312156103a7575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610189575f5ffd5b602080825282518282018190525f918401906040840190835b818110156104015783518352602093840193909201916001016103e3565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8181038181111561047957610479610439565b92915050565b808202811582820484141761047957610479610439565b5f826104c9577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f602082840312156104de575f5ffd5b505191905056fea2646970667358221220a30295460a6ce48d2af339d2fd61f69438d5566faa21d93a1ee467371cf0658f64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063184023a514610043578063592cf3fb1461006b578063d564c4bf146100a0575b5f5ffd5b610056610051366004610329565b6100c0565b60405190151581526020015b60405180910390f35b6100927f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610062565b6100b36100ae366004610397565b610190565b60405161006291906103ca565b5f5f821180156101015750825f815181106100dd576100dd61040c565b6020026020010151845f815181106100f7576100f761040c565b6020026020010151115b15610189575f82845f8151811061011a5761011a61040c565b6020026020010151865f815181106101345761013461040c565b60200260200101516101469190610466565b61015890670de0b6b3a764000061047f565b6101629190610496565b7f000000000000000000000000000000000000000000000000000000000000000011159150505b9392505050565b604080516001808252818301909252606091602080830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101fb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061021f91906104ce565b815f815181106102315761023161040c565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261027e575f5ffd5b813567ffffffffffffffff81111561029857610298610242565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811067ffffffffffffffff821117156102e3576102e3610242565b604052918252602081850181019290810186841115610300575f5ffd5b6020860192505b8383101561031f578235815260209283019201610307565b5095945050505050565b5f5f5f6060848603121561033b575f5ffd5b833567ffffffffffffffff811115610351575f5ffd5b61035d8682870161026f565b935050602084013567ffffffffffffffff811115610379575f5ffd5b6103858682870161026f565b93969395505050506040919091013590565b5f602082840312156103a7575f5ffd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610189575f5ffd5b602080825282518282018190525f918401906040840190835b818110156104015783518352602093840193909201916001016103e3565b509095945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8181038181111561047957610479610439565b92915050565b808202811582820484141761047957610479610439565b5f826104c9577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f602082840312156104de575f5ffd5b505191905056fea2646970667358221220a30295460a6ce48d2af339d2fd61f69438d5566faa21d93a1ee467371cf0658f64736f6c634300081c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/audits/README.md b/audits/README.md index cb7a606..bbe8c83 100644 --- a/audits/README.md +++ b/audits/README.md @@ -5,3 +5,7 @@ This section contains audit-related materials. An internal audit with a focus on Service Staking Mech Usage contracts is located in this folder: [internal audit](https://github.com/valory-xyz/autonolas-staking-programmes/blob/main/audits/internal). +### Internal audit +An internal audit with a focus on social contribute +contracts is located in this folder: [internal audit 1](https://github.com/valory-xyz/autonolas-staking-programmes/blob/main/audits/internal1). + diff --git a/audits/internal1/README.md b/audits/internal1/README.md new file mode 100644 index 0000000..4f0a7ff --- /dev/null +++ b/audits/internal1/README.md @@ -0,0 +1,40 @@ +# Internal audit of autonolas-staking-programmes +The review has been performed based on the contract code in the following repository:
+`https://github.com/valory-xyz/autonolas-staking-programmes`
+commit: `v1.4.0-pre-internal-audit` or `585003faeec5dff2fd96a326f07c3e809dc32898`
+ +## Objectives +The audit focused on contracts in this repo.
+ + +### Flatten version +Flatten version of contracts. [contracts](https://github.com/valory-xyz/autonolas-staking-programmes/blob/main/audits/internal1/analysis/contracts) + +### ERC20/ERC721 checks +N/A + +### Security issues. Updated 23-10-2024 +#### Problems found instrumentally +Several checks are obtained automatically. They are commented.
+All automatic warnings are listed in the following file, concerns of which we address in more detail below:
+[slither-full](https://github.com/valory-xyz/autonolas-staking-programmes/blob/main/audits/internal1/analysis/slither_full.txt) + +### Issue +1. Fixing reentrancy unstake() +``` +more CEI, + IToken(serviceRegistry).transfer(msg.sender, serviceId); = reentrancy via msg.sender as contract. + // Zero the service info: the service is out of the contribute records, however multisig activity is still valid + // If the same service is staked back, the multisig activity continues being tracked + IContributors(contributorsProxy).setServiceInfoForId(msg.sender, 0, 0, address(0), address(0)); + +``` +[x] Fixed + +2. cyclic initialize(address _manager) +``` +Remove params in proxy init() / or setup manage as msg.sender. +``` +[x] Fixed + + diff --git a/audits/internal1/analysis/contracts/ContributeActivityChecker-flatten.sol b/audits/internal1/analysis/contracts/ContributeActivityChecker-flatten.sol new file mode 100644 index 0000000..c273ddd --- /dev/null +++ b/audits/internal1/analysis/contracts/ContributeActivityChecker-flatten.sol @@ -0,0 +1,76 @@ +// Sources flattened with hardhat v2.22.4 https://hardhat.org + +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +// Contributors interface +interface IContributors { + function mapMutisigActivities(address multisig) external view returns (uint256); +} + +/// @dev Zero address. +error ZeroAddress(); + +/// @dev Zero value. +error ZeroValue(); + +/// @title ContributeActivityChecker - Smart contract for performing contributors service staking activity check +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract ContributeActivityChecker { + // Liveness ratio in the format of 1e18 + uint256 public immutable livenessRatio; + // Contributors proxy contract address + address public immutable contributorsProxy; + + /// @dev StakingNativeToken initialization. + /// @param _contributorsProxy Contributors proxy contract address. + /// @param _livenessRatio Liveness ratio in the format of 1e18. + constructor(address _contributorsProxy, uint256 _livenessRatio) { + // Check the zero address + if (_contributorsProxy == address(0)) { + revert ZeroAddress(); + } + + // Check for zero value + if (_livenessRatio == 0) { + revert ZeroValue(); + } + + contributorsProxy = _contributorsProxy; + livenessRatio = _livenessRatio; + } + + /// @dev Gets service multisig nonces. + /// @param multisig Service multisig address. + /// @return nonces Set of a single service multisig nonce. + function getMultisigNonces(address multisig) external view virtual returns (uint256[] memory nonces) { + nonces = new uint256[](1); + // The nonce is equal to the social off-chain activity corresponding to a multisig activity + nonces[0] = IContributors(contributorsProxy).mapMutisigActivities(multisig); + } + + /// @dev Checks if the service multisig liveness ratio passes the defined liveness threshold. + /// @notice The formula for calculating the ratio is the following: + /// currentNonce - service multisig nonce at time now (block.timestamp); + /// lastNonce - service multisig nonce at the previous checkpoint or staking time (tsStart); + /// ratio = (currentNonce - lastNonce) / (block.timestamp - tsStart). + /// @param curNonces Current service multisig set of a single nonce. + /// @param lastNonces Last service multisig set of a single nonce. + /// @param ts Time difference between current and last timestamps. + /// @return ratioPass True, if the liveness ratio passes the check. + function isRatioPass( + uint256[] memory curNonces, + uint256[] memory lastNonces, + uint256 ts + ) external view virtual returns (bool ratioPass) { + // If the checkpoint was called in the exact same block, the ratio is zero + // If the current nonce is not greater than the last nonce, the ratio is zero + if (ts > 0 && curNonces[0] > lastNonces[0]) { + uint256 ratio = ((curNonces[0] - lastNonces[0]) * 1e18) / ts; + ratioPass = (ratio >= livenessRatio); + } + } +} diff --git a/audits/internal1/analysis/contracts/ContributeManager-flatten.sol b/audits/internal1/analysis/contracts/ContributeManager-flatten.sol new file mode 100644 index 0000000..8247621 --- /dev/null +++ b/audits/internal1/analysis/contracts/ContributeManager-flatten.sol @@ -0,0 +1,480 @@ +// Sources flattened with hardhat v2.22.4 https://hardhat.org +pragma solidity ^0.8.25; + +// SPDX-License-Identifier: MIT +// Contributors interface +interface IContributors { + /// @dev Sets service info for the social id. + /// @param serviceOwner Service owner. + /// @param socialId Social id. + /// @param serviceId Service Id. + /// @param multisig Service multisig address. + /// @param stakingInstance Staking instance address. + function setServiceInfoForId( + address serviceOwner, + uint256 socialId, + uint256 serviceId, + address multisig, + address stakingInstance + ) external; + + /// @dev Gets service info corresponding to a specified social Id. + /// @param serviceOwner Service owner. + /// @return socialId Social Id. + /// @return serviceId Corresponding service Id. + /// @return multisig Corresponding service multisig. + /// @return stakingInstance Staking instance address. + function mapSocialIdServiceInfo(address serviceOwner) external view + returns (uint256 socialId, uint256 serviceId, address multisig, address stakingInstance); +} + + +// Service registry related interface +interface IService { + struct AgentParams { + // Number of agent instances + uint32 slots; + // Bond per agent instance + uint96 bond; + } + + /// @dev Creates a new service. + /// @param serviceOwner Individual that creates and controls a service. + /// @param token ERC20 token address for the security deposit, or ETH. + /// @param configHash IPFS hash pointing to the config metadata. + /// @param agentIds Canonical agent Ids. + /// @param agentParams Number of agent instances and required bond to register an instance in the service. + /// @param threshold Threshold for a multisig composed by agents. + /// @return serviceId Created service Id. + function create( + address serviceOwner, + address token, + bytes32 configHash, + uint32[] memory agentIds, + AgentParams[] memory agentParams, + uint32 threshold + ) external returns (uint256 serviceId); + + /// @dev Activates the service and its sensitive components. + /// @param serviceId Correspondent service Id. + /// @return success True, if function executed successfully. + function activateRegistration(uint256 serviceId) external payable returns (bool success); + + /// @dev Registers agent instances. + /// @param serviceId Service Id to be updated. + /// @param agentInstances Agent instance addresses. + /// @param agentIds Canonical Ids of the agent correspondent to the agent instance. + /// @return success True, if function executed successfully. + function registerAgents( + uint256 serviceId, + address[] memory agentInstances, + uint32[] memory agentIds + ) external payable returns (bool success); + + /// @dev Creates multisig instance controlled by the set of service agent instances and deploys the service. + /// @param serviceId Correspondent service Id. + /// @param multisigImplementation Multisig implementation address. + /// @param data Data payload for the multisig creation. + /// @return multisig Address of the created multisig. + function deploy( + uint256 serviceId, + address multisigImplementation, + bytes memory data + ) external returns (address multisig); + + /// @dev Gets the serviceRegistry address. + /// @return serviceRegistry address. + function serviceRegistry() external returns (address); + + /// @dev Gets the serviceRegistryTokenUtility address. + /// @return serviceRegistryTokenUtility address. + function serviceRegistryTokenUtility() external returns (address); + + /// @dev Gets the service instance from the map of services. + /// @param serviceId Service Id. + /// @return securityDeposit Registration activation deposit. + /// @return multisig Service multisig address. + /// @return configHash IPFS hashes pointing to the config metadata. + /// @return threshold Agent instance signers threshold. + /// @return maxNumAgentInstances Total number of agent instances. + /// @return numAgentInstances Actual number of agent instances. + /// @return state Service state. + function mapServices(uint256 serviceId) external view returns ( + uint96 securityDeposit, + address multisig, + bytes32 configHash, + uint32 threshold, + uint32 maxNumAgentInstances, + uint32 numAgentInstances, + uint8 state + ); +} + +// Staking interface +interface IStaking { + /// @dev Gets service staking token. + /// @return Service staking token address. + function stakingToken() external view returns (address); + + /// @dev Gets minimum service staking deposit value required for staking. + /// @return Minimum service staking deposit. + function minStakingDeposit() external view returns (uint256); + + /// @dev Gets number of required agent instances in the service. + /// @return Number of agent instances. + function numAgentInstances() external view returns (uint256); + + /// @dev Gets the service threshold. + /// @return Threshold. + function threshold() external view returns (uint256); + + /// @dev Stakes the service. + /// @param serviceId Service Id. + function stake(uint256 serviceId) external; + + /// @dev Unstakes the service with collected reward, if available. + /// @param serviceId Service Id. + /// @return reward Staking reward. + function unstake(uint256 serviceId) external returns (uint256); + + /// @dev Claims rewards for the service without an additional checkpoint call. + /// @param serviceId Service Id. + /// @return Staking reward. + function claim(uint256 serviceId) external returns (uint256); + + /// @dev Verifies a service staking contract instance. + /// @param instance Service staking proxy instance. + /// @return True, if verification is successful. + function verifyInstance(address instance) external view returns (bool); +} + +// Token interface +interface IToken { + /// @dev Transfers the token amount. + /// @param to Address to transfer to. + /// @param amount The amount to transfer. + /// @return True if the function execution is successful. + function transfer(address to, uint256 amount) external returns (bool); + + /// @dev Transfers the token amount that was previously approved up until the maximum allowance. + /// @param from Account address to transfer from. + /// @param to Account address to transfer to. + /// @param amount Amount to transfer to. + /// @return True if the function execution is successful. + function transferFrom(address from, address to, uint256 amount) external returns (bool); + + /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + /// @param spender Account address that will be able to transfer tokens on behalf of the caller. + /// @param amount Token amount. + /// @return True if the function execution is successful. + function approve(address spender, uint256 amount) external returns (bool); +} + +// Multisig interface +interface IMultisig { + /// @dev Returns array of owners. + /// @return Array of Safe owners. + function getOwners() external view returns (address[] memory); +} + +/// @dev Zero address. +error ZeroAddress(); + +/// @dev Zero value. +error ZeroValue(); + +/// @dev Service is already created and staked for the contributor. +/// @param socialId Social Id. +/// @param serviceId Service Id. +/// @param multisig Multisig address. +error ServiceAlreadyStaked(uint256 socialId, uint256 serviceId, address multisig); + +/// @dev Wrong staking instance. +/// @param stakingInstance Staking instance address. +error WrongStakingInstance(address stakingInstance); + +/// @dev Wrong provided service setup. +/// @param socialId Social Id. +/// @param serviceId Service Id. +/// @param multisig Multisig address. +error WrongServiceSetup(uint256 socialId, uint256 serviceId, address multisig); + +/// @dev Service is not defined for the social Id. +/// @param socialId Social Id. +error ServiceNotDefined(uint256 socialId); + +/// @dev Wrong service owner. +/// @param serviceId Service Id. +/// @param sender Sender address. +/// @param serviceOwner Actual service owner. +error ServiceOwnerOnly(uint256 serviceId, address sender, address serviceOwner); + +/// @title ContributeManager - Smart contract for managing services for contributors +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract ContributeManager { + event CreatedAndStaked(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + event Staked(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + event Unstaked(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + event Claimed(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + + // Number of agent instances + uint256 public constant NUM_AGENT_INSTANCES = 1; + // Threshold + uint256 public constant THRESHOLD = 1; + // Contributor agent Id + uint256 public immutable agentId; + // Contributor service config hash + bytes32 public immutable configHash; + // Contributors proxy address + address public immutable contributorsProxy; + // Service manager address + address public immutable serviceManager; + // OLAS token address + address public immutable olas; + // Service registry address + address public immutable serviceRegistry; + // Service registry token utility address + address public immutable serviceRegistryTokenUtility; + // Staking factory address + address public immutable stakingFactory; + // Safe multisig processing contract address + address public immutable safeMultisig; + // Safe fallback handler + address public immutable fallbackHandler; + + // Nonce + uint256 internal nonce; + + /// @dev ContributeManager constructor. + /// @param _contributorsProxy Contributors proxy address. + /// @param _serviceManager Service manager address. + /// @param _olas OLAS token address. + /// @param _stakingFactory Staking factory address. + /// @param _safeMultisig Safe multisig address. + /// @param _fallbackHandler Multisig fallback handler address. + /// @param _agentId Contributor agent Id. + /// @param _configHash Contributor service config hash. + constructor( + address _contributorsProxy, + address _serviceManager, + address _olas, + address _stakingFactory, + address _safeMultisig, + address _fallbackHandler, + uint256 _agentId, + bytes32 _configHash + ) { + // Check for zero addresses + if (_contributorsProxy == address(0) || _serviceManager == address(0) || _olas == address(0) || + _stakingFactory == address(0) || _safeMultisig == address(0) || _fallbackHandler == address(0)) { + revert ZeroAddress(); + } + + // Check for zero values + if (_agentId == 0 || _configHash == 0) { + revert ZeroValue(); + } + + agentId = _agentId; + configHash = _configHash; + + contributorsProxy = _contributorsProxy; + serviceManager = _serviceManager; + olas = _olas; + stakingFactory = _stakingFactory; + safeMultisig = _safeMultisig; + fallbackHandler = _fallbackHandler; + serviceRegistry = IService(serviceManager).serviceRegistry(); + serviceRegistryTokenUtility = IService(serviceManager).serviceRegistryTokenUtility(); + } + + /// @dev Creates and deploys a service for the contributor. + /// @param token Staking token address. + /// @param minStakingDeposit Min staking deposit value. + /// @return serviceId Minted service Id. + /// @return multisig Service multisig. + function _createAndDeploy( + address token, + uint256 minStakingDeposit + ) internal returns (uint256 serviceId, address multisig) { + // Set agent params + IService.AgentParams[] memory agentParams = new IService.AgentParams[](NUM_AGENT_INSTANCES); + agentParams[0] = IService.AgentParams(uint32(NUM_AGENT_INSTANCES), uint96(minStakingDeposit)); + + // Set agent Ids + uint32[] memory agentIds = new uint32[](NUM_AGENT_INSTANCES); + agentIds[0] = uint32(agentId); + + // Set agent instances as [msg.sender] + address[] memory instances = new address[](NUM_AGENT_INSTANCES); + instances[0] = msg.sender; + + // Create a service owned by this contract + serviceId = IService(serviceManager).create(address(this), token, configHash, agentIds, + agentParams, uint32(THRESHOLD)); + + // Activate registration (1 wei as a deposit wrapper) + IService(serviceManager).activateRegistration{value: 1}(serviceId); + + // Register msg.sender as an agent instance (numAgentInstances wei as a bond wrapper) + IService(serviceManager).registerAgents{value: NUM_AGENT_INSTANCES}(serviceId, instances, agentIds); + + // Prepare Safe multisig data + uint256 localNonce = nonce; + uint256 randomNonce = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender, localNonce))); + bytes memory data = abi.encodePacked(address(0), fallbackHandler, address(0), address(0), uint256(0), + randomNonce, "0x"); + // Deploy the service + multisig = IService(serviceManager).deploy(serviceId, safeMultisig, data); + + // Update the nonce + nonce = localNonce + 1; + } + + /// @dev Stakes the already deployed service. + /// @param socialId Social Id. + /// @param serviceId Service Id. + /// @param multisig Corresponding service multisig. + /// @param stakingInstance Staking instance. + function _stake(uint256 socialId, uint256 serviceId, address multisig, address stakingInstance) internal { + // Add the service into its social Id corresponding record + IContributors(contributorsProxy).setServiceInfoForId(msg.sender, socialId, serviceId, multisig, stakingInstance); + + // Approve service NFT for the staking instance + IToken(serviceRegistry).approve(stakingInstance, serviceId); + + // Stake the service + IStaking(stakingInstance).stake(serviceId); + } + + /// @dev Creates and deploys a service for the contributor, and stakes it with a specified staking contract. + /// @notice The service cannot be registered again if it is currently staked. + /// @param socialId Contributor social Id. + /// @param stakingInstance Contribute staking instance address. + function createAndStake(uint256 socialId, address stakingInstance) external payable { + // Check for zero value + if (socialId == 0) { + revert ZeroValue(); + } + + // Check for existing service corresponding to the msg.sender + (, uint256 serviceId, address multisig, ) = IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender); + if (serviceId > 0) { + revert ServiceAlreadyStaked(socialId, serviceId, multisig); + } + + // Check for staking instance validity + if(!IStaking(stakingFactory).verifyInstance(stakingInstance)) { + revert WrongStakingInstance(stakingInstance); + } + + // Get the token info from the staking contract + // If this call fails, it means the staking contract does not have a token and is not compatible + address token = IStaking(stakingInstance).stakingToken(); + // Check the token address + if (token != olas) { + revert WrongStakingInstance(stakingInstance); + } + + // Get other service info for staking + uint256 minStakingDeposit = IStaking(stakingInstance).minStakingDeposit(); + uint256 numAgentInstances = IStaking(stakingInstance).numAgentInstances(); + uint256 threshold = IStaking(stakingInstance).threshold(); + // Check for number of agent instances that must be equal to one, + // since msg.sender is the only service multisig owner + if (numAgentInstances != NUM_AGENT_INSTANCES || threshold != THRESHOLD) { + revert WrongStakingInstance(stakingInstance); + } + + // Calculate the total bond required for the service deployment: + uint256 totalBond = (1 + NUM_AGENT_INSTANCES) * minStakingDeposit; + + // Transfer the total bond amount from the contributor + IToken(olas).transferFrom(msg.sender, address(this), totalBond); + // Approve token for the serviceRegistryTokenUtility contract + IToken(olas).approve(serviceRegistryTokenUtility, totalBond); + + // Create and deploy service + (serviceId, multisig) = _createAndDeploy(olas, minStakingDeposit); + + // Stake the service + _stake(socialId, serviceId, multisig, stakingInstance); + + emit CreatedAndStaked(socialId, msg.sender, serviceId, multisig, stakingInstance); + } + + /// @dev Stakes the already deployed service. + /// @param socialId Social Id. + /// @param serviceId Service Id. + /// @param stakingInstance Staking instance. + function stake(uint256 socialId, uint256 serviceId, address stakingInstance) external { + // Check for existing service corresponding to the msg.sender + (, uint256 serviceIdCheck, address multisig, ) = IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender); + if (serviceIdCheck > 0) { + revert ServiceAlreadyStaked(socialId, serviceIdCheck, multisig); + } + + // Get the service multisig + (, multisig, , , , , ) = IService(serviceRegistry).mapServices(serviceId); + + // Check that the service multisig owner is msg.sender + uint256 numAgentInstances = IStaking(stakingInstance).numAgentInstances(); + address[] memory multisigOwners = IMultisig(multisig).getOwners(); + if (multisigOwners.length != numAgentInstances || multisigOwners[0] != msg.sender) { + revert WrongServiceSetup(socialId, serviceId, multisig); + } + + // Transfer the service NFT + IToken(serviceRegistry).transferFrom(msg.sender, address(this), serviceId); + + // Stake the service + _stake(socialId, serviceId, multisig, stakingInstance); + + emit Staked(socialId, msg.sender, serviceId, multisig, stakingInstance); + } + + /// @dev Unstakes service Id corresponding to the msg.sender and clears the contributor record. + function unstake() external { + // Check for existing service corresponding to the social Id + (uint256 socialId, uint256 serviceId, address multisig, address stakingInstance) = + IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender); + if (serviceId == 0) { + revert ServiceNotDefined(socialId); + } + + // Unstake the service + IStaking(stakingInstance).unstake(serviceId); + + // Transfer the service back to the original owner + IToken(serviceRegistry).transfer(msg.sender, serviceId); + + // Zero the service info: the service is out of the contribute records, however multisig activity is still valid + // If the same service is staked back, the multisig activity continues being tracked + IContributors(contributorsProxy).setServiceInfoForId(msg.sender, 0, 0, address(0), address(0)); + + emit Unstaked(socialId, msg.sender, serviceId, multisig, stakingInstance); + } + + /// @dev Claims rewards for the service corresponding to msg.sender. + /// @return reward Staking reward. + function claim() external returns (uint256 reward) { + // Check for existing service corresponding to the social Id + (uint256 socialId, uint256 serviceId, address multisig, address stakingInstance) = + IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender); + if (serviceId == 0) { + revert ServiceNotDefined(socialId); + } + + // Claim staking rewards + reward = IStaking(stakingInstance).claim(serviceId); + + emit Claimed(socialId, msg.sender, serviceId, multisig, stakingInstance); + } +} diff --git a/audits/internal1/analysis/contracts/Contributors-flatten.sol b/audits/internal1/analysis/contracts/Contributors-flatten.sol new file mode 100644 index 0000000..5f9c7c5 --- /dev/null +++ b/audits/internal1/analysis/contracts/Contributors-flatten.sol @@ -0,0 +1,219 @@ +// Sources flattened with hardhat v2.22.4 https://hardhat.org + +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +/// @dev Only `owner` has a privilege, but the `sender` was provided. +/// @param sender Sender address. +/// @param owner Required sender address as an owner. +error OwnerOnly(address sender, address owner); + +/// @dev The contract is already initialized. +error AlreadyInitialized(); + +/// @dev Zero address. +error ZeroAddress(); + +/// @dev Only manager is allowed to have access. +error OnlyManager(address sender, address manager); + +/// @dev Wrong length of two arrays. +/// @param numValues1 Number of values in a first array. +/// @param numValues2 Number of values in a second array. +error WrongArrayLength(uint256 numValues1, uint256 numValues2); + +/// @dev Account is unauthorized. +/// @param account Account address. +error UnauthorizedAccount(address account); + +// Struct for service info +struct ServiceInfo { + // Social Id + uint256 socialId; + // Service Id + uint256 serviceId; + // Corresponding service multisig + address multisig; + // Staking instance address + address stakingInstance; +} + +/// @title Contributors - Smart contract for managing contributors +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract Contributors { + event ImplementationUpdated(address indexed implementation); + event OwnerUpdated(address indexed owner); + event ManagerUpdated(address indexed manager); + event SetServiceInfoForId(address indexed serviceOwner, uint256 indexed socialId, uint256 indexed serviceId, + address multisig, address stakingInstance); + event SetContributeAgentStatuses(address[] contributeAgents, bool[] statuses); + event MultisigActivityChanged(address indexed senderAgent, address[] multisigs, uint256[] activityChanges); + + // Version number + string public constant VERSION = "1.0.0"; + // Code position in storage is keccak256("CONTRIBUTORS_PROXY") = "0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7" + bytes32 public constant CONTRIBUTORS_PROXY = 0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7; + + // Contract owner + address public owner; + // Service manager contract address + address public manager; + + // Mapping of address => service info + mapping(address => ServiceInfo) public mapSocialIdServiceInfo; + // Mapping of service multisig address => activity + mapping(address => uint256) public mapMutisigActivities; + // Mapping of whitelisted contributor agents + mapping(address => bool) public mapContributeAgents; + + /// @dev Contributors initializer. + /// @param _manager Manager address. + function initialize(address _manager) external{ + // Check for already initialized + if (owner != address(0)) { + revert AlreadyInitialized(); + } + + // Check for zero address + if (_manager == address(0)) { + revert ZeroAddress(); + } + + owner = msg.sender; + manager = _manager; + } + + /// @dev Changes the contributors implementation contract address. + /// @param newImplementation New implementation contract address. + function changeImplementation(address newImplementation) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for zero address + if (newImplementation == address(0)) { + revert ZeroAddress(); + } + + // Store the contributors implementation address + assembly { + sstore(CONTRIBUTORS_PROXY, newImplementation) + } + + emit ImplementationUpdated(newImplementation); + } + + /// @dev Changes contract owner address. + /// @param newOwner Address of a new owner. + function changeOwner(address newOwner) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for the zero address + if (newOwner == address(0)) { + revert ZeroAddress(); + } + + owner = newOwner; + emit OwnerUpdated(newOwner); + } + + /// @dev Changes contract manager address. + /// @param newManager Address of a new manager. + function changeManager(address newManager) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for the zero address + if (newManager == address(0)) { + revert ZeroAddress(); + } + + manager = newManager; + emit ManagerUpdated(newManager); + } + + /// @dev Sets service info for the social id. + /// @param serviceOwner Service owner. + /// @param socialId Social id. + /// @param serviceId Service Id. + /// @param multisig Service multisig address. + /// @param stakingInstance Staking instance address. + function setServiceInfoForId( + address serviceOwner, + uint256 socialId, + uint256 serviceId, + address multisig, + address stakingInstance + ) external { + // Check for manager + if (msg.sender != manager) { + revert OnlyManager(msg.sender, manager); + } + + // Set (or remove) multisig for the corresponding social id + ServiceInfo storage serviceInfo = mapSocialIdServiceInfo[serviceOwner]; + serviceInfo.socialId = socialId; + serviceInfo.serviceId = serviceId; + serviceInfo.multisig = multisig; + serviceInfo.stakingInstance = stakingInstance; + + emit SetServiceInfoForId(serviceOwner, socialId, serviceId, multisig, stakingInstance); + } + + /// @dev Sets contribute agent statues. + /// @param contributeAgents Contribute agent addresses. + /// @param statuses Corresponding whitelisting statues. + function setContributeAgentStatuses(address[] memory contributeAgents, bool[] memory statuses) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for array lengths + if (contributeAgents.length != statuses.length) { + revert WrongArrayLength(contributeAgents.length, statuses.length); + } + + // Traverse all contribute agents and statuses + for (uint256 i = 0; i < contributeAgents.length; ++i) { + if (contributeAgents[i] == address(0)) { + revert ZeroAddress(); + } + + mapContributeAgents[contributeAgents[i]] = statuses[i]; + } + + emit SetContributeAgentStatuses(contributeAgents, statuses); + } + + /// @dev Increases multisig activity by the contribute agent. + /// @param multisigs Multisig addresses. + /// @param activityChanges Corresponding activity changes + function increaseActivity(address[] memory multisigs, uint256[] memory activityChanges) external { + // Check for whitelisted contribute agent + if (!mapContributeAgents[msg.sender]) { + revert UnauthorizedAccount(msg.sender); + } + + // Check for array lengths + if (multisigs.length != activityChanges.length) { + revert WrongArrayLength(multisigs.length, activityChanges.length); + } + + // Increase / decrease multisig activity + for (uint256 i = 0; i < multisigs.length; ++i) { + mapMutisigActivities[multisigs[i]] += activityChanges[i]; + } + + emit MultisigActivityChanged(msg.sender, multisigs, activityChanges); + } +} diff --git a/audits/internal1/analysis/contracts/ContributorsProxy-flatten.sol b/audits/internal1/analysis/contracts/ContributorsProxy-flatten.sol new file mode 100644 index 0000000..e58ea2b --- /dev/null +++ b/audits/internal1/analysis/contracts/ContributorsProxy-flatten.sol @@ -0,0 +1,76 @@ +// Sources flattened with hardhat v2.22.4 https://hardhat.org + +// SPDX-License-Identifier: MIT + +// File contracts/contribute/ContributorsProxy.sol + +// Original license: SPDX_License_Identifier: MIT +pragma solidity ^0.8.25; + +/// @dev Zero implementation address. +error ZeroImplementationAddress(); + +/// @dev Zero contributors data. +error ZeroContributorsData(); + +/// @dev Proxy initialization failed. +error InitializationFailed(); + +/* +* This is a Contributors proxy contract. +* Proxy implementation is created based on the Universal Upgradeable Proxy Standard (UUPS) EIP-1822. +* The implementation address must be located in a unique storage slot of the proxy contract. +* The upgrade logic must be located in the implementation contract. +* Special contributors implementation address slot is produced by hashing the "CONTRIBUTORS_PROXY" +* string in order to make the slot unique. +* The fallback() implementation for all the delegatecall-s is inspired by the Gnosis Safe set of contracts. +*/ + +/// @title ContributorsProxy - Smart contract for contributors proxy +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract ContributorsProxy { + // Code position in storage is keccak256("CONTRIBUTORS_PROXY") = "0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7" + bytes32 public constant CONTRIBUTORS_PROXY = 0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7; + + /// @dev ContributorsProxy constructor. + /// @param implementation Contributors implementation address. + /// @param contributorsData Contributors initialization data. + constructor(address implementation, bytes memory contributorsData) { + // Check for the zero address, since the delegatecall works even with the zero one + if (implementation == address(0)) { + revert ZeroImplementationAddress(); + } + + // Check for the zero data + if (contributorsData.length == 0) { + revert ZeroContributorsData(); + } + + // Store the contributors implementation address + assembly { + sstore(CONTRIBUTORS_PROXY, implementation) + } + // Initialize proxy tokenomics storage + (bool success, ) = implementation.delegatecall(contributorsData); + if (!success) { + revert InitializationFailed(); + } + } + + /// @dev Delegatecall to all the incoming data. + fallback() external { + assembly { + let implementation := sload(CONTRIBUTORS_PROXY) + calldatacopy(0, 0, calldatasize()) + let success := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { + revert(0, returndatasize()) + } + return(0, returndatasize()) + } + } +} diff --git a/audits/internal1/analysis/contracts/script.sh b/audits/internal1/analysis/contracts/script.sh new file mode 100644 index 0000000..c4d1607 --- /dev/null +++ b/audits/internal1/analysis/contracts/script.sh @@ -0,0 +1,21 @@ +#!/bin/bash + + slither_options=("call-graph" "constructor-calls" "contract-summary" "data-dependency" "function-summary" + "human-summary" "inheritance" "inheritance-graph" "modifiers" "require" "variable-order" "vars-and-auth") + echo -e "\nRunning slither routines ..." + for so in "${slither_options[@]}"; do + echo -e "\t$so" + slither . --print ${so} &> "slither_$so.txt" + done + echo -e "\tfull report" + slither . &> "slither_full.txt" + + # moving generated .dot files to the audit folder + count=`ls -1 *.dot 2>/dev/null | wc -l` + echo -e "\tgenerated $count .dot files" + for _filename in *.dot; do + filename="${_filename%.*}" + cat $_filename | dot -Tpng > slither_$filename.png + done + rm *.dot + diff --git a/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.ContributeActivityChecker.call-graph.png b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.ContributeActivityChecker.call-graph.png new file mode 100644 index 0000000..5c5c7ec Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.ContributeActivityChecker.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.IContributors.call-graph.png b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.IContributors.call-graph.png new file mode 100644 index 0000000..2a97ae9 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.IContributors.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.all_contracts.call-graph.png b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.all_contracts.call-graph.png new file mode 100644 index 0000000..5fe39e5 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.all_contracts.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.inheritance-graph.png b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.inheritance-graph.png new file mode 100644 index 0000000..145be31 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeActivityChecker-flatten.sol.inheritance-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.ContributeManager.call-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.ContributeManager.call-graph.png new file mode 100644 index 0000000..c8a42e6 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.ContributeManager.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IContributors.call-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IContributors.call-graph.png new file mode 100644 index 0000000..58ca33b Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IContributors.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IMultisig.call-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IMultisig.call-graph.png new file mode 100644 index 0000000..1e2dc5b Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IMultisig.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IService.call-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IService.call-graph.png new file mode 100644 index 0000000..ce6fd9b Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IService.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IStaking.call-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IStaking.call-graph.png new file mode 100644 index 0000000..27bc232 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IStaking.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IToken.call-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IToken.call-graph.png new file mode 100644 index 0000000..b1ca9b1 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.IToken.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.all_contracts.call-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.all_contracts.call-graph.png new file mode 100644 index 0000000..385d995 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.all_contracts.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributeManager-flatten.sol.inheritance-graph.png b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.inheritance-graph.png new file mode 100644 index 0000000..a50f088 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributeManager-flatten.sol.inheritance-graph.png differ diff --git a/audits/internal1/analysis/slither_Contributors-flatten.sol.Contributors.call-graph.png b/audits/internal1/analysis/slither_Contributors-flatten.sol.Contributors.call-graph.png new file mode 100644 index 0000000..fdca0c9 Binary files /dev/null and b/audits/internal1/analysis/slither_Contributors-flatten.sol.Contributors.call-graph.png differ diff --git a/audits/internal1/analysis/slither_Contributors-flatten.sol.all_contracts.call-graph.png b/audits/internal1/analysis/slither_Contributors-flatten.sol.all_contracts.call-graph.png new file mode 100644 index 0000000..a9a30be Binary files /dev/null and b/audits/internal1/analysis/slither_Contributors-flatten.sol.all_contracts.call-graph.png differ diff --git a/audits/internal1/analysis/slither_Contributors-flatten.sol.inheritance-graph.png b/audits/internal1/analysis/slither_Contributors-flatten.sol.inheritance-graph.png new file mode 100644 index 0000000..f5e0c34 Binary files /dev/null and b/audits/internal1/analysis/slither_Contributors-flatten.sol.inheritance-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.ContributorsProxy.call-graph.png b/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.ContributorsProxy.call-graph.png new file mode 100644 index 0000000..038f66d Binary files /dev/null and b/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.ContributorsProxy.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.all_contracts.call-graph.png b/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.all_contracts.call-graph.png new file mode 100644 index 0000000..ce1c5a3 Binary files /dev/null and b/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.all_contracts.call-graph.png differ diff --git a/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.inheritance-graph.png b/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.inheritance-graph.png new file mode 100644 index 0000000..fbc2dcf Binary files /dev/null and b/audits/internal1/analysis/slither_ContributorsProxy-flatten.sol.inheritance-graph.png differ diff --git a/audits/internal1/analysis/slither_call-graph.txt b/audits/internal1/analysis/slither_call-graph.txt new file mode 100644 index 0000000..22dd994 --- /dev/null +++ b/audits/internal1/analysis/slither_call-graph.txt @@ -0,0 +1,27 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers:Call Graph: ./ContributeManager-flatten.sol.all_contracts.call-graph.dot +Call Graph: ./ContributeManager-flatten.sol.IContributors.call-graph.dot +Call Graph: ./ContributeManager-flatten.sol.IService.call-graph.dot +Call Graph: ./ContributeManager-flatten.sol.IStaking.call-graph.dot +Call Graph: ./ContributeManager-flatten.sol.IToken.call-graph.dot +Call Graph: ./ContributeManager-flatten.sol.IMultisig.call-graph.dot +Call Graph: ./ContributeManager-flatten.sol.ContributeManager.call-graph.dot + +INFO:Printers:Call Graph: ./ContributorsProxy-flatten.sol.all_contracts.call-graph.dot +Call Graph: ./ContributorsProxy-flatten.sol.ContributorsProxy.call-graph.dot + +INFO:Printers:Call Graph: ./Contributors-flatten.sol.all_contracts.call-graph.dot +Call Graph: ./Contributors-flatten.sol.Contributors.call-graph.dot + +INFO:Printers:Call Graph: ./ContributeActivityChecker-flatten.sol.all_contracts.call-graph.dot +Call Graph: ./ContributeActivityChecker-flatten.sol.IContributors.call-graph.dot +Call Graph: ./ContributeActivityChecker-flatten.sol.ContributeActivityChecker.call-graph.dot + +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_constructor-calls.txt b/audits/internal1/analysis/slither_constructor-calls.txt new file mode 100644 index 0000000..f63c67f --- /dev/null +++ b/audits/internal1/analysis/slither_constructor-calls.txt @@ -0,0 +1,117 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +################################# +####### ContributeManager ####### +################################# + +## Constructor Call Sequence + - ContributeManager + +## Constructor Definitions + +### ContributeManager + + constructor( + address _contributorsProxy, + address _serviceManager, + address _olas, + address _stakingFactory, + address _safeMultisig, + address _fallbackHandler, + uint256 _agentId, + bytes32 _configHash + ) { + // Check for zero addresses + if (_contributorsProxy == address(0) || _serviceManager == address(0) || _olas == address(0) || + _stakingFactory == address(0) || _safeMultisig == address(0) || _fallbackHandler == address(0)) { + revert ZeroAddress(); + } + + // Check for zero values + if (_agentId == 0 || _configHash == 0) { + revert ZeroValue(); + } + + agentId = _agentId; + configHash = _configHash; + + contributorsProxy = _contributorsProxy; + serviceManager = _serviceManager; + olas = _olas; + stakingFactory = _stakingFactory; + safeMultisig = _safeMultisig; + fallbackHandler = _fallbackHandler; + serviceRegistry = IService(serviceManager).serviceRegistry(); + serviceRegistryTokenUtility = IService(serviceManager).serviceRegistryTokenUtility(); + } + +INFO:Printers: +################################# +####### ContributorsProxy ####### +################################# + +## Constructor Call Sequence + - ContributorsProxy + +## Constructor Definitions + +### ContributorsProxy + + constructor(address implementation, bytes memory contributorsData) { + // Check for the zero address, since the delegatecall works even with the zero one + if (implementation == address(0)) { + revert ZeroImplementationAddress(); + } + + // Check for the zero data + if (contributorsData.length == 0) { + revert ZeroContributorsData(); + } + + // Store the contributors implementation address + assembly { + sstore(CONTRIBUTORS_PROXY, implementation) + } + // Initialize proxy tokenomics storage + (bool success, ) = implementation.delegatecall(contributorsData); + if (!success) { + revert InitializationFailed(); + } + } + +INFO:Printers: +INFO:Printers: +######################################### +####### ContributeActivityChecker ####### +######################################### + +## Constructor Call Sequence + - ContributeActivityChecker + +## Constructor Definitions + +### ContributeActivityChecker + + constructor(address _contributorsProxy, uint256 _livenessRatio) { + // Check the zero address + if (_contributorsProxy == address(0)) { + revert ZeroAddress(); + } + + // Check for zero value + if (_livenessRatio == 0) { + revert ZeroValue(); + } + + contributorsProxy = _contributorsProxy; + livenessRatio = _livenessRatio; + } + +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_contract-summary.txt b/audits/internal1/analysis/slither_contract-summary.txt new file mode 100644 index 0000000..79175e8 --- /dev/null +++ b/audits/internal1/analysis/slither_contract-summary.txt @@ -0,0 +1,84 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: ++ Contract IContributors (Most derived contract) + - From IContributors + - mapSocialIdServiceInfo(address) (external) + - setServiceInfoForId(address,uint256,uint256,address,address) (external) + ++ Contract IService (Most derived contract) + - From IService + - activateRegistration(uint256) (external) + - create(address,address,bytes32,uint32[],IService.AgentParams[],uint32) (external) + - deploy(uint256,address,bytes) (external) + - mapServices(uint256) (external) + - registerAgents(uint256,address[],uint32[]) (external) + - serviceRegistry() (external) + - serviceRegistryTokenUtility() (external) + ++ Contract IStaking (Most derived contract) + - From IStaking + - claim(uint256) (external) + - minStakingDeposit() (external) + - numAgentInstances() (external) + - stake(uint256) (external) + - stakingToken() (external) + - threshold() (external) + - unstake(uint256) (external) + - verifyInstance(address) (external) + ++ Contract IToken (Most derived contract) + - From IToken + - approve(address,uint256) (external) + - transfer(address,uint256) (external) + - transferFrom(address,address,uint256) (external) + ++ Contract IMultisig (Most derived contract) + - From IMultisig + - getOwners() (external) + ++ Contract ContributeManager (Most derived contract) + - From ContributeManager + - _createAndDeploy(address,uint256) (internal) + - _stake(uint256,uint256,address,address) (internal) + - claim() (external) + - constructor(address,address,address,address,address,address,uint256,bytes32) (public) + - createAndStake(uint256,address) (external) + - stake(uint256,uint256,address) (external) + - unstake() (external) + +INFO:Printers: ++ Contract ContributorsProxy (Upgradeable Proxy) (Most derived contract) + - From ContributorsProxy + - constructor(address,bytes) (public) + - fallback() (external) + +INFO:Printers: ++ Contract Contributors (Most derived contract) + - From Contributors + - changeImplementation(address) (external) + - changeManager(address) (external) + - changeOwner(address) (external) + - increaseActivity(address[],uint256[]) (external) + - initialize(address) (external) + - setContributeAgentStatuses(address[],bool[]) (external) + - setServiceInfoForId(address,uint256,uint256,address,address) (external) + +INFO:Printers: ++ Contract IContributors (Most derived contract) + - From IContributors + - mapMutisigActivities(address) (external) + ++ Contract ContributeActivityChecker (Most derived contract) + - From ContributeActivityChecker + - constructor(address,uint256) (public) + - getMultisigNonces(address) (external) + - isRatioPass(uint256[],uint256[],uint256) (external) + +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_data-dependency.txt b/audits/internal1/analysis/slither_data-dependency.txt new file mode 100644 index 0000000..9c2cc40 --- /dev/null +++ b/audits/internal1/analysis/slither_data-dependency.txt @@ -0,0 +1,1287 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function setServiceInfoForId(address,uint256,uint256,address,address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Function mapSocialIdServiceInfo(address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function setServiceInfoForId(address,uint256,uint256,address,address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Function mapSocialIdServiceInfo(address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Contract IService ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function create(address,address,bytes32,uint32[],IService.AgentParams[],uint32) ++--------------+--------------+ +| Variable | Dependencies | ++--------------+--------------+ +| serviceOwner | [] | +| token | [] | +| configHash | [] | +| agentIds | [] | +| agentParams | [] | +| threshold | [] | +| serviceId | [] | ++--------------+--------------+ +Function activateRegistration(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| success | [] | ++-----------+--------------+ +Function registerAgents(uint256,address[],uint32[]) ++----------------+--------------+ +| Variable | Dependencies | ++----------------+--------------+ +| serviceId | [] | +| agentInstances | [] | +| agentIds | [] | +| success | [] | ++----------------+--------------+ +Function deploy(uint256,address,bytes) ++------------------------+--------------+ +| Variable | Dependencies | ++------------------------+--------------+ +| serviceId | [] | +| multisigImplementation | [] | +| data | [] | +| multisig | [] | ++------------------------+--------------+ +Function serviceRegistry() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function serviceRegistryTokenUtility() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function mapServices(uint256) ++----------------------+--------------+ +| Variable | Dependencies | ++----------------------+--------------+ +| serviceId | [] | +| securityDeposit | [] | +| multisig | [] | +| configHash | [] | +| threshold | [] | +| maxNumAgentInstances | [] | +| numAgentInstances | [] | +| state | [] | ++----------------------+--------------+ +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function setServiceInfoForId(address,uint256,uint256,address,address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Function mapSocialIdServiceInfo(address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Contract IService ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function create(address,address,bytes32,uint32[],IService.AgentParams[],uint32) ++--------------+--------------+ +| Variable | Dependencies | ++--------------+--------------+ +| serviceOwner | [] | +| token | [] | +| configHash | [] | +| agentIds | [] | +| agentParams | [] | +| threshold | [] | +| serviceId | [] | ++--------------+--------------+ +Function activateRegistration(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| success | [] | ++-----------+--------------+ +Function registerAgents(uint256,address[],uint32[]) ++----------------+--------------+ +| Variable | Dependencies | ++----------------+--------------+ +| serviceId | [] | +| agentInstances | [] | +| agentIds | [] | +| success | [] | ++----------------+--------------+ +Function deploy(uint256,address,bytes) ++------------------------+--------------+ +| Variable | Dependencies | ++------------------------+--------------+ +| serviceId | [] | +| multisigImplementation | [] | +| data | [] | +| multisig | [] | ++------------------------+--------------+ +Function serviceRegistry() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function serviceRegistryTokenUtility() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function mapServices(uint256) ++----------------------+--------------+ +| Variable | Dependencies | ++----------------------+--------------+ +| serviceId | [] | +| securityDeposit | [] | +| multisig | [] | +| configHash | [] | +| threshold | [] | +| maxNumAgentInstances | [] | +| numAgentInstances | [] | +| state | [] | ++----------------------+--------------+ +Contract IStaking ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function stakingToken() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function minStakingDeposit() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function numAgentInstances() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function threshold() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function stake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | ++-----------+--------------+ +Function unstake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function claim(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function verifyInstance(address) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| instance | [] | +| | [] | ++----------+--------------+ +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function setServiceInfoForId(address,uint256,uint256,address,address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Function mapSocialIdServiceInfo(address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Contract IService ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function create(address,address,bytes32,uint32[],IService.AgentParams[],uint32) ++--------------+--------------+ +| Variable | Dependencies | ++--------------+--------------+ +| serviceOwner | [] | +| token | [] | +| configHash | [] | +| agentIds | [] | +| agentParams | [] | +| threshold | [] | +| serviceId | [] | ++--------------+--------------+ +Function activateRegistration(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| success | [] | ++-----------+--------------+ +Function registerAgents(uint256,address[],uint32[]) ++----------------+--------------+ +| Variable | Dependencies | ++----------------+--------------+ +| serviceId | [] | +| agentInstances | [] | +| agentIds | [] | +| success | [] | ++----------------+--------------+ +Function deploy(uint256,address,bytes) ++------------------------+--------------+ +| Variable | Dependencies | ++------------------------+--------------+ +| serviceId | [] | +| multisigImplementation | [] | +| data | [] | +| multisig | [] | ++------------------------+--------------+ +Function serviceRegistry() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function serviceRegistryTokenUtility() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function mapServices(uint256) ++----------------------+--------------+ +| Variable | Dependencies | ++----------------------+--------------+ +| serviceId | [] | +| securityDeposit | [] | +| multisig | [] | +| configHash | [] | +| threshold | [] | +| maxNumAgentInstances | [] | +| numAgentInstances | [] | +| state | [] | ++----------------------+--------------+ +Contract IStaking ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function stakingToken() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function minStakingDeposit() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function numAgentInstances() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function threshold() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function stake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | ++-----------+--------------+ +Function unstake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function claim(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function verifyInstance(address) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| instance | [] | +| | [] | ++----------+--------------+ +Contract IToken ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function transfer(address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| to | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Function transferFrom(address,address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| from | [] | +| to | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Function approve(address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| spender | [] | +| amount | [] | +| | [] | ++----------+--------------+ +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function setServiceInfoForId(address,uint256,uint256,address,address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Function mapSocialIdServiceInfo(address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Contract IService ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function create(address,address,bytes32,uint32[],IService.AgentParams[],uint32) ++--------------+--------------+ +| Variable | Dependencies | ++--------------+--------------+ +| serviceOwner | [] | +| token | [] | +| configHash | [] | +| agentIds | [] | +| agentParams | [] | +| threshold | [] | +| serviceId | [] | ++--------------+--------------+ +Function activateRegistration(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| success | [] | ++-----------+--------------+ +Function registerAgents(uint256,address[],uint32[]) ++----------------+--------------+ +| Variable | Dependencies | ++----------------+--------------+ +| serviceId | [] | +| agentInstances | [] | +| agentIds | [] | +| success | [] | ++----------------+--------------+ +Function deploy(uint256,address,bytes) ++------------------------+--------------+ +| Variable | Dependencies | ++------------------------+--------------+ +| serviceId | [] | +| multisigImplementation | [] | +| data | [] | +| multisig | [] | ++------------------------+--------------+ +Function serviceRegistry() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function serviceRegistryTokenUtility() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function mapServices(uint256) ++----------------------+--------------+ +| Variable | Dependencies | ++----------------------+--------------+ +| serviceId | [] | +| securityDeposit | [] | +| multisig | [] | +| configHash | [] | +| threshold | [] | +| maxNumAgentInstances | [] | +| numAgentInstances | [] | +| state | [] | ++----------------------+--------------+ +Contract IStaking ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function stakingToken() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function minStakingDeposit() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function numAgentInstances() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function threshold() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function stake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | ++-----------+--------------+ +Function unstake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function claim(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function verifyInstance(address) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| instance | [] | +| | [] | ++----------+--------------+ +Contract IToken ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function transfer(address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| to | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Function transferFrom(address,address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| from | [] | +| to | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Function approve(address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| spender | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Contract IMultisig ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function getOwners() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function setServiceInfoForId(address,uint256,uint256,address,address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Function mapSocialIdServiceInfo(address) ++-----------------+--------------+ +| Variable | Dependencies | ++-----------------+--------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | ++-----------------+--------------+ +Contract IService ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function create(address,address,bytes32,uint32[],IService.AgentParams[],uint32) ++--------------+--------------+ +| Variable | Dependencies | ++--------------+--------------+ +| serviceOwner | [] | +| token | [] | +| configHash | [] | +| agentIds | [] | +| agentParams | [] | +| threshold | [] | +| serviceId | [] | ++--------------+--------------+ +Function activateRegistration(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| success | [] | ++-----------+--------------+ +Function registerAgents(uint256,address[],uint32[]) ++----------------+--------------+ +| Variable | Dependencies | ++----------------+--------------+ +| serviceId | [] | +| agentInstances | [] | +| agentIds | [] | +| success | [] | ++----------------+--------------+ +Function deploy(uint256,address,bytes) ++------------------------+--------------+ +| Variable | Dependencies | ++------------------------+--------------+ +| serviceId | [] | +| multisigImplementation | [] | +| data | [] | +| multisig | [] | ++------------------------+--------------+ +Function serviceRegistry() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function serviceRegistryTokenUtility() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function mapServices(uint256) ++----------------------+--------------+ +| Variable | Dependencies | ++----------------------+--------------+ +| serviceId | [] | +| securityDeposit | [] | +| multisig | [] | +| configHash | [] | +| threshold | [] | +| maxNumAgentInstances | [] | +| numAgentInstances | [] | +| state | [] | ++----------------------+--------------+ +Contract IStaking ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function stakingToken() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function minStakingDeposit() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function numAgentInstances() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function threshold() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Function stake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | ++-----------+--------------+ +Function unstake(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function claim(uint256) ++-----------+--------------+ +| Variable | Dependencies | ++-----------+--------------+ +| serviceId | [] | +| | [] | ++-----------+--------------+ +Function verifyInstance(address) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| instance | [] | +| | [] | ++----------+--------------+ +Contract IToken ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function transfer(address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| to | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Function transferFrom(address,address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| from | [] | +| to | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Function approve(address,uint256) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| spender | [] | +| amount | [] | +| | [] | ++----------+--------------+ +Contract IMultisig ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function getOwners() ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| | [] | ++----------+--------------+ +Contract ContributeManager ++-----------------------------+----------------------------------------------------------------------+ +| Variable | Dependencies | ++-----------------------------+----------------------------------------------------------------------+ +| NUM_AGENT_INSTANCES | ['NUM_AGENT_INSTANCES'] | +| THRESHOLD | ['THRESHOLD'] | +| agentId | ['_agentId', 'agentId'] | +| configHash | ['_configHash', 'configHash'] | +| contributorsProxy | ['_contributorsProxy', 'contributorsProxy'] | +| serviceManager | ['_serviceManager', 'serviceManager'] | +| olas | ['_olas', 'olas'] | +| serviceRegistry | ['_serviceManager', 'serviceManager', 'serviceRegistry'] | +| serviceRegistryTokenUtility | ['_serviceManager', 'serviceManager', 'serviceRegistryTokenUtility'] | +| stakingFactory | ['_stakingFactory', 'stakingFactory'] | +| safeMultisig | ['_safeMultisig', 'safeMultisig'] | +| fallbackHandler | ['_fallbackHandler', 'fallbackHandler'] | +| nonce | ['localNonce', 'nonce'] | ++-----------------------------+----------------------------------------------------------------------+ + +Function constructor(address,address,address,address,address,address,uint256,bytes32) ++-----------------------------------------------+---------------------------------------+ +| Variable | Dependencies | ++-----------------------------------------------+---------------------------------------+ +| _contributorsProxy | [] | +| _serviceManager | [] | +| _olas | [] | +| _stakingFactory | [] | +| _safeMultisig | [] | +| _fallbackHandler | [] | +| _agentId | [] | +| _configHash | [] | +| ContributeManager.NUM_AGENT_INSTANCES | [] | +| ContributeManager.THRESHOLD | [] | +| ContributeManager.agentId | ['_agentId'] | +| ContributeManager.configHash | ['_configHash'] | +| ContributeManager.contributorsProxy | ['_contributorsProxy'] | +| ContributeManager.serviceManager | ['_serviceManager', 'serviceManager'] | +| ContributeManager.olas | ['_olas'] | +| ContributeManager.serviceRegistry | ['_serviceManager', 'serviceManager'] | +| ContributeManager.serviceRegistryTokenUtility | ['_serviceManager', 'serviceManager'] | +| ContributeManager.stakingFactory | ['_stakingFactory'] | +| ContributeManager.safeMultisig | ['_safeMultisig'] | +| ContributeManager.fallbackHandler | ['_fallbackHandler'] | +| ContributeManager.nonce | [] | ++-----------------------------------------------+---------------------------------------+ +Function _createAndDeploy(address,uint256) ++-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Variable | Dependencies | ++-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| token | ['olas'] | +| minStakingDeposit | ['minStakingDeposit'] | +| serviceId | ['NUM_AGENT_INSTANCES', 'THRESHOLD', 'agentId', 'agentIds', 'agentParams', 'configHash', 'minStakingDeposit', 'olas', 'serviceManager', 'this', 'token'] | +| multisig | ['NUM_AGENT_INSTANCES', 'THRESHOLD', 'agentId', 'agentIds', 'agentParams', 'block.timestamp', 'configHash', 'data', 'fallbackHandler', 'localNonce', 'minStakingDeposit', 'msg.sender', 'nonce', 'olas', 'randomNonce', 'safeMultisig', 'serviceId', 'serviceManager', 'this', 'token'] | +| agentParams | ['NUM_AGENT_INSTANCES', 'agentParams', 'minStakingDeposit'] | +| agentIds | ['NUM_AGENT_INSTANCES', 'agentId', 'agentIds'] | +| instances | ['NUM_AGENT_INSTANCES', 'instances', 'msg.sender'] | +| localNonce | ['nonce'] | +| randomNonce | ['block.timestamp', 'localNonce', 'msg.sender', 'nonce'] | +| data | ['block.timestamp', 'fallbackHandler', 'localNonce', 'msg.sender', 'nonce', 'randomNonce'] | +| ContributeManager.NUM_AGENT_INSTANCES | ['NUM_AGENT_INSTANCES'] | +| ContributeManager.THRESHOLD | ['THRESHOLD'] | +| ContributeManager.agentId | ['agentId'] | +| ContributeManager.configHash | ['configHash'] | +| ContributeManager.contributorsProxy | [] | +| ContributeManager.serviceManager | ['serviceManager'] | +| ContributeManager.olas | [] | +| ContributeManager.serviceRegistry | [] | +| ContributeManager.serviceRegistryTokenUtility | [] | +| ContributeManager.stakingFactory | [] | +| ContributeManager.safeMultisig | ['safeMultisig'] | +| ContributeManager.fallbackHandler | ['fallbackHandler'] | +| ContributeManager.nonce | ['localNonce', 'nonce'] | ++-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +Function _stake(uint256,uint256,address,address) ++-----------------------------------------------+-----------------------+ +| Variable | Dependencies | ++-----------------------------------------------+-----------------------+ +| socialId | ['socialId'] | +| serviceId | ['serviceId'] | +| multisig | ['multisig'] | +| stakingInstance | ['stakingInstance'] | +| ContributeManager.NUM_AGENT_INSTANCES | [] | +| ContributeManager.THRESHOLD | [] | +| ContributeManager.agentId | [] | +| ContributeManager.configHash | [] | +| ContributeManager.contributorsProxy | ['contributorsProxy'] | +| ContributeManager.serviceManager | [] | +| ContributeManager.olas | [] | +| ContributeManager.serviceRegistry | ['serviceRegistry'] | +| ContributeManager.serviceRegistryTokenUtility | [] | +| ContributeManager.stakingFactory | [] | +| ContributeManager.safeMultisig | [] | +| ContributeManager.fallbackHandler | [] | +| ContributeManager.nonce | [] | ++-----------------------------------------------+-----------------------+ +Function createAndStake(uint256,address) ++-----------------------------------------------+-----------------------------------------------------------------+ +| Variable | Dependencies | ++-----------------------------------------------+-----------------------------------------------------------------+ +| socialId | [] | +| stakingInstance | [] | +| serviceId | ['TUPLE_0', 'TUPLE_1', 'contributorsProxy', 'msg.sender'] | +| multisig | ['TUPLE_0', 'TUPLE_1', 'contributorsProxy', 'msg.sender'] | +| token | ['stakingInstance'] | +| minStakingDeposit | ['stakingInstance'] | +| numAgentInstances | ['stakingInstance'] | +| threshold | ['stakingInstance'] | +| totalBond | ['NUM_AGENT_INSTANCES', 'minStakingDeposit', 'stakingInstance'] | +| ContributeManager.NUM_AGENT_INSTANCES | ['NUM_AGENT_INSTANCES'] | +| ContributeManager.THRESHOLD | ['THRESHOLD'] | +| ContributeManager.agentId | [] | +| ContributeManager.configHash | [] | +| ContributeManager.contributorsProxy | ['contributorsProxy'] | +| ContributeManager.serviceManager | [] | +| ContributeManager.olas | ['olas'] | +| ContributeManager.serviceRegistry | [] | +| ContributeManager.serviceRegistryTokenUtility | ['serviceRegistryTokenUtility'] | +| ContributeManager.stakingFactory | ['stakingFactory'] | +| ContributeManager.safeMultisig | [] | +| ContributeManager.fallbackHandler | [] | +| ContributeManager.nonce | [] | ++-----------------------------------------------+-----------------------------------------------------------------+ +Function stake(uint256,uint256,address) ++-----------------------------------------------+-------------------------------------------------------------------------------------------+ +| Variable | Dependencies | ++-----------------------------------------------+-------------------------------------------------------------------------------------------+ +| socialId | [] | +| serviceId | [] | +| stakingInstance | [] | +| serviceIdCheck | ['TUPLE_2', 'contributorsProxy', 'msg.sender'] | +| multisig | ['TUPLE_2', 'TUPLE_3', 'contributorsProxy', 'msg.sender', 'serviceId', 'serviceRegistry'] | +| numAgentInstances | ['stakingInstance'] | +| multisigOwners | ['TUPLE_3', 'multisig', 'multisigOwners', 'serviceId', 'serviceRegistry'] | +| ContributeManager.NUM_AGENT_INSTANCES | [] | +| ContributeManager.THRESHOLD | [] | +| ContributeManager.agentId | [] | +| ContributeManager.configHash | [] | +| ContributeManager.contributorsProxy | ['contributorsProxy'] | +| ContributeManager.serviceManager | [] | +| ContributeManager.olas | [] | +| ContributeManager.serviceRegistry | ['serviceRegistry'] | +| ContributeManager.serviceRegistryTokenUtility | [] | +| ContributeManager.stakingFactory | [] | +| ContributeManager.safeMultisig | [] | +| ContributeManager.fallbackHandler | [] | +| ContributeManager.nonce | [] | ++-----------------------------------------------+-------------------------------------------------------------------------------------------+ +Function unstake() ++-----------------------------------------------+------------------------------------------------+ +| Variable | Dependencies | ++-----------------------------------------------+------------------------------------------------+ +| socialId | ['TUPLE_4', 'contributorsProxy', 'msg.sender'] | +| serviceId | ['TUPLE_4', 'contributorsProxy', 'msg.sender'] | +| multisig | ['TUPLE_4', 'contributorsProxy', 'msg.sender'] | +| stakingInstance | ['TUPLE_4', 'contributorsProxy', 'msg.sender'] | +| ContributeManager.NUM_AGENT_INSTANCES | [] | +| ContributeManager.THRESHOLD | [] | +| ContributeManager.agentId | [] | +| ContributeManager.configHash | [] | +| ContributeManager.contributorsProxy | ['contributorsProxy'] | +| ContributeManager.serviceManager | [] | +| ContributeManager.olas | [] | +| ContributeManager.serviceRegistry | ['serviceRegistry'] | +| ContributeManager.serviceRegistryTokenUtility | [] | +| ContributeManager.stakingFactory | [] | +| ContributeManager.safeMultisig | [] | +| ContributeManager.fallbackHandler | [] | +| ContributeManager.nonce | [] | ++-----------------------------------------------+------------------------------------------------+ +Function claim() ++-----------------------------------------------+--------------------------------------------------------------------------------+ +| Variable | Dependencies | ++-----------------------------------------------+--------------------------------------------------------------------------------+ +| reward | ['TUPLE_5', 'contributorsProxy', 'msg.sender', 'serviceId', 'stakingInstance'] | +| socialId | ['TUPLE_5', 'contributorsProxy', 'msg.sender'] | +| serviceId | ['TUPLE_5', 'contributorsProxy', 'msg.sender'] | +| multisig | ['TUPLE_5', 'contributorsProxy', 'msg.sender'] | +| stakingInstance | ['TUPLE_5', 'contributorsProxy', 'msg.sender'] | +| ContributeManager.NUM_AGENT_INSTANCES | [] | +| ContributeManager.THRESHOLD | [] | +| ContributeManager.agentId | [] | +| ContributeManager.configHash | [] | +| ContributeManager.contributorsProxy | ['contributorsProxy'] | +| ContributeManager.serviceManager | [] | +| ContributeManager.olas | [] | +| ContributeManager.serviceRegistry | [] | +| ContributeManager.serviceRegistryTokenUtility | [] | +| ContributeManager.stakingFactory | [] | +| ContributeManager.safeMultisig | [] | +| ContributeManager.fallbackHandler | [] | +| ContributeManager.nonce | [] | ++-----------------------------------------------+--------------------------------------------------------------------------------+ +Function slitherConstructorConstantVariables() ++-----------------------------------------------+--------------+ +| Variable | Dependencies | ++-----------------------------------------------+--------------+ +| ContributeManager.NUM_AGENT_INSTANCES | [] | +| ContributeManager.THRESHOLD | [] | +| ContributeManager.agentId | [] | +| ContributeManager.configHash | [] | +| ContributeManager.contributorsProxy | [] | +| ContributeManager.serviceManager | [] | +| ContributeManager.olas | [] | +| ContributeManager.serviceRegistry | [] | +| ContributeManager.serviceRegistryTokenUtility | [] | +| ContributeManager.stakingFactory | [] | +| ContributeManager.safeMultisig | [] | +| ContributeManager.fallbackHandler | [] | +| ContributeManager.nonce | [] | ++-----------------------------------------------+--------------+ +INFO:Printers: +Contract ContributorsProxy ++--------------------+------------------------+ +| Variable | Dependencies | ++--------------------+------------------------+ +| CONTRIBUTORS_PROXY | ['CONTRIBUTORS_PROXY'] | ++--------------------+------------------------+ + +Function constructor(address,bytes) ++--------------------------------------+---------------------------------------------------+ +| Variable | Dependencies | ++--------------------------------------+---------------------------------------------------+ +| implementation | [] | +| contributorsData | ['contributorsData'] | +| success | ['TUPLE_0', 'contributorsData', 'implementation'] | +| ContributorsProxy.CONTRIBUTORS_PROXY | ['CONTRIBUTORS_PROXY'] | ++--------------------------------------+---------------------------------------------------+ +Function fallback() ++--------------------------------------+------------------------+ +| Variable | Dependencies | ++--------------------------------------+------------------------+ +| ContributorsProxy.CONTRIBUTORS_PROXY | ['CONTRIBUTORS_PROXY'] | ++--------------------------------------+------------------------+ +Function slitherConstructorConstantVariables() ++--------------------------------------+--------------+ +| Variable | Dependencies | ++--------------------------------------+--------------+ +| ContributorsProxy.CONTRIBUTORS_PROXY | [] | ++--------------------------------------+--------------+ +INFO:Printers: +Contract Contributors ++------------------------+---------------------------------------------------------------------------------------------------+ +| Variable | Dependencies | ++------------------------+---------------------------------------------------------------------------------------------------+ +| VERSION | [] | +| CONTRIBUTORS_PROXY | ['CONTRIBUTORS_PROXY'] | +| owner | ['msg.sender', 'newOwner', 'owner'] | +| manager | ['_manager', 'manager', 'newManager'] | +| mapSocialIdServiceInfo | ['mapSocialIdServiceInfo', 'multisig', 'serviceId', 'serviceInfo', 'socialId', 'stakingInstance'] | +| mapMutisigActivities | ['activityChanges', 'mapMutisigActivities'] | +| mapContributeAgents | ['mapContributeAgents', 'statuses'] | ++------------------------+---------------------------------------------------------------------------------------------------+ + +Function initialize(address) ++-------------------------------------+-------------------------+ +| Variable | Dependencies | ++-------------------------------------+-------------------------+ +| _manager | [] | +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | [] | +| Contributors.owner | ['msg.sender', 'owner'] | +| Contributors.manager | ['_manager'] | +| Contributors.mapSocialIdServiceInfo | [] | +| Contributors.mapMutisigActivities | [] | +| Contributors.mapContributeAgents | [] | ++-------------------------------------+-------------------------+ +Function changeImplementation(address) ++-------------------------------------+------------------------+ +| Variable | Dependencies | ++-------------------------------------+------------------------+ +| newImplementation | [] | +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | ['CONTRIBUTORS_PROXY'] | +| Contributors.owner | ['owner'] | +| Contributors.manager | [] | +| Contributors.mapSocialIdServiceInfo | [] | +| Contributors.mapMutisigActivities | [] | +| Contributors.mapContributeAgents | [] | ++-------------------------------------+------------------------+ +Function changeOwner(address) ++-------------------------------------+-----------------------+ +| Variable | Dependencies | ++-------------------------------------+-----------------------+ +| newOwner | [] | +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | [] | +| Contributors.owner | ['newOwner', 'owner'] | +| Contributors.manager | [] | +| Contributors.mapSocialIdServiceInfo | [] | +| Contributors.mapMutisigActivities | [] | +| Contributors.mapContributeAgents | [] | ++-------------------------------------+-----------------------+ +Function changeManager(address) ++-------------------------------------+----------------+ +| Variable | Dependencies | ++-------------------------------------+----------------+ +| newManager | [] | +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | [] | +| Contributors.owner | ['owner'] | +| Contributors.manager | ['newManager'] | +| Contributors.mapSocialIdServiceInfo | [] | +| Contributors.mapMutisigActivities | [] | +| Contributors.mapContributeAgents | [] | ++-------------------------------------+----------------+ +Function setServiceInfoForId(address,uint256,uint256,address,address) ++-------------------------------------+---------------------------------------------------------------------------------------------------+ +| Variable | Dependencies | ++-------------------------------------+---------------------------------------------------------------------------------------------------+ +| serviceOwner | [] | +| socialId | [] | +| serviceId | [] | +| multisig | [] | +| stakingInstance | [] | +| serviceInfo | ['multisig', 'serviceId', 'serviceInfo', 'socialId', 'stakingInstance'] | +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | [] | +| Contributors.owner | [] | +| Contributors.manager | ['manager'] | +| Contributors.mapSocialIdServiceInfo | ['mapSocialIdServiceInfo', 'multisig', 'serviceId', 'serviceInfo', 'socialId', 'stakingInstance'] | +| Contributors.mapMutisigActivities | [] | +| Contributors.mapContributeAgents | [] | ++-------------------------------------+---------------------------------------------------------------------------------------------------+ +Function setContributeAgentStatuses(address[],bool[]) ++-------------------------------------+-------------------------------------+ +| Variable | Dependencies | ++-------------------------------------+-------------------------------------+ +| contributeAgents | ['contributeAgents'] | +| statuses | ['statuses'] | +| i | ['i'] | +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | [] | +| Contributors.owner | ['owner'] | +| Contributors.manager | [] | +| Contributors.mapSocialIdServiceInfo | [] | +| Contributors.mapMutisigActivities | [] | +| Contributors.mapContributeAgents | ['mapContributeAgents', 'statuses'] | ++-------------------------------------+-------------------------------------+ +Function increaseActivity(address[],uint256[]) ++-------------------------------------+---------------------------------------------+ +| Variable | Dependencies | ++-------------------------------------+---------------------------------------------+ +| multisigs | ['multisigs'] | +| activityChanges | ['activityChanges'] | +| i | ['i'] | +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | [] | +| Contributors.owner | [] | +| Contributors.manager | [] | +| Contributors.mapSocialIdServiceInfo | [] | +| Contributors.mapMutisigActivities | ['activityChanges', 'mapMutisigActivities'] | +| Contributors.mapContributeAgents | ['mapContributeAgents'] | ++-------------------------------------+---------------------------------------------+ +Function slitherConstructorConstantVariables() ++-------------------------------------+--------------+ +| Variable | Dependencies | ++-------------------------------------+--------------+ +| Contributors.VERSION | [] | +| Contributors.CONTRIBUTORS_PROXY | [] | +| Contributors.owner | [] | +| Contributors.manager | [] | +| Contributors.mapSocialIdServiceInfo | [] | +| Contributors.mapMutisigActivities | [] | +| Contributors.mapContributeAgents | [] | ++-------------------------------------+--------------+ +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function mapMutisigActivities(address) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| multisig | [] | +| | [] | ++----------+--------------+ +INFO:Printers: +Contract IContributors ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ ++----------+--------------+ + +Function mapMutisigActivities(address) ++----------+--------------+ +| Variable | Dependencies | ++----------+--------------+ +| multisig | [] | +| | [] | ++----------+--------------+ +Contract ContributeActivityChecker ++-------------------+---------------------------------------------+ +| Variable | Dependencies | ++-------------------+---------------------------------------------+ +| livenessRatio | ['_livenessRatio', 'livenessRatio'] | +| contributorsProxy | ['_contributorsProxy', 'contributorsProxy'] | ++-------------------+---------------------------------------------+ + +Function constructor(address,uint256) ++---------------------------------------------+------------------------+ +| Variable | Dependencies | ++---------------------------------------------+------------------------+ +| _contributorsProxy | [] | +| _livenessRatio | [] | +| ContributeActivityChecker.livenessRatio | ['_livenessRatio'] | +| ContributeActivityChecker.contributorsProxy | ['_contributorsProxy'] | ++---------------------------------------------+------------------------+ +Function getMultisigNonces(address) ++---------------------------------------------+---------------------------------------------+ +| Variable | Dependencies | ++---------------------------------------------+---------------------------------------------+ +| multisig | [] | +| nonces | ['contributorsProxy', 'multisig', 'nonces'] | +| ContributeActivityChecker.livenessRatio | [] | +| ContributeActivityChecker.contributorsProxy | ['contributorsProxy'] | ++---------------------------------------------+---------------------------------------------+ +Function isRatioPass(uint256[],uint256[],uint256) ++---------------------------------------------+-------------------------------------------------------------+ +| Variable | Dependencies | ++---------------------------------------------+-------------------------------------------------------------+ +| curNonces | ['curNonces'] | +| lastNonces | ['lastNonces'] | +| ts | [] | +| ratioPass | ['curNonces', 'lastNonces', 'livenessRatio', 'ratio', 'ts'] | +| ratio | ['curNonces', 'lastNonces', 'ts'] | +| ContributeActivityChecker.livenessRatio | ['livenessRatio'] | +| ContributeActivityChecker.contributorsProxy | [] | ++---------------------------------------------+-------------------------------------------------------------+ +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_full.txt b/audits/internal1/analysis/slither_full.txt new file mode 100644 index 0000000..e7432ba --- /dev/null +++ b/audits/internal1/analysis/slither_full.txt @@ -0,0 +1,33 @@ + + +Reentrancy in ContributeManager.createAndStake(uint256,address) (ContributeManager-flatten.sol#361-411): + External calls: + - IToken(olas).transferFrom(msg.sender,address(this),totalBond) (ContributeManager-flatten.sol#400) + - IToken(olas).approve(serviceRegistryTokenUtility,totalBond) (ContributeManager-flatten.sol#402) + - (serviceId,multisig) = _createAndDeploy(olas,minStakingDeposit) (ContributeManager-flatten.sol#405) + - serviceId = IService(serviceManager).create(address(this),token,configHash,agentIds,agentParams,uint32(THRESHOLD)) (ContributeManager-flatten.sol#320-321) + - IService(serviceManager).activateRegistration{value: 1}(serviceId) (ContributeManager-flatten.sol#324) + - IService(serviceManager).registerAgents{value: NUM_AGENT_INSTANCES}(serviceId,instances,agentIds) (ContributeManager-flatten.sol#327) + - multisig = IService(serviceManager).deploy(serviceId,safeMultisig,data) (ContributeManager-flatten.sol#335) + - _stake(socialId,serviceId,multisig,stakingInstance) (ContributeManager-flatten.sol#408) + - IContributors(contributorsProxy).setServiceInfoForId(msg.sender,socialId,serviceId,multisig,stakingInstance) (ContributeManager-flatten.sol#348) + - IToken(serviceRegistry).approve(stakingInstance,serviceId) (ContributeManager-flatten.sol#351) + - IStaking(stakingInstance).stake(serviceId) (ContributeManager-flatten.sol#354) + External calls sending eth: + - (serviceId,multisig) = _createAndDeploy(olas,minStakingDeposit) (ContributeManager-flatten.sol#405) + - IService(serviceManager).activateRegistration{value: 1}(serviceId) (ContributeManager-flatten.sol#324) + - IService(serviceManager).registerAgents{value: NUM_AGENT_INSTANCES}(serviceId,instances,agentIds) (ContributeManager-flatten.sol#327) + Event emitted after the call(s): + - CreatedAndStaked(socialId,msg.sender,serviceId,multisig,stakingInstance) (ContributeManager-flatten.sol#410) + +Reentrancy in ContributeManager.unstake() (ContributeManager-flatten.sol#444-463): + External calls: + - IStaking(stakingInstance).unstake(serviceId) (ContributeManager-flatten.sol#453) + - IToken(serviceRegistry).transfer(msg.sender,serviceId) (ContributeManager-flatten.sol#456) + - IContributors(contributorsProxy).setServiceInfoForId(msg.sender,0,0,address(0),address(0)) (ContributeManager-flatten.sol#460) + Event emitted after the call(s): + - Unstaked(socialId,msg.sender,serviceId,multisig,stakingInstance) (ContributeManager-flatten.sol#462) +Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-3 + + + diff --git a/audits/internal1/analysis/slither_function-summary.txt b/audits/internal1/analysis/slither_function-summary.txt new file mode 100644 index 0000000..b8c2d3e --- /dev/null +++ b/audits/internal1/analysis/slither_function-summary.txt @@ -0,0 +1,228 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +Contract IContributors +Contract vars: [] +Inheritance:: [] + ++--------------------------------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++--------------------------------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| setServiceInfoForId(address,uint256,uint256,address,address) | external | [] | [] | [] | [] | [] | 2 | +| mapSocialIdServiceInfo(address) | external | [] | [] | [] | [] | [] | 2 | ++--------------------------------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract IService +Contract vars: [] +Inheritance:: [] + ++------------------------------------------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++------------------------------------------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| create(address,address,bytes32,uint32[],IService.AgentParams[],uint32) | external | [] | [] | [] | [] | [] | 2 | +| activateRegistration(uint256) | external | [] | [] | [] | [] | [] | 2 | +| registerAgents(uint256,address[],uint32[]) | external | [] | [] | [] | [] | [] | 2 | +| deploy(uint256,address,bytes) | external | [] | [] | [] | [] | [] | 2 | +| serviceRegistry() | external | [] | [] | [] | [] | [] | 2 | +| serviceRegistryTokenUtility() | external | [] | [] | [] | [] | [] | 2 | +| mapServices(uint256) | external | [] | [] | [] | [] | [] | 2 | ++------------------------------------------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract IStaking +Contract vars: [] +Inheritance:: [] + ++-------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| stakingToken() | external | [] | [] | [] | [] | [] | 2 | +| minStakingDeposit() | external | [] | [] | [] | [] | [] | 2 | +| numAgentInstances() | external | [] | [] | [] | [] | [] | 2 | +| threshold() | external | [] | [] | [] | [] | [] | 2 | +| stake(uint256) | external | [] | [] | [] | [] | [] | 2 | +| unstake(uint256) | external | [] | [] | [] | [] | [] | 2 | +| claim(uint256) | external | [] | [] | [] | [] | [] | 2 | +| verifyInstance(address) | external | [] | [] | [] | [] | [] | 2 | ++-------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract IToken +Contract vars: [] +Inheritance:: [] + ++---------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++---------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| transfer(address,uint256) | external | [] | [] | [] | [] | [] | 2 | +| transferFrom(address,address,uint256) | external | [] | [] | [] | [] | [] | 2 | +| approve(address,uint256) | external | [] | [] | [] | [] | [] | 2 | ++---------------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract IMultisig +Contract vars: [] +Inheritance:: [] + ++-------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| getOwners() | external | [] | [] | [] | [] | [] | 2 | ++-------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract ContributeManager +Contract vars: ['NUM_AGENT_INSTANCES', 'THRESHOLD', 'agentId', 'configHash', 'contributorsProxy', 'serviceManager', 'olas', 'serviceRegistry', 'serviceRegistryTokenUtility', 'stakingFactory', 'safeMultisig', 'fallbackHandler', 'nonce'] +Inheritance:: [] + ++------------------------------------------------------------------------------+------------+-----------+-----------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++------------------------------------------------------------------------------+------------+-----------+-----------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+ +| constructor(address,address,address,address,address,address,uint256,bytes32) | public | [] | ['serviceManager'] | ['agentId', 'configHash'] | ['revert ZeroAddress()', 'revert ZeroValue()'] | ['IService(serviceManager).serviceRegistry()', 'IService(serviceManager).serviceRegistryTokenUtility()'] | 3 | +| | | | | ['contributorsProxy', 'fallbackHandler'] | | | | +| | | | | ['olas', 'safeMultisig'] | | | | +| | | | | ['serviceManager', 'serviceRegistry'] | | | | +| | | | | ['serviceRegistryTokenUtility', 'stakingFactory'] | | | | +| _createAndDeploy(address,uint256) | internal | [] | ['NUM_AGENT_INSTANCES', 'THRESHOLD'] | ['nonce'] | ['abi.encodePacked()', 'keccak256(bytes)'] | ['IService(serviceManager).activateRegistration{value: 1}(serviceId)', 'IService(serviceManager).create(address(this),token,configHash,agentIds,agentParams,uint32(THRESHOLD))'] | 1 | +| | | | ['agentId', 'block.timestamp'] | | | ['IService(serviceManager).deploy(serviceId,safeMultisig,data)', 'IService(serviceManager).registerAgents{value: NUM_AGENT_INSTANCES}(serviceId,instances,agentIds)'] | | +| | | | ['configHash', 'fallbackHandler'] | | | ['IService.AgentParams(uint32(NUM_AGENT_INSTANCES),uint96(minStakingDeposit))', 'abi.encodePacked(address(0),fallbackHandler,address(0),address(0),uint256(0),randomNonce,0x)'] | | +| | | | ['msg.sender', 'nonce'] | | | ['abi.encodePacked(block.timestamp,msg.sender,localNonce)', 'new IService.AgentParams[](NUM_AGENT_INSTANCES)'] | | +| | | | ['safeMultisig', 'serviceManager'] | | | ['new address[](NUM_AGENT_INSTANCES)', 'new uint32[](NUM_AGENT_INSTANCES)'] | | +| | | | ['this'] | | | | | +| _stake(uint256,uint256,address,address) | internal | [] | ['contributorsProxy', 'msg.sender'] | [] | [] | ['IContributors(contributorsProxy).setServiceInfoForId(msg.sender,socialId,serviceId,multisig,stakingInstance)', 'IStaking(stakingInstance).stake(serviceId)'] | 1 | +| | | | ['serviceRegistry'] | | | ['IToken(serviceRegistry).approve(stakingInstance,serviceId)'] | | +| createAndStake(uint256,address) | external | [] | ['NUM_AGENT_INSTANCES', 'THRESHOLD'] | [] | ['_createAndDeploy', '_stake'] | ['IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender)', 'IStaking(stakingFactory).verifyInstance(stakingInstance)'] | 6 | +| | | | ['contributorsProxy', 'msg.sender'] | | ['revert ServiceAlreadyStaked(uint256,uint256,address)', 'revert WrongStakingInstance(address)'] | ['IStaking(stakingInstance).minStakingDeposit()', 'IStaking(stakingInstance).numAgentInstances()'] | | +| | | | ['olas', 'serviceRegistryTokenUtility'] | | ['revert ZeroValue()'] | ['IStaking(stakingInstance).stakingToken()', 'IStaking(stakingInstance).threshold()'] | | +| | | | ['stakingFactory', 'this'] | | | ['IToken(olas).approve(serviceRegistryTokenUtility,totalBond)', 'IToken(olas).transferFrom(msg.sender,address(this),totalBond)'] | | +| stake(uint256,uint256,address) | external | [] | ['contributorsProxy', 'msg.sender'] | [] | ['_stake', 'revert ServiceAlreadyStaked(uint256,uint256,address)'] | ['IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender)', 'IMultisig(multisig).getOwners()'] | 3 | +| | | | ['serviceRegistry', 'this'] | | ['revert WrongServiceSetup(uint256,uint256,address)'] | ['IService(serviceRegistry).mapServices(serviceId)', 'IStaking(stakingInstance).numAgentInstances()'] | | +| | | | | | | ['IToken(serviceRegistry).transferFrom(msg.sender,address(this),serviceId)'] | | +| unstake() | external | [] | ['contributorsProxy', 'msg.sender'] | [] | ['revert ServiceNotDefined(uint256)'] | ['IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender)', 'IContributors(contributorsProxy).setServiceInfoForId(msg.sender,0,0,address(0),address(0))'] | 2 | +| | | | ['serviceRegistry'] | | | ['IStaking(stakingInstance).unstake(serviceId)', 'IToken(serviceRegistry).transfer(msg.sender,serviceId)'] | | +| claim() | external | [] | ['contributorsProxy', 'msg.sender'] | [] | ['revert ServiceNotDefined(uint256)'] | ['IContributors(contributorsProxy).mapSocialIdServiceInfo(msg.sender)', 'IStaking(stakingInstance).claim(serviceId)'] | 2 | +| slitherConstructorConstantVariables() | internal | [] | [] | ['NUM_AGENT_INSTANCES', 'THRESHOLD'] | [] | [] | 1 | ++------------------------------------------------------------------------------+------------+-----------+-----------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract ContributorsProxy +Contract vars: ['CONTRIBUTORS_PROXY'] +Inheritance:: [] + ++---------------------------------------+------------+-----------+------------------------+------------------------+----------------------------------------------------------------------------+---------------------------------------------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++---------------------------------------+------------+-----------+------------------------+------------------------+----------------------------------------------------------------------------+---------------------------------------------------+-----------------------+ +| constructor(address,bytes) | public | [] | ['CONTRIBUTORS_PROXY'] | [] | ['revert InitializationFailed()', 'revert ZeroContributorsData()'] | ['implementation.delegatecall(contributorsData)'] | 4 | +| | | | | | ['revert ZeroImplementationAddress()', 'sstore(uint256,uint256)'] | | | +| fallback() | external | [] | ['CONTRIBUTORS_PROXY'] | [] | ['calldatacopy(uint256,uint256,uint256)', 'calldatasize()'] | [] | 2 | +| | | | | | ['delegatecall(uint256,uint256,uint256,uint256,uint256,uint256)', 'gas()'] | | | +| | | | | | ['return(uint256,uint256)', 'returndatacopy(uint256,uint256,uint256)'] | | | +| | | | | | ['returndatasize()', 'revert(uint256,uint256)'] | | | +| | | | | | ['sload(uint256)'] | | | +| slitherConstructorConstantVariables() | internal | [] | [] | ['CONTRIBUTORS_PROXY'] | [] | [] | 1 | ++---------------------------------------+------------+-----------+------------------------+------------------------+----------------------------------------------------------------------------+---------------------------------------------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract Contributors +Contract vars: ['VERSION', 'CONTRIBUTORS_PROXY', 'owner', 'manager', 'mapSocialIdServiceInfo', 'mapMutisigActivities', 'mapContributeAgents'] +Inheritance:: [] + ++--------------------------------------------------------------+------------+-----------+-------------------------------------------------+-----------------------------------+-------------------------------------------------------------------------------------+----------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++--------------------------------------------------------------+------------+-----------+-------------------------------------------------+-----------------------------------+-------------------------------------------------------------------------------------+----------------+-----------------------+ +| initialize(address) | external | [] | ['msg.sender', 'owner'] | ['manager', 'owner'] | ['revert AlreadyInitialized()', 'revert ZeroAddress()'] | [] | 3 | +| changeImplementation(address) | external | [] | ['CONTRIBUTORS_PROXY', 'msg.sender'] | [] | ['revert OwnerOnly(address,address)', 'revert ZeroAddress()'] | [] | 3 | +| | | | ['owner'] | | ['sstore(uint256,uint256)'] | | | +| changeOwner(address) | external | [] | ['msg.sender', 'owner'] | ['owner'] | ['revert OwnerOnly(address,address)', 'revert ZeroAddress()'] | [] | 3 | +| changeManager(address) | external | [] | ['msg.sender', 'owner'] | ['manager'] | ['revert OwnerOnly(address,address)', 'revert ZeroAddress()'] | [] | 3 | +| setServiceInfoForId(address,uint256,uint256,address,address) | external | [] | ['manager', 'mapSocialIdServiceInfo'] | ['mapSocialIdServiceInfo'] | ['revert OnlyManager(address,address)'] | [] | 2 | +| | | | ['msg.sender'] | | | | | +| setContributeAgentStatuses(address[],bool[]) | external | [] | ['msg.sender', 'owner'] | ['mapContributeAgents'] | ['revert OwnerOnly(address,address)', 'revert WrongArrayLength(uint256,uint256)'] | [] | 5 | +| | | | | | ['revert ZeroAddress()'] | | | +| increaseActivity(address[],uint256[]) | external | [] | ['mapContributeAgents', 'mapMutisigActivities'] | ['mapMutisigActivities'] | ['revert UnauthorizedAccount(address)', 'revert WrongArrayLength(uint256,uint256)'] | [] | 4 | +| | | | ['msg.sender'] | | | | | +| slitherConstructorConstantVariables() | internal | [] | [] | ['CONTRIBUTORS_PROXY', 'VERSION'] | [] | [] | 1 | ++--------------------------------------------------------------+------------+-----------+-------------------------------------------------+-----------------------------------+-------------------------------------------------------------------------------------+----------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract IContributors +Contract vars: [] +Inheritance:: [] + ++-------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ +| mapMutisigActivities(address) | external | [] | [] | [] | [] | [] | 2 | ++-------------------------------+------------+-----------+------+-------+----------------+----------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Printers: +Contract ContributeActivityChecker +Contract vars: ['livenessRatio', 'contributorsProxy'] +Inheritance:: [] + ++------------------------------------------+------------+-----------+-----------------------+----------------------------------------+------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ +| Function | Visibility | Modifiers | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++------------------------------------------+------------+-----------+-----------------------+----------------------------------------+------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ +| constructor(address,uint256) | public | [] | [] | ['contributorsProxy', 'livenessRatio'] | ['revert ZeroAddress()', 'revert ZeroValue()'] | [] | 3 | +| getMultisigNonces(address) | external | [] | ['contributorsProxy'] | [] | [] | ['IContributors(contributorsProxy).mapMutisigActivities(multisig)', 'new uint256[](1)'] | 1 | +| isRatioPass(uint256[],uint256[],uint256) | external | [] | ['livenessRatio'] | [] | [] | [] | 2 | ++------------------------------------------+------------+-----------+-----------------------+----------------------------------------+------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ + ++-----------+------------+------+-------+----------------+----------------+-----------------------+ +| Modifiers | Visibility | Read | Write | Internal Calls | External Calls | Cyclomatic Complexity | ++-----------+------------+------+-------+----------------+----------------+-----------------------+ ++-----------+------------+------+-------+----------------+----------------+-----------------------+ + +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_human-summary.txt b/audits/internal1/analysis/slither_human-summary.txt new file mode 100644 index 0000000..3fcd87a --- /dev/null +++ b/audits/internal1/analysis/slither_human-summary.txt @@ -0,0 +1,84 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +Compiled with solc +Total number of contracts in source files: 6 +Source lines of code (SLOC) in source files: 213 +Number of assembly lines: 0 +Number of optimization issues: 3 +Number of informational issues: 2 +Number of low issues: 4 +Number of medium issues: 9 +Number of high issues: 5 + ++-------------------+-------------+------+------------+--------------+--------------------+ +| Name | # functions | ERCS | ERC20 info | Complex code | Features | ++-------------------+-------------+------+------------+--------------+--------------------+ +| IContributors | 2 | | | No | | +| IService | 7 | | | No | Receive ETH | +| IStaking | 8 | | | No | | +| IToken | 3 | | | No | | +| IMultisig | 1 | | | No | | +| ContributeManager | 8 | | | No | Receive ETH | +| | | | | | Send ETH | +| | | | | | Tokens interaction | ++-------------------+-------------+------+------------+--------------+--------------------+ +INFO:Printers: +Compiled with solc +Total number of contracts in source files: 1 +Source lines of code (SLOC) in source files: 34 +Number of assembly lines: 0 +Number of optimization issues: 0 +Number of informational issues: 5 +Number of low issues: 0 +Number of medium issues: 1 +Number of high issues: 2 + ++-------------------+-------------+------+------------+--------------+--------------+ +| Name | # functions | ERCS | ERC20 info | Complex code | Features | ++-------------------+-------------+------+------------+--------------+--------------+ +| ContributorsProxy | 3 | | | No | Delegatecall | +| | | | | | Assembly | +| | | | | | Proxy | ++-------------------+-------------+------+------------+--------------+--------------+ +INFO:Printers: +Compiled with solc +Total number of contracts in source files: 1 +Source lines of code (SLOC) in source files: 115 +Number of assembly lines: 0 +Number of optimization issues: 0 +Number of informational issues: 4 +Number of low issues: 0 +Number of medium issues: 0 +Number of high issues: 2 + ++--------------+-------------+------+------------+--------------+----------+ +| Name | # functions | ERCS | ERC20 info | Complex code | Features | ++--------------+-------------+------+------------+--------------+----------+ +| Contributors | 8 | | | No | Assembly | ++--------------+-------------+------+------------+--------------+----------+ +INFO:Printers: +Compiled with solc +Total number of contracts in source files: 2 +Source lines of code (SLOC) in source files: 34 +Number of assembly lines: 0 +Number of optimization issues: 0 +Number of informational issues: 2 +Number of low issues: 0 +Number of medium issues: 0 +Number of high issues: 0 + + ++---------------------------+-------------+------+------------+--------------+----------+ +| Name | # functions | ERCS | ERC20 info | Complex code | Features | ++---------------------------+-------------+------+------------+--------------+----------+ +| IContributors | 1 | | | No | | +| ContributeActivityChecker | 3 | | | No | | ++---------------------------+-------------+------+------------+--------------+----------+ +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_inheritance-graph.txt b/audits/internal1/analysis/slither_inheritance-graph.txt new file mode 100644 index 0000000..f263597 --- /dev/null +++ b/audits/internal1/analysis/slither_inheritance-graph.txt @@ -0,0 +1,17 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers:Inheritance Graph: ./ContributeManager-flatten.sol.inheritance-graph.dot + +INFO:Printers:Inheritance Graph: ./ContributorsProxy-flatten.sol.inheritance-graph.dot + +INFO:Printers:Inheritance Graph: ./Contributors-flatten.sol.inheritance-graph.dot + +INFO:Printers:Inheritance Graph: ./ContributeActivityChecker-flatten.sol.inheritance-graph.dot + +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_inheritance.txt b/audits/internal1/analysis/slither_inheritance.txt new file mode 100644 index 0000000..a01445b --- /dev/null +++ b/audits/internal1/analysis/slither_inheritance.txt @@ -0,0 +1,73 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers:Inheritance +Child_Contract -> Immediate_Base_Contracts [Not_Immediate_Base_Contracts] ++ IContributors + ++ IService + ++ IStaking + ++ IToken + ++ IMultisig + ++ ContributeManager + + +Base_Contract -> Immediate_Child_Contracts + [Not_Immediate_Child_Contracts] + ++ IContributors + ++ IService + ++ IStaking + ++ IToken + ++ IMultisig + ++ ContributeManager + +INFO:Printers:Inheritance +Child_Contract -> Immediate_Base_Contracts [Not_Immediate_Base_Contracts] ++ ContributorsProxy + + +Base_Contract -> Immediate_Child_Contracts + [Not_Immediate_Child_Contracts] + ++ ContributorsProxy + +INFO:Printers:Inheritance +Child_Contract -> Immediate_Base_Contracts [Not_Immediate_Base_Contracts] ++ Contributors + + +Base_Contract -> Immediate_Child_Contracts + [Not_Immediate_Child_Contracts] + ++ Contributors + +INFO:Printers:Inheritance +Child_Contract -> Immediate_Base_Contracts [Not_Immediate_Base_Contracts] ++ IContributors + ++ ContributeActivityChecker + + +Base_Contract -> Immediate_Child_Contracts + [Not_Immediate_Child_Contracts] + ++ IContributors + ++ ContributeActivityChecker + +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_modifiers.txt b/audits/internal1/analysis/slither_modifiers.txt new file mode 100644 index 0000000..bd686ca --- /dev/null +++ b/audits/internal1/analysis/slither_modifiers.txt @@ -0,0 +1,113 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +Contract IContributors ++------------------------+-----------+ +| Function | Modifiers | ++------------------------+-----------+ +| setServiceInfoForId | [] | +| mapSocialIdServiceInfo | [] | ++------------------------+-----------+ +INFO:Printers: +Contract IService ++-----------------------------+-----------+ +| Function | Modifiers | ++-----------------------------+-----------+ +| create | [] | +| activateRegistration | [] | +| registerAgents | [] | +| deploy | [] | +| serviceRegistry | [] | +| serviceRegistryTokenUtility | [] | +| mapServices | [] | ++-----------------------------+-----------+ +INFO:Printers: +Contract IStaking ++-------------------+-----------+ +| Function | Modifiers | ++-------------------+-----------+ +| stakingToken | [] | +| minStakingDeposit | [] | +| numAgentInstances | [] | +| threshold | [] | +| stake | [] | +| unstake | [] | +| claim | [] | +| verifyInstance | [] | ++-------------------+-----------+ +INFO:Printers: +Contract IToken ++--------------+-----------+ +| Function | Modifiers | ++--------------+-----------+ +| transfer | [] | +| transferFrom | [] | +| approve | [] | ++--------------+-----------+ +INFO:Printers: +Contract IMultisig ++-----------+-----------+ +| Function | Modifiers | ++-----------+-----------+ +| getOwners | [] | ++-----------+-----------+ +INFO:Printers: +Contract ContributeManager ++-------------------------------------+-----------+ +| Function | Modifiers | ++-------------------------------------+-----------+ +| constructor | [] | +| _createAndDeploy | [] | +| _stake | [] | +| createAndStake | [] | +| stake | [] | +| unstake | [] | +| claim | [] | +| slitherConstructorConstantVariables | [] | ++-------------------------------------+-----------+ +INFO:Printers: +Contract ContributorsProxy ++-------------------------------------+-----------+ +| Function | Modifiers | ++-------------------------------------+-----------+ +| constructor | [] | +| fallback | [] | +| slitherConstructorConstantVariables | [] | ++-------------------------------------+-----------+ +INFO:Printers: +Contract Contributors ++-------------------------------------+-----------+ +| Function | Modifiers | ++-------------------------------------+-----------+ +| initialize | [] | +| changeImplementation | [] | +| changeOwner | [] | +| changeManager | [] | +| setServiceInfoForId | [] | +| setContributeAgentStatuses | [] | +| increaseActivity | [] | +| slitherConstructorConstantVariables | [] | ++-------------------------------------+-----------+ +INFO:Printers: +Contract IContributors ++----------------------+-----------+ +| Function | Modifiers | ++----------------------+-----------+ +| mapMutisigActivities | [] | ++----------------------+-----------+ +INFO:Printers: +Contract ContributeActivityChecker ++-------------------+-----------+ +| Function | Modifiers | ++-------------------+-----------+ +| constructor | [] | +| getMultisigNonces | [] | +| isRatioPass | [] | ++-------------------+-----------+ +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_require.txt b/audits/internal1/analysis/slither_require.txt new file mode 100644 index 0000000..a8d135a --- /dev/null +++ b/audits/internal1/analysis/slither_require.txt @@ -0,0 +1,113 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +Contract IContributors ++------------------------+-------------------+ +| Function | require or assert | ++------------------------+-------------------+ +| setServiceInfoForId | | +| mapSocialIdServiceInfo | | ++------------------------+-------------------+ +INFO:Printers: +Contract IService ++-----------------------------+-------------------+ +| Function | require or assert | ++-----------------------------+-------------------+ +| create | | +| activateRegistration | | +| registerAgents | | +| deploy | | +| serviceRegistry | | +| serviceRegistryTokenUtility | | +| mapServices | | ++-----------------------------+-------------------+ +INFO:Printers: +Contract IStaking ++-------------------+-------------------+ +| Function | require or assert | ++-------------------+-------------------+ +| stakingToken | | +| minStakingDeposit | | +| numAgentInstances | | +| threshold | | +| stake | | +| unstake | | +| claim | | +| verifyInstance | | ++-------------------+-------------------+ +INFO:Printers: +Contract IToken ++--------------+-------------------+ +| Function | require or assert | ++--------------+-------------------+ +| transfer | | +| transferFrom | | +| approve | | ++--------------+-------------------+ +INFO:Printers: +Contract IMultisig ++-----------+-------------------+ +| Function | require or assert | ++-----------+-------------------+ +| getOwners | | ++-----------+-------------------+ +INFO:Printers: +Contract ContributeManager ++-------------------------------------+-------------------+ +| Function | require or assert | ++-------------------------------------+-------------------+ +| constructor | | +| _createAndDeploy | | +| _stake | | +| createAndStake | | +| stake | | +| unstake | | +| claim | | +| slitherConstructorConstantVariables | | ++-------------------------------------+-------------------+ +INFO:Printers: +Contract ContributorsProxy ++-------------------------------------+-------------------+ +| Function | require or assert | ++-------------------------------------+-------------------+ +| constructor | | +| fallback | | +| slitherConstructorConstantVariables | | ++-------------------------------------+-------------------+ +INFO:Printers: +Contract Contributors ++-------------------------------------+-------------------+ +| Function | require or assert | ++-------------------------------------+-------------------+ +| initialize | | +| changeImplementation | | +| changeOwner | | +| changeManager | | +| setServiceInfoForId | | +| setContributeAgentStatuses | | +| increaseActivity | | +| slitherConstructorConstantVariables | | ++-------------------------------------+-------------------+ +INFO:Printers: +Contract IContributors ++----------------------+-------------------+ +| Function | require or assert | ++----------------------+-------------------+ +| mapMutisigActivities | | ++----------------------+-------------------+ +INFO:Printers: +Contract ContributeActivityChecker ++-------------------+-------------------+ +| Function | require or assert | ++-------------------+-------------------+ +| constructor | | +| getMultisigNonces | | +| isRatioPass | | ++-------------------+-------------------+ +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_variable-order.txt b/audits/internal1/analysis/slither_variable-order.txt new file mode 100644 index 0000000..da2c732 --- /dev/null +++ b/audits/internal1/analysis/slither_variable-order.txt @@ -0,0 +1,79 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +IContributors: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +IService: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +IStaking: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +IToken: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +IMultisig: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +ContributeManager: ++-------------------------+---------+------+--------+ +| Name | Type | Slot | Offset | ++-------------------------+---------+------+--------+ +| ContributeManager.nonce | uint256 | 0 | 0 | ++-------------------------+---------+------+--------+ + +INFO:Printers: +ContributorsProxy: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +INFO:Printers: +Contributors: ++-------------------------------------+---------------------------------+------+--------+ +| Name | Type | Slot | Offset | ++-------------------------------------+---------------------------------+------+--------+ +| Contributors.owner | address | 0 | 0 | +| Contributors.manager | address | 1 | 0 | +| Contributors.mapSocialIdServiceInfo | mapping(address => ServiceInfo) | 2 | 0 | +| Contributors.mapMutisigActivities | mapping(address => uint256) | 3 | 0 | +| Contributors.mapContributeAgents | mapping(address => bool) | 4 | 0 | ++-------------------------------------+---------------------------------+------+--------+ + +INFO:Printers: +IContributors: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +ContributeActivityChecker: ++------+------+------+--------+ +| Name | Type | Slot | Offset | ++------+------+------+--------+ ++------+------+------+--------+ + +INFO:Slither:. analyzed (10 contracts) diff --git a/audits/internal1/analysis/slither_vars-and-auth.txt b/audits/internal1/analysis/slither_vars-and-auth.txt new file mode 100644 index 0000000..1ffe245 --- /dev/null +++ b/audits/internal1/analysis/slither_vars-and-auth.txt @@ -0,0 +1,117 @@ +'solc --version' running +'solc ./ContributeManager-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributorsProxy-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./Contributors-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +'solc --version' running +'solc ./ContributeActivityChecker-flatten.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --allow-paths .,/home/andrey/valory/autonolas-staking-programmes/audits/internal1/analysis/contracts' running +INFO:Printers: +Contract IContributors ++------------------------+-------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++------------------------+-------------------------+--------------------------+ +| setServiceInfoForId | [] | [] | +| mapSocialIdServiceInfo | [] | [] | ++------------------------+-------------------------+--------------------------+ + +Contract IService ++-----------------------------+-------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++-----------------------------+-------------------------+--------------------------+ +| create | [] | [] | +| activateRegistration | [] | [] | +| registerAgents | [] | [] | +| deploy | [] | [] | +| serviceRegistry | [] | [] | +| serviceRegistryTokenUtility | [] | [] | +| mapServices | [] | [] | ++-----------------------------+-------------------------+--------------------------+ + +Contract IStaking ++-------------------+-------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++-------------------+-------------------------+--------------------------+ +| stakingToken | [] | [] | +| minStakingDeposit | [] | [] | +| numAgentInstances | [] | [] | +| threshold | [] | [] | +| stake | [] | [] | +| unstake | [] | [] | +| claim | [] | [] | +| verifyInstance | [] | [] | ++-------------------+-------------------------+--------------------------+ + +Contract IToken ++--------------+-------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++--------------+-------------------------+--------------------------+ +| transfer | [] | [] | +| transferFrom | [] | [] | +| approve | [] | [] | ++--------------+-------------------------+--------------------------+ + +Contract IMultisig ++-----------+-------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++-----------+-------------------------+--------------------------+ +| getOwners | [] | [] | ++-----------+-------------------------+--------------------------+ + +Contract ContributeManager ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+ +| Function | State variables written | Conditions on msg.sender | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+ +| constructor | ['agentId', 'configHash', 'contributorsProxy', 'fallbackHandler', 'olas', 'safeMultisig', 'serviceManager', 'serviceRegistry', 'serviceRegistryTokenUtility', 'stakingFactory'] | [] | +| _createAndDeploy | ['nonce'] | [] | +| _stake | [] | [] | +| createAndStake | ['nonce'] | [] | +| stake | [] | ['multisigOwners.length != numAgentInstances || multisigOwners[0] != msg.sender'] | +| unstake | [] | [] | +| claim | [] | [] | +| slitherConstructorConstantVariables | ['NUM_AGENT_INSTANCES', 'THRESHOLD'] | [] | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+ + +INFO:Printers: +Contract ContributorsProxy ++-------------------------------------+-------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++-------------------------------------+-------------------------+--------------------------+ +| constructor | [] | [] | +| fallback | [] | [] | +| slitherConstructorConstantVariables | ['CONTRIBUTORS_PROXY'] | [] | ++-------------------------------------+-------------------------+--------------------------+ + +INFO:Printers: +Contract Contributors ++-------------------------------------+-----------------------------------+---------------------------------------+ +| Function | State variables written | Conditions on msg.sender | ++-------------------------------------+-----------------------------------+---------------------------------------+ +| initialize | ['manager', 'owner'] | [] | +| changeImplementation | [] | ['msg.sender != owner'] | +| changeOwner | ['owner'] | ['msg.sender != owner'] | +| changeManager | ['manager'] | ['msg.sender != owner'] | +| setServiceInfoForId | ['mapSocialIdServiceInfo'] | ['msg.sender != manager'] | +| setContributeAgentStatuses | ['mapContributeAgents'] | ['msg.sender != owner'] | +| increaseActivity | ['mapMutisigActivities'] | ['! mapContributeAgents[msg.sender]'] | +| slitherConstructorConstantVariables | ['CONTRIBUTORS_PROXY', 'VERSION'] | [] | ++-------------------------------------+-----------------------------------+---------------------------------------+ + +INFO:Printers: +Contract IContributors ++----------------------+-------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++----------------------+-------------------------+--------------------------+ +| mapMutisigActivities | [] | [] | ++----------------------+-------------------------+--------------------------+ + +Contract ContributeActivityChecker ++-------------------+----------------------------------------+--------------------------+ +| Function | State variables written | Conditions on msg.sender | ++-------------------+----------------------------------------+--------------------------+ +| constructor | ['contributorsProxy', 'livenessRatio'] | [] | +| getMultisigNonces | [] | [] | +| isRatioPass | [] | [] | ++-------------------+----------------------------------------+--------------------------+ + +INFO:Slither:. analyzed (10 contracts) diff --git a/contracts/contribute/ContributeActivityChecker.sol b/contracts/contribute/ContributeActivityChecker.sol new file mode 100644 index 0000000..7c343a5 --- /dev/null +++ b/contracts/contribute/ContributeActivityChecker.sol @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +// Contributors interface +interface IContributors { + function mapMutisigActivities(address multisig) external view returns (uint256); +} + +/// @dev Zero address. +error ZeroAddress(); + +/// @dev Zero value. +error ZeroValue(); + +/// @title ContributeActivityChecker - Smart contract for performing contributors service staking activity check +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract ContributeActivityChecker { + // Liveness ratio in the format of 1e18 + uint256 public immutable livenessRatio; + // Contributors proxy contract address + address public immutable contributorsProxy; + + /// @dev StakingNativeToken initialization. + /// @param _contributorsProxy Contributors proxy contract address. + /// @param _livenessRatio Liveness ratio in the format of 1e18. + constructor(address _contributorsProxy, uint256 _livenessRatio) { + // Check the zero address + if (_contributorsProxy == address(0)) { + revert ZeroAddress(); + } + + // Check for zero value + if (_livenessRatio == 0) { + revert ZeroValue(); + } + + contributorsProxy = _contributorsProxy; + livenessRatio = _livenessRatio; + } + + /// @dev Gets service multisig nonces. + /// @param multisig Service multisig address. + /// @return nonces Set of a single service multisig nonce. + function getMultisigNonces(address multisig) external view virtual returns (uint256[] memory nonces) { + nonces = new uint256[](1); + // The nonce is equal to the social off-chain activity corresponding to a multisig activity + nonces[0] = IContributors(contributorsProxy).mapMutisigActivities(multisig); + } + + /// @dev Checks if the service multisig liveness ratio passes the defined liveness threshold. + /// @notice The formula for calculating the ratio is the following: + /// currentNonce - service multisig nonce at time now (block.timestamp); + /// lastNonce - service multisig nonce at the previous checkpoint or staking time (tsStart); + /// ratio = (currentNonce - lastNonce) / (block.timestamp - tsStart). + /// @param curNonces Current service multisig set of a single nonce. + /// @param lastNonces Last service multisig set of a single nonce. + /// @param ts Time difference between current and last timestamps. + /// @return ratioPass True, if the liveness ratio passes the check. + function isRatioPass( + uint256[] memory curNonces, + uint256[] memory lastNonces, + uint256 ts + ) external view virtual returns (bool ratioPass) { + // If the checkpoint was called in the exact same block, the ratio is zero + // If the current nonce is not greater than the last nonce, the ratio is zero + if (ts > 0 && curNonces[0] > lastNonces[0]) { + uint256 ratio = ((curNonces[0] - lastNonces[0]) * 1e18) / ts; + ratioPass = (ratio >= livenessRatio); + } + } +} \ No newline at end of file diff --git a/contracts/contribute/ContributeManager.sol b/contracts/contribute/ContributeManager.sol new file mode 100644 index 0000000..dbb074c --- /dev/null +++ b/contracts/contribute/ContributeManager.sol @@ -0,0 +1,355 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import {ERC721TokenReceiver} from "../../lib/autonolas-registries/lib/solmate/src/tokens/ERC721.sol"; +import {IContributors} from "./interfaces/IContributors.sol"; +import {IService} from "./interfaces/IService.sol"; +import {IStaking} from "./interfaces/IStaking.sol"; +import {IToken, INFToken} from "./interfaces/IToken.sol"; + +// Multisig interface +interface IMultisig { + /// @dev Returns array of owners. + /// @return Array of Safe owners. + function getOwners() external view returns (address[] memory); +} + +/// @dev Zero address. +error ZeroAddress(); + +/// @dev Zero value. +error ZeroValue(); + +/// @dev Caught reentrancy violation. +error ReentrancyGuard(); + +/// @dev Service is already created and staked for the contributor. +/// @param socialId Social Id. +/// @param serviceId Service Id. +/// @param multisig Multisig address. +error ServiceAlreadyStaked(uint256 socialId, uint256 serviceId, address multisig); + +/// @dev Wrong staking instance. +/// @param stakingInstance Staking instance address. +error WrongStakingInstance(address stakingInstance); + +/// @dev Wrong provided service setup. +/// @param socialId Social Id. +/// @param serviceId Service Id. +/// @param multisig Multisig address. +error WrongServiceSetup(uint256 socialId, uint256 serviceId, address multisig); + +/// @dev Service is not defined for the social Id. +/// @param socialId Social Id. +error ServiceNotDefined(uint256 socialId); + +/// @dev Wrong service owner. +/// @param serviceId Service Id. +/// @param sender Sender address. +/// @param serviceOwner Actual service owner. +error ServiceOwnerOnly(uint256 serviceId, address sender, address serviceOwner); + +/// @title ContributeManager - Smart contract for managing services for contributors +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract ContributeManager is ERC721TokenReceiver { + event CreatedAndStaked(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + event Staked(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + event Unstaked(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + event Claimed(uint256 indexed socialId, address indexed serviceOwner, uint256 serviceId, + address indexed multisig, address stakingInstance); + + // Number of agent instances + uint256 public constant NUM_AGENT_INSTANCES = 1; + // Threshold + uint256 public constant THRESHOLD = 1; + // Contributor agent Id + uint256 public immutable agentId; + // Contributor service config hash + bytes32 public immutable configHash; + // Contributors proxy address + address public immutable contributorsProxy; + // Service manager address + address public immutable serviceManager; + // OLAS token address + address public immutable olas; + // Service registry address + address public immutable serviceRegistry; + // Service registry token utility address + address public immutable serviceRegistryTokenUtility; + // Staking factory address + address public immutable stakingFactory; + // Safe multisig processing contract address + address public immutable safeMultisig; + // Safe fallback handler + address public immutable fallbackHandler; + + // Nonce + uint256 internal _nonce; + // Reentrancy lock + uint256 internal _locked = 1; + + /// @dev ContributeManager constructor. + /// @param _contributorsProxy Contributors proxy address. + /// @param _serviceManager Service manager address. + /// @param _olas OLAS token address. + /// @param _stakingFactory Staking factory address. + /// @param _safeMultisig Safe multisig address. + /// @param _fallbackHandler Multisig fallback handler address. + /// @param _agentId Contributor agent Id. + /// @param _configHash Contributor service config hash. + constructor( + address _contributorsProxy, + address _serviceManager, + address _olas, + address _stakingFactory, + address _safeMultisig, + address _fallbackHandler, + uint256 _agentId, + bytes32 _configHash + ) { + // Check for zero addresses + if (_contributorsProxy == address(0) || _serviceManager == address(0) || _olas == address(0) || + _stakingFactory == address(0) || _safeMultisig == address(0) || _fallbackHandler == address(0)) { + revert ZeroAddress(); + } + + // Check for zero values + if (_agentId == 0 || _configHash == 0) { + revert ZeroValue(); + } + + agentId = _agentId; + configHash = _configHash; + + contributorsProxy = _contributorsProxy; + serviceManager = _serviceManager; + olas = _olas; + stakingFactory = _stakingFactory; + safeMultisig = _safeMultisig; + fallbackHandler = _fallbackHandler; + serviceRegistry = IService(serviceManager).serviceRegistry(); + serviceRegistryTokenUtility = IService(serviceManager).serviceRegistryTokenUtility(); + } + + /// @dev Creates and deploys a service for the contributor. + /// @param token Staking token address. + /// @param minStakingDeposit Min staking deposit value. + /// @return serviceId Minted service Id. + /// @return multisig Service multisig. + function _createAndDeploy( + address token, + uint256 minStakingDeposit + ) internal returns (uint256 serviceId, address multisig) { + // Set agent params + IService.AgentParams[] memory agentParams = new IService.AgentParams[](NUM_AGENT_INSTANCES); + agentParams[0] = IService.AgentParams(uint32(NUM_AGENT_INSTANCES), uint96(minStakingDeposit)); + + // Set agent Ids + uint32[] memory agentIds = new uint32[](NUM_AGENT_INSTANCES); + agentIds[0] = uint32(agentId); + + // Set agent instances as [msg.sender] + address[] memory instances = new address[](NUM_AGENT_INSTANCES); + instances[0] = msg.sender; + + // Create a service owned by this contract + serviceId = IService(serviceManager).create(address(this), token, configHash, agentIds, + agentParams, uint32(THRESHOLD)); + + // Activate registration (1 wei as a deposit wrapper) + IService(serviceManager).activateRegistration{value: 1}(serviceId); + + // Register msg.sender as an agent instance (numAgentInstances wei as a bond wrapper) + IService(serviceManager).registerAgents{value: NUM_AGENT_INSTANCES}(serviceId, instances, agentIds); + + // Prepare Safe multisig data + uint256 localNonce = _nonce; + uint256 randomNonce = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender, localNonce))); + bytes memory data = abi.encodePacked(address(0), fallbackHandler, address(0), address(0), uint256(0), + randomNonce, "0x"); + // Deploy the service + multisig = IService(serviceManager).deploy(serviceId, safeMultisig, data); + + // Update the nonce + _nonce = localNonce + 1; + } + + /// @dev Stakes the already deployed service. + /// @param socialId Social Id. + /// @param serviceId Service Id. + /// @param multisig Corresponding service multisig. + /// @param stakingInstance Staking instance. + function _stake(uint256 socialId, uint256 serviceId, address multisig, address stakingInstance) internal { + // Add the service into its social Id corresponding record + IContributors(contributorsProxy).setServiceInfoForId(msg.sender, socialId, serviceId, multisig, stakingInstance); + + // Approve service NFT for the staking instance + INFToken(serviceRegistry).approve(stakingInstance, serviceId); + + // Stake the service + IStaking(stakingInstance).stake(serviceId); + } + + /// @dev Creates and deploys a service for the contributor, and stakes it with a specified staking contract. + /// @notice The service cannot be registered again if it is currently staked. + /// @param socialId Contributor social Id. + /// @param stakingInstance Contribute staking instance address. + function createAndStake(uint256 socialId, address stakingInstance) external payable { + // Reentrancy guard + if (_locked > 1) { + revert ReentrancyGuard(); + } + _locked = 2; + + // Check for zero value + if (socialId == 0) { + revert ZeroValue(); + } + + // Check for existing service corresponding to the msg.sender + (, uint256 serviceId, address multisig, ) = IContributors(contributorsProxy).mapAccountServiceInfo(msg.sender); + if (serviceId > 0) { + revert ServiceAlreadyStaked(socialId, serviceId, multisig); + } + + // Check for staking instance validity + if(!IStaking(stakingFactory).verifyInstance(stakingInstance)) { + revert WrongStakingInstance(stakingInstance); + } + + // Get the token info from the staking contract + // If this call fails, it means the staking contract does not have a token and is not compatible + address token = IStaking(stakingInstance).stakingToken(); + // Check the token address + if (token != olas) { + revert WrongStakingInstance(stakingInstance); + } + + // Get other service info for staking + uint256 minStakingDeposit = IStaking(stakingInstance).minStakingDeposit(); + uint256 numAgentInstances = IStaking(stakingInstance).numAgentInstances(); + uint256 threshold = IStaking(stakingInstance).threshold(); + // Check for number of agent instances that must be equal to one, + // since msg.sender is the only service multisig owner + if ((numAgentInstances > 0 && numAgentInstances != NUM_AGENT_INSTANCES) || + (threshold > 0 && threshold != THRESHOLD)) { + revert WrongStakingInstance(stakingInstance); + } + + // Calculate the total bond required for the service deployment: + uint256 totalBond = (1 + NUM_AGENT_INSTANCES) * minStakingDeposit; + + // Transfer the total bond amount from the contributor + IToken(olas).transferFrom(msg.sender, address(this), totalBond); + // Approve token for the serviceRegistryTokenUtility contract + IToken(olas).approve(serviceRegistryTokenUtility, totalBond); + + // Create and deploy service + (serviceId, multisig) = _createAndDeploy(olas, minStakingDeposit); + + // Stake the service + _stake(socialId, serviceId, multisig, stakingInstance); + + emit CreatedAndStaked(socialId, msg.sender, serviceId, multisig, stakingInstance); + + _locked = 1; + } + + /// @dev Stakes the already deployed service. + /// @param socialId Social Id. + /// @param serviceId Service Id. + /// @param stakingInstance Staking instance. + function stake(uint256 socialId, uint256 serviceId, address stakingInstance) external { + // Reentrancy guard + if (_locked > 1) { + revert ReentrancyGuard(); + } + _locked = 2; + + // Check for existing service corresponding to the msg.sender + (, uint256 serviceIdCheck, address multisig, ) = IContributors(contributorsProxy).mapAccountServiceInfo(msg.sender); + if (serviceIdCheck > 0) { + revert ServiceAlreadyStaked(socialId, serviceIdCheck, multisig); + } + + // Get the service multisig + (, multisig, , , , , ) = IService(serviceRegistry).mapServices(serviceId); + + // Check that the service multisig owner is msg.sender + uint256 numAgentInstances = IStaking(stakingInstance).numAgentInstances(); + address[] memory multisigOwners = IMultisig(multisig).getOwners(); + if (multisigOwners.length != numAgentInstances || multisigOwners[0] != msg.sender) { + revert WrongServiceSetup(socialId, serviceId, multisig); + } + + // Transfer the service NFT + INFToken(serviceRegistry).safeTransferFrom(msg.sender, address(this), serviceId); + + // Stake the service + _stake(socialId, serviceId, multisig, stakingInstance); + + emit Staked(socialId, msg.sender, serviceId, multisig, stakingInstance); + + _locked = 1; + } + + /// @dev Unstakes service Id corresponding to the msg.sender and clears the contributor record. + function unstake() external { + // Reentrancy guard + if (_locked > 1) { + revert ReentrancyGuard(); + } + _locked = 2; + + // Check for existing service corresponding to the social Id + (uint256 socialId, uint256 serviceId, address multisig, address stakingInstance) = + IContributors(contributorsProxy).mapAccountServiceInfo(msg.sender); + if (serviceId == 0) { + revert ServiceNotDefined(socialId); + } + + // Unstake the service + IStaking(stakingInstance).unstake(serviceId); + + // Transfer the service back to the original owner + INFToken(serviceRegistry).transferFrom(address(this), msg.sender, serviceId); + + // Zero the service info: the service is out of the contribute records, however multisig activity is still valid + // If the same service is staked back, the multisig activity continues being tracked + IContributors(contributorsProxy).setServiceInfoForId(msg.sender, 0, 0, address(0), address(0)); + + emit Unstaked(socialId, msg.sender, serviceId, multisig, stakingInstance); + + _locked = 1; + } + + /// @dev Claims rewards for the service corresponding to msg.sender. + /// @return reward Staking reward. + function claim() external returns (uint256 reward) { + // Reentrancy guard + if (_locked > 1) { + revert ReentrancyGuard(); + } + _locked = 2; + + // Check for existing service corresponding to the social Id + (uint256 socialId, uint256 serviceId, address multisig, address stakingInstance) = + IContributors(contributorsProxy).mapAccountServiceInfo(msg.sender); + if (serviceId == 0) { + revert ServiceNotDefined(socialId); + } + + // Claim staking rewards + reward = IStaking(stakingInstance).claim(serviceId); + + emit Claimed(socialId, msg.sender, serviceId, multisig, stakingInstance); + + _locked = 1; + } +} \ No newline at end of file diff --git a/contracts/contribute/Contributors.sol b/contracts/contribute/Contributors.sol new file mode 100644 index 0000000..1215291 --- /dev/null +++ b/contracts/contribute/Contributors.sol @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +/// @dev Only `owner` has a privilege, but the `sender` was provided. +/// @param sender Sender address. +/// @param owner Required sender address as an owner. +error OwnerOnly(address sender, address owner); + +/// @dev The contract is already initialized. +error AlreadyInitialized(); + +/// @dev Zero address. +error ZeroAddress(); + +/// @dev Only manager is allowed to have access. +error ManagerOnly(address sender, address manager); + +/// @dev Wrong length of two arrays. +/// @param numValues1 Number of values in a first array. +/// @param numValues2 Number of values in a second array. +error WrongArrayLength(uint256 numValues1, uint256 numValues2); + +/// @dev Account is unauthorized. +/// @param account Account address. +error UnauthorizedAccount(address account); + +// Struct for service info +struct ServiceInfo { + // Social Id + uint256 socialId; + // Service Id + uint256 serviceId; + // Corresponding service multisig + address multisig; + // Staking instance address + address stakingInstance; +} + +/// @title Contributors - Smart contract for managing contributors +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract Contributors { + event ImplementationUpdated(address indexed implementation); + event OwnerUpdated(address indexed owner); + event ManagerUpdated(address indexed manager); + event SetServiceInfoForId(address indexed serviceOwner, uint256 indexed socialId, uint256 indexed serviceId, + address multisig, address stakingInstance); + event SetContributeServiceStatuses(address[] contributeServices, bool[] statuses); + event MultisigActivityChanged(address indexed senderAgent, address[] multisigs, uint256[] activityChanges); + + // Version number + string public constant VERSION = "1.0.0"; + // Code position in storage is keccak256("CONTRIBUTORS_PROXY") = "0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7" + bytes32 public constant CONTRIBUTORS_PROXY = 0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7; + + // Contract owner + address public owner; + // Service manager contract address + address public manager; + + // Mapping of account address => service info + mapping(address => ServiceInfo) public mapAccountServiceInfo; + // Mapping of service multisig address => activity + mapping(address => uint256) public mapMutisigActivities; + // Mapping of whitelisted contributor agents + mapping(address => bool) public mapContributeAgents; + + /// @dev Contributors initializer. + function initialize() external{ + // Check for already initialized + if (owner != address(0)) { + revert AlreadyInitialized(); + } + + owner = msg.sender; + } + + /// @dev Changes the contributors implementation contract address. + /// @param newImplementation New implementation contract address. + function changeImplementation(address newImplementation) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for zero address + if (newImplementation == address(0)) { + revert ZeroAddress(); + } + + // Store the contributors implementation address + assembly { + sstore(CONTRIBUTORS_PROXY, newImplementation) + } + + emit ImplementationUpdated(newImplementation); + } + + /// @dev Changes contract owner address. + /// @param newOwner Address of a new owner. + function changeOwner(address newOwner) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for the zero address + if (newOwner == address(0)) { + revert ZeroAddress(); + } + + owner = newOwner; + emit OwnerUpdated(newOwner); + } + + /// @dev Changes contract manager address. + /// @param newManager Address of a new manager. + function changeManager(address newManager) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for the zero address + if (newManager == address(0)) { + revert ZeroAddress(); + } + + manager = newManager; + emit ManagerUpdated(newManager); + } + + /// @dev Sets service info for the social id. + /// @param serviceOwner Service owner. + /// @param socialId Social id. + /// @param serviceId Service Id. + /// @param multisig Service multisig address. + /// @param stakingInstance Staking instance address. + function setServiceInfoForId( + address serviceOwner, + uint256 socialId, + uint256 serviceId, + address multisig, + address stakingInstance + ) external { + // Check for manager + if (msg.sender != manager) { + revert ManagerOnly(msg.sender, manager); + } + + // Set (or remove) multisig for the corresponding social id + ServiceInfo storage serviceInfo = mapAccountServiceInfo[serviceOwner]; + serviceInfo.socialId = socialId; + serviceInfo.serviceId = serviceId; + serviceInfo.multisig = multisig; + serviceInfo.stakingInstance = stakingInstance; + + emit SetServiceInfoForId(serviceOwner, socialId, serviceId, multisig, stakingInstance); + } + + /// @dev Sets contribute service multisig statues. + /// @param contributeServices Contribute service multisig addresses. + /// @param statuses Corresponding whitelisting statues. + function setContributeServiceStatuses(address[] memory contributeServices, bool[] memory statuses) external { + // Check for the ownership + if (msg.sender != owner) { + revert OwnerOnly(msg.sender, owner); + } + + // Check for array lengths + if (contributeServices.length == 0 || contributeServices.length != statuses.length) { + revert WrongArrayLength(contributeServices.length, statuses.length); + } + + // Traverse all contribute service multisigs and statuses + for (uint256 i = 0; i < contributeServices.length; ++i) { + // Check for zero addresses + if (contributeServices[i] == address(0)) { + revert ZeroAddress(); + } + + mapContributeAgents[contributeServices[i]] = statuses[i]; + } + + emit SetContributeServiceStatuses(contributeServices, statuses); + } + + /// @dev Increases multisig activity by the contribute service. + /// @param multisigs Multisig addresses. + /// @param activityChanges Corresponding activity changes + function increaseActivity(address[] memory multisigs, uint256[] memory activityChanges) external { + // Check for whitelisted contribute agent + if (!mapContributeAgents[msg.sender]) { + revert UnauthorizedAccount(msg.sender); + } + + // Check for array lengths + if (multisigs.length == 0 || multisigs.length != activityChanges.length) { + revert WrongArrayLength(multisigs.length, activityChanges.length); + } + + // Increase / decrease multisig activity + for (uint256 i = 0; i < multisigs.length; ++i) { + mapMutisigActivities[multisigs[i]] += activityChanges[i]; + } + + emit MultisigActivityChanged(msg.sender, multisigs, activityChanges); + } +} \ No newline at end of file diff --git a/contracts/contribute/ContributorsProxy.sol b/contracts/contribute/ContributorsProxy.sol new file mode 100644 index 0000000..921887b --- /dev/null +++ b/contracts/contribute/ContributorsProxy.sol @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +/// @dev Zero implementation address. +error ZeroImplementationAddress(); + +/// @dev Zero contributors data. +error ZeroContributorsData(); + +/// @dev Proxy initialization failed. +error InitializationFailed(); + +/* +* This is a Contributors proxy contract. +* Proxy implementation is created based on the Universal Upgradeable Proxy Standard (UUPS) EIP-1822. +* The implementation address must be located in a unique storage slot of the proxy contract. +* The upgrade logic must be located in the implementation contract. +* Special contributors implementation address slot is produced by hashing the "CONTRIBUTORS_PROXY" +* string in order to make the slot unique. +* The fallback() implementation for all the delegatecall-s is inspired by the Gnosis Safe set of contracts. +*/ + +/// @title ContributorsProxy - Smart contract for contributors proxy +/// @author Aleksandr Kuperman - +/// @author Andrey Lebedev - +/// @author Tatiana Priemova - +/// @author David Vilela - +contract ContributorsProxy { + // Code position in storage is keccak256("CONTRIBUTORS_PROXY") = "0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7" + bytes32 public constant CONTRIBUTORS_PROXY = 0x8f33b4c48c4f3159dc130f2111086160da6c94439c147bd337ecee0aa81518c7; + + /// @dev ContributorsProxy constructor. + /// @param implementation Contributors implementation address. + /// @param contributorsData Contributors initialization data. + constructor(address implementation, bytes memory contributorsData) { + // Check for the zero address, since the delegatecall works even with the zero one + if (implementation == address(0)) { + revert ZeroImplementationAddress(); + } + + // Check for the zero data + if (contributorsData.length == 0) { + revert ZeroContributorsData(); + } + + // Store the contributors implementation address + assembly { + sstore(CONTRIBUTORS_PROXY, implementation) + } + // Initialize proxy tokenomics storage + (bool success, ) = implementation.delegatecall(contributorsData); + if (!success) { + revert InitializationFailed(); + } + } + + /// @dev Delegatecall to all the incoming data. + fallback() external { + assembly { + let implementation := sload(CONTRIBUTORS_PROXY) + calldatacopy(0, 0, calldatasize()) + let success := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + if eq(success, 0) { + revert(0, returndatasize()) + } + return(0, returndatasize()) + } + } +} \ No newline at end of file diff --git a/contracts/contribute/interfaces/IContributors.sol b/contracts/contribute/interfaces/IContributors.sol new file mode 100644 index 0000000..ac0e5c6 --- /dev/null +++ b/contracts/contribute/interfaces/IContributors.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +// Contributors interface +interface IContributors { + /// @dev Sets service info for the social id. + /// @param serviceOwner Service owner. + /// @param socialId Social id. + /// @param serviceId Service Id. + /// @param multisig Service multisig address. + /// @param stakingInstance Staking instance address. + function setServiceInfoForId( + address serviceOwner, + uint256 socialId, + uint256 serviceId, + address multisig, + address stakingInstance + ) external; + + /// @dev Gets service info corresponding to a specified service owner. + /// @param serviceOwner Service owner. + /// @return socialId Social Id. + /// @return serviceId Corresponding service Id. + /// @return multisig Corresponding service multisig. + /// @return stakingInstance Staking instance address. + function mapAccountServiceInfo(address serviceOwner) external view + returns (uint256 socialId, uint256 serviceId, address multisig, address stakingInstance); +} diff --git a/contracts/contribute/interfaces/IService.sol b/contracts/contribute/interfaces/IService.sol new file mode 100644 index 0000000..d42b652 --- /dev/null +++ b/contracts/contribute/interfaces/IService.sol @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +// Service registry related interface +interface IService { + struct AgentParams { + // Number of agent instances + uint32 slots; + // Bond per agent instance + uint96 bond; + } + + /// @dev Creates a new service. + /// @param serviceOwner Individual that creates and controls a service. + /// @param token ERC20 token address for the security deposit, or ETH. + /// @param configHash IPFS hash pointing to the config metadata. + /// @param agentIds Canonical agent Ids. + /// @param agentParams Number of agent instances and required bond to register an instance in the service. + /// @param threshold Threshold for a multisig composed by agents. + /// @return serviceId Created service Id. + function create( + address serviceOwner, + address token, + bytes32 configHash, + uint32[] memory agentIds, + AgentParams[] memory agentParams, + uint32 threshold + ) external returns (uint256 serviceId); + + /// @dev Activates the service and its sensitive components. + /// @param serviceId Correspondent service Id. + /// @return success True, if function executed successfully. + function activateRegistration(uint256 serviceId) external payable returns (bool success); + + /// @dev Registers agent instances. + /// @param serviceId Service Id to be updated. + /// @param agentInstances Agent instance addresses. + /// @param agentIds Canonical Ids of the agent correspondent to the agent instance. + /// @return success True, if function executed successfully. + function registerAgents( + uint256 serviceId, + address[] memory agentInstances, + uint32[] memory agentIds + ) external payable returns (bool success); + + /// @dev Creates multisig instance controlled by the set of service agent instances and deploys the service. + /// @param serviceId Correspondent service Id. + /// @param multisigImplementation Multisig implementation address. + /// @param data Data payload for the multisig creation. + /// @return multisig Address of the created multisig. + function deploy( + uint256 serviceId, + address multisigImplementation, + bytes memory data + ) external returns (address multisig); + + /// @dev Gets the serviceRegistry address. + /// @return serviceRegistry address. + function serviceRegistry() external returns (address); + + /// @dev Gets the serviceRegistryTokenUtility address. + /// @return serviceRegistryTokenUtility address. + function serviceRegistryTokenUtility() external returns (address); + + /// @dev Gets the service instance from the map of services. + /// @param serviceId Service Id. + /// @return securityDeposit Registration activation deposit. + /// @return multisig Service multisig address. + /// @return configHash IPFS hashes pointing to the config metadata. + /// @return threshold Agent instance signers threshold. + /// @return maxNumAgentInstances Total number of agent instances. + /// @return numAgentInstances Actual number of agent instances. + /// @return state Service state. + function mapServices(uint256 serviceId) external view returns ( + uint96 securityDeposit, + address multisig, + bytes32 configHash, + uint32 threshold, + uint32 maxNumAgentInstances, + uint32 numAgentInstances, + uint8 state + ); +} diff --git a/contracts/contribute/interfaces/IStaking.sol b/contracts/contribute/interfaces/IStaking.sol new file mode 100644 index 0000000..778412c --- /dev/null +++ b/contracts/contribute/interfaces/IStaking.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +// Staking interface +interface IStaking { + /// @dev Gets service staking token. + /// @return Service staking token address. + function stakingToken() external view returns (address); + + /// @dev Gets minimum service staking deposit value required for staking. + /// @return Minimum service staking deposit. + function minStakingDeposit() external view returns (uint256); + + /// @dev Gets number of required agent instances in the service. + /// @return Number of agent instances. + function numAgentInstances() external view returns (uint256); + + /// @dev Gets the service threshold. + /// @return Threshold. + function threshold() external view returns (uint256); + + /// @dev Stakes the service. + /// @param serviceId Service Id. + function stake(uint256 serviceId) external; + + /// @dev Unstakes the service with collected reward, if available. + /// @param serviceId Service Id. + /// @return reward Staking reward. + function unstake(uint256 serviceId) external returns (uint256); + + /// @dev Claims rewards for the service without an additional checkpoint call. + /// @param serviceId Service Id. + /// @return Staking reward. + function claim(uint256 serviceId) external returns (uint256); + + /// @dev Verifies a service staking contract instance. + /// @param instance Service staking proxy instance. + /// @return True, if verification is successful. + function verifyInstance(address instance) external view returns (bool); +} diff --git a/contracts/contribute/interfaces/IToken.sol b/contracts/contribute/interfaces/IToken.sol new file mode 100644 index 0000000..b17a335 --- /dev/null +++ b/contracts/contribute/interfaces/IToken.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +// ERC20 token interface +interface IToken { + /// @dev Transfers the token amount. + /// @param to Address to transfer to. + /// @param amount The amount to transfer. + /// @return True if the function execution is successful. + function transfer(address to, uint256 amount) external returns (bool); + + /// @dev Transfers the token amount that was previously approved up until the maximum allowance. + /// @param from Account address to transfer from. + /// @param to Account address to transfer to. + /// @param amount Amount to transfer to. + /// @return True if the function execution is successful. + function transferFrom(address from, address to, uint256 amount) external returns (bool); + + /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + /// @param spender Account address that will be able to transfer tokens on behalf of the caller. + /// @param amount Token amount. + /// @return True if the function execution is successful. + function approve(address spender, uint256 amount) external returns (bool); +} + +// ERC721 token interface +interface INFToken { + /// @dev Sets token `id` as the allowance of `spender` over the caller's tokens. + /// @param spender Account address that will be able to transfer the token on behalf of the caller. + /// @param id Token id. + function approve(address spender, uint256 id) external; + + /// @dev Transfers a specified token Id. + /// @param from Account address to transfer from. + /// @param to Account address to transfer to. + /// @param id Token id. + function transferFrom(address from, address to, uint256 id) external; + + /// @dev Transfers a specified token Id with a callback. + /// @param from Account address to transfer from. + /// @param to Account address to transfer to. + /// @param id Token id. + function safeTransferFrom(address from, address to, uint256 id) external; +} \ No newline at end of file diff --git a/contracts/test/ABICreator.sol b/contracts/test/ABICreator.sol index f08ba9d..c168be1 100644 --- a/contracts/test/ABICreator.sol +++ b/contracts/test/ABICreator.sol @@ -4,14 +4,18 @@ pragma solidity ^0.8.25; // Getting ABIs for the Gnosis Safe master copy and proxy contracts import "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol"; import "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol"; +import "@gnosis.pm/safe-contracts/contracts/handler/DefaultCallbackHandler.sol"; import "@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol"; // Getting ABIs for registry contracts -import "../../lib/autonolas-registries/contracts/ComponentRegistry.sol"; -import "../../lib/autonolas-registries/contracts/AgentRegistry.sol"; -import "../../lib/autonolas-registries/contracts/ServiceRegistry.sol"; -import "../../lib/autonolas-registries/contracts/ServiceRegistryTokenUtility.sol"; -import "../../lib/autonolas-registries/contracts/multisigs/GnosisSafeMultisig.sol"; +import {ComponentRegistry} from "../../lib/autonolas-registries/contracts/ComponentRegistry.sol"; +import {AgentRegistry} from "../../lib/autonolas-registries/contracts/AgentRegistry.sol"; +import {ServiceRegistry} from "../../lib/autonolas-registries/contracts/ServiceRegistry.sol"; +import {OperatorWhitelist} from "../../lib/autonolas-registries/contracts/utils/OperatorWhitelist.sol"; +import {ServiceRegistryL2} from "../../lib/autonolas-registries/contracts/ServiceRegistryL2.sol"; +import {ServiceRegistryTokenUtility} from "../../lib/autonolas-registries/contracts/ServiceRegistryTokenUtility.sol"; +import {ServiceManagerToken} from "../../lib/autonolas-registries/contracts/ServiceManagerToken.sol"; +import {GnosisSafeMultisig} from "../../lib/autonolas-registries/contracts/multisigs/GnosisSafeMultisig.sol"; import {StakingFactory} from "../../lib/autonolas-registries/contracts/staking/StakingFactory.sol"; import {StakingToken} from "../../lib/autonolas-registries/contracts/staking/StakingToken.sol"; import {StakingNativeToken} from "../../lib/autonolas-registries/contracts/staking/StakingNativeToken.sol"; diff --git a/hardhat.config.js b/hardhat.config.js index 6a7fc67..db0e789 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -12,8 +12,8 @@ require("@nomicfoundation/hardhat-toolbox"); const ALCHEMY_API_KEY_MAINNET = process.env.ALCHEMY_API_KEY_MAINNET; const ALCHEMY_API_KEY_MATIC = process.env.ALCHEMY_API_KEY_MATIC; -const ALCHEMY_API_KEY_GOERLI = process.env.ALCHEMY_API_KEY_GOERLI; -const ALCHEMY_API_KEY_MUMBAI = process.env.ALCHEMY_API_KEY_MUMBAI; +const ALCHEMY_API_KEY_SEPOLIA = process.env.ALCHEMY_API_KEY_SEPOLIA; +const ALCHEMY_API_KEY_AMOY = process.env.ALCHEMY_API_KEY_AMOY; let TESTNET_MNEMONIC = process.env.TESTNET_MNEMONIC; const accounts = { @@ -32,8 +32,10 @@ if (!TESTNET_MNEMONIC) { const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY; const POLYGONSCAN_API_KEY = process.env.POLYGONSCAN_API_KEY; const GNOSISSCAN_API_KEY = process.env.GNOSISSCAN_API_KEY; -const CHIADOSCAN_API_KEY = "10200"; +const ARBISCAN_API_KEY = process.env.ARBISCAN_API_KEY; const OPSCAN_API_KEY = process.env.OPSCAN_API_KEY; +const BASESCAN_API_KEY = process.env.BASESCAN_API_KEY; +const CELOSCAN_API_KEY = process.env.CELOSCAN_API_KEY; module.exports = { networks: { @@ -55,24 +57,70 @@ module.exports = { accounts: accounts, chainId: 100, }, - goerli: { - url: "https://eth-goerli.g.alchemy.com/v2/" + ALCHEMY_API_KEY_GOERLI, + arbitrumOne: { + url: "https://arb1.arbitrum.io/rpc", accounts: accounts, - chainId: 5, + chainId: 42161, }, - polygonMumbai: { - url: "https://polygon-mumbai.g.alchemy.com/v2/" + ALCHEMY_API_KEY_MUMBAI, + optimistic: { + url: "https://optimism.drpc.org", + accounts: accounts, + chainId: 10, + }, + base: { + url: "https://mainnet.base.org", + accounts: accounts, + chainId: 8453, + }, + celo: { + url: "https://forno.celo.org", accounts: accounts, + chainId: 42220, + }, + mode: { + url: "https://mainnet.mode.network", + accounts: accounts, + chainId: 34443, + }, + sepolia: { + url: "https://eth-sepolia.g.alchemy.com/v2/" + ALCHEMY_API_KEY_SEPOLIA, + accounts: accounts, + chainId: 11155111, + }, + polygonAmoy: { + url: "https://polygon-amoy.g.alchemy.com/v2/" + ALCHEMY_API_KEY_AMOY, + accounts: accounts, + chainId: 80002 }, chiado: { url: "https://rpc.chiadochain.net", accounts: accounts, chainId: 10200 }, - optimistic: { - url: "https://optimism.drpc.org", + arbitrumSepolia: { + url: "https://sepolia-rollup.arbitrum.io/rpc", accounts: accounts, - chainId: 10, + chainId: 421614, + }, + optimisticSepolia: { + url: "https://sepolia.optimism.io", + accounts: accounts, + chainId: 11155420, + }, + baseSepolia: { + url: "https://sepolia.base.org", + accounts: accounts, + chainId: 84532, + }, + celoAlfajores: { + url: "https://alfajores-forno.celo-testnet.org", + accounts: accounts, + chainId: 44787, + }, + modeSepolia: { + url: "https://sepolia.mode.network", + accounts: accounts, + chainId: 919, }, hardhat: { allowUnlimitedContractSize: true @@ -80,6 +128,14 @@ module.exports = { }, etherscan: { customChains: [ + { + network: "polygonAmoy", + chainId: 80002, + urls: { + apiURL: "https://api-amoy.polygonscan.com/api", + browserURL: "https://amoy.polygonscan.com/" + } + }, { network: "chiado", chainId: 10200, @@ -96,6 +152,14 @@ module.exports = { browserURL: "https://gnosisscan.io/" }, }, + { + network: "arbitrumSepolia", + chainId: 421614, + urls: { + apiURL: "https://api-sepolia.arbiscan.io/api", + browserURL: "https://sepolia.arbiscan.io" + }, + }, { network: "optimistic", chainId: 10, @@ -104,21 +168,86 @@ module.exports = { browserURL: "https://optimistic.etherscan.io" }, }, + { + network: "optimisticSepolia", + chainId: 11155420, + urls: { + apiURL: "https://api-sepolia-optimism.etherscan.io/api", + browserURL: "https://sepolia-optimistic.etherscan.io" + }, + }, + { + network: "base", + chainId: 8453, + urls: { + apiURL: "https://api.basescan.org/api", + browserURL: "https://basescan.org" + }, + }, + { + network: "baseSepolia", + chainId: 84532, + urls: { + apiURL: "https://base-sepolia.blockscout.com/api", + browserURL: "https://base-sepolia.blockscout.com/" + }, + }, + { + network: "celo", + chainId: 42220, + urls: { + apiURL: "https://api.celoscan.io/api", + browserURL: "https://explorer.celo.org/" + }, + }, + { + network: "celoAlfajores", + chainId: 44787, + urls: { + apiURL: "https://api-alfajores.celoscan.io/api", + browserURL: "https://alfajores-blockscout.celo-testnet.org/" + }, + }, + { + network: "mode", + chainId: 34443, + urls: { + apiURL: "https://explorer.mode.network/api", + browserURL: "https://explorer.mode.network" + }, + }, + { + network: "modeSepolia", + chainId: 919, + urls: { + apiURL: "https://sepolia.explorer.mode.network/api", + browserURL: "https://sepolia.explorer.mode.network" + }, + }, ], apiKey: { mainnet: ETHERSCAN_API_KEY, polygon: POLYGONSCAN_API_KEY, gnosis: GNOSISSCAN_API_KEY, - goerli: ETHERSCAN_API_KEY, - polygonMumbai: POLYGONSCAN_API_KEY, - chiado: CHIADOSCAN_API_KEY, + arbitrumOne: ARBISCAN_API_KEY, optimistic: OPSCAN_API_KEY, + base: BASESCAN_API_KEY, + celo: CELOSCAN_API_KEY, + sepolia: ETHERSCAN_API_KEY, + polygonAmoy: POLYGONSCAN_API_KEY, + chiado: GNOSISSCAN_API_KEY, + arbitrumSepolia: ARBISCAN_API_KEY, + optimisticSepolia: OPSCAN_API_KEY, + baseSepolia: OPSCAN_API_KEY, + celoAlfajores: CELOSCAN_API_KEY, + mode: OPSCAN_API_KEY, + modeSepolia: OPSCAN_API_KEY, } }, solidity: { compilers: [ { - version: "0.8.25", + version: "0.8.28", settings: { optimizer: { enabled: true, diff --git a/package.json b/package.json index 7129f8c..87da197 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "chai": "^4.3.10", "eslint": "^8.52.0", "ethers": "^5.7.2", - "hardhat": "^2.22.4", + "hardhat": "^2.22.14", "hardhat-contract-sizer": "^2.10.0", "hardhat-deploy": "^0.11.43", "hardhat-deploy-ethers": "^0.3.0-beta.13", diff --git a/scripts/deployment/README.md b/scripts/deployment/README.md index 0531c38..4f48bc1 100644 --- a/scripts/deployment/README.md +++ b/scripts/deployment/README.md @@ -31,14 +31,16 @@ Parameters of the `globals.json` file: liveness (activity). In other words, it's the minimum number of transactions the service multisig needs to perform in order to pass the liveness check. To check this `rewardsPerSecond* livenessPeriod/1e18` should approximate the number of txs required per livenessPeriod. Assuming the number of required tx-s per day is 10, the liveness ratio can be checked by means of [this formula](https://www.wolframalpha.com/input?i=%28115740740740740+*+60+*+60+*+24%29+%2F+10%5E18); -- `mechActivityCheckerAddress`: a mech activity checker contract address that is currently deployed using `agentMechAddress` - and `livenessRatio` values; +- `stakingActivityCheckerAddress`: a basic activity checker contract address that uses only the `livenessRatio` value; +- `singleMechActivityCheckerAddress`: a mech activity checker contract address that uses `agentMechAddress` and `livenessRatio` values; +- `mechActivityCheckerAddress`: a mech activity checker contract address that uses deliveries of `mechMarketplaceAddress` and `livenessRatio` values; +- `requesterActivityCheckerAddress`: a mech activity checker contract address that uses requests of `mechMarketplaceAddress` and `livenessRatio` values; - `stakingTokenAddress`: a staking token implementation address all the instances are created with when deploying a proxy staking contract; - `stakingFactoryAddress`: a staking proxy factory that creates each proxy staking contract; - `stakingParams`: a set of staking contract parameters used to initiate each staking proxy contract. See [here](https://github.com/valory-xyz/autonolas-registries/blob/main/docs/StakingSmartContracts.pdf) for more details. The script file name identifies the number of deployment steps taken from / to the number in the file name. For example: -- `deploy_01_mech_activity_checker.js` will complete step 1. +- `deploy_01_staking_token_instance.js` will complete step 1. Export network-related API keys defined in `hardhat.config.js` file that correspond to the required network. diff --git a/scripts/deployment/deploy_02_staking_token_instance.js b/scripts/deployment/deploy_01_staking_token_instance.js similarity index 96% rename from scripts/deployment/deploy_02_staking_token_instance.js rename to scripts/deployment/deploy_01_staking_token_instance.js index 0e00d8c..2980092 100644 --- a/scripts/deployment/deploy_02_staking_token_instance.js +++ b/scripts/deployment/deploy_01_staking_token_instance.js @@ -51,7 +51,7 @@ async function main() { const stakingToken = await ethers.getContractAt("StakingToken", stakingTokenAddress); // Transaction signing and execution - console.log("21. EOA to deploy StakingTokenInstance via the StakingFactory"); + console.log("1. EOA to deploy StakingTokenInstance via the StakingFactory"); console.log("You are signing the following transaction: StakingFactory.connect(EOA).createStakingInstance()"); const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); const initPayload = stakingToken.interface.encodeFunctionData("initialize", [stakingParams, @@ -77,7 +77,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/verify_02_staking_token_instance.js --network " + providerName + " " + stakingTokenInstanceAddress, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_01_staking_token_instance.js --network " + providerName + " " + stakingTokenInstanceAddress, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/deploy_03_staking_native_token_instance.js b/scripts/deployment/deploy_02_staking_native_token_instance.js similarity index 95% rename from scripts/deployment/deploy_03_staking_native_token_instance.js rename to scripts/deployment/deploy_02_staking_native_token_instance.js index e575452..5a08851 100644 --- a/scripts/deployment/deploy_03_staking_native_token_instance.js +++ b/scripts/deployment/deploy_02_staking_native_token_instance.js @@ -49,7 +49,7 @@ async function main() { const stakingNativeToken = await ethers.getContractAt("StakingNativeToken", stakingNativeTokenAddress); // Transaction signing and execution - console.log("22. EOA to deploy StakingNativeTokenInstance via the StakingFactory"); + console.log("2. EOA to deploy StakingNativeTokenInstance via the StakingFactory"); console.log("You are signing the following transaction: StakingFactory.connect(EOA).createStakingInstance()"); const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); const initPayload = stakingNativeToken.interface.encodeFunctionData("initialize", [stakingParams]); @@ -73,7 +73,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/verify_03_staking_native_token_instance.js --network " + providerName + " " + stakingNativeTokenInstanceAddress, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_02_staking_native_token_instance.js --network " + providerName + " " + stakingNativeTokenInstanceAddress, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/deploy_00_basic_service_staking_activity_checker.js b/scripts/deployment/deploy_03_basic_staking_activity_checker.js similarity index 96% rename from scripts/deployment/deploy_00_basic_service_staking_activity_checker.js rename to scripts/deployment/deploy_03_basic_staking_activity_checker.js index a79ed98..37b0694 100644 --- a/scripts/deployment/deploy_00_basic_service_staking_activity_checker.js +++ b/scripts/deployment/deploy_03_basic_staking_activity_checker.js @@ -53,7 +53,7 @@ async function main() { console.log("EOA is:", deployer); // Transaction signing and execution - console.log("0. EOA to deploy StakingActivityChecker"); + console.log("3. EOA to deploy StakingActivityChecker"); const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); const StakingActivityChecker = await ethers.getContractFactory("StakingActivityChecker"); console.log("You are signing the following transaction: StakingActivityChecker.connect(EOA).deploy()"); @@ -74,7 +74,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/verify_00_basic_service_staking_activity_checker.js --network " + providerName + " " + stakingActivityChecker.address, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_03_basic_service_staking_activity_checker.js --network " + providerName + " " + stakingActivityChecker.address, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/deploy_05_single_mech_activity_checker.js b/scripts/deployment/deploy_04_single_mech_activity_checker.js similarity index 95% rename from scripts/deployment/deploy_05_single_mech_activity_checker.js rename to scripts/deployment/deploy_04_single_mech_activity_checker.js index dab1465..5c8dc61 100644 --- a/scripts/deployment/deploy_05_single_mech_activity_checker.js +++ b/scripts/deployment/deploy_04_single_mech_activity_checker.js @@ -43,7 +43,7 @@ async function main() { console.log("EOA is:", deployer); // Transaction signing and execution - console.log("5. EOA to deploy SingleMechActivityChecker"); + console.log("4. EOA to deploy SingleMechActivityChecker"); const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); const SingleMechActivityChecker = await ethers.getContractFactory("SingleMechActivityChecker"); console.log("You are signing the following transaction: SingleMechActivityChecker.connect(EOA).deploy()"); @@ -65,7 +65,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/verify_05_single_mech_activity_checker.js --network " + providerName + " " + singleMechActivityChecker.address, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_04_single_mech_activity_checker.js --network " + providerName + " " + singleMechActivityChecker.address, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/deploy_01_mech_activity_checker.js b/scripts/deployment/deploy_05_mech_activity_checker.js similarity index 96% rename from scripts/deployment/deploy_01_mech_activity_checker.js rename to scripts/deployment/deploy_05_mech_activity_checker.js index 5543c4b..9608f9e 100644 --- a/scripts/deployment/deploy_01_mech_activity_checker.js +++ b/scripts/deployment/deploy_05_mech_activity_checker.js @@ -43,7 +43,7 @@ async function main() { console.log("EOA is:", deployer); // Transaction signing and execution - console.log("1. EOA to deploy MechActivityChecker"); + console.log("5. EOA to deploy MechActivityChecker"); const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); const MechActivityChecker = await ethers.getContractFactory("MechActivityChecker"); console.log("You are signing the following transaction: MechActivityChecker.connect(EOA).deploy()"); @@ -65,7 +65,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/verify_01_mech_activity_checker.js --network " + providerName + " " + mechActivityChecker.address, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_05_mech_activity_checker.js --network " + providerName + " " + mechActivityChecker.address, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/deploy_04_requester_activity_checker.js b/scripts/deployment/deploy_06_requester_activity_checker.js similarity index 95% rename from scripts/deployment/deploy_04_requester_activity_checker.js rename to scripts/deployment/deploy_06_requester_activity_checker.js index a2d798a..8bd28c3 100644 --- a/scripts/deployment/deploy_04_requester_activity_checker.js +++ b/scripts/deployment/deploy_06_requester_activity_checker.js @@ -43,7 +43,7 @@ async function main() { console.log("EOA is:", deployer); // Transaction signing and execution - console.log("4. EOA to deploy RequesterActivityChecker"); + console.log("6. EOA to deploy RequesterActivityChecker"); const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); const RequesterActivityChecker = await ethers.getContractFactory("RequesterActivityChecker"); console.log("You are signing the following transaction: RequesterActivityChecker.connect(EOA).deploy()"); @@ -65,7 +65,7 @@ async function main() { // Contract verification if (parsedData.contractVerification) { const execSync = require("child_process").execSync; - execSync("npx hardhat verify --constructor-args scripts/deployment/verify_04_requester_activity_checker.js --network " + providerName + " " + requesterActivityChecker.address, { encoding: "utf-8" }); + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_06_requester_activity_checker.js --network " + providerName + " " + requesterActivityChecker.address, { encoding: "utf-8" }); } } diff --git a/scripts/deployment/deploy_07_contributors.js b/scripts/deployment/deploy_07_contributors.js new file mode 100644 index 0000000..aacade7 --- /dev/null +++ b/scripts/deployment/deploy_07_contributors.js @@ -0,0 +1,75 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("7. EOA to deploy Contributors"); + console.log("You are signing the following transaction: Contributors.connect(EOA).deploy()"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const Contributors = await ethers.getContractFactory("Contributors"); + const contributors = await Contributors.connect(EOA).deploy({ gasPrice }); + const result = await contributors.deployed(); + + // Transaction details + console.log("Contract deployment: Contributors"); + console.log("Contract address:", contributors.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.contributorsAddress = contributors.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --network " + providerName + " " + contributors.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/deploy_08_contributors_proxy.js b/scripts/deployment/deploy_08_contributors_proxy.js new file mode 100644 index 0000000..f2b962f --- /dev/null +++ b/scripts/deployment/deploy_08_contributors_proxy.js @@ -0,0 +1,80 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const contributorsAddress = parsedData.contributorsAddress; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Assemble the contributors proxy data + const contributors = await ethers.getContractAt("Contributors", contributorsAddress); + const proxyData = contributors.interface.encodeFunctionData("initialize", []); + + // Transaction signing and execution + console.log("8. EOA to deploy ContributorsProxy"); + console.log("You are signing the following transaction: ContributorsProxy.connect(EOA).deploy()"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const ContributorsProxy = await ethers.getContractFactory("ContributorsProxy"); + const contributorsProxy = await ContributorsProxy.connect(EOA).deploy(contributorsAddress, proxyData, { gasPrice }); + const result = await contributorsProxy.deployed(); + + // Transaction details + console.log("Contract deployment: ContributorsProxy"); + console.log("Contract address:", contributorsProxy.address); + console.log("Transaction:", result.deployTransaction.hash); + + // Wait for half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.contributorsProxyAddress = contributorsProxy.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_08_contributors_proxy.js --network " + providerName + " " + contributorsProxy.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/deploy_09_contribute_manager.js b/scripts/deployment/deploy_09_contribute_manager.js new file mode 100644 index 0000000..3c7a1c4 --- /dev/null +++ b/scripts/deployment/deploy_09_contribute_manager.js @@ -0,0 +1,84 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const contributorsProxyAddress = parsedData.contributorsProxyAddress; + const serviceManagerTokenAddress = parsedData.serviceManagerTokenAddress; + const olasAddress = parsedData.olasAddress; + const stakingFactoryAddress = parsedData.stakingFactoryAddress; + const gnosisSafeMultisigImplementationAddress = parsedData.gnosisSafeMultisigImplementationAddress; + const fallbackHandlerAddress = parsedData.fallbackHandlerAddress; + const agentId = parsedData.agentId; + const configHash = parsedData.configHash; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("9. EOA to deploy ContributeManager"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const ContributeManager = await ethers.getContractFactory("ContributeManager"); + console.log("You are signing the following transaction: ContributeManager.connect(EOA).deploy()"); + const contributeManager = await ContributeManager.connect(EOA).deploy(contributorsProxyAddress, + serviceManagerTokenAddress, olasAddress, stakingFactoryAddress, gnosisSafeMultisigImplementationAddress, + fallbackHandlerAddress, agentId, configHash, { gasPrice }); + const result = await contributeManager.deployed(); + + // Transaction details + console.log("Contract deployment: ContributeManager"); + console.log("Contract address:", contributeManager.address); + console.log("Transaction:", result.deployTransaction.hash); + // Wait half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.contributeManagerAddress = contributeManager.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_09_contribute_manager.js --network " + providerName + " " + contributeManager.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/deploy_10_contribute_activity_checker.js b/scripts/deployment/deploy_10_contribute_activity_checker.js new file mode 100644 index 0000000..701bfb9 --- /dev/null +++ b/scripts/deployment/deploy_10_contribute_activity_checker.js @@ -0,0 +1,77 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const contributorsProxyAddress = parsedData.contributorsProxyAddress; + const livenessRatio = parsedData.livenessRatio; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Transaction signing and execution + console.log("10. EOA to deploy ContributeActivityChecker"); + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + const ContributeActivityChecker = await ethers.getContractFactory("ContributeActivityChecker"); + console.log("You are signing the following transaction: ContributeActivityChecker.connect(EOA).deploy()"); + const contributeActivityChecker = await ContributeActivityChecker.connect(EOA).deploy(contributorsProxyAddress, + livenessRatio, { gasPrice }); + const result = await contributeActivityChecker.deployed(); + + // Transaction details + console.log("Contract deployment: ContributeActivityChecker"); + console.log("Contract address:", contributeActivityChecker.address); + console.log("Transaction:", result.deployTransaction.hash); + // Wait half a minute for the transaction completion + await new Promise(r => setTimeout(r, 30000)); + + // Writing updated parameters back to the JSON file + parsedData.contributeActivityCheckerAddress = contributeActivityChecker.address; + fs.writeFileSync(globalsFile, JSON.stringify(parsedData)); + + // Contract verification + if (parsedData.contractVerification) { + const execSync = require("child_process").execSync; + execSync("npx hardhat verify --constructor-args scripts/deployment/verify_10_contribute_activity_checker.js --network " + providerName + " " + contributeActivityChecker.address, { encoding: "utf-8" }); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/deploy_11_contributors_proxy_change_manager.js b/scripts/deployment/deploy_11_contributors_proxy_change_manager.js new file mode 100644 index 0000000..4f1ec34 --- /dev/null +++ b/scripts/deployment/deploy_11_contributors_proxy_change_manager.js @@ -0,0 +1,66 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const contributorsProxyAddress = parsedData.contributorsProxyAddress; + const contributeManagerAddress = parsedData.contributeManagerAddress; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Get the contributors proxy contract + const contributorsProxy = await ethers.getContractAt("Contributors", contributorsProxyAddress); + + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + + // Transaction signing and execution + console.log("11. EOA to change manager in ContributorsProxy"); + console.log("You are signing the following transaction: ContributorsProxy.connect(EOA).changeManager()"); + const result = await contributorsProxy.changeManager(contributeManagerAddress, { gasPrice }); + + // Transaction details + console.log("Contract deployment: ContributorsProxy"); + console.log("Contract address:", contributorsProxy.address); + console.log("Transaction:", result.hash); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/deploy_12_contributors_proxy_set_contribute_agent_statuses.js b/scripts/deployment/deploy_12_contributors_proxy_set_contribute_agent_statuses.js new file mode 100644 index 0000000..336b285 --- /dev/null +++ b/scripts/deployment/deploy_12_contributors_proxy_set_contribute_agent_statuses.js @@ -0,0 +1,66 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const contributorsProxyAddress = parsedData.contributorsProxyAddress; + const contributeAgentAddress = parsedData.contributeAgentAddress; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Get the contributors proxy contract + const contributorsProxy = await ethers.getContractAt("Contributors", contributorsProxyAddress); + + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + + // Transaction signing and execution + console.log("12. EOA to set contribute agent statuses in ContributorsProxy"); + console.log("You are signing the following transaction: ContributorsProxy.connect(EOA).setContributeAgentStatuses()"); + const result = await contributorsProxy.setContributeAgentStatuses([contributeAgentAddress], [true], { gasPrice }); + + // Transaction details + console.log("Contract deployment: ContributorsProxy"); + console.log("Contract address:", contributorsProxy.address); + console.log("Transaction:", result.hash); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/deploy_13_contributors_proxy_change_owner.js b/scripts/deployment/deploy_13_contributors_proxy_change_owner.js new file mode 100644 index 0000000..72cbdfa --- /dev/null +++ b/scripts/deployment/deploy_13_contributors_proxy_change_owner.js @@ -0,0 +1,66 @@ +/*global process*/ + +const { ethers } = require("hardhat"); +const { LedgerSigner } = require("@anders-t/ethers-ledger"); + +async function main() { + const fs = require("fs"); + const globalsFile = "globals.json"; + const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); + let parsedData = JSON.parse(dataFromJSON); + const useLedger = parsedData.useLedger; + const derivationPath = parsedData.derivationPath; + const providerName = parsedData.providerName; + const gasPriceInGwei = parsedData.gasPriceInGwei; + const contributorsProxyAddress = parsedData.contributorsProxyAddress; + const bridgeMediatorAddress = parsedData.bridgeMediatorAddress; + + let networkURL = parsedData.networkURL; + if (providerName === "polygon") { + if (!process.env.ALCHEMY_API_KEY_MATIC) { + console.log("set ALCHEMY_API_KEY_MATIC env variable"); + } + networkURL += process.env.ALCHEMY_API_KEY_MATIC; + } else if (providerName === "polygonAmoy") { + if (!process.env.ALCHEMY_API_KEY_AMOY) { + console.log("set ALCHEMY_API_KEY_AMOY env variable"); + return; + } + networkURL += process.env.ALCHEMY_API_KEY_AMOY; + } + + const provider = new ethers.providers.JsonRpcProvider(networkURL); + const signers = await ethers.getSigners(); + + let EOA; + if (useLedger) { + EOA = new LedgerSigner(provider, derivationPath); + } else { + EOA = signers[0]; + } + // EOA address + const deployer = await EOA.getAddress(); + console.log("EOA is:", deployer); + + // Get the contributors proxy contract + const contributorsProxy = await ethers.getContractAt("Contributors", contributorsProxyAddress); + + const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); + + // Transaction signing and execution + console.log("13. EOA to change owner in ContributorsProxy"); + console.log("You are signing the following transaction: ContributorsProxy.connect(EOA).changeOwner()"); + const result = await contributorsProxy.changeOwner(bridgeMediatorAddress, { gasPrice }); + + // Transaction details + console.log("Contract deployment: ContributorsProxy"); + console.log("Contract address:", contributorsProxy.address); + console.log("Transaction:", result.hash); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployment/globals_base_mainnet_contribute.json b/scripts/deployment/globals_base_mainnet_contribute.json new file mode 100644 index 0000000..b8bd963 --- /dev/null +++ b/scripts/deployment/globals_base_mainnet_contribute.json @@ -0,0 +1 @@ +{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"base","networkURL":"https://mainnet.base.org","gasPriceInGwei":"2","bridgeMediatorAddress":"0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA","gnosisSafeAddress":"0x69f4D1788e39c87893C980c06EdF4b7f686e2938","gnosisSafeProxyFactoryAddress":"0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC","fallbackHandlerAddress":"0x017062a1dE2FE6b99BE3d9d37841FeD19F573804","olasAddress":"0x54330d28ca3357F294334BDC454a032e7f353416","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistryAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","serviceRegistryTokenUtilityAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5","serviceManagerTokenAddress":"0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b","gnosisSafeMultisigImplementationAddress":"0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac","stakingTokenAddress":"0xEB5638eefE289691EcE01943f768EDBF96258a80","stakingNativeTokenAddress":"","stakingFactoryAddress":"0x1cEe30D08943EB58EFF84DD1AB44a6ee6FEff63a","agentId":"6","configHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","livenessRatio":"700000000000000","contributeActivityCheckerAddress":"","stakingParams":{"metadataHash":"","maxNumServices":"100","rewardsPerSecond":"1000000000000000","minStakingDeposit":"50000000000000000000","minNumStakingPeriods":"3","maxNumInactivityPeriods":"3","livenessPeriod":"86400","timeForEmissions":"2592000","numAgentInstances":"1","agentIds":["14"],"threshold":"0","configHash":"0x0000000000000000000000000000000000000000000000000000000000000000","proxyHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistry":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","activityChecker":""},"contributeAgentAddress":""} \ No newline at end of file diff --git a/scripts/deployment/globals_base_sepolia.json b/scripts/deployment/globals_base_sepolia.json index 579ceb5..f7e7ac4 100644 --- a/scripts/deployment/globals_base_sepolia.json +++ b/scripts/deployment/globals_base_sepolia.json @@ -1 +1 @@ -{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"baseSepolia","networkURL":"https://sepolia.base.org","gasPriceInGwei":"2","gnosisSafeAddress":"0x69f4D1788e39c87893C980c06EdF4b7f686e2938","gnosisSafeProxyFactoryAddress":"0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC","olasAddress":"","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","serviceRegistryTokenUtilityAddress":"0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994","mechActivityCheckerAddress":""} \ No newline at end of file +{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"baseSepolia","networkURL":"https://sepolia.base.org","gasPriceInGwei":"5","gnosisSafeAddress":"0x69f4D1788e39c87893C980c06EdF4b7f686e2938","gnosisSafeProxyFactoryAddress":"0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC","bridgeMediatorAddress":"0xeDd71796B90eaCc56B074C39BAC90ED2Ca6D93Ee","olasAddress":"0x54330d28ca3357F294334BDC454a032e7f353416","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","serviceRegistryTokenUtilityAddress":"0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994","serviceManagerTokenAddress":"0x5BA58970c2Ae16Cf6218783018100aF2dCcFc915","gnosisSafeMultisigImplementationAddress":"0x19936159B528C66750992C3cBcEd2e71cF4E4824","gnosisSafeSameAddressMultisigImplementationAddress":"0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2","fallbackHandlerAddress":"0x017062a1dE2FE6b99BE3d9d37841FeD19F573804","stakingFactoryAddress":"0x1cEe30D08943EB58EFF84DD1AB44a6ee6FEff63a","agentId":"6","configHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","livenessRatio":"700000000000000","contributorsAddress":"0xadBBC3FE82836366Bb178Fd210d4dd915e9B3415","contributeActivityCheckerAddress":"0x4cEB52802ef86edF8796632546d89e55c87a0901","contributorsProxyAddress":"0xd6AA4Ec948d84f6Db8EEf25104CeE0Ecd280C74e","contributeManagerAddress":"0x95dA0F8C3eC5D40209f0EF1ED5E61deD28307d8d"} \ No newline at end of file diff --git a/scripts/deployment/globals_mode_mainnet_optimus_alpha.json b/scripts/deployment/globals_mode_mainnet_optimus_alpha.json new file mode 100644 index 0000000..809ed91 --- /dev/null +++ b/scripts/deployment/globals_mode_mainnet_optimus_alpha.json @@ -0,0 +1,38 @@ +{ + "contractVerification":true, + "useLedger":true, + "derivationPath":"m/44'/60'/2'/0/0", + "providerName":"mode", + "networkURL":"https://mainnet.mode.network", + "gasPriceInGwei":"1", + "gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552", + "gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2", + "serviceRegistryAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE", + "serviceRegistryTokenUtilityAddress":"0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5", + "olasAddress":"0xcfD1D50ce23C46D3Cf6407487B2F8934e96DC8f9", + "multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000", + "stakingNativeTokenAddress":"0x88DE734655184a09B70700aE4F72364d1ad23728", + "stakingTokenAddress":"0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA", + "livenessRatio":"46296296296296", + "stakingActivityCheckerAddress":"", + "stakingFactoryAddress":"0x75D529FAe220bC8db714F0202193726b46881B76", + "stakingParams": + { + "metadataHash":"", + "maxNumServices":"10", + "rewardsPerSecond":"1649305555557", + "minStakingDeposit":"20000000000000000000", + "minNumStakingPeriods":"3", + "maxNumInactivityPeriods":"2", + "livenessPeriod":"86400", + "timeForEmissions":"2592000", + "numAgentInstances":"1", + "agentIds":[], + "threshold":"0", + "configHash":"0x0000000000000000000000000000000000000000000000000000000000000000", + "proxyHash":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000", + "serviceRegistry":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE", + "activityChecker":"" + }, + "stakingTokenInstanceAddress":"" +} \ No newline at end of file diff --git a/scripts/deployment/verify_02_staking_token_instance.js b/scripts/deployment/verify_01_staking_token_instance.js similarity index 100% rename from scripts/deployment/verify_02_staking_token_instance.js rename to scripts/deployment/verify_01_staking_token_instance.js diff --git a/scripts/deployment/verify_03_staking_native_token_instance.js b/scripts/deployment/verify_02_staking_native_token_instance.js similarity index 100% rename from scripts/deployment/verify_03_staking_native_token_instance.js rename to scripts/deployment/verify_02_staking_native_token_instance.js diff --git a/scripts/deployment/verify_00_basic_service_staking_activity_checker.js b/scripts/deployment/verify_03_basic_service_staking_activity_checker.js similarity index 100% rename from scripts/deployment/verify_00_basic_service_staking_activity_checker.js rename to scripts/deployment/verify_03_basic_service_staking_activity_checker.js diff --git a/scripts/deployment/verify_05_single_mech_activity_checker.js b/scripts/deployment/verify_04_single_mech_activity_checker.js similarity index 100% rename from scripts/deployment/verify_05_single_mech_activity_checker.js rename to scripts/deployment/verify_04_single_mech_activity_checker.js diff --git a/scripts/deployment/verify_01_mech_activity_checker.js b/scripts/deployment/verify_05_mech_activity_checker.js similarity index 100% rename from scripts/deployment/verify_01_mech_activity_checker.js rename to scripts/deployment/verify_05_mech_activity_checker.js diff --git a/scripts/deployment/verify_04_requester_activity_checker.js b/scripts/deployment/verify_06_requester_activity_checker.js similarity index 100% rename from scripts/deployment/verify_04_requester_activity_checker.js rename to scripts/deployment/verify_06_requester_activity_checker.js diff --git a/scripts/deployment/verify_08_contributors_proxy.js b/scripts/deployment/verify_08_contributors_proxy.js new file mode 100644 index 0000000..ead937b --- /dev/null +++ b/scripts/deployment/verify_08_contributors_proxy.js @@ -0,0 +1,11 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); +const contributorsAddress = parsedData.contributorsAddress; +const proxyData = "0x8129fc1c"; // initialize() + +module.exports = [ + contributorsAddress, + proxyData +]; \ No newline at end of file diff --git a/scripts/deployment/verify_09_contribute_manager.js b/scripts/deployment/verify_09_contribute_manager.js new file mode 100644 index 0000000..3b45fd1 --- /dev/null +++ b/scripts/deployment/verify_09_contribute_manager.js @@ -0,0 +1,23 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); +const contributorsProxyAddress = parsedData.contributorsProxyAddress; +const serviceManagerTokenAddress = parsedData.serviceManagerTokenAddress; +const olasAddress = parsedData.olasAddress; +const stakingFactoryAddress = parsedData.stakingFactoryAddress; +const gnosisSafeMultisigImplementationAddress = parsedData.gnosisSafeMultisigImplementationAddress; +const fallbackHandlerAddress = parsedData.fallbackHandlerAddress; +const agentId = parsedData.agentId; +const configHash = parsedData.configHash; + +module.exports = [ + contributorsProxyAddress, + serviceManagerTokenAddress, + olasAddress, + stakingFactoryAddress, + gnosisSafeMultisigImplementationAddress, + fallbackHandlerAddress, + agentId, + configHash +]; \ No newline at end of file diff --git a/scripts/deployment/verify_10_contribute_activity_checker.js b/scripts/deployment/verify_10_contribute_activity_checker.js new file mode 100644 index 0000000..b2c59e9 --- /dev/null +++ b/scripts/deployment/verify_10_contribute_activity_checker.js @@ -0,0 +1,11 @@ +const fs = require("fs"); +const globalsFile = "globals.json"; +const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); +const parsedData = JSON.parse(dataFromJSON); +const contributorsProxyAddress = parsedData.contributorsProxyAddress; +const livenessRatio = parsedData.livenessRatio; + +module.exports = [ + contributorsProxyAddress, + livenessRatio +]; \ No newline at end of file diff --git a/test/StakingContribute.js b/test/StakingContribute.js new file mode 100644 index 0000000..9b6e699 --- /dev/null +++ b/test/StakingContribute.js @@ -0,0 +1,545 @@ +/*global describe, context, beforeEach, it*/ +const { expect } = require("chai"); +const { ethers } = require("hardhat"); +const helpers = require("@nomicfoundation/hardhat-network-helpers"); +const safeContracts = require("@gnosis.pm/safe-contracts"); + +describe.only("Staking Contribute", function () { + let componentRegistry; + let agentRegistry; + let serviceRegistry; + let serviceRegistryTokenUtility; + let operatorWhitelist; + let serviceManager; + let token; + let gnosisSafe; + let gnosisSafeProxyFactory; + let fallbackHandler; + let gnosisSafeMultisig; + let stakingFactory; + let contributors; + let contributorsProxy; + let contributeManager; + let contributeActivityChecker; + let stakingTokenImplementation; + let stakingToken; + let signers; + let deployer; + let operator; + let agentInstances; + let bytecodeHash; + const AddressZero = ethers.constants.AddressZero; + const HashZero = ethers.constants.HashZero; + const defaultHash = "0x" + "5".repeat(64); + const regDeposit = 1000; + const regBond = 1000; + const serviceId = 1; + const agentId = 1; + let socialId = 1; + const agentIds = [1]; + const agentParams = [[1, regBond]]; + const threshold = 1; + const livenessPeriod = 10; // Ten seconds + const initSupply = "5" + "0".repeat(26); + const payload = "0x"; + const livenessRatio = "1" + "0".repeat(16); // 0.01 transaction per second (TPS) + let serviceParams = { + metadataHash: defaultHash, + maxNumServices: 3, + rewardsPerSecond: "1" + "0".repeat(15), + minStakingDeposit: regDeposit, + minNumStakingPeriods: 3, + maxNumInactivityPeriods: 3, + livenessPeriod: livenessPeriod, // Ten seconds + timeForEmissions: 100, + numAgentInstances: 1, + agentIds: [], + threshold: 1, + configHash: HashZero, + proxyHash: HashZero, + serviceRegistry: AddressZero, + activityChecker: AddressZero + }; + const maxInactivity = serviceParams.maxNumInactivityPeriods * livenessPeriod + 1; + + beforeEach(async function () { + signers = await ethers.getSigners(); + deployer = signers[0]; + operator = signers[1]; + agentInstances = [signers[2], signers[3], signers[4]]; + + const ServiceRegistry = await ethers.getContractFactory("ServiceRegistryL2"); + serviceRegistry = await ServiceRegistry.deploy("Service Registry L2", "SERVICE", "https://localhost/service/"); + await serviceRegistry.deployed(); + serviceParams.serviceRegistry = serviceRegistry.address; + + const ServiceRegistryTokenUtility = await ethers.getContractFactory("ServiceRegistryTokenUtility"); + serviceRegistryTokenUtility = await ServiceRegistryTokenUtility.deploy(serviceRegistry.address); + await serviceRegistry.deployed(); + + const OperatorWhitelist = await ethers.getContractFactory("OperatorWhitelist"); + operatorWhitelist = await OperatorWhitelist.deploy(serviceRegistry.address); + await operatorWhitelist.deployed(); + + const ServiceManagerToken = await ethers.getContractFactory("ServiceManagerToken"); + serviceManager = await ServiceManagerToken.deploy(serviceRegistry.address, serviceRegistryTokenUtility.address, + operatorWhitelist.address); + await serviceManager.deployed(); + + const Token = await ethers.getContractFactory("ERC20Token"); + token = await Token.deploy(); + await token.deployed(); + + const GnosisSafe = await ethers.getContractFactory("GnosisSafe"); + gnosisSafe = await GnosisSafe.deploy(); + await gnosisSafe.deployed(); + + const GnosisSafeProxyFactory = await ethers.getContractFactory("GnosisSafeProxyFactory"); + gnosisSafeProxyFactory = await GnosisSafeProxyFactory.deploy(); + await gnosisSafeProxyFactory.deployed(); + + const FallbackHandler = await ethers.getContractFactory("DefaultCallbackHandler"); + fallbackHandler = await FallbackHandler.deploy(); + await fallbackHandler.deployed(); + + const GnosisSafeMultisig = await ethers.getContractFactory("GnosisSafeMultisig"); + gnosisSafeMultisig = await GnosisSafeMultisig.deploy(gnosisSafe.address, gnosisSafeProxyFactory.address); + await gnosisSafeMultisig.deployed(); + + const GnosisSafeProxy = await ethers.getContractFactory("GnosisSafeProxy"); + const gnosisSafeProxy = await GnosisSafeProxy.deploy(gnosisSafe.address); + await gnosisSafeProxy.deployed(); + const bytecode = await ethers.provider.getCode(gnosisSafeProxy.address); + bytecodeHash = ethers.utils.keccak256(bytecode); + serviceParams.proxyHash = bytecodeHash; + + const StakingFactory = await ethers.getContractFactory("StakingFactory"); + stakingFactory = await StakingFactory.deploy(AddressZero); + await stakingFactory.deployed(); + + const Contributors = await ethers.getContractFactory("Contributors"); + contributors = await Contributors.deploy(); + await contributors.deployed(); + + const ContributorsProxy = await ethers.getContractFactory("ContributorsProxy"); + const proxyData = contributors.interface.encodeFunctionData("initialize", []); + contributorsProxy = await ContributorsProxy.deploy(contributors.address, proxyData); + await contributorsProxy.deployed(); + contributors = await ethers.getContractAt("Contributors", contributorsProxy.address); + + const ContributeManager = await ethers.getContractFactory("ContributeManager"); + contributeManager = await ContributeManager.deploy(contributorsProxy.address, serviceManager.address, + token.address, stakingFactory.address, gnosisSafeMultisig.address, fallbackHandler.address, + agentId, defaultHash); + + const ContributeActivityChecker = await ethers.getContractFactory("ContributeActivityChecker"); + contributeActivityChecker = await ContributeActivityChecker.deploy(contributorsProxy.address, livenessRatio); + await contributeActivityChecker.deployed(); + serviceParams.activityChecker = contributeActivityChecker.address; + + const StakingToken = await ethers.getContractFactory("StakingToken"); + stakingTokenImplementation = await StakingToken.deploy(); + const initPayload = stakingTokenImplementation.interface.encodeFunctionData("initialize", + [serviceParams, serviceRegistryTokenUtility.address, token.address]); + const tx = await stakingFactory.createStakingInstance(stakingTokenImplementation.address, initPayload); + const res = await tx.wait(); + // Get staking contract instance address from the event + const stakingTokenAddress = "0x" + res.logs[0].topics[2].slice(26); + stakingToken = await ethers.getContractAt("StakingToken", stakingTokenAddress); + + // Set service manager + await serviceRegistry.changeManager(serviceManager.address); + await serviceRegistryTokenUtility.changeManager(serviceManager.address); + + // Mint tokens to the service owner and the operator + await token.mint(deployer.address, initSupply); + await token.mint(operator.address, initSupply); + + // Whitelist gnosis multisig implementations + await serviceRegistry.changeMultisigPermission(gnosisSafeMultisig.address, true); + + // Set the manager of contributorsProxy + await contributors.changeManager(contributeManager.address); + + // Set deployer address to be the agent + await contributors.setContributeServiceStatuses([deployer.address], [true]); + + // Fund the staking contract + await token.approve(stakingTokenAddress, ethers.utils.parseEther("1")); + await stakingToken.deposit(ethers.utils.parseEther("1")); + }); + + context("Initialization", function () { + it("Ownership violations", async function () { + // Trying to change owner from a non-owner account address + await expect( + contributors.connect(operator).changeOwner(operator.address) + ).to.be.revertedWithCustomError(serviceRegistry, "OwnerOnly"); + + // Trying to change owner for the zero address + await expect( + contributors.connect(deployer).changeOwner(AddressZero) + ).to.be.revertedWithCustomError(serviceRegistry, "ZeroAddress"); + + // Changing the owner + await contributors.connect(deployer).changeOwner(operator.address); + + // Trying to change owner from the previous owner address + await expect( + contributors.connect(deployer).changeOwner(deployer.address) + ).to.be.revertedWithCustomError(serviceRegistry, "OwnerOnly"); + + // Change the owner back + await contributors.connect(operator).changeOwner(deployer.address); + + // Trying to change manager from a non-owner account address + await expect( + contributors.connect(operator).changeManager(operator.address) + ).to.be.revertedWithCustomError(serviceRegistry, "OwnerOnly"); + + // Trying to change manager for the zero address + await expect( + contributors.connect(deployer).changeManager(AddressZero) + ).to.be.revertedWithCustomError(serviceRegistry, "ZeroAddress"); + + // Try to increase the service activity not by the whitelisted service multisig + await expect( + contributors.connect(operator).increaseActivity([deployer.address], [10]) + ).to.be.revertedWithCustomError(contributors, "UnauthorizedAccount"); + // Wrong array lengths + await expect( + contributors.increaseActivity([], [10]) + ).to.be.revertedWithCustomError(contributors, "WrongArrayLength"); + await expect( + contributors.increaseActivity([deployer.address], []) + ).to.be.revertedWithCustomError(contributors, "WrongArrayLength"); + + // Try to set contribute service multisig statuses not by the owner + await expect( + contributors.connect(operator).setContributeServiceStatuses([deployer.address], [true]) + ).to.be.revertedWithCustomError(contributors, "OwnerOnly"); + // Wrong array lengths + await expect( + contributors.setContributeServiceStatuses([], [true]) + ).to.be.revertedWithCustomError(contributors, "WrongArrayLength"); + await expect( + contributors.setContributeServiceStatuses([deployer.address], []) + ).to.be.revertedWithCustomError(contributors, "WrongArrayLength"); + // Zero addresses + await expect( + contributors.setContributeServiceStatuses([AddressZero], [true]) + ).to.be.revertedWithCustomError(contributors, "ZeroAddress"); + + // Try to set service info not by the manager + await expect( + contributors.setServiceInfoForId(deployer.address, 1, 1, deployer.address, deployer.address) + ).to.be.revertedWithCustomError(contributors, "ManagerOnly"); + + // Try to re-initialize the proxy + await expect( + contributors.initialize() + ).to.be.revertedWithCustomError(contributors, "AlreadyInitialized"); + + // Try to change implementation not by the owner + await expect( + contributors.connect(operator).changeImplementation(deployer.address) + ).to.be.revertedWithCustomError(contributors, "OwnerOnly"); + // Try to change implementation to the zero address + await expect( + contributors.changeImplementation(AddressZero) + ).to.be.revertedWithCustomError(contributors, "ZeroAddress"); + + // Change implementation + await contributors.changeImplementation(deployer.address); + + // Proxy creation failure + const ContributorsProxy = await ethers.getContractFactory("ContributorsProxy"); + await expect( + ContributorsProxy.deploy(AddressZero, payload) + ).to.be.revertedWithCustomError(contributorsProxy, "ZeroImplementationAddress"); + await expect( + ContributorsProxy.deploy(deployer.address, payload) + ).to.be.revertedWithCustomError(contributorsProxy, "ZeroContributorsData"); + }); + + it("Failing to initialize with wrong parameters", async function () { + const ContributeManager = await ethers.getContractFactory("ContributeManager"); + await expect( + ContributeManager.deploy(AddressZero, serviceManager.address, + token.address, stakingFactory.address, gnosisSafeMultisig.address, fallbackHandler.address, + agentId, defaultHash) + ).to.be.revertedWithCustomError(contributeManager, "ZeroAddress"); + await expect( + ContributeManager.deploy(contributorsProxy.address, AddressZero, + token.address, stakingFactory.address, gnosisSafeMultisig.address, fallbackHandler.address, + agentId, defaultHash) + ).to.be.revertedWithCustomError(contributeManager, "ZeroAddress"); + await expect( + ContributeManager.deploy(contributorsProxy.address, serviceManager.address, + AddressZero, stakingFactory.address, gnosisSafeMultisig.address, fallbackHandler.address, + agentId, defaultHash) + ).to.be.revertedWithCustomError(contributeManager, "ZeroAddress"); + await expect( + ContributeManager.deploy(contributorsProxy.address, serviceManager.address, + token.address, AddressZero, gnosisSafeMultisig.address, fallbackHandler.address, + agentId, defaultHash) + ).to.be.revertedWithCustomError(contributeManager, "ZeroAddress"); + await expect( + ContributeManager.deploy(contributorsProxy.address, serviceManager.address, + token.address, stakingFactory.address, AddressZero, fallbackHandler.address, + agentId, defaultHash) + ).to.be.revertedWithCustomError(contributeManager, "ZeroAddress"); + await expect( + ContributeManager.deploy(contributorsProxy.address, serviceManager.address, + token.address, stakingFactory.address, gnosisSafeMultisig.address, AddressZero, + agentId, defaultHash) + ).to.be.revertedWithCustomError(contributeManager, "ZeroAddress"); + await expect( + ContributeManager.deploy(contributorsProxy.address, serviceManager.address, + token.address, stakingFactory.address, gnosisSafeMultisig.address, fallbackHandler.address, + 0, defaultHash) + ).to.be.revertedWithCustomError(contributeManager, "ZeroValue"); + await expect( + ContributeManager.deploy(contributorsProxy.address, serviceManager.address, + token.address, stakingFactory.address, gnosisSafeMultisig.address, fallbackHandler.address, + agentId, HashZero) + ).to.be.revertedWithCustomError(contributeManager, "ZeroValue"); + + const ContributeActivityChecker = await ethers.getContractFactory("ContributeActivityChecker"); + await expect( + ContributeActivityChecker.deploy(AddressZero, livenessRatio) + ).to.be.revertedWithCustomError(ContributeActivityChecker, "ZeroAddress"); + await expect( + ContributeActivityChecker.deploy(contributorsProxy.address, 0) + ).to.be.revertedWithCustomError(ContributeActivityChecker, "ZeroValue"); + }); + }); + + context("Contribute manager", function () { + it("Create and stake", async function () { + // Approve OLAS for contributeManager + await token.approve(contributeManager.address, serviceParams.minStakingDeposit * 2); + + // Create and stake the service + await contributeManager.createAndStake(socialId, stakingToken.address, {value: 2}); + }); + + it("Mint, stake, unstake and stake again", async function () { + // Take a snapshot of the current state of the blockchain + const snapshot = await helpers.takeSnapshot(); + + // Approve OLAS for contributeManager + await token.approve(contributeManager.address, serviceParams.minStakingDeposit * 2); + + // Create and stake the service + await contributeManager.createAndStake(socialId, stakingToken.address, {value: 2}); + + // Increase the time while the service does not reach the required amount of transactions per second (TPS) + await helpers.time.increase(maxInactivity); + + // Unstake the service + await contributeManager.unstake(); + + // Approve the service for the contributeManager + await serviceRegistry.approve(contributeManager.address, serviceId); + + // Stake the service again + await contributeManager.stake(socialId, serviceId, stakingToken.address); + + // Restore a previous state of blockchain + snapshot.restore(); + }); + + it("Mint, stake, perform activity, claim", async function () { + // Take a snapshot of the current state of the blockchain + const snapshot = await helpers.takeSnapshot(); + + // Approve OLAS for contributeManager + await token.approve(contributeManager.address, serviceParams.minStakingDeposit * 2); + + // Create and stake the service + await contributeManager.createAndStake(socialId, stakingToken.address, {value: 2}); + + // Get the user data + const serviceInfo = await contributors.mapAccountServiceInfo(deployer.address); + + // Perform the service activity + await contributors.increaseActivity([serviceInfo.multisig], [10]); + + // Increase the time until the next staking epoch + await helpers.time.increase(livenessPeriod); + + // Call the checkpoint + await stakingToken.checkpoint(); + + const balanceBefore = ethers.BigNumber.from(await token.balanceOf(serviceInfo.multisig)); + + // Claim rewards + await contributeManager.claim(); + + const balanceAfter = ethers.BigNumber.from(await token.balanceOf(serviceInfo.multisig)); + // The balance before and after the claim must be different + expect(balanceAfter).to.gt(balanceBefore); + + // Restore a previous state of blockchain + snapshot.restore(); + }); + + it("Should fail when executing with incorrect values and states", async function () { + // Take a snapshot of the current state of the blockchain + const snapshot = await helpers.takeSnapshot(); + + // Approve OLAS for contributeManager + await token.approve(contributeManager.address, serviceParams.minStakingDeposit * 2); + + // Try to create a new service with zero social Id + await expect( + contributeManager.createAndStake(0, stakingToken.address, {value: 2}) + ).to.be.revertedWithCustomError(contributeManager, "ZeroValue"); + + // Try to create and stake a new service with wrong staking instance + await expect( + contributeManager.createAndStake(socialId, deployer.address, {value: 2}) + ).to.be.revertedWithCustomError(contributeManager, "WrongStakingInstance"); + + // Create and stake the service + await contributeManager.createAndStake(socialId, stakingToken.address, {value: 2}); + + // Try to create the service again + await expect( + contributeManager.createAndStake(socialId, stakingToken.address, {value: 2}) + ).to.be.revertedWithCustomError(contributeManager, "ServiceAlreadyStaked"); + + // Try to stake the service again + await expect( + contributeManager.stake(socialId, serviceId, stakingToken.address) + ).to.be.revertedWithCustomError(contributeManager, "ServiceAlreadyStaked"); + + // Increase the time while the service does not reach the required amount of transactions per second (TPS) + await helpers.time.increase(maxInactivity); + + // Unstake the service + await contributeManager.unstake(); + + // Try to unstake again + await expect( + contributeManager.unstake() + ).to.be.revertedWithCustomError(contributeManager, "ServiceNotDefined"); + + // Try to claim the unstaked service + await expect( + contributeManager.claim() + ).to.be.revertedWithCustomError(contributeManager, "ServiceNotDefined"); + + // Approve more OLAS for contributeManager + await token.approve(serviceRegistryTokenUtility.address, serviceParams.minStakingDeposit * 3); + await token.connect(operator).approve(serviceRegistryTokenUtility.address, serviceParams.minStakingDeposit * 3); + + // Create wrong service setup + await serviceManager.create(deployer.address, token.address, defaultHash, agentIds, agentParams, threshold); + await serviceManager.activateRegistration(serviceId + 1, {value: 1}); + await serviceManager.connect(operator).registerAgents(serviceId + 1, [agentInstances[0].address], agentIds, {value: 1}); + await serviceManager.deploy(serviceId + 1, gnosisSafeMultisig.address, payload); + + // Approve service for the contribute manager + await serviceRegistry.approve(contributeManager.address, serviceId + 1); + + // Try to stake with wrong parameters + await expect( + contributeManager.stake(socialId, serviceId + 1, stakingToken.address) + ).to.be.revertedWithCustomError(contributeManager, "WrongServiceSetup"); + + // Create another wrong service setup + await serviceManager.create(deployer.address, token.address, defaultHash, agentIds, [[2, regBond]], 2); + await serviceManager.activateRegistration(serviceId + 2, {value: 1}); + await serviceManager.connect(operator).registerAgents(serviceId + 2, [agentInstances[1].address, agentInstances[2].address], + [agentId, agentId], {value: 2}); + await serviceManager.deploy(serviceId + 2, gnosisSafeMultisig.address, payload); + + // Approve service for the contribute manager + await serviceRegistry.approve(contributeManager.address, serviceId + 2); + + // Try to stake with wrong parameters + await expect( + contributeManager.stake(socialId, serviceId + 2, stakingToken.address) + ).to.be.revertedWithCustomError(contributeManager, "WrongServiceSetup"); + + // Approve the service for the contributeManager + await serviceRegistry.approve(contributeManager.address, serviceId); + + // Stake the service again + await contributeManager.stake(socialId, serviceId, stakingToken.address); + + // Restore a previous state of blockchain + snapshot.restore(); + }); + + it("Should fail when staking with a wrong instance", async function () { + // Approve OLAS for contributeManager + await token.approve(contributeManager.address, serviceParams.minStakingDeposit * 2); + + // Deploy a staking contract with max number of services equal to one + const testServiceParams = JSON.parse(JSON.stringify(serviceParams)); + testServiceParams.numAgentInstances = 2; + + let initPayload = stakingTokenImplementation.interface.encodeFunctionData("initialize", + [testServiceParams, serviceRegistryTokenUtility.address, token.address]); + let tx = await stakingFactory.createStakingInstance(stakingTokenImplementation.address, initPayload); + let res = await tx.wait(); + // Get staking contract instance address from the event + let stakingTokenAddress = "0x" + res.logs[0].topics[2].slice(26); + + // Fund the staking contract + let testStakingToken = await ethers.getContractAt("StakingToken", stakingTokenAddress); + await token.approve(stakingTokenAddress, ethers.utils.parseEther("1")); + await testStakingToken.deposit(ethers.utils.parseEther("1")); + + // Try to create and stake a new service with wrong num agent instances + await expect( + contributeManager.createAndStake(socialId, stakingTokenAddress, {value: 2}) + ).to.be.revertedWithCustomError(contributeManager, "WrongStakingInstance"); + + // Reset number of agent isntances and update threshold + testServiceParams.numAgentInstances = 1; + testServiceParams.threshold = 2; + + initPayload = stakingTokenImplementation.interface.encodeFunctionData("initialize", + [testServiceParams, serviceRegistryTokenUtility.address, token.address]); + tx = await stakingFactory.createStakingInstance(stakingTokenImplementation.address, initPayload); + res = await tx.wait(); + // Get staking contract instance address from the event + stakingTokenAddress = "0x" + res.logs[0].topics[2].slice(26); + + // Fund the staking contract + testStakingToken = await ethers.getContractAt("StakingToken", stakingTokenAddress); + await token.approve(stakingTokenAddress, ethers.utils.parseEther("1")); + await testStakingToken.deposit(ethers.utils.parseEther("1")); + + // Try to create and stake a new service with wrong threshold + await expect( + contributeManager.createAndStake(socialId, stakingTokenAddress, {value: 2}) + ).to.be.revertedWithCustomError(contributeManager, "WrongStakingInstance"); + + // Reset threshold + testServiceParams.threshold = 1; + + // Update the token address + initPayload = stakingTokenImplementation.interface.encodeFunctionData("initialize", + [testServiceParams, serviceRegistryTokenUtility.address, deployer.address]); + tx = await stakingFactory.createStakingInstance(stakingTokenImplementation.address, initPayload); + res = await tx.wait(); + // Get staking contract instance address from the event + stakingTokenAddress = "0x" + res.logs[0].topics[2].slice(26); + + // Fund the staking contract + testStakingToken = await ethers.getContractAt("StakingToken", stakingTokenAddress); + await token.approve(stakingTokenAddress, ethers.utils.parseEther("1")); + await testStakingToken.deposit(ethers.utils.parseEther("1")); + + // Try to create and stake a new service with wrong token + await expect( + contributeManager.createAndStake(socialId, stakingTokenAddress, {value: 2}) + ).to.be.revertedWithCustomError(contributeManager, "WrongStakingInstance"); + }); + }); +}); diff --git a/yarn.lock b/yarn.lock index 8967b49..493d428 100644 --- a/yarn.lock +++ b/yarn.lock @@ -675,53 +675,53 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@nomicfoundation/edr-darwin-arm64@0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.3.8.tgz#09de1f03c0336670fce959f376f0fe9137545836" - integrity sha512-eB0leCexS8sQEmfyD72cdvLj9djkBzQGP4wSQw6SNf2I4Sw4Cnzb3d45caG2FqFFjbvfqL0t+badUUIceqQuMw== - -"@nomicfoundation/edr-darwin-x64@0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.3.8.tgz#c3ca237c74ed3b6fb800fd7f1de7174f4ad24f72" - integrity sha512-JksVCS1N5ClwVF14EvO25HCQ+Laljh/KRfHERMVAC9ZwPbTuAd/9BtKvToCBi29uCHWqsXMI4lxCApYQv2nznw== - -"@nomicfoundation/edr-linux-arm64-gnu@0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.3.8.tgz#08bd367789e745f4e78a8a87368fc470eea8a7de" - integrity sha512-raCE+fOeNXhVBLUo87cgsHSGvYYRB6arih4eG6B9KGACWK5Veebtm9xtKeiD8YCsdUlUfat6F7ibpeNm91fpsA== - -"@nomicfoundation/edr-linux-arm64-musl@0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.3.8.tgz#9cab5cbec0052cb5812c6c66c463d28a756cd916" - integrity sha512-PwiDp4wBZWMCIy29eKkv8moTKRrpiSDlrc+GQMSZLhOAm8T33JKKXPwD/2EbplbhCygJDGXZdtEKl9x9PaH66A== - -"@nomicfoundation/edr-linux-x64-gnu@0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.3.8.tgz#d4a11b6ebcd1b29d7431d185c6df3e65a2cd4bde" - integrity sha512-6AcvA/XKoipGap5jJmQ9Y6yT7Uf39D9lu2hBcDCXnXbMcXaDGw4mn1/L4R63D+9VGZyu1PqlcJixCUZlGGIWlg== - -"@nomicfoundation/edr-linux-x64-musl@0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.3.8.tgz#b8eef960d06380a365866ddd1e97ecb7fbf6bd70" - integrity sha512-cxb0sEmZjlwhYWO28sPsV64VDx31ekskhC1IsDXU1p9ntjHSJRmW4KEIqJ2O3QwJap/kLKfMS6TckvY10gjc6w== - -"@nomicfoundation/edr-win32-x64-msvc@0.3.8": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.3.8.tgz#ac7061aeb07cc847c429513080b76bb05297a869" - integrity sha512-yVuVPqRRNLZk7TbBMkKw7lzCvI8XO8fNTPTYxymGadjr9rEGRuNTU1yBXjfJ59I1jJU/X2TSkRk1OFX0P5tpZQ== - -"@nomicfoundation/edr@^0.3.7": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.3.8.tgz#28fe7ae4f462ae74a16cd1a714ff7b1cd9c22b4c" - integrity sha512-u2UJ5QpznSHVkZRh6ePWoeVb6kmPrrqh08gCnZ9FHlJV9CITqlrTQHJkacd+INH31jx88pTAJnxePE4XAiH5qg== - dependencies: - "@nomicfoundation/edr-darwin-arm64" "0.3.8" - "@nomicfoundation/edr-darwin-x64" "0.3.8" - "@nomicfoundation/edr-linux-arm64-gnu" "0.3.8" - "@nomicfoundation/edr-linux-arm64-musl" "0.3.8" - "@nomicfoundation/edr-linux-x64-gnu" "0.3.8" - "@nomicfoundation/edr-linux-x64-musl" "0.3.8" - "@nomicfoundation/edr-win32-x64-msvc" "0.3.8" +"@nomicfoundation/edr-darwin-arm64@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.6.4.tgz#6eaa64a6ea5201e4c92b121f2b7fd197b26e450a" + integrity sha512-QNQErISLgssV9+qia8sIjRANqtbW8snSDvjspixT/kSQ5ZSGxxctTg7x72wPSrcu8+EBEveIe5uqENIp5GH8HQ== + +"@nomicfoundation/edr-darwin-x64@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.6.4.tgz#d15ca89e9deef7d0a710cf90e79f3cc270a5a999" + integrity sha512-cjVmREiwByyc9+oGfvAh49IAw+oVJHF9WWYRD+Tm/ZlSpnEVWxrGNBak2bd/JSYjn+mZE7gmWS4SMRi4nKaLUg== + +"@nomicfoundation/edr-linux-arm64-gnu@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.6.4.tgz#e73c41ca015dfddb5f4cb6cd3d9b2cbe5cc28989" + integrity sha512-96o9kRIVD6W5VkgKvUOGpWyUGInVQ5BRlME2Fa36YoNsRQMaKtmYJEU0ACosYES6ZTpYC8U5sjMulvPtVoEfOA== + +"@nomicfoundation/edr-linux-arm64-musl@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.6.4.tgz#90906f733e4ad26657baeb22d28855d934ab7541" + integrity sha512-+JVEW9e5plHrUfQlSgkEj/UONrIU6rADTEk+Yp9pbe+mzNkJdfJYhs5JYiLQRP4OjxH4QOrXI97bKU6FcEbt5Q== + +"@nomicfoundation/edr-linux-x64-gnu@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.6.4.tgz#11b8bd73df145a192e5a08199e5e81995fcde502" + integrity sha512-nzYWW+fO3EZItOeP4CrdMgDXfaGBIBkKg0Y/7ySpUxLqzut40O4Mb0/+quqLAFkacUSWMlFp8nsmypJfOH5zoA== + +"@nomicfoundation/edr-linux-x64-musl@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.6.4.tgz#a34b9a2c9e34853207824dc81622668a069ca642" + integrity sha512-QFRoE9qSQ2boRrVeQ1HdzU+XN7NUgwZ1SIy5DQt4d7jCP+5qTNsq8LBNcqhRBOATgO63nsweNUhxX/Suj5r1Sw== + +"@nomicfoundation/edr-win32-x64-msvc@0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.6.4.tgz#ca035c6f66ae9f88fa3ef123a1f3a2099cce7a5a" + integrity sha512-2yopjelNkkCvIjUgBGhrn153IBPLwnsDeNiq6oA0WkeM8tGmQi4td+PGi9jAriUDAkc59Yoi2q9hYA6efiY7Zw== + +"@nomicfoundation/edr@^0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.6.4.tgz#1cd336c46a60f5af774e6cf0f1943f49f63dded6" + integrity sha512-YgrSuT3yo5ZQkbvBGqQ7hG+RDvz3YygSkddg4tb1Z0Y6pLXFzwrcEwWaJCFAVeeZxdxGfCgGMUYgRVneK+WXkw== + dependencies: + "@nomicfoundation/edr-darwin-arm64" "0.6.4" + "@nomicfoundation/edr-darwin-x64" "0.6.4" + "@nomicfoundation/edr-linux-arm64-gnu" "0.6.4" + "@nomicfoundation/edr-linux-arm64-musl" "0.6.4" + "@nomicfoundation/edr-linux-x64-gnu" "0.6.4" + "@nomicfoundation/edr-linux-x64-musl" "0.6.4" + "@nomicfoundation/edr-win32-x64-msvc" "0.6.4" "@nomicfoundation/ethereumjs-common@4.0.4": version "4.0.4" @@ -1574,7 +1574,7 @@ check-error@^1.0.2, check-error@^1.0.3: dependencies: get-func-name "^2.0.2" -chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.2: +chokidar@3.5.3, chokidar@^3.5.2: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -1589,6 +1589,13 @@ chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.2: optionalDependencies: fsevents "~2.3.2" +chokidar@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.1.tgz#4a6dff66798fb0f72a94f616abbd7e1a19f31d41" + integrity sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA== + dependencies: + readdirp "^4.0.1" + chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -1686,16 +1693,16 @@ command-exists@^1.2.8: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== -commander@3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" - integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== - commander@^10.0.0: version "10.0.1" resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== +commander@^8.1.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + commander@^9.3.0: version "9.5.0" resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" @@ -2392,17 +2399,6 @@ fs-constants@^1.0.0: resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" - integrity sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" - fs-extra@^10.0.0, fs-extra@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" @@ -2602,7 +2598,7 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0: +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -2686,14 +2682,14 @@ hardhat-tracer@^2.6.0: debug "^4.3.4" ethers "^5.6.1" -hardhat@^2.22.4: - version "2.22.4" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.4.tgz#766227b6cefca5dbf4fd15ab5b5a68138fa13baf" - integrity sha512-09qcXJFBHQUaraJkYNr7XlmwjOj27xBB0SL2rYS024hTj9tPMbp26AFjlf5quBMO9SR4AJFg+4qWahcYcvXBuQ== +hardhat@^2.22.14: + version "2.22.14" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.14.tgz#389bb3789a52adc0b1a3b4bfc9b891239d5a2b42" + integrity sha512-sD8vHtS9l5QQVHzyPPe3auwZDJyZ0fG3Z9YENVa4oOqVEefCuHcPzdU736rei3zUKTqkX0zPIHkSMHpu02Fq1A== dependencies: "@ethersproject/abi" "^5.1.2" "@metamask/eth-sig-util" "^4.0.0" - "@nomicfoundation/edr" "^0.3.7" + "@nomicfoundation/edr" "^0.6.4" "@nomicfoundation/ethereumjs-common" "4.0.4" "@nomicfoundation/ethereumjs-tx" "5.0.4" "@nomicfoundation/ethereumjs-util" "9.0.4" @@ -2706,7 +2702,7 @@ hardhat@^2.22.4: ansi-escapes "^4.3.0" boxen "^5.1.2" chalk "^2.4.2" - chokidar "^3.4.0" + chokidar "^4.0.0" ci-info "^2.0.0" debug "^4.1.1" enquirer "^2.3.0" @@ -2719,6 +2715,7 @@ hardhat@^2.22.4: glob "7.2.0" immutable "^4.0.0-rc.12" io-ts "1.10.4" + json-stream-stringify "^3.1.4" keccak "^3.0.2" lodash "^4.17.11" mnemonist "^0.38.0" @@ -2727,7 +2724,7 @@ hardhat@^2.22.4: raw-body "^2.4.1" resolve "1.17.0" semver "^6.3.0" - solc "0.7.3" + solc "0.8.26" source-map-support "^0.5.13" stacktrace-parser "^0.1.10" tsort "0.0.1" @@ -3054,12 +3051,10 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - integrity sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw== - optionalDependencies: - graceful-fs "^4.1.6" +json-stream-stringify@^3.1.4: + version "3.1.6" + resolved "https://registry.yarnpkg.com/json-stream-stringify/-/json-stream-stringify-3.1.6.tgz#ebe32193876fb99d4ec9f612389a8d8e2b5d54d4" + integrity sha512-x7fpwxOkbhFCaJDJ8vb1fBY3DdSa4AlITaz+HHILQJzdPMnHEFjxPwVUi1ALIbcIxDE0PNe/0i7frnY8QnBQog== jsonfile@^4.0.0: version "4.0.0" @@ -3103,13 +3098,6 @@ kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" - integrity sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw== - optionalDependencies: - graceful-fs "^4.1.9" - levn@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" @@ -3793,6 +3781,11 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readdirp@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.0.2.tgz#388fccb8b75665da3abffe2d8f8ed59fe74c230a" + integrity sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA== + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -3843,7 +3836,7 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-from-string@^2.0.0, require-from-string@^2.0.2: +require-from-string@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== @@ -3884,13 +3877,6 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@^2.2.8: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -4102,18 +4088,16 @@ slice-ansi@^4.0.0: astral-regex "^2.0.0" is-fullwidth-code-point "^3.0.0" -solc@0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/solc/-/solc-0.7.3.tgz#04646961bd867a744f63d2b4e3c0701ffdc7d78a" - integrity sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA== +solc@0.8.26: + version "0.8.26" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a" + integrity sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g== dependencies: command-exists "^1.2.8" - commander "3.0.2" + commander "^8.1.0" follow-redirects "^1.12.1" - fs-extra "^0.30.0" js-sha3 "0.8.0" memorystream "^0.3.1" - require-from-string "^2.0.0" semver "^5.5.0" tmp "0.0.33"