Skip to content

Commit

Permalink
Merge pull request #13 from valory-xyz/staking_bond
Browse files Browse the repository at this point in the history
refactor and test: adjusting to the last version of registries
  • Loading branch information
kupermind authored Jan 23, 2024
2 parents 5c51fc0 + 448b2c9 commit ac54fb7
Show file tree
Hide file tree
Showing 11 changed files with 2,669 additions and 2,342 deletions.
1,113 changes: 0 additions & 1,113 deletions abis/0.8.21/ServiceStakingMechUsage.json

This file was deleted.

1,216 changes: 0 additions & 1,216 deletions abis/0.8.21/ServiceStakingTokenMechUsage.json

This file was deleted.

1,275 changes: 1,275 additions & 0 deletions abis/0.8.23/ServiceStakingMechUsage.json

Large diffs are not rendered by default.

1,378 changes: 1,378 additions & 0 deletions abis/0.8.23/ServiceStakingTokenMechUsage.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/mech_usage/ServiceStakingMechUsage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
pragma solidity ^0.8.23;

import {MechAgentMod} from "./MechAgentMod.sol";
import {ServiceStakingNativeToken} from "../../lib/autonolas-registries/contracts/staking/ServiceStakingNativeToken.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/mech_usage/ServiceStakingTokenMechUsage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
pragma solidity ^0.8.23;

import {MechAgentMod} from "./MechAgentMod.sol";
import {ServiceStakingToken} from "../../lib/autonolas-registries/contracts/staking/ServiceStakingToken.sol";
Expand Down
4 changes: 2 additions & 2 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ module.exports = {
solidity: {
compilers: [
{
version: "0.8.21",
version: "0.8.23",
settings: {
optimizer: {
enabled: true,
runs: 750,
runs: 1000000,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion lib/forge-std
1 change: 1 addition & 0 deletions test/ServiceStakingMechUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe("ServiceStakingMechUsage", function () {
maxNumServices: 10,
rewardsPerSecond: "1" + "0".repeat(15),
minStakingDeposit: 10,
minNumStakingPeriods: 3,
maxNumInactivityPeriods: 3,
livenessPeriod: livenessPeriod, // Ten seconds
livenessRatio: "1" + "0".repeat(16), // 0.01 transaction per second (TPS)
Expand Down
16 changes: 9 additions & 7 deletions test/ServiceStakingMechUsages.t.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity =0.8.21;
pragma solidity =0.8.23;

import {IService} from "../lib/autonolas-registries/contracts/interfaces/IService.sol";
import "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol";
Expand Down Expand Up @@ -59,6 +59,8 @@ contract BaseSetup is Test {
uint256 internal rewardsPerSecond = 0.0001 ether;
// Minimum service staking deposit value required for staking
uint256 internal minStakingDeposit = regDeposit;
// Min number of staking periods before the service can be unstaked
uint256 internal minNumStakingPeriods = 3;
// Max number of accumulated inactivity periods after which the service is evicted
uint256 internal maxNumInactivityPeriods = 3;
// Liveness period
Expand Down Expand Up @@ -109,8 +111,8 @@ contract BaseSetup is Test {

// Deploy service staking native token and arbitrary ERC20 token
ServiceStakingBase.StakingParams memory stakingParams = ServiceStakingBase.StakingParams(maxNumServices,
rewardsPerSecond, minStakingDeposit, maxNumInactivityPeriods, livenessPeriod, livenessRatio,
numAgentInstances, emptyArray, 0, bytes32(0));
rewardsPerSecond, minStakingDeposit, minNumStakingPeriods, maxNumInactivityPeriods, livenessPeriod,
livenessRatio, numAgentInstances, emptyArray, 0, bytes32(0));
agentMech = new MockAgentMech();
serviceStakingMechUsage = new ServiceStakingMechUsage(stakingParams, address(serviceRegistry),
multisigProxyHash, address(agentMech));
Expand Down Expand Up @@ -239,7 +241,7 @@ contract ServiceStakingMechUsages is BaseSetup {
}

// Move one day ahead
vm.warp(block.timestamp + serviceStakingMechUsage.maxAllowedInactivity() + 1);
vm.warp(block.timestamp + serviceStakingMechUsage.maxInactivityDuration() + 1);

// Call the checkpoint
serviceStakingMechUsage.checkpoint();
Expand Down Expand Up @@ -310,7 +312,7 @@ contract ServiceStakingMechUsages is BaseSetup {
}

// Move one day ahead
vm.warp(block.timestamp + serviceStakingMechUsage.maxAllowedInactivity() + 1);
vm.warp(block.timestamp + serviceStakingMechUsage.maxInactivityDuration() + 1);

// Call the checkpoint
serviceStakingMechUsage.checkpoint();
Expand Down Expand Up @@ -390,7 +392,7 @@ contract ServiceStakingMechUsages is BaseSetup {
}

// Move one day ahead
vm.warp(block.timestamp + serviceStakingMechUsage.maxAllowedInactivity() + 1);
vm.warp(block.timestamp + serviceStakingMechUsage.maxInactivityDuration() + 1);

// Call the checkpoint
serviceStakingMechUsage.checkpoint();
Expand Down Expand Up @@ -470,7 +472,7 @@ contract ServiceStakingMechUsages is BaseSetup {
}

// Move one day ahead
vm.warp(block.timestamp + serviceStakingMechUsage.maxAllowedInactivity() + 1);
vm.warp(block.timestamp + serviceStakingMechUsage.maxInactivityDuration() + 1);

// Call the checkpoint
serviceStakingTokenMechUsage.checkpoint();
Expand Down

0 comments on commit ac54fb7

Please sign in to comment.