Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved staking (new staking - part 2 - SWIP-20) #264

Merged
merged 41 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1f31392
rename to commitedStake
0xCardinalError May 30, 2024
bd828e6
add potential stake and commited stake and update their amounts with …
0xCardinalError May 30, 2024
75280ae
update from latest staking
0xCardinalError Jun 10, 2024
c16f56c
add potential and commited stakes
0xCardinalError Jun 10, 2024
40e6d0e
change to potentialStake
0xCardinalError Jun 10, 2024
cbcac28
add effectiveStake as calculation
0xCardinalError Jun 10, 2024
63d4081
remove minimum from redis and add it to staking
0xCardinalError Jun 12, 2024
dccbe4d
use just 2 params
0xCardinalError Jun 13, 2024
658d9c0
substract commitedStake amount accordingly to currentPrice
0xCardinalError Jun 13, 2024
ae07e41
make new deployment procedure with new staking contracts
0xCardinalError Jun 24, 2024
fd1cd1a
add check if node has entered staking game
0xCardinalError Jun 24, 2024
aa1d34e
fix redistribution tests to match new staking calculations
0xCardinalError Jun 24, 2024
f90d7b7
add migration code, fix staking code
0xCardinalError Jun 24, 2024
f1e9bbc
remove logs
0xCardinalError Jun 24, 2024
03b5d86
add migration tests that checks values
0xCardinalError Jul 2, 2024
2dfab4e
fix error in value changes, make withdrawl test
0xCardinalError Jul 2, 2024
f838e56
add few more tests
0xCardinalError Jul 5, 2024
e0ce4cd
add extra case in test, for minimal first deposit
0xCardinalError Jul 5, 2024
a50e039
fix wrong spelling of committed in many places
0xCardinalError Jul 8, 2024
7209d9d
group variable
0xCardinalError Jul 8, 2024
5ed3b21
remove obsolete code in calc
0xCardinalError Jul 8, 2024
f399af6
remove obsolete variable, add comment about it
0xCardinalError Jul 8, 2024
094c116
better comments
0xCardinalError Jul 8, 2024
b8fb6bb
remove not needed struct access
0xCardinalError Jul 8, 2024
c749d83
change naming
0xCardinalError Jul 9, 2024
5998c9c
add withdrawable stake read function
0xCardinalError Jul 9, 2024
ed004d2
change usable stake to effective stake
0xCardinalError Jul 11, 2024
0b6d0a7
fix stat test with effective stake
0xCardinalError Jul 12, 2024
8aad41a
add test for multiple withdrawls
0xCardinalError Jul 12, 2024
dae4e65
remove wrong line
0xCardinalError Jul 12, 2024
01ea1f1
add check that value is the same
0xCardinalError Jul 12, 2024
1b64dba
add more tests and conditions
0xCardinalError Jul 12, 2024
9e3e1dd
optmize gas
0xCardinalError Jul 16, 2024
ded87e6
another optimization for gas with local var
0xCardinalError Jul 16, 2024
3438f2d
fix wrong var
0xCardinalError Jul 16, 2024
974b71f
Merge branch 'new_staking' of https://github.com/ethersphere/storage-…
0xCardinalError Jul 16, 2024
b06a313
deploy to tesnet light and fix deployment constructor params
0xCardinalError Jul 16, 2024
849937d
remove non exsisting call
0xCardinalError Jul 22, 2024
4fb1f33
testnet deployed
0xCardinalError Aug 22, 2024
6021b5c
fix: Remove pauser role (#263)
0xCardinalError Aug 26, 2024
228946c
fix: remove isValue as it is not needed (#260)
0xCardinalError Aug 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deploy/local/003_deploy_staking.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { DeployFunction } from 'hardhat-deploy/types';
import { networkConfig } from '../../helper-hardhat-config';

const func: DeployFunction = async function ({ deployments, getNamedAccounts, network, ethers }) {

Check warning on line 4 in deploy/local/003_deploy_staking.ts

View workflow job for this annotation

GitHub Actions / check

'ethers' is defined but never used
const { deploy, get, log } = deployments;
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
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
Loading