forked from Uniswap/sdks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
writeInterop.js
94 lines (87 loc) · 2 KB
/
writeInterop.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const fs = require('fs')
const { AllowanceTransfer, SignatureTransfer } = require('./dist')
const PERMIT2_ADDRESS = '0xf0ffb02791362602acf0edce574e74dd9bd3120e'
const TOKEN_ADDRESS = '0xb9728f6DE23E1Beeb7Bab38cbf0e60C0A48136eC'
const SPENDER_ADDRESS = '0x0000000000000000000000000000000000000001'
const EXPIRATION = '10000000000000'
const AMOUNT = '1000000000000000000'
const chainId = 31337
const interop = {
_PERMIT_HASH: AllowanceTransfer.hash(
{
details: {
token: TOKEN_ADDRESS,
amount: AMOUNT,
expiration: EXPIRATION,
nonce: 0,
},
spender: SPENDER_ADDRESS,
sigDeadline: EXPIRATION,
},
PERMIT2_ADDRESS,
chainId
),
_PERMIT_BATCH_HASH: AllowanceTransfer.hash(
{
details: [
{
token: TOKEN_ADDRESS,
amount: AMOUNT,
expiration: EXPIRATION,
nonce: 0,
},
],
spender: SPENDER_ADDRESS,
sigDeadline: EXPIRATION,
},
PERMIT2_ADDRESS,
chainId
),
_PERMIT_TRANSFER: SignatureTransfer.hash(
{
permitted: {
token: TOKEN_ADDRESS,
amount: AMOUNT,
},
spender: SPENDER_ADDRESS,
nonce: '0',
deadline: EXPIRATION,
},
PERMIT2_ADDRESS,
chainId
),
_PERMIT_TRANSFER_BATCH: SignatureTransfer.hash(
{
permitted: [
{
token: TOKEN_ADDRESS,
amount: AMOUNT,
},
],
spender: SPENDER_ADDRESS,
nonce: '0',
deadline: EXPIRATION,
},
PERMIT2_ADDRESS,
chainId
),
_PERMIT_TRANSFER_WITNESS: SignatureTransfer.hash(
{
permitted: {
token: TOKEN_ADDRESS,
amount: AMOUNT,
},
spender: SPENDER_ADDRESS,
nonce: '0',
deadline: EXPIRATION,
},
PERMIT2_ADDRESS,
chainId,
{
witnessTypeName: 'MockWitness',
witnessType: { MockWitness: [{ name: 'mock', type: 'uint256' }] },
witness: { mock: '0' },
}
),
}
fs.writeFileSync('./test/interop.json', JSON.stringify(interop))