-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from valory-xyz/fix/unlocking-staking-rewards
Fix/unlocking staking rewards
- Loading branch information
Showing
22 changed files
with
4,852 additions
and
2,245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Release History - `optimus` | ||
|
||
## v0.1.0 - [Release Date: 2024-09-06] | ||
|
||
- **Feat/uniswap**: Added support for Uniswap integration. | ||
- **Feat/claim reward**: Introduced the feature for claiming rewards. | ||
- **V0.1.0 release**: Initial version of the project. | ||
- **Fix: claim rewards**: Fixed an issue with claiming rewards. | ||
|
||
## v0.2.0 - [Release Date: 2024-09-06] | ||
|
||
- **Unlocking Staking Rewards**: Added logic to unlock staking rewards based on meeting a daily minimum transaction threshold on the Optimism network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/valory/contracts/staking_activity_checker/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# ------------------------------------------------------------------------------ | ||
# | ||
# Copyright 2024 Valory AG | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
"""This module contains the support resources for the staking activity checker contract.""" |
87 changes: 87 additions & 0 deletions
87
packages/valory/contracts/staking_activity_checker/build/StakingActivityChecker.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"_format": "hh-sol-artifact-1", | ||
"contractName": "StakingActivityChecker", | ||
"sourceName": "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": "0x608060405234801561000f575f80fd5b506004361061003f575f3560e01c8063184023a514610043578063592cf3fb1461006b578063d564c4bf146100a0575b5f80fd5b610056610051366004610328565b6100c0565b60405190151581526020015b60405180910390f35b6100927f00000000000000000000000000000000000000000000000000002a1b324b8f6881565b604051908152602001610062565b6100b36100ae366004610390565b610190565b60405161006291906103c3565b5f80821180156101015750825f815181106100dd576100dd610406565b6020026020010151845f815181106100f7576100f7610406565b6020026020010151115b15610189575f82845f8151811061011a5761011a610406565b6020026020010151865f8151811061013457610134610406565b60200260200101516101469190610460565b61015890670de0b6b3a7640000610479565b6101629190610490565b7f00000000000000000000000000000000000000000000000000002a1b324b8f6811159150505b9392505050565b604080516001808252818301909252606091602080830190803683370190505090508173ffffffffffffffffffffffffffffffffffffffff1663affed0e06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101fb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061021f91906104c8565b815f8151811061023157610231610406565b602002602001018181525050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f83011261027e575f80fd5b8135602067ffffffffffffffff8083111561029b5761029b610242565b8260051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811084821117156102de576102de610242565b60405293845260208187018101949081019250878511156102fd575f80fd5b6020870191505b8482101561031d57813583529183019190830190610304565b979650505050505050565b5f805f6060848603121561033a575f80fd5b833567ffffffffffffffff80821115610351575f80fd5b61035d8783880161026f565b94506020860135915080821115610372575f80fd5b5061037f8682870161026f565b925050604084013590509250925092565b5f602082840312156103a0575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610189575f80fd5b602080825282518282018190525f9190848201906040850190845b818110156103fa578351835292840192918401916001016103de565b50909695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8181038181111561047357610473610433565b92915050565b808202811582820484141761047357610473610433565b5f826104c3577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f602082840312156104d8575f80fd5b505191905056fea26469706673582212205cd6cde3d106d475558793ccc0670f4af07e2e69e437eff007791837f35d016464736f6c63430008190033", | ||
"linkReferences": {}, | ||
"deployedLinkReferences": {} | ||
} |
44 changes: 44 additions & 0 deletions
44
packages/valory/contracts/staking_activity_checker/contract.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
# ------------------------------------------------------------------------------ | ||
# | ||
# Copyright 2024 Valory AG | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
"""This module contains the class to connect to the `StakingActivityChecker` contract.""" | ||
|
||
from enum import Enum | ||
|
||
from aea.common import JSONLike | ||
from aea.configurations.base import PublicId | ||
from aea.contracts.base import Contract | ||
from aea.crypto.base import LedgerApi | ||
|
||
|
||
class StakingActivityCheckerContract(Contract): | ||
"""The Staking Activity Checker contract.""" | ||
|
||
contract_id = PublicId.from_str("valory/staking_activity_checker:0.1.0") | ||
|
||
@classmethod | ||
def liveness_ratio( | ||
cls, | ||
ledger_api: LedgerApi, | ||
contract_address: str, | ||
) -> JSONLike: | ||
"""Retrieve the liveness ratio.""" | ||
contract = cls.get_instance(ledger_api, contract_address) | ||
liveness_ratio = contract.functions.livenessRatio().call() | ||
return dict(data=liveness_ratio) |
23 changes: 23 additions & 0 deletions
23
packages/valory/contracts/staking_activity_checker/contract.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: staking_activity_checker | ||
author: valory | ||
version: 0.1.0 | ||
type: contract | ||
description: Staking activity checker contract | ||
license: Apache-2.0 | ||
aea_version: '>=1.0.0, <2.0.0' | ||
fingerprint: | ||
__init__.py: bafybeigqm6q7kgfzgpcse7zer5uea3s7myolry2r3teovuzqgkn43j7bei | ||
build/StakingActivityChecker.json: bafybeiety3kkkmdz2gdzktg54wvmhavftaw4wjnrddztt64jpknagrc6xa | ||
contract.py: bafybeihnil43tcs2jhii5gxhsffzknsvljnnhradi62pnxhs525orc2cw4 | ||
fingerprint_ignore_patterns: [] | ||
contracts: [] | ||
class_name: StakingActivityCheckerContract | ||
contract_interface_paths: | ||
ethereum: build/StakingActivityChecker.json | ||
dependencies: | ||
open-aea-ledger-ethereum: | ||
version: ==1.55.0 | ||
open-aea-test-autonomy: | ||
version: ==0.15.2 | ||
web3: | ||
version: <7,>=6.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# ------------------------------------------------------------------------------ | ||
# | ||
# Copyright 2024 Valory AG | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
"""This module contains the support resources for the staking token contract.""" |
Oops, something went wrong.