git.delta.rocks / unique-network / refs/commits / c43c309b3350

difftreelog

test remove explicitly set evm gasPrice

Yaroslav Bolyukin2023-05-30parent: #026e1c3.patch.diff
in: master

1 file changed

modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
113 data: object,113 data: object,
114 from: signer,114 from: signer,
115 gas: gas ?? this.helper.eth.DEFAULT_GAS,115 gas: gas ?? this.helper.eth.DEFAULT_GAS,
116 gasPrice: await this.getGasPrice(),
117 });116 });
118 return await contract.deploy({data: object}).send({from: signer});117 return await contract.deploy({data: object}).send({from: signer});
119 }118 }
122121
123class NativeContractGroup extends EthGroupBase {122class NativeContractGroup extends EthGroupBase {
124123
125 async contractHelpers(caller: string): Promise<Contract> {124 contractHelpers(caller: string) {
126 const web3 = this.helper.getWeb3();125 const web3 = this.helper.getWeb3();
127 return new web3.eth.Contract(contractHelpersAbi as any, this.helper.getApi().consts.evmContractHelpers.contractAddress.toString(), {126 return new web3.eth.Contract(contractHelpersAbi as any, this.helper.getApi().consts.evmContractHelpers.contractAddress.toString(), {
128 from: caller,127 from: caller,
129 gas: this.helper.eth.DEFAULT_GAS,128 gas: this.helper.eth.DEFAULT_GAS,
130 gasPrice: await this.getGasPrice(),
131 });129 });
132 }130 }
133131
134 async collectionHelpers(caller: string) {132 collectionHelpers(caller: string) {
135 const web3 = this.helper.getWeb3();133 const web3 = this.helper.getWeb3();
136 return new web3.eth.Contract(collectionHelpersAbi as any, this.helper.getApi().consts.common.contractAddress.toString(), {134 return new web3.eth.Contract(collectionHelpersAbi as any, this.helper.getApi().consts.common.contractAddress.toString(), {
137 from: caller,135 from: caller,
138 gas: this.helper.eth.DEFAULT_GAS,136 gas: this.helper.eth.DEFAULT_GAS,
139 gasPrice: await this.getGasPrice(),
140 });137 });
141 }138 }
142139
143 async collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false) {140 collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false) {
144 let abi;141 let abi;
145 if (address === this.helper.ethAddress.fromCollectionId(0)) {142 if (address === this.helper.ethAddress.fromCollectionId(0)) {
146 abi = nativeFungibleAbi;143 abi = nativeFungibleAbi;
162 const web3 = this.helper.getWeb3();159 const web3 = this.helper.getWeb3();
163 return new web3.eth.Contract(abi as any, address, {160 return new web3.eth.Contract(abi as any, address, {
164 gas: this.helper.eth.DEFAULT_GAS,161 gas: this.helper.eth.DEFAULT_GAS,
165 gasPrice: await this.getGasPrice(),
166 ...(caller ? {from: caller} : {}),162 ...(caller ? {from: caller} : {}),
167 });163 });
168 }164 }
171 return this.collection(this.helper.ethAddress.fromCollectionId(collectionId), mode, caller, mergeDeprecated);167 return this.collection(this.helper.ethAddress.fromCollectionId(collectionId), mode, caller, mergeDeprecated);
172 }168 }
173169
174 async rftToken(address: string, caller?: string, mergeDeprecated = false) {170 rftToken(address: string, caller?: string, mergeDeprecated = false) {
175 const web3 = this.helper.getWeb3();171 const web3 = this.helper.getWeb3();
176 const abi = mergeDeprecated ? [...refungibleTokenAbi, ...refungibleTokenDeprecatedAbi] : refungibleTokenAbi;172 const abi = mergeDeprecated ? [...refungibleTokenAbi, ...refungibleTokenDeprecatedAbi] : refungibleTokenAbi;
177 return new web3.eth.Contract(abi as any, address, {173 return new web3.eth.Contract(abi as any, address, {
178 gas: this.helper.eth.DEFAULT_GAS,174 gas: this.helper.eth.DEFAULT_GAS,
179 gasPrice: await this.getGasPrice(),
180 ...(caller ? {from: caller} : {}),175 ...(caller ? {from: caller} : {}),
181 });176 });
182 }177 }
216 async sendEVM(signer: IKeyringPair, contractAddress: string, abi: string, value: string, gasLimit?: number) {211 async sendEVM(signer: IKeyringPair, contractAddress: string, abi: string, value: string, gasLimit?: number) {
217 if (!gasLimit) gasLimit = this.DEFAULT_GAS;212 if (!gasLimit) gasLimit = this.DEFAULT_GAS;
218 const web3 = this.helper.getWeb3();213 const web3 = this.helper.getWeb3();
214 // FIXME: can't send legacy transaction using tx.evm.call
219 const gasPrice = await web3.eth.getGasPrice();215 const gasPrice = await web3.eth.getGasPrice();
220 // TODO: check execution status216 // TODO: check execution status
221 await this.helper.executeExtrinsic(217 await this.helper.executeExtrinsic(
383class EthAddressGroup extends EthGroupBase {379class EthAddressGroup extends EthGroupBase {
384 extractCollectionId(address: string): number {380 extractCollectionId(address: string): number {
385 if (!(address.length === 42 || address.length === 40)) throw new Error('address wrong format');381 if (!(address.length === 42 || address.length === 40)) throw new Error('address wrong format');
386 return parseInt(address.substr(address.length - 8), 16);382 return parseInt(address.slice(address.length - 8), 16);
387 }383 }
388384
389 fromCollectionId(collectionId: number): string {385 fromCollectionId(collectionId: number): string {