Skip to content

Commit

Permalink
Merge pull request #146 from valory-xyz/staking
Browse files Browse the repository at this point in the history
test and chore: updating tests accounting for staking implementation
  • Loading branch information
kupermind authored Oct 31, 2024
2 parents 0a4d9f2 + 7f0f5b1 commit feddebf
Show file tree
Hide file tree
Showing 15 changed files with 1,042 additions and 634 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:
jobs:
build:
continue-on-error: False
runs-on: ubuntu-latest
runs-on: macos-latest
concurrency: 1
env:
PROPTEST_MAX_SHRINK_ITERS: 1000
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
Expand Down Expand Up @@ -45,7 +48,7 @@ jobs:

# Compile the code and run foundry tests
- name: Run foundry tests
run: forge test --hh -vvv
run: forge test --hh -vv --match-test testTokenomicsBasic

scan:
name: gitleaks
Expand Down
13 changes: 7 additions & 6 deletions contracts/AutonolasGovernance.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
pragma solidity ^0.8.25;

// Importing all the necessary Autonolas governance contracts
import {buOLAS} from "../lib/autonolas-governance/contracts/buOLAS.sol";

Check warning on line 5 in contracts/AutonolasGovernance.sol

View workflow job for this annotation

GitHub Actions / build

imported name buOLAS is not used
import "../lib/autonolas-governance/contracts/OLAS.sol";
import "../lib/autonolas-governance/contracts/GovernorOLAS.sol";
import "../lib/autonolas-governance/contracts/Timelock.sol";
import "../lib/autonolas-governance/contracts/veOLAS.sol";
import {wveOLAS} from "../lib/autonolas-governance/contracts/wveOLAS.sol";
import {OLAS} from "../lib/autonolas-governance/contracts/OLAS.sol";

Check warning on line 6 in contracts/AutonolasGovernance.sol

View workflow job for this annotation

GitHub Actions / build

imported name OLAS is not used
import {GovernorOLAS} from "../lib/autonolas-governance/contracts/GovernorOLAS.sol";

Check warning on line 7 in contracts/AutonolasGovernance.sol

View workflow job for this annotation

GitHub Actions / build

imported name GovernorOLAS is not used
import {Timelock} from "../lib/autonolas-governance/contracts/Timelock.sol";

Check warning on line 8 in contracts/AutonolasGovernance.sol

View workflow job for this annotation

GitHub Actions / build

imported name Timelock is not used
import {veOLAS} from "../lib/autonolas-governance/contracts/veOLAS.sol";

Check warning on line 9 in contracts/AutonolasGovernance.sol

View workflow job for this annotation

GitHub Actions / build

imported name veOLAS is not used
import {wveOLAS} from "../lib/autonolas-governance/contracts/wveOLAS.sol";

Check warning on line 10 in contracts/AutonolasGovernance.sol

View workflow job for this annotation

GitHub Actions / build

imported name wveOLAS is not used
import {VoteWeighting} from "../lib/autonolas-governance/contracts/VoteWeighting.sol";

Check warning on line 11 in contracts/AutonolasGovernance.sol

View workflow job for this annotation

GitHub Actions / build

imported name VoteWeighting is not used
17 changes: 10 additions & 7 deletions contracts/AutonolasRegistries.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
pragma solidity ^0.8.25;

// Importing all the necessary Autonolas registries contracts
import "../lib/autonolas-registries/contracts/AgentRegistry.sol";
import "../lib/autonolas-registries/contracts/ComponentRegistry.sol";
import "../lib/autonolas-registries/contracts/RegistriesManager.sol";
import "../lib/autonolas-registries/contracts/ServiceManager.sol";
import "../lib/autonolas-registries/contracts/ServiceRegistry.sol";
import {AgentRegistry} from "../lib/autonolas-registries/contracts/AgentRegistry.sol";

Check warning on line 5 in contracts/AutonolasRegistries.sol

View workflow job for this annotation

GitHub Actions / build

imported name AgentRegistry is not used
import {ComponentRegistry} from "../lib/autonolas-registries/contracts/ComponentRegistry.sol";

Check warning on line 6 in contracts/AutonolasRegistries.sol

View workflow job for this annotation

GitHub Actions / build

imported name ComponentRegistry is not used
import {RegistriesManager} from "../lib/autonolas-registries/contracts/RegistriesManager.sol";

Check warning on line 7 in contracts/AutonolasRegistries.sol

View workflow job for this annotation

GitHub Actions / build

imported name RegistriesManager is not used
import {ServiceManager} from "../lib/autonolas-registries/contracts/ServiceManager.sol";
import {ServiceRegistry} from "../lib/autonolas-registries/contracts/ServiceRegistry.sol";
import {GnosisSafeMultisig} from "../lib/autonolas-registries/contracts/multisigs/GnosisSafeMultisig.sol";
import {GnosisSafeSameAddressMultisig} from "../lib/autonolas-registries/contracts/multisigs/GnosisSafeSameAddressMultisig.sol";
import {GnosisSafeSameAddressMultisig} from "../lib/autonolas-registries/contracts/multisigs/GnosisSafeSameAddressMultisig.sol";
import {StakingActivityChecker} from "../lib/autonolas-registries/contracts/staking/StakingActivityChecker.sol";
import {StakingFactory} from "../lib/autonolas-registries/contracts/staking/StakingFactory.sol";
import {StakingToken} from "../lib/autonolas-registries/contracts/staking/StakingToken.sol";
20 changes: 13 additions & 7 deletions contracts/AutonolasTokenomics.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
pragma solidity ^0.8.25;

// Importing all the necessary Autonolas tokenomics contracts
import "../lib/autonolas-tokenomics/contracts/DonatorBlacklist.sol";
import {DonatorBlacklist} from "../lib/autonolas-tokenomics/contracts/DonatorBlacklist.sol";
import {GenericBondCalculator} from "../lib/autonolas-tokenomics/contracts/GenericBondCalculator.sol";
import "../lib/autonolas-tokenomics/contracts/Depository.sol";
import "../lib/autonolas-tokenomics/contracts/Dispenser.sol";
import "../lib/autonolas-tokenomics/contracts/Tokenomics.sol";
import "../lib/autonolas-tokenomics/contracts/TokenomicsProxy.sol";
import "../lib/autonolas-tokenomics/contracts/Treasury.sol";
import {Depository} from "../lib/autonolas-tokenomics/contracts/Depository.sol";
import {Dispenser} from "../lib/autonolas-tokenomics/contracts/Dispenser.sol";
import {Tokenomics} from "../lib/autonolas-tokenomics/contracts/Tokenomics.sol";
import {TokenomicsProxy} from "../lib/autonolas-tokenomics/contracts/TokenomicsProxy.sol";
import {Treasury} from "../lib/autonolas-tokenomics/contracts/Treasury.sol";
import {BridgeRelayer} from "../lib/autonolas-tokenomics/contracts/staking/test/BridgeRelayer.sol";
import {EthereumDepositProcessor} from "../lib/autonolas-tokenomics/contracts/staking/EthereumDepositProcessor.sol";
import {GnosisDepositProcessorL1} from "../lib/autonolas-tokenomics/contracts/staking/GnosisDepositProcessorL1.sol";
import {GnosisTargetDispenserL2} from "../lib/autonolas-tokenomics/contracts/staking/GnosisTargetDispenserL2.sol";
import {MockDepositProcessorL1} from "../lib/autonolas-tokenomics/contracts/staking/test/MockDepositProcessorL1.sol";
import {MockStakingDispenser} from "../lib/autonolas-tokenomics/contracts/staking/test/MockStakingDispenser.sol";
9 changes: 5 additions & 4 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const accounts = {
};

module.exports = {
gasReporter: {
enabled: true
},
networks: {
local: {
url: "http://localhost:8545",
Expand All @@ -29,13 +26,14 @@ module.exports = {
solidity: {
compilers: [
{
version: "0.8.23",
version: "0.8.28",
settings: {
optimizer: {
enabled: true,
runs: 100,
},
},
evmVersion: "cancun"
},
{
version: "0.5.16", // uniswap
Expand All @@ -44,5 +42,8 @@ module.exports = {
version: "0.6.6", // uniswap
}
]
},
gasReporter: {
enabled: true
}
};
2 changes: 1 addition & 1 deletion lib/autonolas-governance
2 changes: 1 addition & 1 deletion lib/autonolas-registries
2 changes: 1 addition & 1 deletion lib/autonolas-tokenomics
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@
"devDependencies": {
"@gnosis.pm/safe-contracts": "^1.3.0",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomicfoundation/hardhat-toolbox": "^2.0.1",
"@nomiclabs/hardhat-ethers": "^2.2.2",
"@nomiclabs/hardhat-etherscan": "^3.1.6",
"@typechain/ethers-v5": "^10.2.0",
"@typechain/hardhat": "^6.1.5",
"@types/mocha": "^10.0.1",
"chai": "^4.3.7",
"eslint": "^8.34.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.9",
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@typechain/ethers-v5": "^11.1.2",
"@typechain/hardhat": "^9.1.0",
"@types/mocha": "^10.0.3",
"chai": "^4.3.10",
"eslint": "^8.52.0",
"ethers": "^5.7.2",
"hardhat": "^2.14.0",
"hardhat-contract-sizer": "^2.8.0",
"hardhat-deploy": "^0.11.23",
"hardhat": "^2.22.15",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-deploy": "^0.11.43",
"hardhat-gas-reporter": "^1.0.9",
"solidity-coverage": "^0.8.2",
"solidity-coverage": "^0.8.5",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^4.9.5"
},
"dependencies": {
"@openzeppelin/contracts": "=4.8.3",
"@prb/math": "^4.0.0",
"@prb/math": "=4.0.2",
"@uniswap/lib": "^4.0.1-alpha",
"@uniswap/v2-core": "^1.0.1",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"canonical-weth": "^1.4.0",
"solhint": "^3.4.0"
"solhint": "^3.6.2"
}
}
8 changes: 7 additions & 1 deletion test/NodeDeployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ describe("Node deployment", function () {
const epochLen = oneMonth;
const supplyProductOLAS = "20" + decimals;
const vesting = oneWeek;
const maxNumClaimingEpochs = 10;
const maxNumStakingTargets = 100;
const defaultMinStakingWeight = 100;
const defaultMaxStakingIncentive = ethers.utils.parseEther("1");
const retainer = "0x" + "0".repeat(24) + "5".repeat(40);

const signers = await ethers.getSigners();
const deployer = signers[0];
Expand Down Expand Up @@ -271,7 +276,8 @@ describe("Node deployment", function () {
await depository.deployed();
// Deploy dispenser contract
const Dispenser = await ethers.getContractFactory("Dispenser");
const dispenser = await Dispenser.deploy(tokenomics.address, treasury.address);
const dispenser = await Dispenser.deploy(olas.address, tokenomics.address, treasury.address, deployer.address,
retainer, maxNumClaimingEpochs, maxNumStakingTargets, defaultMinStakingWeight, defaultMaxStakingIncentive);
await dispenser.deployed();
// Change to the correct addresses
await tokenomics.changeManagers(treasury.address, depository.address, dispenser.address);
Expand Down
Loading

0 comments on commit feddebf

Please sign in to comment.