@@ -5,24 +5,23 @@ import {
5
5
singleAssetTwoPartyCoinTransferInterpreterParamsEncoding ,
6
6
} from '@connext/types'
7
7
import { Signer } from 'ethers'
8
- import {
8
+ import { constants , utils , BigNumber , BigNumberish } from 'ethers'
9
+ import { GraphToken } from '../../build/typechain/contracts/GraphToken'
10
+ import MultisigArtifact from '../../build/contracts/MinimumViableMultisig.json'
11
+ import { IndexerCtdt } from '../../build/typechain/contracts/IndexerCtdt'
12
+ import { toBN } from './testHelpers'
13
+ import { MockDispute } from '../../build/typechain/contracts/MockDispute'
14
+
15
+ const { Zero, AddressZero } = constants
16
+ const {
9
17
parseEther,
10
- BigNumber ,
11
18
Interface,
12
19
randomBytes,
13
20
solidityKeccak256,
14
- bigNumberify ,
15
21
solidityPack,
16
22
keccak256,
17
- BigNumberish ,
18
23
defaultAbiCoder,
19
- } from 'ethers/utils'
20
- import { GraphToken } from '../../build/typechain/contracts/GraphToken'
21
- import MultisigArtifact from '../../build/contracts/MinimumViableMultisig.json'
22
- import { IndexerCtdt } from '../../build/typechain/contracts/IndexerCtdt'
23
- import { toBN } from './testHelpers'
24
- import { MockDispute } from '../../build/typechain/contracts/MockDispute'
25
- import { Zero , AddressZero } from 'ethers/constants'
24
+ } = utils
26
25
27
26
export async function getRandomFundedChannelSigners (
28
27
numSigners : number ,
@@ -160,7 +159,7 @@ export const getFreeBalanceState = (
160
159
} ,
161
160
{
162
161
assetId : AddressZero ,
163
- deposit : new BigNumber ( 0 ) ,
162
+ deposit : BigNumber . from ( 0 ) ,
164
163
} ,
165
164
)
166
165
@@ -174,7 +173,7 @@ export const getFreeBalanceState = (
174
173
} ,
175
174
{
176
175
assetId : AddressZero ,
177
- deposit : new BigNumber ( 0 ) ,
176
+ deposit : BigNumber . from ( 0 ) ,
178
177
} ,
179
178
)
180
179
@@ -310,12 +309,12 @@ export class MiniCommitment {
310
309
return {
311
310
to : ctdt . address ,
312
311
value : 0 ,
313
- data : ctdt . interface . functions . executeWithdraw . encode ( [
312
+ data : ctdt . interface . encodeFunctionData ( ' executeWithdraw(address,bytes32,bytes,bytes)' , [
314
313
withdrawInterpreterAddress ,
315
314
randomBytes ( 32 ) , // nonce
316
- encode ( withdrawOutcomeEncoding , { to : recipient , amount : bigNumberify ( amount ) } ) ,
315
+ encode ( withdrawOutcomeEncoding , { to : recipient , amount : BigNumber . from ( amount ) } ) ,
317
316
encode ( withdrawOutcomeInterpreterParamsEncoding , {
318
- limit : bigNumberify ( amount ) ,
317
+ limit : BigNumber . from ( amount ) ,
319
318
tokenAddress : assetId ,
320
319
} ) ,
321
320
] ) ,
@@ -345,16 +344,20 @@ export class MiniCommitment {
345
344
return {
346
345
to : ctdt . address ,
347
346
value : 0 ,
348
- data : ctdt . interface . functions . executeEffectOfInterpretedAppOutcome . encode ( [
349
- mockDispute . address ,
350
- freeBalanceIdentityHash ,
351
- appIdentityHash ,
352
- interpreterAddr ,
353
- encodedParams ,
354
- ] ) ,
347
+ data : ctdt . interface . encodeFunctionData (
348
+ 'executeEffectOfInterpretedAppOutcome(address,bytes32,bytes32,address,bytes)' ,
349
+ [
350
+ mockDispute . address ,
351
+ freeBalanceIdentityHash ,
352
+ appIdentityHash ,
353
+ interpreterAddr ,
354
+ encodedParams ,
355
+ ] ,
356
+ ) ,
355
357
operation : MultisigOperation . DelegateCall ,
356
358
}
357
359
}
360
+
358
361
// TODO: returns signed app execute effect tx
359
362
case CommitmentTypes . setup : {
360
363
const {
@@ -366,11 +369,10 @@ export class MiniCommitment {
366
369
return {
367
370
to : ctdt . address ,
368
371
value : 0 ,
369
- data : ctdt . interface . functions . executeEffectOfFreeBalance . encode ( [
370
- mockDispute . address ,
371
- freeBalanceIdentityHash ,
372
- interpreterAddr ,
373
- ] ) ,
372
+ data : ctdt . interface . encodeFunctionData (
373
+ 'executeEffectOfFreeBalance(address,bytes32,address)' ,
374
+ [ mockDispute . address , freeBalanceIdentityHash , interpreterAddr ] ,
375
+ ) ,
374
376
operation : MultisigOperation . DelegateCall ,
375
377
}
376
378
}
@@ -406,13 +408,11 @@ export class MiniCommitment {
406
408
407
409
// Encode call to execute transaction
408
410
const multisig = new Interface ( MultisigArtifact . abi )
409
- const txData = multisig . functions . execTransaction . encode ( [
410
- details . to ,
411
- details . value ,
412
- details . data ,
413
- details . operation ,
414
- signatures ,
415
- ] )
411
+
412
+ const txData = multisig . encodeFunctionData (
413
+ 'execTransaction(address,uint256,bytes,uint8,bytes[])' ,
414
+ [ details . to , details . value , details . data , details . operation , signatures ] ,
415
+ )
416
416
417
417
return { to : this . multisigAddress , value : 0 , data : txData }
418
418
}
0 commit comments