@paraswap/dex-lib 3.8.14 → 3.8.16-oswap
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/concentrator/arUSD.json +568 -0
- package/build/abi/concentrator/arUSD5115.json +1746 -0
- package/build/abi/fx-protocol/FxMarket.json +1284 -0
- package/build/abi/{wombat/pool.json → fx-protocol/FxUSD.json} +541 -603
- package/build/abi/fx-protocol/weETHOralce.json +676 -0
- package/build/abi/inception/inception-ineth-pool.json +1062 -0
- package/build/abi/inception/inception-ineth.json +609 -0
- package/build/abi/inception/inception-ratio-feed.json +93 -0
- package/build/abi/inception/inception-vault.json +991 -0
- package/build/abi/infusion/InfusionFactory.json +147 -0
- package/build/abi/infusion/InfusionPair.json +658 -0
- package/build/abi/infusion/InfusionRouter.json +442 -0
- package/build/abi/oswap/oswap.abi.json +452 -0
- package/build/dex/aave-v1/aave-v1.js +0 -1
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/angle-transmuter/angle-transmuter.js +1 -1
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -1
- package/build/dex/concentrator-arusd/concentrator-arusd-event.d.ts +17 -0
- package/build/dex/concentrator-arusd/concentrator-arusd-event.js +66 -0
- package/build/dex/concentrator-arusd/concentrator-arusd-event.js.map +1 -0
- package/build/dex/concentrator-arusd/concentrator-arusd.d.ts +41 -0
- package/build/dex/concentrator-arusd/concentrator-arusd.js +188 -0
- package/build/dex/concentrator-arusd/concentrator-arusd.js.map +1 -0
- package/build/dex/concentrator-arusd/config.d.ts +3 -0
- package/build/dex/concentrator-arusd/config.js +14 -0
- package/build/dex/concentrator-arusd/config.js.map +1 -0
- package/build/dex/concentrator-arusd/types.d.ts +14 -0
- package/build/dex/concentrator-arusd/types.js +3 -0
- package/build/dex/concentrator-arusd/types.js.map +1 -0
- package/build/dex/concentrator-arusd/utils.d.ts +4 -0
- package/build/dex/concentrator-arusd/utils.js +27 -0
- package/build/dex/concentrator-arusd/utils.js.map +1 -0
- package/build/dex/fx-protocol-rusd/config.d.ts +3 -0
- package/build/dex/fx-protocol-rusd/config.js +15 -0
- package/build/dex/fx-protocol-rusd/config.js.map +1 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.d.ts +18 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js +71 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js.map +1 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.d.ts +39 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js +201 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js.map +1 -0
- package/build/dex/fx-protocol-rusd/types.d.ts +13 -0
- package/build/dex/fx-protocol-rusd/types.js +3 -0
- package/build/dex/fx-protocol-rusd/types.js.map +1 -0
- package/build/dex/fx-protocol-rusd/utils.d.ts +4 -0
- package/build/dex/fx-protocol-rusd/utils.js +26 -0
- package/build/dex/fx-protocol-rusd/utils.js.map +1 -0
- package/build/dex/idex.d.ts +11 -7
- package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
- package/build/dex/idle-dao/idle-dao-pool.js +176 -0
- package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
- package/build/dex/idle-dao/scripts.d.ts +9 -0
- package/build/dex/idle-dao/scripts.js +552 -0
- package/build/dex/idle-dao/scripts.js.map +1 -0
- package/build/dex/inception/config.d.ts +5 -0
- package/build/dex/inception/config.js +112 -0
- package/build/dex/inception/config.js.map +1 -0
- package/build/dex/inception/inception-event-pool.d.ts +23 -0
- package/build/dex/inception/inception-event-pool.js +34 -0
- package/build/dex/inception/inception-event-pool.js.map +1 -0
- package/build/dex/inception/inception-native.d.ts +43 -0
- package/build/dex/inception/inception-native.js +131 -0
- package/build/dex/inception/inception-native.js.map +1 -0
- package/build/dex/inception/inception-pool.d.ts +18 -0
- package/build/dex/inception/inception-pool.js +32 -0
- package/build/dex/inception/inception-pool.js.map +1 -0
- package/build/dex/inception/inception-price-feed.d.ts +19 -0
- package/build/dex/inception/inception-price-feed.js +51 -0
- package/build/dex/inception/inception-price-feed.js.map +1 -0
- package/build/dex/inception/inception.d.ts +44 -0
- package/build/dex/inception/inception.js +162 -0
- package/build/dex/inception/inception.js.map +1 -0
- package/build/dex/inception/tokens.d.ts +9 -0
- package/build/dex/inception/tokens.js +28 -0
- package/build/dex/inception/tokens.js.map +1 -0
- package/build/dex/inception/types.d.ts +22 -0
- package/build/dex/inception/types.js +3 -0
- package/build/dex/inception/types.js.map +1 -0
- package/build/dex/inception/utils.d.ts +7 -0
- package/build/dex/inception/utils.js +58 -0
- package/build/dex/inception/utils.js.map +1 -0
- package/build/dex/index.js +6 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/infusion/config.d.ts +4 -0
- package/build/dex/infusion/config.js +25 -0
- package/build/dex/infusion/config.js.map +1 -0
- package/build/dex/infusion/infusion-stable-pool.d.ts +4 -0
- package/build/dex/infusion/infusion-stable-pool.js +74 -0
- package/build/dex/infusion/infusion-stable-pool.js.map +1 -0
- package/build/dex/infusion/infusion.d.ts +54 -0
- package/build/dex/infusion/infusion.js +510 -0
- package/build/dex/infusion/infusion.js.map +1 -0
- package/build/dex/infusion/types.d.ts +47 -0
- package/build/dex/infusion/types.js +3 -0
- package/build/dex/infusion/types.js.map +1 -0
- package/build/dex/infusion/utils/isStablePair.d.ts +2 -0
- package/build/dex/infusion/utils/isStablePair.js +18 -0
- package/build/dex/infusion/utils/isStablePair.js.map +1 -0
- package/build/dex/oswap/config.d.ts +5 -0
- package/build/dex/oswap/config.js +31 -0
- package/build/dex/oswap/config.js.map +1 -0
- package/build/dex/oswap/oswap-pool.d.ts +51 -0
- package/build/dex/oswap/oswap-pool.js +150 -0
- package/build/dex/oswap/oswap-pool.js.map +1 -0
- package/build/dex/oswap/oswap.d.ts +46 -0
- package/build/dex/oswap/oswap.js +273 -0
- package/build/dex/oswap/oswap.js.map +1 -0
- package/build/dex/oswap/types.d.ts +20 -0
- package/build/dex/oswap/types.js +3 -0
- package/build/dex/oswap/types.js.map +1 -0
- package/build/dex/platypus/platypus.js +3 -17
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.js +0 -4
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/weth/config.js +3 -0
- package/build/dex/weth/config.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/concentrator/arUSD.json +568 -0
- package/src/abi/concentrator/arUSD5115.json +1746 -0
- package/src/abi/fx-protocol/FxMarket.json +1284 -0
- package/src/abi/fx-protocol/FxUSD.json +1227 -0
- package/src/abi/fx-protocol/weETHOralce.json +676 -0
- package/src/abi/oswap/oswap.abi.json +452 -0
- package/src/dex/angle-transmuter/angle-transmuter.ts +1 -1
- package/src/dex/concentrator-arusd/concentrator-arusd-e2e.test.ts +92 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-event.ts +100 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-integration.test.ts +104 -0
- package/src/dex/concentrator-arusd/concentrator-arusd.ts +269 -0
- package/src/dex/concentrator-arusd/concetrator-arusd-events.test.ts +97 -0
- package/src/dex/concentrator-arusd/config.ts +13 -0
- package/src/dex/concentrator-arusd/types.ts +16 -0
- package/src/dex/concentrator-arusd/utils.ts +36 -0
- package/src/dex/fx-protocol-rusd/config.ts +14 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-e2e.test.ts +96 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-events.test.ts +101 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-integration.test.ts +104 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd-event.ts +112 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd.ts +282 -0
- package/src/dex/fx-protocol-rusd/types.ts +16 -0
- package/src/dex/fx-protocol-rusd/utils.ts +47 -0
- package/src/dex/idex.ts +48 -41
- package/src/dex/index.ts +6 -0
- package/src/dex/oswap/config.ts +32 -0
- package/src/dex/oswap/oswap-e2e.test.ts +91 -0
- package/src/dex/oswap/oswap-events.test.ts +88 -0
- package/src/dex/oswap/oswap-integration.test.ts +269 -0
- package/src/dex/oswap/oswap-pool.ts +190 -0
- package/src/dex/oswap/oswap.ts +392 -0
- package/src/dex/oswap/types.ts +29 -0
- package/src/dex/weth/config.ts +3 -0
- package/src/dex/weth/weth-e2e.test.ts +156 -0
- package/src/dex/wsteth/wsteth-integration.test.ts +0 -1
- package/tests/constants-e2e.ts +10 -0
- package/.vscode/launch.json +0 -53
- package/.vscode/settings.json +0 -2
- package/.vscode/tasks.json +0 -15
- package/build/abi/maverick-v2/MaverickV2Router.json +0 -778
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
- package/build/dex/aave-v2/tokens-avalanche.json +0 -44
- package/build/dex/aave-v2/tokens-mainnet.json +0 -188
- package/build/dex/aave-v2/tokens-polygon.json +0 -44
- package/build/dex/bProtocol.d.ts +0 -18
- package/build/dex/bProtocol.js +0 -39
- package/build/dex/bProtocol.js.map +0 -1
- package/build/dex/bancor.d.ts +0 -26
- package/build/dex/bancor.js +0 -58
- package/build/dex/bancor.js.map +0 -1
- package/build/dex/compound.d.ts +0 -18
- package/build/dex/compound.js +0 -46
- package/build/dex/compound.js.map +0 -1
- package/build/dex/curve-v2.d.ts +0 -58
- package/build/dex/curve-v2.js +0 -180
- package/build/dex/curve-v2.js.map +0 -1
- package/build/dex/dodo-v1.d.ts +0 -33
- package/build/dex/dodo-v1.js +0 -63
- package/build/dex/dodo-v1.js.map +0 -1
- package/build/dex/lido.d.ts +0 -19
- package/build/dex/lido.js +0 -42
- package/build/dex/lido.js.map +0 -1
- package/build/dex/maker-psm/scripts/gem.abi.json +0 -136
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +0 -185
- package/build/dex/maker-psm/scripts/validate-state.js.map +0 -1
- package/build/dex/maker-psm/scripts/vat.abi.json +0 -243
- package/build/dex/onebit.d.ts +0 -25
- package/build/dex/onebit.js +0 -42
- package/build/dex/onebit.js.map +0 -1
- package/build/dex/smoothy.d.ts +0 -26
- package/build/dex/smoothy.js +0 -48
- package/build/dex/smoothy.js.map +0 -1
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +0 -1
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
- package/build/dex/stable-pool.d.ts +0 -28
- package/build/dex/stable-pool.js +0 -55
- package/build/dex/stable-pool.js.map +0 -1
- package/build/dex/trader-joe-v2.1/base.d.ts +0 -18
- package/build/dex/trader-joe-v2.1/base.js +0 -99
- package/build/dex/trader-joe-v2.1/base.js.map +0 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.d.ts +0 -7
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js +0 -20
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js.map +0 -1
- package/build/dex/trader-joe-v2.1.d.ts +0 -43
- package/build/dex/trader-joe-v2.1.js +0 -79
- package/build/dex/trader-joe-v2.1.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
- package/config.ts +0 -1946
- package/src/dex/dexs.txt +0 -58
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [],
|
|
4
|
+
"stateMutability": "nonpayable",
|
|
5
|
+
"type": "constructor"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"anonymous": false,
|
|
9
|
+
"inputs": [
|
|
10
|
+
{
|
|
11
|
+
"indexed": false,
|
|
12
|
+
"internalType": "address",
|
|
13
|
+
"name": "previousAdmin",
|
|
14
|
+
"type": "address"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"indexed": false,
|
|
18
|
+
"internalType": "address",
|
|
19
|
+
"name": "newAdmin",
|
|
20
|
+
"type": "address"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"name": "AdminChanged",
|
|
24
|
+
"type": "event"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"anonymous": false,
|
|
28
|
+
"inputs": [
|
|
29
|
+
{
|
|
30
|
+
"indexed": false,
|
|
31
|
+
"internalType": "address",
|
|
32
|
+
"name": "previousAdmin",
|
|
33
|
+
"type": "address"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"indexed": false,
|
|
37
|
+
"internalType": "address",
|
|
38
|
+
"name": "newAdmin",
|
|
39
|
+
"type": "address"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"name": "OperatorChanged",
|
|
43
|
+
"type": "event"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"anonymous": false,
|
|
47
|
+
"inputs": [
|
|
48
|
+
{
|
|
49
|
+
"indexed": false,
|
|
50
|
+
"internalType": "uint256",
|
|
51
|
+
"name": "traderate0",
|
|
52
|
+
"type": "uint256"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"indexed": false,
|
|
56
|
+
"internalType": "uint256",
|
|
57
|
+
"name": "traderate1",
|
|
58
|
+
"type": "uint256"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"name": "TraderateChanged",
|
|
62
|
+
"type": "event"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"inputs": [],
|
|
66
|
+
"name": "approveStETH",
|
|
67
|
+
"outputs": [],
|
|
68
|
+
"stateMutability": "nonpayable",
|
|
69
|
+
"type": "function"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"inputs": [
|
|
73
|
+
{
|
|
74
|
+
"internalType": "uint256[]",
|
|
75
|
+
"name": "requestIds",
|
|
76
|
+
"type": "uint256[]"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"name": "claimStETHWithdrawalForETH",
|
|
80
|
+
"outputs": [],
|
|
81
|
+
"stateMutability": "nonpayable",
|
|
82
|
+
"type": "function"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"inputs": [
|
|
86
|
+
{
|
|
87
|
+
"internalType": "uint256[]",
|
|
88
|
+
"name": "requestIds",
|
|
89
|
+
"type": "uint256[]"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"name": "claimStETHWithdrawalForWETH",
|
|
93
|
+
"outputs": [],
|
|
94
|
+
"stateMutability": "nonpayable",
|
|
95
|
+
"type": "function"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"inputs": [
|
|
99
|
+
{
|
|
100
|
+
"internalType": "uint256",
|
|
101
|
+
"name": "amount",
|
|
102
|
+
"type": "uint256"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"name": "depositETHForStETH",
|
|
106
|
+
"outputs": [],
|
|
107
|
+
"stateMutability": "nonpayable",
|
|
108
|
+
"type": "function"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"inputs": [
|
|
112
|
+
{
|
|
113
|
+
"internalType": "uint256",
|
|
114
|
+
"name": "amount",
|
|
115
|
+
"type": "uint256"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"name": "depositWETHForStETH",
|
|
119
|
+
"outputs": [],
|
|
120
|
+
"stateMutability": "nonpayable",
|
|
121
|
+
"type": "function"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"inputs": [],
|
|
125
|
+
"name": "minimumFunds",
|
|
126
|
+
"outputs": [
|
|
127
|
+
{
|
|
128
|
+
"internalType": "uint256",
|
|
129
|
+
"name": "",
|
|
130
|
+
"type": "uint256"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"stateMutability": "view",
|
|
134
|
+
"type": "function"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"inputs": [],
|
|
138
|
+
"name": "operator",
|
|
139
|
+
"outputs": [
|
|
140
|
+
{
|
|
141
|
+
"internalType": "address",
|
|
142
|
+
"name": "",
|
|
143
|
+
"type": "address"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"stateMutability": "view",
|
|
147
|
+
"type": "function"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"inputs": [],
|
|
151
|
+
"name": "owner",
|
|
152
|
+
"outputs": [
|
|
153
|
+
{
|
|
154
|
+
"internalType": "address",
|
|
155
|
+
"name": "",
|
|
156
|
+
"type": "address"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"stateMutability": "view",
|
|
160
|
+
"type": "function"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"inputs": [
|
|
164
|
+
{
|
|
165
|
+
"internalType": "uint256[]",
|
|
166
|
+
"name": "amounts",
|
|
167
|
+
"type": "uint256[]"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"name": "requestStETHWithdrawalForETH",
|
|
171
|
+
"outputs": [
|
|
172
|
+
{
|
|
173
|
+
"internalType": "uint256[]",
|
|
174
|
+
"name": "requestIds",
|
|
175
|
+
"type": "uint256[]"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"stateMutability": "nonpayable",
|
|
179
|
+
"type": "function"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"inputs": [
|
|
183
|
+
{
|
|
184
|
+
"internalType": "uint256",
|
|
185
|
+
"name": "_minimumFunds",
|
|
186
|
+
"type": "uint256"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"name": "setMinimumFunds",
|
|
190
|
+
"outputs": [],
|
|
191
|
+
"stateMutability": "nonpayable",
|
|
192
|
+
"type": "function"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"inputs": [
|
|
196
|
+
{
|
|
197
|
+
"internalType": "address",
|
|
198
|
+
"name": "newOperator",
|
|
199
|
+
"type": "address"
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
"name": "setOperator",
|
|
203
|
+
"outputs": [],
|
|
204
|
+
"stateMutability": "nonpayable",
|
|
205
|
+
"type": "function"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"inputs": [
|
|
209
|
+
{
|
|
210
|
+
"internalType": "address",
|
|
211
|
+
"name": "newOwner",
|
|
212
|
+
"type": "address"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"name": "setOwner",
|
|
216
|
+
"outputs": [],
|
|
217
|
+
"stateMutability": "nonpayable",
|
|
218
|
+
"type": "function"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"inputs": [
|
|
222
|
+
{
|
|
223
|
+
"internalType": "uint256",
|
|
224
|
+
"name": "buyT1",
|
|
225
|
+
"type": "uint256"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"internalType": "uint256",
|
|
229
|
+
"name": "sellT1",
|
|
230
|
+
"type": "uint256"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"name": "setPrices",
|
|
234
|
+
"outputs": [],
|
|
235
|
+
"stateMutability": "nonpayable",
|
|
236
|
+
"type": "function"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"inputs": [],
|
|
240
|
+
"name": "steth",
|
|
241
|
+
"outputs": [
|
|
242
|
+
{
|
|
243
|
+
"internalType": "contract IERC20",
|
|
244
|
+
"name": "",
|
|
245
|
+
"type": "address"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"stateMutability": "view",
|
|
249
|
+
"type": "function"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"inputs": [
|
|
253
|
+
{
|
|
254
|
+
"internalType": "uint256",
|
|
255
|
+
"name": "amountIn",
|
|
256
|
+
"type": "uint256"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"internalType": "uint256",
|
|
260
|
+
"name": "amountOutMin",
|
|
261
|
+
"type": "uint256"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"internalType": "address[]",
|
|
265
|
+
"name": "path",
|
|
266
|
+
"type": "address[]"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"internalType": "address",
|
|
270
|
+
"name": "to",
|
|
271
|
+
"type": "address"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"internalType": "uint256",
|
|
275
|
+
"name": "deadline",
|
|
276
|
+
"type": "uint256"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"name": "swapExactTokensForTokens",
|
|
280
|
+
"outputs": [
|
|
281
|
+
{
|
|
282
|
+
"internalType": "uint256[]",
|
|
283
|
+
"name": "amounts",
|
|
284
|
+
"type": "uint256[]"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"stateMutability": "nonpayable",
|
|
288
|
+
"type": "function"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"inputs": [
|
|
292
|
+
{
|
|
293
|
+
"internalType": "uint256",
|
|
294
|
+
"name": "amountOut",
|
|
295
|
+
"type": "uint256"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"internalType": "uint256",
|
|
299
|
+
"name": "amountInMax",
|
|
300
|
+
"type": "uint256"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"internalType": "address[]",
|
|
304
|
+
"name": "path",
|
|
305
|
+
"type": "address[]"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"internalType": "address",
|
|
309
|
+
"name": "to",
|
|
310
|
+
"type": "address"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"internalType": "uint256",
|
|
314
|
+
"name": "deadline",
|
|
315
|
+
"type": "uint256"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"name": "swapTokensForExactTokens",
|
|
319
|
+
"outputs": [
|
|
320
|
+
{
|
|
321
|
+
"internalType": "uint256[]",
|
|
322
|
+
"name": "amounts",
|
|
323
|
+
"type": "uint256[]"
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
"stateMutability": "nonpayable",
|
|
327
|
+
"type": "function"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"inputs": [],
|
|
331
|
+
"name": "token0",
|
|
332
|
+
"outputs": [
|
|
333
|
+
{
|
|
334
|
+
"internalType": "contract IERC20",
|
|
335
|
+
"name": "",
|
|
336
|
+
"type": "address"
|
|
337
|
+
}
|
|
338
|
+
],
|
|
339
|
+
"stateMutability": "view",
|
|
340
|
+
"type": "function"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"inputs": [],
|
|
344
|
+
"name": "token1",
|
|
345
|
+
"outputs": [
|
|
346
|
+
{
|
|
347
|
+
"internalType": "contract IERC20",
|
|
348
|
+
"name": "",
|
|
349
|
+
"type": "address"
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
"stateMutability": "view",
|
|
353
|
+
"type": "function"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"inputs": [],
|
|
357
|
+
"name": "traderate0",
|
|
358
|
+
"outputs": [
|
|
359
|
+
{
|
|
360
|
+
"internalType": "uint256",
|
|
361
|
+
"name": "",
|
|
362
|
+
"type": "uint256"
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
"stateMutability": "view",
|
|
366
|
+
"type": "function"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"inputs": [],
|
|
370
|
+
"name": "traderate1",
|
|
371
|
+
"outputs": [
|
|
372
|
+
{
|
|
373
|
+
"internalType": "uint256",
|
|
374
|
+
"name": "",
|
|
375
|
+
"type": "uint256"
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
"stateMutability": "view",
|
|
379
|
+
"type": "function"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"inputs": [
|
|
383
|
+
{
|
|
384
|
+
"internalType": "address",
|
|
385
|
+
"name": "to",
|
|
386
|
+
"type": "address"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"internalType": "uint256",
|
|
390
|
+
"name": "amount",
|
|
391
|
+
"type": "uint256"
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
"name": "transferEth",
|
|
395
|
+
"outputs": [],
|
|
396
|
+
"stateMutability": "nonpayable",
|
|
397
|
+
"type": "function"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"inputs": [
|
|
401
|
+
{
|
|
402
|
+
"internalType": "address",
|
|
403
|
+
"name": "token",
|
|
404
|
+
"type": "address"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"internalType": "address",
|
|
408
|
+
"name": "to",
|
|
409
|
+
"type": "address"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"internalType": "uint256",
|
|
413
|
+
"name": "amount",
|
|
414
|
+
"type": "uint256"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"name": "transferToken",
|
|
418
|
+
"outputs": [],
|
|
419
|
+
"stateMutability": "nonpayable",
|
|
420
|
+
"type": "function"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"inputs": [],
|
|
424
|
+
"name": "weth",
|
|
425
|
+
"outputs": [
|
|
426
|
+
{
|
|
427
|
+
"internalType": "contract IWEth",
|
|
428
|
+
"name": "",
|
|
429
|
+
"type": "address"
|
|
430
|
+
}
|
|
431
|
+
],
|
|
432
|
+
"stateMutability": "view",
|
|
433
|
+
"type": "function"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"inputs": [],
|
|
437
|
+
"name": "withdrawal",
|
|
438
|
+
"outputs": [
|
|
439
|
+
{
|
|
440
|
+
"internalType": "contract IStETHWithdrawal",
|
|
441
|
+
"name": "",
|
|
442
|
+
"type": "address"
|
|
443
|
+
}
|
|
444
|
+
],
|
|
445
|
+
"stateMutability": "view",
|
|
446
|
+
"type": "function"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"stateMutability": "payable",
|
|
450
|
+
"type": "receive"
|
|
451
|
+
}
|
|
452
|
+
]
|
|
@@ -102,7 +102,7 @@ export class AngleTransmuter
|
|
|
102
102
|
// Returns the list of contract adapters (name and index)
|
|
103
103
|
// for a buy/sell. Return null if there are no adapters.
|
|
104
104
|
getAdapters(side: SwapSide): { name: string; index: number }[] | null {
|
|
105
|
-
return
|
|
105
|
+
return null;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// Returns list of pool identifiers that can be used
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
5
|
+
import { testE2E } from '../../../tests/utils-e2e';
|
|
6
|
+
import { Tokens, Holders } from '../../../tests/constants-e2e';
|
|
7
|
+
import { Network, ContractMethod, SwapSide } from '../../constants';
|
|
8
|
+
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
9
|
+
import { generateConfig } from '../../config';
|
|
10
|
+
|
|
11
|
+
function testForNetwork(
|
|
12
|
+
network: Network,
|
|
13
|
+
dexKey: string,
|
|
14
|
+
tokenASymbol: string,
|
|
15
|
+
tokenBSymbol: string,
|
|
16
|
+
tokenAAmount: string,
|
|
17
|
+
tokenBAmount: string,
|
|
18
|
+
) {
|
|
19
|
+
const provider = new StaticJsonRpcProvider(
|
|
20
|
+
generateConfig(network).privateHttpProvider,
|
|
21
|
+
network,
|
|
22
|
+
);
|
|
23
|
+
const tokens = Tokens[network];
|
|
24
|
+
const holders = Holders[network];
|
|
25
|
+
|
|
26
|
+
const sideToContractMethods = new Map([
|
|
27
|
+
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
describe(`${network}`, () => {
|
|
31
|
+
sideToContractMethods.forEach((contractMethods, side) =>
|
|
32
|
+
describe(`${side}`, () => {
|
|
33
|
+
contractMethods.forEach((contractMethod: ContractMethod) => {
|
|
34
|
+
describe(`${contractMethod}`, () => {
|
|
35
|
+
it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
36
|
+
await testE2E(
|
|
37
|
+
tokens[tokenASymbol],
|
|
38
|
+
tokens[tokenBSymbol],
|
|
39
|
+
holders[tokenASymbol],
|
|
40
|
+
side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
|
|
41
|
+
side,
|
|
42
|
+
dexKey,
|
|
43
|
+
contractMethod,
|
|
44
|
+
network,
|
|
45
|
+
provider,
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('ConcentratorArusd E2E', () => {
|
|
56
|
+
const dexKey = 'ConcentratorArusd';
|
|
57
|
+
const network = Network.MAINNET;
|
|
58
|
+
|
|
59
|
+
const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [
|
|
60
|
+
[
|
|
61
|
+
{
|
|
62
|
+
name: 'rUSD',
|
|
63
|
+
amount: '1000000000000000',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'arUSD',
|
|
67
|
+
amount: '1000000000000000000',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
{
|
|
72
|
+
name: 'arUSD',
|
|
73
|
+
amount: '1000000000000000000',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'rUSD',
|
|
77
|
+
amount: '1000000000000000000',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
pairs.forEach(pair => {
|
|
83
|
+
testForNetwork(
|
|
84
|
+
network,
|
|
85
|
+
dexKey,
|
|
86
|
+
pair[0].name,
|
|
87
|
+
pair[1].name,
|
|
88
|
+
pair[0].amount,
|
|
89
|
+
pair[1].amount,
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { Interface } from '@ethersproject/abi';
|
|
3
|
+
import { IDexHelper } from '../../dex-helper';
|
|
4
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
|
+
import { Address, Log, Logger } from '../../types';
|
|
6
|
+
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
7
|
+
import { ConcentratorArusdState } from './types';
|
|
8
|
+
import { BI_POWS } from '../../bigint-constants';
|
|
9
|
+
import { getOnChainState } from './utils';
|
|
10
|
+
|
|
11
|
+
export class ConcentratorArusdEvent extends StatefulEventSubscriber<ConcentratorArusdState> {
|
|
12
|
+
decoder = (log: Log) => this.poolInterface.parseLog(log);
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
parentName: string,
|
|
16
|
+
protected dexHelper: IDexHelper,
|
|
17
|
+
private poolAddress: Address,
|
|
18
|
+
private poolInterface: Interface,
|
|
19
|
+
logger: Logger,
|
|
20
|
+
) {
|
|
21
|
+
super(parentName, 'ConcentratorArusd', dexHelper, logger);
|
|
22
|
+
this.addressesSubscribed = [poolAddress];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protected processLog(
|
|
26
|
+
state: DeepReadonly<ConcentratorArusdState>,
|
|
27
|
+
log: Readonly<Log>,
|
|
28
|
+
): AsyncOrSync<DeepReadonly<ConcentratorArusdState> | null> {
|
|
29
|
+
const event = this.decoder(log);
|
|
30
|
+
const _state: ConcentratorArusdState = _.cloneDeep(state);
|
|
31
|
+
if (event.name === 'Deposit') {
|
|
32
|
+
_state.totalSupply = (
|
|
33
|
+
BigInt(_state.totalSupply) + BigInt(event.args.amountSyOut)
|
|
34
|
+
).toString();
|
|
35
|
+
_state.totalAssets = (
|
|
36
|
+
BigInt(_state.totalAssets) + BigInt(event.args.amountDeposited)
|
|
37
|
+
).toString();
|
|
38
|
+
return _state;
|
|
39
|
+
} else if (event.name === 'Redeem') {
|
|
40
|
+
_state.totalSupply = (
|
|
41
|
+
BigInt(_state.totalSupply) - BigInt(event.args.amountSyToRedeem)
|
|
42
|
+
).toString();
|
|
43
|
+
_state.totalAssets = (
|
|
44
|
+
BigInt(_state.totalAssets) - BigInt(event.args.amountTokenOut)
|
|
45
|
+
).toString();
|
|
46
|
+
return _state;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async generateState(
|
|
52
|
+
blockNumber: number | 'latest' = 'latest',
|
|
53
|
+
): Promise<DeepReadonly<ConcentratorArusdState>> {
|
|
54
|
+
const state = await getOnChainState(
|
|
55
|
+
this.dexHelper.multiContract,
|
|
56
|
+
this.poolAddress,
|
|
57
|
+
this.poolInterface,
|
|
58
|
+
blockNumber,
|
|
59
|
+
);
|
|
60
|
+
return state;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async getPrice(
|
|
64
|
+
blockNumber: number,
|
|
65
|
+
ethAmount: bigint,
|
|
66
|
+
is_deposit: boolean,
|
|
67
|
+
): Promise<bigint> {
|
|
68
|
+
const state = await this.getOrGenerateState(blockNumber);
|
|
69
|
+
if (!state) throw new Error('Cannot compute price');
|
|
70
|
+
const { totalSupply, totalAssets } = state;
|
|
71
|
+
const nav = (BigInt(totalAssets) * BI_POWS[18]) / BigInt(totalSupply);
|
|
72
|
+
if (is_deposit) {
|
|
73
|
+
return BigInt((ethAmount * BI_POWS[18]) / nav);
|
|
74
|
+
}
|
|
75
|
+
return BigInt((nav * ethAmount) / BI_POWS[18]);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async getOrGenerateState(
|
|
79
|
+
blockNumber: number,
|
|
80
|
+
): Promise<DeepReadonly<ConcentratorArusdState> | null> {
|
|
81
|
+
const state = this.getState(blockNumber);
|
|
82
|
+
if (state) {
|
|
83
|
+
return state;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.logger.debug(
|
|
87
|
+
`No state found for ${this.addressesSubscribed[0]}, generating new one`,
|
|
88
|
+
);
|
|
89
|
+
const newState = await this.generateState(blockNumber);
|
|
90
|
+
|
|
91
|
+
if (!newState) {
|
|
92
|
+
this.logger.debug(
|
|
93
|
+
`Could not regenerate state for ${this.addressesSubscribed[0]}`,
|
|
94
|
+
);
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
this.setState(newState, blockNumber);
|
|
98
|
+
return newState;
|
|
99
|
+
}
|
|
100
|
+
}
|