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

New staking - part 1 and 2 - SWIP-19 and 20 combined #252

Merged
merged 39 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
de1413d
reformat code and add some state optimizations
n00b21337 Apr 10, 2024
955a3da
refactor code to be more concise, refactor test for proper deployment
n00b21337 Apr 10, 2024
bad3a0e
remove reverts use custom errors
n00b21337 Apr 10, 2024
170f00e
rewrite tests to match new errors
n00b21337 Apr 10, 2024
52fb11f
cleanup errors
n00b21337 Apr 10, 2024
6c5df4a
swap all the overlays keys with address keys and use them
n00b21337 Apr 16, 2024
c317a3a
change redis contract to use new staking mappings
n00b21337 Apr 16, 2024
0373ea6
fixing all staking tests
n00b21337 Apr 16, 2024
6de0e5a
fix redistribution tests, 5 more failing
n00b21337 Apr 16, 2024
df5b180
fix test errors, add function to check overlay is proper
n00b21337 Apr 16, 2024
fd0dfd3
fix game stakes
n00b21337 Apr 18, 2024
b3e1537
add code to change overlays, add tests to test changing of overlays t…
n00b21337 Apr 18, 2024
a8c47fc
remove owner from staking mapping, adjust tests to work with that and…
n00b21337 May 6, 2024
dc217e6
remove obsolete var
n00b21337 May 6, 2024
ad14c60
change event name
n00b21337 May 17, 2024
6c707f2
remove obsolete parametar
n00b21337 May 17, 2024
25e7b18
change owner to sender, add crucial revert for hopping not to be hack…
n00b21337 May 17, 2024
d7541d6
fix tests to work with new contract changes
n00b21337 May 17, 2024
d88fd0c
change the name
n00b21337 May 17, 2024
9bb99bc
switch to using overload function for isParticipatingInUpcomingRound
n00b21337 May 20, 2024
cc9d49c
remove overlay from commit, use lookup for whole struct and reuse it
n00b21337 May 20, 2024
6121290
change reveal to not use overlay, adjust tests
n00b21337 May 20, 2024
a847545
add most optimized version of struct reading
n00b21337 May 22, 2024
1cc528e
cleanup
n00b21337 May 22, 2024
850bbb3
add direct lookups or better gas util
n00b21337 May 23, 2024
fc1534b
fix tests to use actuall node address on all places
n00b21337 May 24, 2024
b40526c
cleanup logs, cleanup tests
n00b21337 May 24, 2024
551da73
remove old logs from tests
n00b21337 May 24, 2024
3776f1b
remove console log
n00b21337 May 24, 2024
5673ba1
remove double staking calls
n00b21337 May 28, 2024
8e4e93d
fix doc and line break
n00b21337 May 28, 2024
75072a4
Merge branch 'master' of github.com:ethersphere/storage-incentives in…
n00b21337 May 29, 2024
e285072
remove oveloading function, no need for it as its not called by contr…
n00b21337 Jun 10, 2024
420f219
change functionality of depositStake to be one function to do all thi…
n00b21337 Jun 10, 2024
c558efb
change to manageState
n00b21337 Jun 10, 2024
4b492c3
adjust tests
n00b21337 Jun 10, 2024
a276407
add deployments with updated contracts
n00b21337 Jul 3, 2024
0d6540e
Improved staking (new staking - part 2 - SWIP-20) (#264)
n00b21337 Aug 26, 2024
87e8c6a
Merge branch 'master' into new_staking
n00b21337 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