Skip to content

Commit

Permalink
Separated CommitManagerV2/V2U1, reworked deployment scripts, updated …
Browse files Browse the repository at this point in the history
…Staking parameters, added parameters for new Commit Managers
  • Loading branch information
0xbraindevd committed Jan 26, 2024
1 parent 2d932a7 commit add3d33
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 52 deletions.
6 changes: 3 additions & 3 deletions contracts/v1/storage/ParametersStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract ParametersStorage is Named, Versioned, HubDependent {
// minimumStake
args3[0] = 50_000 ether;
// maximumStake
args3[1] = 5_000_000 ether;
args3[1] = 2_000_000 ether;

r2 = 20;
// r1
Expand All @@ -64,9 +64,9 @@ contract ParametersStorage is Named, Versioned, HubDependent {
epochLength = 90 days;

// stakeWithdrawalDelay
args4[0] = 5 minutes;
args4[0] = 28 days;
// rewardWithdrawalDelay
args4[1] = 5 minutes;
args4[1] = 28 days;
// slashingFreezeDuration
args2[2] = 730 days;

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('CommitManagerV1') &&
(hre.helpers.contractDeployments.contracts['CommitManagerV1'].version === undefined ||
hre.helpers.contractDeployments.contracts['CommitManagerV1'].version?.startsWith('2.'))
) {
if (hre.helpers.isDeployed('CommitManagerV2')) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('CommitManagerV1U1') &&
(hre.helpers.contractDeployments.contracts['CommitManagerV1U1'].version === undefined ||
hre.helpers.contractDeployments.contracts['CommitManagerV1U1'].version?.startsWith('2.'))
) {
if (hre.helpers.isDeployed('CommitManagerV2U1')) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('CommitManagerV1') &&
(hre.helpers.contractDeployments.contracts['CommitManagerV1'].version === undefined ||
hre.helpers.contractDeployments.contracts['CommitManagerV1'].version?.startsWith('1.'))
) {
return;
}

console.log('Deploying CommitManager V2...');

const CommitManagerV1 = await hre.helpers.deploy({
const CommitManagerV2 = await hre.helpers.deploy({
newContractName: 'CommitManagerV2',
newContractNameInHub: 'CommitManagerV1',
});

await hre.helpers.updateContractParameters('CommitManagerV1', CommitManagerV1);
await hre.helpers.updateContractParameters('CommitManagerV2', CommitManagerV2);
};

export default func;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('CommitManagerV1U1') &&
(hre.helpers.contractDeployments.contracts['CommitManagerV1U1'].version === undefined ||
hre.helpers.contractDeployments.contracts['CommitManagerV1U1'].version?.startsWith('1.'))
) {
return;
}

console.log('Deploying CommitManager V2U1...');

const CommitManagerV1U1 = await hre.helpers.deploy({
const CommitManagerV2U1 = await hre.helpers.deploy({
newContractName: 'CommitManagerV2U1',
newContractNameInHub: 'CommitManagerV1U1',
});

await hre.helpers.updateContractParameters('CommitManagerV1U1', CommitManagerV1U1);
await hre.helpers.updateContractParameters('CommitManagerV2U1', CommitManagerV2U1);
};

export default func;
Expand Down
Loading

0 comments on commit add3d33

Please sign in to comment.