difftreelog
test update gas prices for new frontier
in: master
4 files changed
node/cli/src/chain_spec.rsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56use cumulus_primitives_core::ParaId;7use nft_runtime::*;8use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};9use sc_service::ChainType;10use sp_core::{sr25519, Pair, Public};11use sp_runtime::traits::{IdentifyAccount, Verify};12use std::collections::BTreeMap;1314use serde::{Deserialize, Serialize};15use serde_json::map::Map;1617/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.18pub type ChainSpec = sc_service::GenericChainSpec<nft_runtime::GenesisConfig, Extensions>;1920/// Helper function to generate a crypto pair from seed21pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {22 TPublic::Pair::from_string(&format!("//{}", seed), None)23 .expect("static values are valid; qed")24 .public()25}2627/// The extensions for the [`ChainSpec`].28#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]29#[serde(deny_unknown_fields)]30pub struct Extensions {31 /// The relay chain of the Parachain.32 pub relay_chain: String,33 /// The id of the Parachain.34 pub para_id: u32,35}3637impl Extensions {38 /// Try to get the extension from the given `ChainSpec`.39 pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {40 sc_chain_spec::get_extension(chain_spec.extensions())41 }42}4344type AccountPublic = <Signature as Verify>::Signer;4546/// Helper function to generate an account ID from seed47pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId48where49 AccountPublic: From<<TPublic::Pair as Pair>::Public>,50{51 AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()52}5354pub fn development_config(id: ParaId) -> ChainSpec {55 let mut properties = Map::new();56 properties.insert("tokenSymbol".into(), "testUNQ".into());57 properties.insert("tokenDecimals".into(), 15.into());58 properties.insert("ss58Format".into(), 42.into()); // Generic Substrate wildcard (SS58 checksum preimage)5960 ChainSpec::from_genesis(61 // Name62 "Development",63 // ID64 "dev",65 ChainType::Local,66 move || {67 testnet_genesis(68 // Sudo account69 get_account_id_from_seed::<sr25519::Public>("Alice"),70 vec![71 get_from_seed::<AuraId>("Alice"),72 get_from_seed::<AuraId>("Bob"),73 ],74 // Pre-funded accounts75 vec![76 get_account_id_from_seed::<sr25519::Public>("Alice"),77 get_account_id_from_seed::<sr25519::Public>("Bob"),78 ],79 id,80 )81 },82 // Bootnodes83 vec![],84 // Telemetry85 None,86 // Protocol ID87 None,88 // Properties89 Some(properties),90 // Extensions91 Extensions {92 relay_chain: "rococo-dev".into(),93 para_id: id.into(),94 },95 )96}9798pub fn local_testnet_rococo_config(id: ParaId) -> ChainSpec {99 ChainSpec::from_genesis(100 // Name101 "Local Testnet",102 // ID103 "local_testnet",104 ChainType::Local,105 move || {106 testnet_genesis(107 // Sudo account108 get_account_id_from_seed::<sr25519::Public>("Alice"),109 vec![110 get_from_seed::<AuraId>("Alice"),111 get_from_seed::<AuraId>("Bob"),112 ],113 // Pre-funded accounts114 vec![115 get_account_id_from_seed::<sr25519::Public>("Alice"),116 get_account_id_from_seed::<sr25519::Public>("Bob"),117 get_account_id_from_seed::<sr25519::Public>("Charlie"),118 get_account_id_from_seed::<sr25519::Public>("Dave"),119 get_account_id_from_seed::<sr25519::Public>("Eve"),120 get_account_id_from_seed::<sr25519::Public>("Ferdie"),121 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),122 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),123 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),124 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),125 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),126 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),127 ],128 id,129 )130 },131 // Bootnodes132 vec![],133 // Telemetry134 None,135 // Protocol ID136 None,137 // Properties138 None,139 // Extensions140 Extensions {141 relay_chain: "rococo-local".into(),142 para_id: id.into(),143 },144 )145}146147pub fn local_testnet_westend_config(id: ParaId) -> ChainSpec {148 ChainSpec::from_genesis(149 // Name150 "Local Testnet",151 // ID152 "local_testnet",153 ChainType::Local,154 move || {155 testnet_genesis(156 // Sudo account157 get_account_id_from_seed::<sr25519::Public>("Alice"),158 vec![159 get_from_seed::<AuraId>("Alice"),160 get_from_seed::<AuraId>("Bob"),161 get_from_seed::<AuraId>("Charlie"),162 get_from_seed::<AuraId>("Dave"),163 get_from_seed::<AuraId>("Eve"),164 ],165 // Pre-funded accounts166 vec![167 get_account_id_from_seed::<sr25519::Public>("Alice"),168 get_account_id_from_seed::<sr25519::Public>("Bob"),169 get_account_id_from_seed::<sr25519::Public>("Charlie"),170 get_account_id_from_seed::<sr25519::Public>("Dave"),171 get_account_id_from_seed::<sr25519::Public>("Eve"),172 get_account_id_from_seed::<sr25519::Public>("Ferdie"),173 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),174 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),175 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),176 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),177 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),178 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),179 ],180 id,181 )182 },183 // Bootnodes184 vec![],185 // Telemetry186 None,187 // Protocol ID188 None,189 // Properties190 None,191 // Extensions192 Extensions {193 relay_chain: "westend-local".into(),194 para_id: id.into(),195 },196 )197}198199fn testnet_genesis(200 root_key: AccountId,201 initial_authorities: Vec<AuraId>,202 endowed_accounts: Vec<AccountId>,203 id: ParaId,204) -> GenesisConfig {205 GenesisConfig {206 system: nft_runtime::SystemConfig {207 code: nft_runtime::WASM_BINARY208 .expect("WASM binary was not build, please build it!")209 .to_vec(),210 changes_trie_config: Default::default(),211 },212 balances: BalancesConfig {213 balances: endowed_accounts214 .iter()215 .cloned()216 .map(|k| (k, 1 << 70))217 .collect(),218 },219 treasury: Default::default(),220 sudo: SudoConfig { key: root_key },221 vesting: VestingConfig { vesting: vec![] },222 parachain_info: nft_runtime::ParachainInfoConfig { parachain_id: id },223 aura: nft_runtime::AuraConfig {224 authorities: initial_authorities,225 },226 aura_ext: Default::default(),227 evm: EVMConfig {228 accounts: BTreeMap::new(),229 },230 ethereum: EthereumConfig {},231 }232}1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56use cumulus_primitives_core::ParaId;7use nft_runtime::*;8use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};9use sc_service::ChainType;10use sp_core::{sr25519, Pair, Public};11use sp_runtime::traits::{IdentifyAccount, Verify};12use std::collections::BTreeMap;1314use serde::{Deserialize, Serialize};15use serde_json::map::Map;1617/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.18pub type ChainSpec = sc_service::GenericChainSpec<nft_runtime::GenesisConfig, Extensions>;1920/// Helper function to generate a crypto pair from seed21pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {22 TPublic::Pair::from_string(&format!("//{}", seed), None)23 .expect("static values are valid; qed")24 .public()25}2627/// The extensions for the [`ChainSpec`].28#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]29#[serde(deny_unknown_fields)]30pub struct Extensions {31 /// The relay chain of the Parachain.32 pub relay_chain: String,33 /// The id of the Parachain.34 pub para_id: u32,35}3637impl Extensions {38 /// Try to get the extension from the given `ChainSpec`.39 pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {40 sc_chain_spec::get_extension(chain_spec.extensions())41 }42}4344type AccountPublic = <Signature as Verify>::Signer;4546/// Helper function to generate an account ID from seed47pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId48where49 AccountPublic: From<<TPublic::Pair as Pair>::Public>,50{51 AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()52}5354pub fn development_config(id: ParaId) -> ChainSpec {55 let mut properties = Map::new();56 properties.insert("tokenSymbol".into(), "testUNQ".into());57 properties.insert("tokenDecimals".into(), 15.into());58 properties.insert("ss58Format".into(), 42.into()); // Generic Substrate wildcard (SS58 checksum preimage)5960 ChainSpec::from_genesis(61 // Name62 "Development",63 // ID64 "dev",65 ChainType::Local,66 move || {67 testnet_genesis(68 // Sudo account69 get_account_id_from_seed::<sr25519::Public>("Alice"),70 vec![71 get_from_seed::<AuraId>("Alice"),72 get_from_seed::<AuraId>("Bob"),73 ],74 // Pre-funded accounts75 vec![76 get_account_id_from_seed::<sr25519::Public>("Alice"),77 get_account_id_from_seed::<sr25519::Public>("Bob"),78 ],79 id,80 )81 },82 // Bootnodes83 vec![],84 // Telemetry85 None,86 // Protocol ID87 None,88 // Properties89 Some(properties),90 // Extensions91 Extensions {92 relay_chain: "rococo-dev".into(),93 para_id: id.into(),94 },95 )96}9798pub fn local_testnet_rococo_config(id: ParaId) -> ChainSpec {99 ChainSpec::from_genesis(100 // Name101 "Local Testnet",102 // ID103 "local_testnet",104 ChainType::Local,105 move || {106 testnet_genesis(107 // Sudo account108 get_account_id_from_seed::<sr25519::Public>("Alice"),109 vec![110 get_from_seed::<AuraId>("Alice"),111 get_from_seed::<AuraId>("Bob"),112 ],113 // Pre-funded accounts114 vec![115 get_account_id_from_seed::<sr25519::Public>("Alice"),116 get_account_id_from_seed::<sr25519::Public>("Bob"),117 get_account_id_from_seed::<sr25519::Public>("Charlie"),118 get_account_id_from_seed::<sr25519::Public>("Dave"),119 get_account_id_from_seed::<sr25519::Public>("Eve"),120 get_account_id_from_seed::<sr25519::Public>("Ferdie"),121 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),122 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),123 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),124 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),125 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),126 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),127 ],128 id,129 )130 },131 // Bootnodes132 vec![],133 // Telemetry134 None,135 // Protocol ID136 None,137 // Properties138 None,139 // Extensions140 Extensions {141 relay_chain: "rococo-local".into(),142 para_id: id.into(),143 },144 )145}146147pub fn local_testnet_westend_config(id: ParaId) -> ChainSpec {148 ChainSpec::from_genesis(149 // Name150 "Local Testnet",151 // ID152 "local_testnet",153 ChainType::Local,154 move || {155 testnet_genesis(156 // Sudo account157 get_account_id_from_seed::<sr25519::Public>("Alice"),158 vec![159 get_from_seed::<AuraId>("Alice"),160 get_from_seed::<AuraId>("Bob"),161 get_from_seed::<AuraId>("Charlie"),162 get_from_seed::<AuraId>("Dave"),163 get_from_seed::<AuraId>("Eve"),164 ],165 // Pre-funded accounts166 vec![167 get_account_id_from_seed::<sr25519::Public>("Alice"),168 get_account_id_from_seed::<sr25519::Public>("Bob"),169 get_account_id_from_seed::<sr25519::Public>("Charlie"),170 get_account_id_from_seed::<sr25519::Public>("Dave"),171 get_account_id_from_seed::<sr25519::Public>("Eve"),172 get_account_id_from_seed::<sr25519::Public>("Ferdie"),173 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),174 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),175 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),176 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),177 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),178 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),179 ],180 id,181 )182 },183 // Bootnodes184 vec![],185 // Telemetry186 None,187 // Protocol ID188 None,189 // Properties190 None,191 // Extensions192 Extensions {193 relay_chain: "westend-local".into(),194 para_id: id.into(),195 },196 )197}198199fn testnet_genesis(200 root_key: AccountId,201 initial_authorities: Vec<AuraId>,202 endowed_accounts: Vec<AccountId>,203 id: ParaId,204) -> GenesisConfig {205 GenesisConfig {206 system: nft_runtime::SystemConfig {207 code: nft_runtime::WASM_BINARY208 .expect("WASM binary was not build, please build it!")209 .to_vec(),210 changes_trie_config: Default::default(),211 },212 balances: BalancesConfig {213 balances: endowed_accounts214 .iter()215 .cloned()216 // 1e13 UNQ217 .map(|k| (k, 1 << 100))218 .collect(),219 },220 treasury: Default::default(),221 sudo: SudoConfig { key: root_key },222 vesting: VestingConfig { vesting: vec![] },223 parachain_info: nft_runtime::ParachainInfoConfig { parachain_id: id },224 aura: nft_runtime::AuraConfig {225 authorities: initial_authorities,226 },227 aura_ext: Default::default(),228 evm: EVMConfig {229 accounts: BTreeMap::new(),230 },231 ethereum: EthereumConfig {},232 }233}tests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth--- a/tests/src/eth/marketplace/marketplace.test.ts
+++ b/tests/src/eth/marketplace/marketplace.test.ts
@@ -13,38 +13,41 @@
describe('Matcher contract usage', () => {
itWeb3('With UNQ', async ({api, web3}) => {
const alice = privateKey('//Alice');
- const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId));
const matcherOwner = await createEthAccountWithBalance(api, web3);
- const helpers = contractHelpers(web3, matcherOwner);
-
const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
from: matcherOwner,
...GAS_ARGS,
});
const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments:[matcherOwner]}).send({from: matcherOwner});
-
+ const helpers = contractHelpers(web3, matcherOwner);
+ await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
+ await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
await transferBalanceToEth(api, alice, matcher.options.address);
- await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
- await transferBalanceToEth(api, alice, subToEth(alice.address));
+ const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+ const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
await setCollectionSponsorExpectSuccess(collectionId, alice.address);
await confirmSponsorshipExpectSuccess(collectionId);
- const seller = privateKey('//Seller/' + Date.now());
- await addToAllowListExpectSuccess(alice, collectionId, {Ethereum:subToEth(seller.address)});
+ await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
+ await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
+
+ const seller = privateKey('//Bob');
await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
+ await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
- // To transfer item to matcher it first needs to be transfered to EVM account of seller
+ // To transfer item to matcher it first needs to be transfered to EVM account of bob
await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
+
+ // Token is owned by seller initially
expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
// Ask
{
await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
- await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
+ await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
}
// Token is transferred to matcher
@@ -69,6 +72,7 @@
// selling for custom tokens excluded from release
itWeb3.skip('With custom ERC20', async ({api, web3}) => {
+ const alice = privateKey('//Alice');
const matcherOwner = await createEthAccountWithBalance(api, web3);
const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
from: matcherOwner,
@@ -76,7 +80,6 @@
});
const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
- const alice = privateKey('//Alice');
const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
@@ -100,7 +103,7 @@
// Ask
{
await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
- await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, evmFungible.options.address, evmCollection.options.address, tokenId, 1));
+ await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, evmFungible.options.address, evmCollection.options.address, tokenId, 1));
}
// Token is transferred to matcher
@@ -134,40 +137,43 @@
itWeb3('With escrow', async ({api, web3}) => {
const alice = privateKey('//Alice');
- const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId));
const matcherOwner = await createEthAccountWithBalance(api, web3);
- const helpers = contractHelpers(web3, matcherOwner);
const escrow = await createEthAccountWithBalance(api, web3);
-
const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
from: matcherOwner,
...GAS_ARGS,
});
- const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
+ const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner, gas: 10000000});
await matcher.methods.setEscrow(escrow).send({from: matcherOwner});
-
- await transferBalanceToEth(api, alice, matcher.options.address);
+ const helpers = contractHelpers(web3, matcherOwner);
await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
+ await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
+ await transferBalanceToEth(api, alice, matcher.options.address);
- await transferBalanceToEth(api, alice, subToEth(alice.address));
+ const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+ const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
await setCollectionSponsorExpectSuccess(collectionId, alice.address);
await confirmSponsorshipExpectSuccess(collectionId);
- const seller = privateKey('//Seller/' + Date.now());
+ await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
+ await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
+
+ const seller = privateKey('//Bob');
await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
- // To transfer item to matcher it first needs to be transfered to EVM account of seller
+ // To transfer item to matcher it first needs to be transfered to EVM account of bob
await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
+
+ // Token is owned by seller initially
expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
// Ask
{
await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
- await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
+ await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
}
// Token is transferred to matcher
tests/src/eth/payable.test.tsdiffbeforeafterboth--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -1,7 +1,7 @@
import {expect} from 'chai';
import privateKey from '../substrate/privateKey';
import {submitTransactionAsync} from '../substrate/substrate-api';
-import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth} from './util/helpers';
+import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';
import {evmToAddress} from '@polkadot/util-crypto';
import {getGenericResult} from '../util/helpers';
import {getBalanceSingle, transferBalanceExpectSuccess} from '../substrate/get-balance';
@@ -23,7 +23,7 @@
// Transaction fee/value will be payed from subToEth(sender) evm balance,
// which is backed by evmToAddress(subToEth(sender)) substrate balance
- await transferBalanceExpectSuccess(api, alice, evmToAddress(subToEth(alice.address)), '1000000000000');
+ await transferBalanceToEth(api, alice, subToEth(alice.address));
{
const tx = api.tx.evm.call(
tests/src/eth/util/helpers.tsdiffbeforeafterboth--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -19,7 +19,7 @@
import contractHelpersAbi from './contractHelpersAbi.json';
import getBalance from '../../substrate/get-balance';
-export const GAS_ARGS = {gas: 1000000};
+export const GAS_ARGS = {gas: 2500000};
let web3Connected = false;
export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {
@@ -63,7 +63,7 @@
return account;
}
-export async function transferBalanceToEth(api: ApiPromise, source: IKeyringPair, target: string, amount = 10000n * UNIQUE) {
+export async function transferBalanceToEth(api: ApiPromise, source: IKeyringPair, target: string, amount = 1000n * UNIQUE) {
const tx = api.tx.balances.transfer(evmToAddress(target), amount);
const events = await submitTransactionAsync(source, tx);
const result = getGenericResult(events);
@@ -234,7 +234,7 @@
* @param mkTx - closure, receiving `contract.methods`, and returning method call,
* to be used as following (assuming `to` = erc20 contract):
* `m => m.transfer(to, amount)`
- *
+ *
* # Example
* ```ts
* executeEthTxOnSub(api, alice, erc20Contract, m => m.transfer(target, amount));
@@ -260,7 +260,7 @@
/**
* Measure how much gas given closure consumes
- *
+ *
* @param user which user balance will be checked
*/
export async function recordEthFee(api: ApiPromise, user: string, call: () => Promise<any>): Promise<bigint> {