Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save percybolmer/704a2efbc1a0bd92531bf336caa1a893 to your computer and use it in GitHub Desktop.
Save percybolmer/704a2efbc1a0bd92531bf336caa1a893 to your computer and use it in GitHub Desktop.
it("withdraw 50 from a stake", async() => {
devToken = await DevToken.deployed();
let owner = accounts[0];
let withdraw_amount = 50;
// Try withdrawing 50 from first stake
await devToken.withdrawStake(withdraw_amount, 0, {from:owner});
// Grab a new summary to see if the total amount has changed
let summary = await devToken.hasStake(owner);
assert.equal(summary.total_amount, 200-withdraw_amount, "The total staking amount should be 150");
// Itterate all stakes and verify their amount aswell.
let stake_amount = summary.stakes[0].amount;
assert.equal(stake_amount, 100-withdraw_amount, "Wrong Amount in first stake after withdrawal");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment