difftreelog
eth/allowList migrated
in: master
1 file changed
tests/src/eth/allowlist.test.tsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';18import {expect} from 'chai';19import {isAllowlisted, normalizeAccountId} from '../util/helpers';20import {21 contractHelpers,22 createEthAccount,23 createEthAccountWithBalance,24 deployFlipper,25 evmCollection,26 evmCollectionHelpers,27 getCollectionAddressFromResult,28 itWeb3,29} from './util/helpers';30import {itEth, usingEthPlaygrounds} from './util/playgrounds';18import {itEth, usingEthPlaygrounds, expect} from './util/playgrounds';311932describe('EVM contract allowlist', () => {20describe('EVM contract allowlist', () => {21 let donor: IKeyringPair;2223 before(async function() {24 await usingEthPlaygrounds(async (_helper, privateKey) => {25 donor = privateKey('//Alice');26 });27 });2833 itWeb3('Contract allowlist can be toggled', async ({api, web3, privateKeyWrapper}) => {29 itEth('Contract allowlist can be toggled', async ({helper}) => {34 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);30 const owner = await helper.eth.createAccountWithBalance(donor);35 const flipper = await deployFlipper(web3, owner);31 const flipper = await helper.eth.deployFlipper(owner);3637 const helpers = contractHelpers(web3, owner);32 const helpers = helper.ethNativeContract.contractHelpers(owner);383339 // Any user is allowed by default34 // Any user is allowed by default40 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;35 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;48 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;43 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;49 });44 });504551 itWeb3('Non-allowlisted user can\'t call contract with allowlist enabled', async ({api, web3, privateKeyWrapper}) => {46 itEth('Non-allowlisted user can\'t call contract with allowlist enabled', async ({helper}) => {52 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);47 const owner = await helper.eth.createAccountWithBalance(donor);53 const flipper = await deployFlipper(web3, owner);48 const caller = await helper.eth.createAccountWithBalance(donor);54 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);49 const flipper = await helper.eth.deployFlipper(owner);5556 const helpers = contractHelpers(web3, owner);50 const helpers = helper.ethNativeContract.contractHelpers(owner);575158 // User can flip with allowlist disabled52 // User can flip with allowlist disabled59 await flipper.methods.flip().send({from: caller});53 await flipper.methods.flip().send({from: caller});