Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adding staking contracts configuration #30

Merged
merged 39 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a4b8bc3
chore: adding staking contracts configuration
kupermind Sep 24, 2024
2609181
chore: updating deployment scripts
kupermind Sep 25, 2024
c24dfb2
feat and chore: re-introducing single mech activity checke
kupermind Sep 25, 2024
b275815
chore: deploy activity checker
DavidMinarsch Sep 25, 2024
8bfd62d
chore: updating deployment configs
kupermind Sep 25, 2024
7c4cee2
chore: adding Tsunami staking contract specs
kupermind Oct 9, 2024
52c46a0
Merge pull request #31 from valory-xyz/tsunami
kupermind Oct 10, 2024
1281c6f
chore: refactor script namings and readme
kupermind Oct 21, 2024
c534fc0
feat: contribute contracts stack
kupermind Oct 22, 2024
f0620e7
chore: name fix
kupermind Oct 22, 2024
badceb8
chore: removing unnecessary event
kupermind Oct 22, 2024
aa04650
feat: getting close to creating a service
kupermind Oct 22, 2024
6199f79
refactor: first implementation
kupermind Oct 22, 2024
8b52f29
chore: cleanup
kupermind Oct 22, 2024
b5b734c
refactor: polishing
kupermind Oct 22, 2024
0b24408
refactor: polishing
kupermind Oct 22, 2024
a43e44f
refactor: staking verifier
kupermind Oct 23, 2024
edf4380
refactor: service owner dependency first
kupermind Oct 23, 2024
585003f
chore: spacing
kupermind Oct 23, 2024
528f7c1
chore: adding deployment scripts
kupermind Oct 23, 2024
aaa2039
doc: v.1.4.0-internal-audit
Oct 23, 2024
63eedea
doc: v.1.4.0-internal-audit
Oct 23, 2024
bc9a4e9
refactor: NFT fix
kupermind Oct 23, 2024
3918217
chore: set initial contribute agent statuses
kupermind Oct 23, 2024
fda1740
Merge remote-tracking branch 'origin/v.1.4.0-internal-audit' into scr…
kupermind Oct 23, 2024
e5eb2de
addressing audit remarks and adding graphics
kupermind Oct 23, 2024
4dca0fd
chore: adding optimus deployment script for mode
kupermind Oct 23, 2024
80d45c2
test: add more tests
kupermind Oct 23, 2024
4783cd9
chore: missing ABIs
kupermind Oct 23, 2024
b9b5919
chore: adding ABIs
kupermind Oct 23, 2024
4c0c33d
chore: testnet re-deployment
kupermind Oct 23, 2024
b57872f
doc: update contribute flowchart
kupermind Oct 24, 2024
7bd49bb
doc: update contribute flowchart
kupermind Oct 24, 2024
011463c
test: next to full coverage
kupermind Oct 24, 2024
33044d6
Merge pull request #34 from valory-xyz/scripts_tests
DavidMinarsch Oct 24, 2024
e752848
Merge pull request #33 from valory-xyz/contribute
kupermind Oct 24, 2024
16b6405
Merge pull request #32 from valory-xyz/refactor
kupermind Oct 24, 2024
830380a
test: unskipping other tests
kupermind Oct 24, 2024
2a96a08
chore: removing unnecesary variables
kupermind Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
111 changes: 111 additions & 0 deletions abis/0.8.25/SingleMechActivityChecker.json
Original file line number Diff line number Diff line change
@@ -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": "0x60c060405234801561000f575f80fd5b506040516107b33803806107b383398101604081905261002e9161008a565b80805f0361004f57604051637c946ed760e01b815260040160405180910390fd5b6080526001600160a01b0382166100785760405162ca95f960e81b815260040160405180910390fd5b506001600160a01b031660a0526100c1565b5f806040838503121561009b575f80fd5b82516001600160a01b03811681146100b1575f80fd5b6020939093015192949293505050565b60805160a0516106c56100ee5f395f818160b0015261036501525f8181607b015261024701526106c55ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb1461007657806375af4b6d146100ab578063d564c4bf146100f7575b5f80fd5b61006161005c3660046104d8565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610540565b610276565b60405161006d9190610573565b5f80821180156101585750825f81518110610134576101346105b6565b6020026020010151845f8151811061014e5761014e6105b6565b6020026020010151115b8015610197575082600181518110610172576101726105b6565b60200260200101518460018151811061018d5761018d6105b6565b6020026020010151115b1561026f575f835f815181106101af576101af6105b6565b6020026020010151855f815181106101c9576101c96105b6565b60200260200101516101db9190610610565b90505f846001815181106101f1576101f16105b6565b60200260200101518660018151811061020c5761020c6105b6565b602002602001015161021e9190610610565b905081811161026c575f8461023b83670de0b6b3a7640000610629565b6102459190610640565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103039190610678565b815f81518110610315576103156105b6565b60209081029190910101526040517f7af7347300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f00000000000000000000000000000000000000000000000000000000000000001690637af7347390602401602060405180830381865afa1580156103aa573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce9190610678565b816001815181106103e1576103e16105b6565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f80fd5b8135602067ffffffffffffffff8083111561044b5761044b6103f2565b8260051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110848211171561048e5761048e6103f2565b60405293845260208187018101949081019250878511156104ad575f80fd5b6020870191505b848210156104cd578135835291830191908301906104b4565b979650505050505050565b5f805f606084860312156104ea575f80fd5b833567ffffffffffffffff80821115610501575f80fd5b61050d8783880161041f565b94506020860135915080821115610522575f80fd5b5061052f8682870161041f565b925050604084013590509250925092565b5f60208284031215610550575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f80fd5b602080825282518282018190525f9190848201906040850190845b818110156105aa5783518352928401929184019160010161058e565b50909695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610623576106236105e3565b92915050565b8082028115828204841417610623576106236105e3565b5f82610673577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f60208284031215610688575f80fd5b505191905056fea2646970667358221220d1ee4c8bb347cdb972deb32c3b7b6629aa0f005e9850e5cda30ec98f7669fea664736f6c63430008190033",
"deployedBytecode": "0x608060405234801561000f575f80fd5b506004361061004a575f3560e01c8063184023a51461004e578063592cf3fb1461007657806375af4b6d146100ab578063d564c4bf146100f7575b5f80fd5b61006161005c3660046104d8565b610117565b60405190151581526020015b60405180910390f35b61009d7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161006d565b6100d27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161006d565b61010a610105366004610540565b610276565b60405161006d9190610573565b5f80821180156101585750825f81518110610134576101346105b6565b6020026020010151845f8151811061014e5761014e6105b6565b6020026020010151115b8015610197575082600181518110610172576101726105b6565b60200260200101518460018151811061018d5761018d6105b6565b6020026020010151115b1561026f575f835f815181106101af576101af6105b6565b6020026020010151855f815181106101c9576101c96105b6565b60200260200101516101db9190610610565b90505f846001815181106101f1576101f16105b6565b60200260200101518660018151811061020c5761020c6105b6565b602002602001015161021e9190610610565b905081811161026c575f8461023b83670de0b6b3a7640000610629565b6102459190610640565b7f000000000000000000000000000000000000000000000000000000000000000011159350505b50505b9392505050565b60408051600280825260608083018452926020830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102df573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103039190610678565b815f81518110610315576103156105b6565b60209081029190910101526040517f7af7347300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301527f00000000000000000000000000000000000000000000000000000000000000001690637af7347390602401602060405180830381865afa1580156103aa573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ce9190610678565b816001815181106103e1576103e16105b6565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261042e575f80fd5b8135602067ffffffffffffffff8083111561044b5761044b6103f2565b8260051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110848211171561048e5761048e6103f2565b60405293845260208187018101949081019250878511156104ad575f80fd5b6020870191505b848210156104cd578135835291830191908301906104b4565b979650505050505050565b5f805f606084860312156104ea575f80fd5b833567ffffffffffffffff80821115610501575f80fd5b61050d8783880161041f565b94506020860135915080821115610522575f80fd5b5061052f8682870161041f565b925050604084013590509250925092565b5f60208284031215610550575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461026f575f80fd5b602080825282518282018190525f9190848201906040850190845b818110156105aa5783518352928401929184019160010161058e565b50909695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115610623576106236105e3565b92915050565b8082028115828204841417610623576106236105e3565b5f82610673577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f60208284031215610688575f80fd5b505191905056fea2646970667358221220d1ee4c8bb347cdb972deb32c3b7b6629aa0f005e9850e5cda30ec98f7669fea664736f6c63430008190033",
"linkReferences": {},
"deployedLinkReferences": {}
}
111 changes: 111 additions & 0 deletions abis/0.8.28/ContributeActivityChecker.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
Loading
Loading