Skip to content

Commit

Permalink
New staking - part 1 and 2 - SWIP-19 and 20 combined (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCardinalError authored Aug 26, 2024
1 parent f81aea4 commit 1728975
Show file tree
Hide file tree
Showing 18 changed files with 1,702 additions and 1,087 deletions.
3 changes: 2 additions & 1 deletion deploy/local/003_deploy_staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts, ne
const swarmNetworkID = networkConfig[network.name]?.swarmNetworkId;

const token = await get('TestToken');
const oracleAddress = (await get('PriceOracle')).address;

const args = [token.address, swarmNetworkID];
const args = [token.address, swarmNetworkID, oracleAddress];
await deploy('StakeRegistry', {
from: deployer,
args: args,
Expand Down
14 changes: 8 additions & 6 deletions deploy/main/003_deploy_staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts, ne
const { deployer } = await getNamedAccounts();
const swarmNetworkID = networkConfig[network.name]?.swarmNetworkId;
const token = await get('Token');
let staking = null;
const oracleAddress = (await get('PriceOracle')).address;

// We use legacy token that was migrated, until we deploy new one with this framework
if (!(staking = await get('StakeRegistry'))) {
} else {
log('Using already deployed Staking at', staking.address);
}
const args = [token.address, swarmNetworkID, oracleAddress];
await deploy('StakeRegistry', {
from: deployer,
args: args,
log: true,
waitConfirmations: networkConfig[network.name]?.blockConfirmations || 6,
});

log('----------------------------------------------------');
};
Expand Down
2 changes: 1 addition & 1 deletion deploy/main/010_deploy_verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const func: DeployFunction = async function ({ deployments, network }) {

// Verify staking
const staking = await get('StakeRegistry');
const argStaking = [token.address, swarmNetworkID];
const argStaking = [token.address, swarmNetworkID, priceOracle.address];

log('Verifying...');
await verify(staking.address, argStaking);
Expand Down
3 changes: 2 additions & 1 deletion deploy/test/003_deploy_staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts, ne
const { deployer } = await getNamedAccounts();
const swarmNetworkID = networkConfig[network.name]?.swarmNetworkId;
const token = await get('TestToken');
const oracleAddress = (await get('PriceOracle')).address;

const args = [token.address, swarmNetworkID];
const args = [token.address, swarmNetworkID, oracleAddress];
await deploy('StakeRegistry', {
from: deployer,
args: args,
Expand Down
2 changes: 1 addition & 1 deletion deploy/test/010_deploy_verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const func: DeployFunction = async function ({ deployments, network }) {

// Verify staking
const staking = await get('StakeRegistry');
const argStaking = [token.address, swarmNetworkID];
const argStaking = [token.address, swarmNetworkID, priceOracle.address];

log('Staking');
await verify(staking.address, argStaking);
Expand Down
189 changes: 89 additions & 100 deletions deployments/testnet/Redistribution.json

Large diffs are not rendered by default.

Loading

0 comments on commit 1728975

Please sign in to comment.