From 2e1bc8bdcea5a496920e06d9db391f68cc62f846 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Tue, 14 Mar 2023 13:08:09 +0300 Subject: [PATCH] Fixing failing transaction in test --- package.json | 1 + test/integration/veDelegation.test.ts | 50 +++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index f34d9aa..0ed2680 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "test-ve": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/VeOcean.test.ts'", "test-df": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/DFRewards.test.ts'", "test-dt": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/Datatoken.test.ts'", + "test-delegation": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/veDelegation.test.ts'", "test-zend": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/ZEnding.test.ts'", "lint": "eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx .", "lint:fix": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx . --fix", diff --git a/test/integration/veDelegation.test.ts b/test/integration/veDelegation.test.ts index 694fde4..717a927 100644 --- a/test/integration/veDelegation.test.ts +++ b/test/integration/veDelegation.test.ts @@ -105,7 +105,7 @@ describe('veOcean tests', async () => { amount ) const timestamp = Math.floor(Date.now() / 1000) - const unlockTime = timestamp + 7 * 86400 + const unlockTime = timestamp + 7 if (parseInt(currentBalance) > 0 || currentLock > 0) { // we already have some locked tokens, so our transaction should fail @@ -147,12 +147,48 @@ describe('veOcean tests', async () => { from: Alice }) console.log('TX1: ', tx1) + console.log('Date.now() ', Date.now()) + console.log('lockTime', lockTime) + const extLockTime = Number(lockTime) + 7000000 + console.log('extLockTime', extLockTime) - const tx = await delegateContract.methods - .create_boost(Alice, Bob, 100, 0, lockTime, 0) - .send({ - from: Alice - }) - console.log('TX: ', tx) + const tx2 = await veOcean.increaseUnlockTime(Alice, extLockTime) + + console.log('TX2: ', tx2) + + const estGas = await calculateEstimatedGas( + Alice, + delegateContract.methods.create_boost, + Alice, + Bob, + 10000, + 0, + extLockTime, + 0 + ) + + console.log('estGas', estGas) + + // const tx = await delegateContract.methods + // .create_boost(Alice, Bob, 10000, 0, extLockTime, 0) + // .send({ + // from: Alice + // }) + // console.log('TX: ', tx) + + const tx3 = await sendTx( + Alice, + estGas, + web3, + 1, + delegateContract.methods.create_boost, + Alice, + Bob, + 10000, + 0, + extLockTime, + 0 + ) + console.log('TX3: ', tx3) }) })