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

Sm 392 #187

Open
wants to merge 3 commits into
base: v2/seeker-staking
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions deployments/genesis.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ const LocalTestnetParameters: ContractParameters = {
FuturepassRegistrar: '',

ProtocolTimeManager: {
cycleDuration: 1000,
periodDuration: 100,
cycleDuration: 100000,
periodDuration: 10000,
},

Registries: {
Expand Down
77 changes: 38 additions & 39 deletions scripts/init_local_network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,51 +82,50 @@ export async function main() {
console.log('Incentivising node', i, 'is ready');
}

const time = await contracts.protocolTimeManager.getTime();
const periodDuration = time[1][2] + BigInt(10);

// forward time to start protocol
await provider.send('evm_increaseTime', [101]);
await provider.send('evm_increaseTime', [periodDuration.toString()]);
await provider.send('evm_mine', []);

// ensure each node can redeem a ticket from incentivising
for (const node of nodes) {
const { ticket, redeemerRand, senderSig, receiverSig } =
await utils.createSignedTicket(
contracts,
incentivisingNodes[0].signer,
incentivisingNodes[0].signer,
node.signer,
);

await contracts.ticketing
.connect(node.signer)
.redeem(ticket, redeemerRand, senderSig, receiverSig)
.then(tx => tx.wait());
}
// for (const node of nodes) {
// const { ticket, redeemerRand, senderSig, receiverSig } =
// await utils.createSignedTicket(
// contracts,
// incentivisingNodes[0].signer,
// incentivisingNodes[0].signer,
// node.signer,
// );

// await contracts.ticketing
// .connect(node.signer)
// .redeem(ticket, redeemerRand, senderSig, receiverSig)
// .then(tx => tx.wait());
// }

// have each node also have unclaimed rewards for the first cycle
for (const node of nodes) {
await utils.depositTicketing(contracts, node.signer);

const { ticket, redeemerRand, senderSig, receiverSig } =
await utils.createSignedTicket(
contracts,
node.signer,
node.signer,
node.signer,
);

await contracts.ticketing
.connect(node.signer)
.redeem(ticket, redeemerRand, senderSig, receiverSig)
.then(tx => tx.wait());

console.log(
`node ${await node.signer.getAddress()} successfully redeemed!`,
);
}

// progress to start next cycle
await provider.send('evm_increaseTime', [1500]);
await provider.send('evm_mine', []);
// for (const node of nodes) {
// await utils.depositTicketing(contracts, node.signer);

// const { ticket, redeemerRand, senderSig, receiverSig } =
// await utils.createSignedTicket(
// contracts,
// node.signer,
// node.signer,
// node.signer,
// );

// await contracts.ticketing
// .connect(node.signer)
// .redeem(ticket, redeemerRand, senderSig, receiverSig)
// .then(tx => tx.wait());

// console.log(
// `node ${await node.signer.getAddress()} successfully redeemed!`,
// );
// }
}

async function createNode(
Expand Down
Loading