Skip to content

Commit

Permalink
Updated the randomNumber() problem again caused due to basisPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
remedcu committed May 17, 2021
1 parent 161644f commit ac88289
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
24 changes: 12 additions & 12 deletions tests-js/Locked/anyone.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,30 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("Anyone could deposit Tokens using deposit().", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = randomValue();
await lockedSOV.deposit(userOne, value, basisPoint, { from: userOne });
});

it("No one could deposit Tokens using deposit() with 10000 as BasisPoint.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 10000;
await expectRevert(lockedSOV.deposit(userOne, value, basisPoint, { from: userOne }), "Basis Point has to be less than 10000.");
});

it("Anyone could deposit Tokens using depositSOV().", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
await lockedSOV.depositSOV(userOne, value, { from: userOne });
});

it("Anyone can withdraw unlocked Tokens using withdraw().", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -124,7 +124,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("Anyone can withdraw unlocked Tokens to another wallet using withdraw().", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -133,7 +133,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("Anyone can create a vesting schedule and stake tokens using createVestingAndStake().", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userThree, value);
await sov.approve(lockedSOV.address, value, { from: userThree });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -153,7 +153,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("Anyone can use stakeTokens() to stake locked sov who already has a vesting contract.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -163,7 +163,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("No one can use stakeTokens() who already has not created a vesting contract.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userFive, value);
await sov.approve(lockedSOV.address, value, { from: userFive });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -172,7 +172,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("Anyone can withdraw unlocked and stake locked balance using withdrawAndStakeTokens() who already has a vesting contract.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -181,7 +181,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("No one can use withdrawAndStakeTokens() who does not have a vesting contract.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userFour, value);
await sov.approve(lockedSOV.address, value, { from: userFour });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -194,7 +194,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("Anyone can transfer locked balance using transfer().", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -207,7 +207,7 @@ contract("Locked SOV (Any User Functions)", (accounts) => {
});

it("No one can transfer locked balance using transfer() unless migration has started.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand Down
18 changes: 9 additions & 9 deletions tests-js/Locked/event.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Depositing Tokens using deposit() to own account should emit Deposited.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = randomValue();
Expand All @@ -127,7 +127,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Depositing Tokens using deposit() to another account should emit Deposited.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = randomValue();
Expand All @@ -141,7 +141,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Depositing Tokens using depositSOV() to own account should emit Deposited.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let txReceipt = await lockedSOV.depositSOV(userOne, value, { from: userOne });
Expand All @@ -167,7 +167,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Withdrawing unlocked Tokens to own account using withdraw() should emit Withdrawn.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -181,7 +181,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Withdrawing unlocked Tokens to another account using withdraw() should emit Withdrawn.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -195,7 +195,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Using createVestingAndStake() should emit both VestingCreated and TokenStaked.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand Down Expand Up @@ -223,7 +223,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Using stakeTokens() should emit TokenStaked.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -239,7 +239,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Using withdrawAndStakeTokens() should emit Withdrawn and TokenStaked.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand Down Expand Up @@ -267,7 +267,7 @@ contract("Locked SOV (Events)", (accounts) => {
});

it("Transfering locked balance using transfer() should emit UserTransfered.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand Down
10 changes: 5 additions & 5 deletions tests-js/Locked/state.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function getTokenBalances(addr, sovContract, lockedSOVContract) {
* @returns value The token amount which was deposited by user.
*/
async function userDeposits(sovContract, lockedSOVContract, sender, receiver, basisPoint) {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sovContract.mint(sender, value);
await sovContract.approve(lockedSOVContract.address, value, { from: sender });
await lockedSOVContract.deposit(receiver, value, basisPoint, { from: sender });
Expand Down Expand Up @@ -350,7 +350,7 @@ contract("Locked SOV (State)", (accounts) => {
});

it("Using createVestingAndStake() should create vesting address and stake tokens correctly.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userThree, value);
await sov.approve(lockedSOV.address, value, { from: userThree });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand Down Expand Up @@ -384,7 +384,7 @@ contract("Locked SOV (State)", (accounts) => {
});

it("Using stakeTokens() should correctly stake the locked tokens.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand All @@ -409,7 +409,7 @@ contract("Locked SOV (State)", (accounts) => {

// TODO from here
it("Using withdrawAndStakeTokens() should correctly withdraw all unlocked tokens and stake locked tokens correctly.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userTwo, value);
await sov.approve(lockedSOV.address, value, { from: userTwo });
let basisPoint = 5000; // 50% will be unlocked, rest will go to locked balance.
Expand Down Expand Up @@ -468,7 +468,7 @@ contract("Locked SOV (State)", (accounts) => {
});

it("Using transfer() should correctly transfer locked token to new locked sov.", async () => {
let value = randomValue() + 1;
let value = randomValue() + 10;
await sov.mint(userOne, value);
await sov.approve(lockedSOV.address, value, { from: userOne });
let basisPoint = 0;
Expand Down

0 comments on commit ac88289

Please sign in to comment.