Comparing the value of oceanFeeAmount returned from the event to the value stored in the subgraph

This commit is contained in:
Jamie Hewitt 2023-01-10 17:23:47 +00:00
parent 8853b3ff7a
commit 908164b958
1 changed files with 8 additions and 1 deletions

View File

@ -45,7 +45,6 @@ describe('Fixed Rate Exchange tests', async () => {
const templateIndex = 1
const dtAmount = '10'
const datatoken = new Datatoken(web3, 8996)
const oceanFeeAmount = String((Number(dtAmount) * Number(feeAmount)) / 100)
let datatokenAddress: string
let fixedRateAddress: string
let baseTokenAddress: string
@ -628,6 +627,11 @@ describe('Fixed Rate Exchange tests', async () => {
const tx = (
await fixedRate.buyDatatokens(user1, exchangeId, dtAmount, '100')
).events?.Swapped
const oceanFeeAmount = web3.utils.fromWei(
new BN(tx.returnValues.oceanFeeAmount)
)
await sleep(sleepMs)
user1Balance = await datatoken.balance(datatokenAddress, user1)
// user1 has 1 datatoken
@ -658,6 +662,9 @@ describe('Fixed Rate Exchange tests', async () => {
await datatoken.approve(datatokenAddress, fixedRateAddress, dtAmount, user1)
const tx = (await fixedRate.sellDatatokens(user1, exchangeId, '10', '9'))
.events?.Swapped
const oceanFeeAmount = web3.utils.fromWei(
new BN(tx.returnValues.oceanFeeAmount)
)
assert(tx != null)
await sleep(sleepMs)
const swapsQuery = {