git.delta.rocks / unique-network / refs/commits / 1c142c5374ba

difftreelog

source

tests/src/eth/base.test.ts1.1 KiBsourcehistory
12import { createEthAccount, createEthAccountWithBalance, deployFlipper, ethBalanceViaSub, GAS_ARGS, itWeb3, recordEthFee } from './util/helpers';3import { expect } from 'chai';4import { UNIQUE } from '../util/helpers';56describe('Contract calls', () => {7  itWeb3('Call of simple contract fee is less than 0.2 UNQ', async ({ web3, api }) => {8    const deployer = await createEthAccountWithBalance(api, web3);9    const flipper = await deployFlipper(web3 as any, deployer);1011    const cost = await recordEthFee(api, deployer, () => flipper.methods.flip().send({from: deployer}));12    expect(cost < BigInt(0.2 * Number(UNIQUE))).to.be.true;13  });1415  itWeb3('Balance transfer fee is less than 0.2 UNQ', async ({ web3, api }) => {16    const userA = await createEthAccountWithBalance(api, web3);17    const userB = createEthAccount(web3);1819    const cost = await recordEthFee(api, userA, () => web3.eth.sendTransaction({ from: userA, to: userB, value: '1000000', ...GAS_ARGS }));20    expect(cost - await ethBalanceViaSub(api, userB) < BigInt(0.2 * Number(UNIQUE))).to.be.true;21  });22});