@dhedge/v2-sdk 1.9.8 → 1.9.9
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/README.md +34 -0
- package/dist/config.d.ts +7 -1
- package/dist/entities/pool.d.ts +22 -1
- package/dist/services/flatmoney/keeperFee.d.ts +6 -0
- package/dist/services/flatmoney/stableLp.d.ts +9 -0
- package/dist/services/flatmoney/stableModule.d.ts +4 -0
- package/dist/test/utils/testingHelper.d.ts +2 -1
- package/dist/test/wallet.d.ts +1 -0
- package/dist/v2-sdk.cjs.development.js +2895 -1
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +2895 -1
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/flatmoney/DelayedOrder.json +547 -0
- package/src/abi/flatmoney/IFlatcoinVault.json +570 -0
- package/src/abi/flatmoney/KeeperFee.json +364 -0
- package/src/abi/flatmoney/StableModule.json +770 -0
- package/src/config.ts +19 -0
- package/src/entities/pool.ts +67 -0
- package/src/services/flatmoney/keeperFee.ts +84 -0
- package/src/services/flatmoney/stableLp.ts +135 -0
- package/src/services/flatmoney/stableModule.ts +43 -0
- package/src/test/flatmoney.test.ts +164 -0
- package/src/test/utils/testingHelper.ts +4 -3
- package/src/test/wallet.ts +4 -1
package/dist/v2-sdk.esm.js
CHANGED
|
@@ -7,6 +7,7 @@ import JSBI from 'jsbi';
|
|
|
7
7
|
import 'lodash-es/set';
|
|
8
8
|
import '@ethersproject/abi';
|
|
9
9
|
import axios from 'axios';
|
|
10
|
+
import BigNumber$1 from 'bignumber.js';
|
|
10
11
|
import { Token as Token$1, Pair, TokenAmount, Route, Trade, TradeType, Percent } from '@sushiswap/sdk';
|
|
11
12
|
import { SwapTypes, SOR } from '@balancer-labs/sor';
|
|
12
13
|
|
|
@@ -4240,7 +4241,7 @@ var Transaction;
|
|
|
4240
4241
|
Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
|
|
4241
4242
|
})(Transaction || (Transaction = {}));
|
|
4242
4243
|
|
|
4243
|
-
var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM2, _Network$ARBITRUM2, _Network$BASE2, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap;
|
|
4244
|
+
var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM2, _Network$ARBITRUM2, _Network$BASE2, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap, _flatMoneyContractAdd;
|
|
4244
4245
|
|
|
4245
4246
|
require("dotenv").config();
|
|
4246
4247
|
|
|
@@ -4257,6 +4258,12 @@ var lyraNetworkMap = (_lyraNetworkMap = {}, _lyraNetworkMap[Network.OPTIMISM] =
|
|
|
4257
4258
|
var MaxUint128 = "0xffffffffffffffffffffffffffffffff";
|
|
4258
4259
|
var UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
|
|
4259
4260
|
var SYNTHETIX_TRACKING_CODE = "0x4448454447450000000000000000000000000000000000000000000000000000";
|
|
4261
|
+
var flatMoneyContractAddresses = (_flatMoneyContractAdd = {}, _flatMoneyContractAdd[Network.BASE] = {
|
|
4262
|
+
DelayedOrder: "0x6D857e9D24a7566bB72a3FB0847A3E0e4E1c2879",
|
|
4263
|
+
FlatcoinVault: "0x95Fa1ddc9a78273f795e67AbE8f1Cd2Cd39831fF",
|
|
4264
|
+
StableModule: "0xb95fB324b8A2fAF8ec4f76e3dF46C718402736e2",
|
|
4265
|
+
RETH: "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c"
|
|
4266
|
+
}, _flatMoneyContractAdd);
|
|
4260
4267
|
|
|
4261
4268
|
var abi$3 = [
|
|
4262
4269
|
{
|
|
@@ -20058,6 +20065,2750 @@ function getExitVestTxData(vestId) {
|
|
|
20058
20065
|
return iXRam.encodeFunctionData("exitVest", [vestId, false]);
|
|
20059
20066
|
}
|
|
20060
20067
|
|
|
20068
|
+
var DelayedOrderAbi = [
|
|
20069
|
+
{
|
|
20070
|
+
inputs: [
|
|
20071
|
+
],
|
|
20072
|
+
stateMutability: "nonpayable",
|
|
20073
|
+
type: "constructor"
|
|
20074
|
+
},
|
|
20075
|
+
{
|
|
20076
|
+
inputs: [
|
|
20077
|
+
{
|
|
20078
|
+
internalType: "uint256",
|
|
20079
|
+
name: "amount",
|
|
20080
|
+
type: "uint256"
|
|
20081
|
+
},
|
|
20082
|
+
{
|
|
20083
|
+
internalType: "uint256",
|
|
20084
|
+
name: "minAmount",
|
|
20085
|
+
type: "uint256"
|
|
20086
|
+
}
|
|
20087
|
+
],
|
|
20088
|
+
name: "AmountTooSmall",
|
|
20089
|
+
type: "error"
|
|
20090
|
+
},
|
|
20091
|
+
{
|
|
20092
|
+
inputs: [
|
|
20093
|
+
{
|
|
20094
|
+
internalType: "uint256",
|
|
20095
|
+
name: "executableTime",
|
|
20096
|
+
type: "uint256"
|
|
20097
|
+
}
|
|
20098
|
+
],
|
|
20099
|
+
name: "ExecutableTimeNotReached",
|
|
20100
|
+
type: "error"
|
|
20101
|
+
},
|
|
20102
|
+
{
|
|
20103
|
+
inputs: [
|
|
20104
|
+
{
|
|
20105
|
+
internalType: "uint256",
|
|
20106
|
+
name: "supplied",
|
|
20107
|
+
type: "uint256"
|
|
20108
|
+
},
|
|
20109
|
+
{
|
|
20110
|
+
internalType: "uint256",
|
|
20111
|
+
name: "accepted",
|
|
20112
|
+
type: "uint256"
|
|
20113
|
+
}
|
|
20114
|
+
],
|
|
20115
|
+
name: "HighSlippage",
|
|
20116
|
+
type: "error"
|
|
20117
|
+
},
|
|
20118
|
+
{
|
|
20119
|
+
inputs: [
|
|
20120
|
+
{
|
|
20121
|
+
internalType: "uint256",
|
|
20122
|
+
name: "fee",
|
|
20123
|
+
type: "uint256"
|
|
20124
|
+
}
|
|
20125
|
+
],
|
|
20126
|
+
name: "InvalidFee",
|
|
20127
|
+
type: "error"
|
|
20128
|
+
},
|
|
20129
|
+
{
|
|
20130
|
+
inputs: [
|
|
20131
|
+
{
|
|
20132
|
+
internalType: "string",
|
|
20133
|
+
name: "variableName",
|
|
20134
|
+
type: "string"
|
|
20135
|
+
}
|
|
20136
|
+
],
|
|
20137
|
+
name: "InvariantViolation",
|
|
20138
|
+
type: "error"
|
|
20139
|
+
},
|
|
20140
|
+
{
|
|
20141
|
+
inputs: [
|
|
20142
|
+
{
|
|
20143
|
+
internalType: "uint256",
|
|
20144
|
+
name: "maxFillPrice",
|
|
20145
|
+
type: "uint256"
|
|
20146
|
+
},
|
|
20147
|
+
{
|
|
20148
|
+
internalType: "uint256",
|
|
20149
|
+
name: "currentPrice",
|
|
20150
|
+
type: "uint256"
|
|
20151
|
+
}
|
|
20152
|
+
],
|
|
20153
|
+
name: "MaxFillPriceTooLow",
|
|
20154
|
+
type: "error"
|
|
20155
|
+
},
|
|
20156
|
+
{
|
|
20157
|
+
inputs: [
|
|
20158
|
+
{
|
|
20159
|
+
internalType: "uint256",
|
|
20160
|
+
name: "minFillPrice",
|
|
20161
|
+
type: "uint256"
|
|
20162
|
+
},
|
|
20163
|
+
{
|
|
20164
|
+
internalType: "uint256",
|
|
20165
|
+
name: "currentPrice",
|
|
20166
|
+
type: "uint256"
|
|
20167
|
+
}
|
|
20168
|
+
],
|
|
20169
|
+
name: "MinFillPriceTooHigh",
|
|
20170
|
+
type: "error"
|
|
20171
|
+
},
|
|
20172
|
+
{
|
|
20173
|
+
inputs: [
|
|
20174
|
+
],
|
|
20175
|
+
name: "ModuleKeyEmpty",
|
|
20176
|
+
type: "error"
|
|
20177
|
+
},
|
|
20178
|
+
{
|
|
20179
|
+
inputs: [
|
|
20180
|
+
{
|
|
20181
|
+
internalType: "address",
|
|
20182
|
+
name: "account",
|
|
20183
|
+
type: "address"
|
|
20184
|
+
},
|
|
20185
|
+
{
|
|
20186
|
+
internalType: "uint256",
|
|
20187
|
+
name: "totalBalance",
|
|
20188
|
+
type: "uint256"
|
|
20189
|
+
},
|
|
20190
|
+
{
|
|
20191
|
+
internalType: "uint256",
|
|
20192
|
+
name: "withdrawAmount",
|
|
20193
|
+
type: "uint256"
|
|
20194
|
+
}
|
|
20195
|
+
],
|
|
20196
|
+
name: "NotEnoughBalanceForWithdraw",
|
|
20197
|
+
type: "error"
|
|
20198
|
+
},
|
|
20199
|
+
{
|
|
20200
|
+
inputs: [
|
|
20201
|
+
{
|
|
20202
|
+
internalType: "int256",
|
|
20203
|
+
name: "marginAmount",
|
|
20204
|
+
type: "int256"
|
|
20205
|
+
},
|
|
20206
|
+
{
|
|
20207
|
+
internalType: "uint256",
|
|
20208
|
+
name: "feeAmount",
|
|
20209
|
+
type: "uint256"
|
|
20210
|
+
}
|
|
20211
|
+
],
|
|
20212
|
+
name: "NotEnoughMarginForFees",
|
|
20213
|
+
type: "error"
|
|
20214
|
+
},
|
|
20215
|
+
{
|
|
20216
|
+
inputs: [
|
|
20217
|
+
{
|
|
20218
|
+
internalType: "uint256",
|
|
20219
|
+
name: "tokenId",
|
|
20220
|
+
type: "uint256"
|
|
20221
|
+
},
|
|
20222
|
+
{
|
|
20223
|
+
internalType: "address",
|
|
20224
|
+
name: "msgSender",
|
|
20225
|
+
type: "address"
|
|
20226
|
+
}
|
|
20227
|
+
],
|
|
20228
|
+
name: "NotTokenOwner",
|
|
20229
|
+
type: "error"
|
|
20230
|
+
},
|
|
20231
|
+
{
|
|
20232
|
+
inputs: [
|
|
20233
|
+
{
|
|
20234
|
+
internalType: "address",
|
|
20235
|
+
name: "msgSender",
|
|
20236
|
+
type: "address"
|
|
20237
|
+
}
|
|
20238
|
+
],
|
|
20239
|
+
name: "OnlyOwner",
|
|
20240
|
+
type: "error"
|
|
20241
|
+
},
|
|
20242
|
+
{
|
|
20243
|
+
inputs: [
|
|
20244
|
+
],
|
|
20245
|
+
name: "OrderHasExpired",
|
|
20246
|
+
type: "error"
|
|
20247
|
+
},
|
|
20248
|
+
{
|
|
20249
|
+
inputs: [
|
|
20250
|
+
],
|
|
20251
|
+
name: "OrderHasNotExpired",
|
|
20252
|
+
type: "error"
|
|
20253
|
+
},
|
|
20254
|
+
{
|
|
20255
|
+
inputs: [
|
|
20256
|
+
{
|
|
20257
|
+
internalType: "bytes32",
|
|
20258
|
+
name: "moduleKey",
|
|
20259
|
+
type: "bytes32"
|
|
20260
|
+
}
|
|
20261
|
+
],
|
|
20262
|
+
name: "Paused",
|
|
20263
|
+
type: "error"
|
|
20264
|
+
},
|
|
20265
|
+
{
|
|
20266
|
+
inputs: [
|
|
20267
|
+
],
|
|
20268
|
+
name: "PositionCreatesBadDebt",
|
|
20269
|
+
type: "error"
|
|
20270
|
+
},
|
|
20271
|
+
{
|
|
20272
|
+
inputs: [
|
|
20273
|
+
{
|
|
20274
|
+
internalType: "string",
|
|
20275
|
+
name: "variableName",
|
|
20276
|
+
type: "string"
|
|
20277
|
+
}
|
|
20278
|
+
],
|
|
20279
|
+
name: "ValueNotPositive",
|
|
20280
|
+
type: "error"
|
|
20281
|
+
},
|
|
20282
|
+
{
|
|
20283
|
+
inputs: [
|
|
20284
|
+
{
|
|
20285
|
+
internalType: "uint256",
|
|
20286
|
+
name: "withdrawAmount",
|
|
20287
|
+
type: "uint256"
|
|
20288
|
+
},
|
|
20289
|
+
{
|
|
20290
|
+
internalType: "uint256",
|
|
20291
|
+
name: "keeperFee",
|
|
20292
|
+
type: "uint256"
|
|
20293
|
+
}
|
|
20294
|
+
],
|
|
20295
|
+
name: "WithdrawalTooSmall",
|
|
20296
|
+
type: "error"
|
|
20297
|
+
},
|
|
20298
|
+
{
|
|
20299
|
+
inputs: [
|
|
20300
|
+
{
|
|
20301
|
+
internalType: "string",
|
|
20302
|
+
name: "variableName",
|
|
20303
|
+
type: "string"
|
|
20304
|
+
}
|
|
20305
|
+
],
|
|
20306
|
+
name: "ZeroAddress",
|
|
20307
|
+
type: "error"
|
|
20308
|
+
},
|
|
20309
|
+
{
|
|
20310
|
+
inputs: [
|
|
20311
|
+
{
|
|
20312
|
+
internalType: "string",
|
|
20313
|
+
name: "variableName",
|
|
20314
|
+
type: "string"
|
|
20315
|
+
}
|
|
20316
|
+
],
|
|
20317
|
+
name: "ZeroValue",
|
|
20318
|
+
type: "error"
|
|
20319
|
+
},
|
|
20320
|
+
{
|
|
20321
|
+
anonymous: false,
|
|
20322
|
+
inputs: [
|
|
20323
|
+
{
|
|
20324
|
+
indexed: false,
|
|
20325
|
+
internalType: "uint8",
|
|
20326
|
+
name: "version",
|
|
20327
|
+
type: "uint8"
|
|
20328
|
+
}
|
|
20329
|
+
],
|
|
20330
|
+
name: "Initialized",
|
|
20331
|
+
type: "event"
|
|
20332
|
+
},
|
|
20333
|
+
{
|
|
20334
|
+
inputs: [
|
|
20335
|
+
],
|
|
20336
|
+
name: "MIN_DEPOSIT",
|
|
20337
|
+
outputs: [
|
|
20338
|
+
{
|
|
20339
|
+
internalType: "uint256",
|
|
20340
|
+
name: "",
|
|
20341
|
+
type: "uint256"
|
|
20342
|
+
}
|
|
20343
|
+
],
|
|
20344
|
+
stateMutability: "view",
|
|
20345
|
+
type: "function"
|
|
20346
|
+
},
|
|
20347
|
+
{
|
|
20348
|
+
inputs: [
|
|
20349
|
+
],
|
|
20350
|
+
name: "MODULE_KEY",
|
|
20351
|
+
outputs: [
|
|
20352
|
+
{
|
|
20353
|
+
internalType: "bytes32",
|
|
20354
|
+
name: "",
|
|
20355
|
+
type: "bytes32"
|
|
20356
|
+
}
|
|
20357
|
+
],
|
|
20358
|
+
stateMutability: "view",
|
|
20359
|
+
type: "function"
|
|
20360
|
+
},
|
|
20361
|
+
{
|
|
20362
|
+
inputs: [
|
|
20363
|
+
{
|
|
20364
|
+
internalType: "uint256",
|
|
20365
|
+
name: "tokenId",
|
|
20366
|
+
type: "uint256"
|
|
20367
|
+
},
|
|
20368
|
+
{
|
|
20369
|
+
internalType: "int256",
|
|
20370
|
+
name: "marginAdjustment",
|
|
20371
|
+
type: "int256"
|
|
20372
|
+
},
|
|
20373
|
+
{
|
|
20374
|
+
internalType: "int256",
|
|
20375
|
+
name: "additionalSizeAdjustment",
|
|
20376
|
+
type: "int256"
|
|
20377
|
+
},
|
|
20378
|
+
{
|
|
20379
|
+
internalType: "uint256",
|
|
20380
|
+
name: "fillPrice",
|
|
20381
|
+
type: "uint256"
|
|
20382
|
+
},
|
|
20383
|
+
{
|
|
20384
|
+
internalType: "uint256",
|
|
20385
|
+
name: "keeperFee",
|
|
20386
|
+
type: "uint256"
|
|
20387
|
+
}
|
|
20388
|
+
],
|
|
20389
|
+
name: "announceLeverageAdjust",
|
|
20390
|
+
outputs: [
|
|
20391
|
+
],
|
|
20392
|
+
stateMutability: "nonpayable",
|
|
20393
|
+
type: "function"
|
|
20394
|
+
},
|
|
20395
|
+
{
|
|
20396
|
+
inputs: [
|
|
20397
|
+
{
|
|
20398
|
+
internalType: "uint256",
|
|
20399
|
+
name: "tokenId",
|
|
20400
|
+
type: "uint256"
|
|
20401
|
+
},
|
|
20402
|
+
{
|
|
20403
|
+
internalType: "uint256",
|
|
20404
|
+
name: "minFillPrice",
|
|
20405
|
+
type: "uint256"
|
|
20406
|
+
},
|
|
20407
|
+
{
|
|
20408
|
+
internalType: "uint256",
|
|
20409
|
+
name: "keeperFee",
|
|
20410
|
+
type: "uint256"
|
|
20411
|
+
}
|
|
20412
|
+
],
|
|
20413
|
+
name: "announceLeverageClose",
|
|
20414
|
+
outputs: [
|
|
20415
|
+
],
|
|
20416
|
+
stateMutability: "nonpayable",
|
|
20417
|
+
type: "function"
|
|
20418
|
+
},
|
|
20419
|
+
{
|
|
20420
|
+
inputs: [
|
|
20421
|
+
{
|
|
20422
|
+
internalType: "uint256",
|
|
20423
|
+
name: "margin",
|
|
20424
|
+
type: "uint256"
|
|
20425
|
+
},
|
|
20426
|
+
{
|
|
20427
|
+
internalType: "uint256",
|
|
20428
|
+
name: "additionalSize",
|
|
20429
|
+
type: "uint256"
|
|
20430
|
+
},
|
|
20431
|
+
{
|
|
20432
|
+
internalType: "uint256",
|
|
20433
|
+
name: "maxFillPrice",
|
|
20434
|
+
type: "uint256"
|
|
20435
|
+
},
|
|
20436
|
+
{
|
|
20437
|
+
internalType: "uint256",
|
|
20438
|
+
name: "keeperFee",
|
|
20439
|
+
type: "uint256"
|
|
20440
|
+
}
|
|
20441
|
+
],
|
|
20442
|
+
name: "announceLeverageOpen",
|
|
20443
|
+
outputs: [
|
|
20444
|
+
],
|
|
20445
|
+
stateMutability: "nonpayable",
|
|
20446
|
+
type: "function"
|
|
20447
|
+
},
|
|
20448
|
+
{
|
|
20449
|
+
inputs: [
|
|
20450
|
+
{
|
|
20451
|
+
internalType: "uint256",
|
|
20452
|
+
name: "depositAmount",
|
|
20453
|
+
type: "uint256"
|
|
20454
|
+
},
|
|
20455
|
+
{
|
|
20456
|
+
internalType: "uint256",
|
|
20457
|
+
name: "minAmountOut",
|
|
20458
|
+
type: "uint256"
|
|
20459
|
+
},
|
|
20460
|
+
{
|
|
20461
|
+
internalType: "uint256",
|
|
20462
|
+
name: "keeperFee",
|
|
20463
|
+
type: "uint256"
|
|
20464
|
+
}
|
|
20465
|
+
],
|
|
20466
|
+
name: "announceStableDeposit",
|
|
20467
|
+
outputs: [
|
|
20468
|
+
],
|
|
20469
|
+
stateMutability: "nonpayable",
|
|
20470
|
+
type: "function"
|
|
20471
|
+
},
|
|
20472
|
+
{
|
|
20473
|
+
inputs: [
|
|
20474
|
+
{
|
|
20475
|
+
internalType: "uint256",
|
|
20476
|
+
name: "withdrawAmount",
|
|
20477
|
+
type: "uint256"
|
|
20478
|
+
},
|
|
20479
|
+
{
|
|
20480
|
+
internalType: "uint256",
|
|
20481
|
+
name: "minAmountOut",
|
|
20482
|
+
type: "uint256"
|
|
20483
|
+
},
|
|
20484
|
+
{
|
|
20485
|
+
internalType: "uint256",
|
|
20486
|
+
name: "keeperFee",
|
|
20487
|
+
type: "uint256"
|
|
20488
|
+
}
|
|
20489
|
+
],
|
|
20490
|
+
name: "announceStableWithdraw",
|
|
20491
|
+
outputs: [
|
|
20492
|
+
],
|
|
20493
|
+
stateMutability: "nonpayable",
|
|
20494
|
+
type: "function"
|
|
20495
|
+
},
|
|
20496
|
+
{
|
|
20497
|
+
inputs: [
|
|
20498
|
+
{
|
|
20499
|
+
internalType: "address",
|
|
20500
|
+
name: "account",
|
|
20501
|
+
type: "address"
|
|
20502
|
+
}
|
|
20503
|
+
],
|
|
20504
|
+
name: "cancelExistingOrder",
|
|
20505
|
+
outputs: [
|
|
20506
|
+
],
|
|
20507
|
+
stateMutability: "nonpayable",
|
|
20508
|
+
type: "function"
|
|
20509
|
+
},
|
|
20510
|
+
{
|
|
20511
|
+
inputs: [
|
|
20512
|
+
{
|
|
20513
|
+
internalType: "address",
|
|
20514
|
+
name: "account",
|
|
20515
|
+
type: "address"
|
|
20516
|
+
},
|
|
20517
|
+
{
|
|
20518
|
+
internalType: "bytes[]",
|
|
20519
|
+
name: "priceUpdateData",
|
|
20520
|
+
type: "bytes[]"
|
|
20521
|
+
}
|
|
20522
|
+
],
|
|
20523
|
+
name: "executeOrder",
|
|
20524
|
+
outputs: [
|
|
20525
|
+
],
|
|
20526
|
+
stateMutability: "payable",
|
|
20527
|
+
type: "function"
|
|
20528
|
+
},
|
|
20529
|
+
{
|
|
20530
|
+
inputs: [
|
|
20531
|
+
{
|
|
20532
|
+
internalType: "address",
|
|
20533
|
+
name: "account",
|
|
20534
|
+
type: "address"
|
|
20535
|
+
}
|
|
20536
|
+
],
|
|
20537
|
+
name: "getAnnouncedOrder",
|
|
20538
|
+
outputs: [
|
|
20539
|
+
{
|
|
20540
|
+
components: [
|
|
20541
|
+
{
|
|
20542
|
+
internalType: "enum FlatcoinStructs.OrderType",
|
|
20543
|
+
name: "orderType",
|
|
20544
|
+
type: "uint8"
|
|
20545
|
+
},
|
|
20546
|
+
{
|
|
20547
|
+
internalType: "uint256",
|
|
20548
|
+
name: "keeperFee",
|
|
20549
|
+
type: "uint256"
|
|
20550
|
+
},
|
|
20551
|
+
{
|
|
20552
|
+
internalType: "uint64",
|
|
20553
|
+
name: "executableAtTime",
|
|
20554
|
+
type: "uint64"
|
|
20555
|
+
},
|
|
20556
|
+
{
|
|
20557
|
+
internalType: "bytes",
|
|
20558
|
+
name: "orderData",
|
|
20559
|
+
type: "bytes"
|
|
20560
|
+
}
|
|
20561
|
+
],
|
|
20562
|
+
internalType: "struct FlatcoinStructs.Order",
|
|
20563
|
+
name: "order",
|
|
20564
|
+
type: "tuple"
|
|
20565
|
+
}
|
|
20566
|
+
],
|
|
20567
|
+
stateMutability: "view",
|
|
20568
|
+
type: "function"
|
|
20569
|
+
},
|
|
20570
|
+
{
|
|
20571
|
+
inputs: [
|
|
20572
|
+
{
|
|
20573
|
+
internalType: "address",
|
|
20574
|
+
name: "account",
|
|
20575
|
+
type: "address"
|
|
20576
|
+
}
|
|
20577
|
+
],
|
|
20578
|
+
name: "hasOrderExpired",
|
|
20579
|
+
outputs: [
|
|
20580
|
+
{
|
|
20581
|
+
internalType: "bool",
|
|
20582
|
+
name: "expired",
|
|
20583
|
+
type: "bool"
|
|
20584
|
+
}
|
|
20585
|
+
],
|
|
20586
|
+
stateMutability: "view",
|
|
20587
|
+
type: "function"
|
|
20588
|
+
},
|
|
20589
|
+
{
|
|
20590
|
+
inputs: [
|
|
20591
|
+
{
|
|
20592
|
+
internalType: "contract IFlatcoinVault",
|
|
20593
|
+
name: "_vault",
|
|
20594
|
+
type: "address"
|
|
20595
|
+
}
|
|
20596
|
+
],
|
|
20597
|
+
name: "initialize",
|
|
20598
|
+
outputs: [
|
|
20599
|
+
],
|
|
20600
|
+
stateMutability: "nonpayable",
|
|
20601
|
+
type: "function"
|
|
20602
|
+
},
|
|
20603
|
+
{
|
|
20604
|
+
inputs: [
|
|
20605
|
+
{
|
|
20606
|
+
internalType: "contract IFlatcoinVault",
|
|
20607
|
+
name: "_vault",
|
|
20608
|
+
type: "address"
|
|
20609
|
+
}
|
|
20610
|
+
],
|
|
20611
|
+
name: "setVault",
|
|
20612
|
+
outputs: [
|
|
20613
|
+
],
|
|
20614
|
+
stateMutability: "nonpayable",
|
|
20615
|
+
type: "function"
|
|
20616
|
+
},
|
|
20617
|
+
{
|
|
20618
|
+
inputs: [
|
|
20619
|
+
],
|
|
20620
|
+
name: "vault",
|
|
20621
|
+
outputs: [
|
|
20622
|
+
{
|
|
20623
|
+
internalType: "contract IFlatcoinVault",
|
|
20624
|
+
name: "",
|
|
20625
|
+
type: "address"
|
|
20626
|
+
}
|
|
20627
|
+
],
|
|
20628
|
+
stateMutability: "view",
|
|
20629
|
+
type: "function"
|
|
20630
|
+
}
|
|
20631
|
+
];
|
|
20632
|
+
|
|
20633
|
+
var StableModuleAbi = [
|
|
20634
|
+
{
|
|
20635
|
+
inputs: [
|
|
20636
|
+
],
|
|
20637
|
+
stateMutability: "nonpayable",
|
|
20638
|
+
type: "constructor"
|
|
20639
|
+
},
|
|
20640
|
+
{
|
|
20641
|
+
inputs: [
|
|
20642
|
+
{
|
|
20643
|
+
internalType: "uint256",
|
|
20644
|
+
name: "amount",
|
|
20645
|
+
type: "uint256"
|
|
20646
|
+
},
|
|
20647
|
+
{
|
|
20648
|
+
internalType: "uint256",
|
|
20649
|
+
name: "minAmount",
|
|
20650
|
+
type: "uint256"
|
|
20651
|
+
}
|
|
20652
|
+
],
|
|
20653
|
+
name: "AmountTooSmall",
|
|
20654
|
+
type: "error"
|
|
20655
|
+
},
|
|
20656
|
+
{
|
|
20657
|
+
inputs: [
|
|
20658
|
+
{
|
|
20659
|
+
internalType: "uint256",
|
|
20660
|
+
name: "supplied",
|
|
20661
|
+
type: "uint256"
|
|
20662
|
+
},
|
|
20663
|
+
{
|
|
20664
|
+
internalType: "uint256",
|
|
20665
|
+
name: "accepted",
|
|
20666
|
+
type: "uint256"
|
|
20667
|
+
}
|
|
20668
|
+
],
|
|
20669
|
+
name: "HighSlippage",
|
|
20670
|
+
type: "error"
|
|
20671
|
+
},
|
|
20672
|
+
{
|
|
20673
|
+
inputs: [
|
|
20674
|
+
{
|
|
20675
|
+
internalType: "uint256",
|
|
20676
|
+
name: "fee",
|
|
20677
|
+
type: "uint256"
|
|
20678
|
+
}
|
|
20679
|
+
],
|
|
20680
|
+
name: "InvalidFee",
|
|
20681
|
+
type: "error"
|
|
20682
|
+
},
|
|
20683
|
+
{
|
|
20684
|
+
inputs: [
|
|
20685
|
+
{
|
|
20686
|
+
internalType: "uint256",
|
|
20687
|
+
name: "skewFraction",
|
|
20688
|
+
type: "uint256"
|
|
20689
|
+
}
|
|
20690
|
+
],
|
|
20691
|
+
name: "MaxSkewReached",
|
|
20692
|
+
type: "error"
|
|
20693
|
+
},
|
|
20694
|
+
{
|
|
20695
|
+
inputs: [
|
|
20696
|
+
],
|
|
20697
|
+
name: "ModuleKeyEmpty",
|
|
20698
|
+
type: "error"
|
|
20699
|
+
},
|
|
20700
|
+
{
|
|
20701
|
+
inputs: [
|
|
20702
|
+
{
|
|
20703
|
+
internalType: "address",
|
|
20704
|
+
name: "msgSender",
|
|
20705
|
+
type: "address"
|
|
20706
|
+
}
|
|
20707
|
+
],
|
|
20708
|
+
name: "OnlyAuthorizedModule",
|
|
20709
|
+
type: "error"
|
|
20710
|
+
},
|
|
20711
|
+
{
|
|
20712
|
+
inputs: [
|
|
20713
|
+
{
|
|
20714
|
+
internalType: "address",
|
|
20715
|
+
name: "msgSender",
|
|
20716
|
+
type: "address"
|
|
20717
|
+
}
|
|
20718
|
+
],
|
|
20719
|
+
name: "OnlyOwner",
|
|
20720
|
+
type: "error"
|
|
20721
|
+
},
|
|
20722
|
+
{
|
|
20723
|
+
inputs: [
|
|
20724
|
+
],
|
|
20725
|
+
name: "PriceImpactDuringFullWithdraw",
|
|
20726
|
+
type: "error"
|
|
20727
|
+
},
|
|
20728
|
+
{
|
|
20729
|
+
inputs: [
|
|
20730
|
+
],
|
|
20731
|
+
name: "PriceImpactDuringWithdraw",
|
|
20732
|
+
type: "error"
|
|
20733
|
+
},
|
|
20734
|
+
{
|
|
20735
|
+
inputs: [
|
|
20736
|
+
{
|
|
20737
|
+
internalType: "string",
|
|
20738
|
+
name: "variableName",
|
|
20739
|
+
type: "string"
|
|
20740
|
+
}
|
|
20741
|
+
],
|
|
20742
|
+
name: "ZeroAddress",
|
|
20743
|
+
type: "error"
|
|
20744
|
+
},
|
|
20745
|
+
{
|
|
20746
|
+
anonymous: false,
|
|
20747
|
+
inputs: [
|
|
20748
|
+
{
|
|
20749
|
+
indexed: true,
|
|
20750
|
+
internalType: "address",
|
|
20751
|
+
name: "owner",
|
|
20752
|
+
type: "address"
|
|
20753
|
+
},
|
|
20754
|
+
{
|
|
20755
|
+
indexed: true,
|
|
20756
|
+
internalType: "address",
|
|
20757
|
+
name: "spender",
|
|
20758
|
+
type: "address"
|
|
20759
|
+
},
|
|
20760
|
+
{
|
|
20761
|
+
indexed: false,
|
|
20762
|
+
internalType: "uint256",
|
|
20763
|
+
name: "value",
|
|
20764
|
+
type: "uint256"
|
|
20765
|
+
}
|
|
20766
|
+
],
|
|
20767
|
+
name: "Approval",
|
|
20768
|
+
type: "event"
|
|
20769
|
+
},
|
|
20770
|
+
{
|
|
20771
|
+
anonymous: false,
|
|
20772
|
+
inputs: [
|
|
20773
|
+
{
|
|
20774
|
+
indexed: false,
|
|
20775
|
+
internalType: "uint8",
|
|
20776
|
+
name: "version",
|
|
20777
|
+
type: "uint8"
|
|
20778
|
+
}
|
|
20779
|
+
],
|
|
20780
|
+
name: "Initialized",
|
|
20781
|
+
type: "event"
|
|
20782
|
+
},
|
|
20783
|
+
{
|
|
20784
|
+
anonymous: false,
|
|
20785
|
+
inputs: [
|
|
20786
|
+
{
|
|
20787
|
+
indexed: true,
|
|
20788
|
+
internalType: "address",
|
|
20789
|
+
name: "account",
|
|
20790
|
+
type: "address"
|
|
20791
|
+
},
|
|
20792
|
+
{
|
|
20793
|
+
indexed: false,
|
|
20794
|
+
internalType: "uint256",
|
|
20795
|
+
name: "amount",
|
|
20796
|
+
type: "uint256"
|
|
20797
|
+
}
|
|
20798
|
+
],
|
|
20799
|
+
name: "Locked",
|
|
20800
|
+
type: "event"
|
|
20801
|
+
},
|
|
20802
|
+
{
|
|
20803
|
+
anonymous: false,
|
|
20804
|
+
inputs: [
|
|
20805
|
+
{
|
|
20806
|
+
indexed: true,
|
|
20807
|
+
internalType: "address",
|
|
20808
|
+
name: "from",
|
|
20809
|
+
type: "address"
|
|
20810
|
+
},
|
|
20811
|
+
{
|
|
20812
|
+
indexed: true,
|
|
20813
|
+
internalType: "address",
|
|
20814
|
+
name: "to",
|
|
20815
|
+
type: "address"
|
|
20816
|
+
},
|
|
20817
|
+
{
|
|
20818
|
+
indexed: false,
|
|
20819
|
+
internalType: "uint256",
|
|
20820
|
+
name: "value",
|
|
20821
|
+
type: "uint256"
|
|
20822
|
+
}
|
|
20823
|
+
],
|
|
20824
|
+
name: "Transfer",
|
|
20825
|
+
type: "event"
|
|
20826
|
+
},
|
|
20827
|
+
{
|
|
20828
|
+
anonymous: false,
|
|
20829
|
+
inputs: [
|
|
20830
|
+
{
|
|
20831
|
+
indexed: true,
|
|
20832
|
+
internalType: "address",
|
|
20833
|
+
name: "account",
|
|
20834
|
+
type: "address"
|
|
20835
|
+
},
|
|
20836
|
+
{
|
|
20837
|
+
indexed: false,
|
|
20838
|
+
internalType: "uint256",
|
|
20839
|
+
name: "amount",
|
|
20840
|
+
type: "uint256"
|
|
20841
|
+
}
|
|
20842
|
+
],
|
|
20843
|
+
name: "Unlocked",
|
|
20844
|
+
type: "event"
|
|
20845
|
+
},
|
|
20846
|
+
{
|
|
20847
|
+
inputs: [
|
|
20848
|
+
],
|
|
20849
|
+
name: "MIN_LIQUIDITY",
|
|
20850
|
+
outputs: [
|
|
20851
|
+
{
|
|
20852
|
+
internalType: "uint256",
|
|
20853
|
+
name: "",
|
|
20854
|
+
type: "uint256"
|
|
20855
|
+
}
|
|
20856
|
+
],
|
|
20857
|
+
stateMutability: "view",
|
|
20858
|
+
type: "function"
|
|
20859
|
+
},
|
|
20860
|
+
{
|
|
20861
|
+
inputs: [
|
|
20862
|
+
],
|
|
20863
|
+
name: "MODULE_KEY",
|
|
20864
|
+
outputs: [
|
|
20865
|
+
{
|
|
20866
|
+
internalType: "bytes32",
|
|
20867
|
+
name: "",
|
|
20868
|
+
type: "bytes32"
|
|
20869
|
+
}
|
|
20870
|
+
],
|
|
20871
|
+
stateMutability: "view",
|
|
20872
|
+
type: "function"
|
|
20873
|
+
},
|
|
20874
|
+
{
|
|
20875
|
+
inputs: [
|
|
20876
|
+
{
|
|
20877
|
+
internalType: "address",
|
|
20878
|
+
name: "owner",
|
|
20879
|
+
type: "address"
|
|
20880
|
+
},
|
|
20881
|
+
{
|
|
20882
|
+
internalType: "address",
|
|
20883
|
+
name: "spender",
|
|
20884
|
+
type: "address"
|
|
20885
|
+
}
|
|
20886
|
+
],
|
|
20887
|
+
name: "allowance",
|
|
20888
|
+
outputs: [
|
|
20889
|
+
{
|
|
20890
|
+
internalType: "uint256",
|
|
20891
|
+
name: "",
|
|
20892
|
+
type: "uint256"
|
|
20893
|
+
}
|
|
20894
|
+
],
|
|
20895
|
+
stateMutability: "view",
|
|
20896
|
+
type: "function"
|
|
20897
|
+
},
|
|
20898
|
+
{
|
|
20899
|
+
inputs: [
|
|
20900
|
+
{
|
|
20901
|
+
internalType: "address",
|
|
20902
|
+
name: "spender",
|
|
20903
|
+
type: "address"
|
|
20904
|
+
},
|
|
20905
|
+
{
|
|
20906
|
+
internalType: "uint256",
|
|
20907
|
+
name: "amount",
|
|
20908
|
+
type: "uint256"
|
|
20909
|
+
}
|
|
20910
|
+
],
|
|
20911
|
+
name: "approve",
|
|
20912
|
+
outputs: [
|
|
20913
|
+
{
|
|
20914
|
+
internalType: "bool",
|
|
20915
|
+
name: "",
|
|
20916
|
+
type: "bool"
|
|
20917
|
+
}
|
|
20918
|
+
],
|
|
20919
|
+
stateMutability: "nonpayable",
|
|
20920
|
+
type: "function"
|
|
20921
|
+
},
|
|
20922
|
+
{
|
|
20923
|
+
inputs: [
|
|
20924
|
+
{
|
|
20925
|
+
internalType: "address",
|
|
20926
|
+
name: "account",
|
|
20927
|
+
type: "address"
|
|
20928
|
+
}
|
|
20929
|
+
],
|
|
20930
|
+
name: "balanceOf",
|
|
20931
|
+
outputs: [
|
|
20932
|
+
{
|
|
20933
|
+
internalType: "uint256",
|
|
20934
|
+
name: "",
|
|
20935
|
+
type: "uint256"
|
|
20936
|
+
}
|
|
20937
|
+
],
|
|
20938
|
+
stateMutability: "view",
|
|
20939
|
+
type: "function"
|
|
20940
|
+
},
|
|
20941
|
+
{
|
|
20942
|
+
inputs: [
|
|
20943
|
+
],
|
|
20944
|
+
name: "decimals",
|
|
20945
|
+
outputs: [
|
|
20946
|
+
{
|
|
20947
|
+
internalType: "uint8",
|
|
20948
|
+
name: "",
|
|
20949
|
+
type: "uint8"
|
|
20950
|
+
}
|
|
20951
|
+
],
|
|
20952
|
+
stateMutability: "view",
|
|
20953
|
+
type: "function"
|
|
20954
|
+
},
|
|
20955
|
+
{
|
|
20956
|
+
inputs: [
|
|
20957
|
+
{
|
|
20958
|
+
internalType: "address",
|
|
20959
|
+
name: "spender",
|
|
20960
|
+
type: "address"
|
|
20961
|
+
},
|
|
20962
|
+
{
|
|
20963
|
+
internalType: "uint256",
|
|
20964
|
+
name: "subtractedValue",
|
|
20965
|
+
type: "uint256"
|
|
20966
|
+
}
|
|
20967
|
+
],
|
|
20968
|
+
name: "decreaseAllowance",
|
|
20969
|
+
outputs: [
|
|
20970
|
+
{
|
|
20971
|
+
internalType: "bool",
|
|
20972
|
+
name: "",
|
|
20973
|
+
type: "bool"
|
|
20974
|
+
}
|
|
20975
|
+
],
|
|
20976
|
+
stateMutability: "nonpayable",
|
|
20977
|
+
type: "function"
|
|
20978
|
+
},
|
|
20979
|
+
{
|
|
20980
|
+
inputs: [
|
|
20981
|
+
{
|
|
20982
|
+
internalType: "address",
|
|
20983
|
+
name: "_account",
|
|
20984
|
+
type: "address"
|
|
20985
|
+
},
|
|
20986
|
+
{
|
|
20987
|
+
internalType: "uint64",
|
|
20988
|
+
name: "_executableAtTime",
|
|
20989
|
+
type: "uint64"
|
|
20990
|
+
},
|
|
20991
|
+
{
|
|
20992
|
+
components: [
|
|
20993
|
+
{
|
|
20994
|
+
internalType: "uint256",
|
|
20995
|
+
name: "depositAmount",
|
|
20996
|
+
type: "uint256"
|
|
20997
|
+
},
|
|
20998
|
+
{
|
|
20999
|
+
internalType: "uint256",
|
|
21000
|
+
name: "minAmountOut",
|
|
21001
|
+
type: "uint256"
|
|
21002
|
+
}
|
|
21003
|
+
],
|
|
21004
|
+
internalType: "struct FlatcoinStructs.AnnouncedStableDeposit",
|
|
21005
|
+
name: "_announcedDeposit",
|
|
21006
|
+
type: "tuple"
|
|
21007
|
+
}
|
|
21008
|
+
],
|
|
21009
|
+
name: "executeDeposit",
|
|
21010
|
+
outputs: [
|
|
21011
|
+
{
|
|
21012
|
+
internalType: "uint256",
|
|
21013
|
+
name: "_liquidityMinted",
|
|
21014
|
+
type: "uint256"
|
|
21015
|
+
}
|
|
21016
|
+
],
|
|
21017
|
+
stateMutability: "nonpayable",
|
|
21018
|
+
type: "function"
|
|
21019
|
+
},
|
|
21020
|
+
{
|
|
21021
|
+
inputs: [
|
|
21022
|
+
{
|
|
21023
|
+
internalType: "address",
|
|
21024
|
+
name: "_account",
|
|
21025
|
+
type: "address"
|
|
21026
|
+
},
|
|
21027
|
+
{
|
|
21028
|
+
internalType: "uint64",
|
|
21029
|
+
name: "_executableAtTime",
|
|
21030
|
+
type: "uint64"
|
|
21031
|
+
},
|
|
21032
|
+
{
|
|
21033
|
+
components: [
|
|
21034
|
+
{
|
|
21035
|
+
internalType: "uint256",
|
|
21036
|
+
name: "withdrawAmount",
|
|
21037
|
+
type: "uint256"
|
|
21038
|
+
},
|
|
21039
|
+
{
|
|
21040
|
+
internalType: "uint256",
|
|
21041
|
+
name: "minAmountOut",
|
|
21042
|
+
type: "uint256"
|
|
21043
|
+
}
|
|
21044
|
+
],
|
|
21045
|
+
internalType: "struct FlatcoinStructs.AnnouncedStableWithdraw",
|
|
21046
|
+
name: "_announcedWithdraw",
|
|
21047
|
+
type: "tuple"
|
|
21048
|
+
}
|
|
21049
|
+
],
|
|
21050
|
+
name: "executeWithdraw",
|
|
21051
|
+
outputs: [
|
|
21052
|
+
{
|
|
21053
|
+
internalType: "uint256",
|
|
21054
|
+
name: "_amountOut",
|
|
21055
|
+
type: "uint256"
|
|
21056
|
+
},
|
|
21057
|
+
{
|
|
21058
|
+
internalType: "uint256",
|
|
21059
|
+
name: "_withdrawFee",
|
|
21060
|
+
type: "uint256"
|
|
21061
|
+
}
|
|
21062
|
+
],
|
|
21063
|
+
stateMutability: "nonpayable",
|
|
21064
|
+
type: "function"
|
|
21065
|
+
},
|
|
21066
|
+
{
|
|
21067
|
+
inputs: [
|
|
21068
|
+
{
|
|
21069
|
+
internalType: "address",
|
|
21070
|
+
name: "_account",
|
|
21071
|
+
type: "address"
|
|
21072
|
+
}
|
|
21073
|
+
],
|
|
21074
|
+
name: "getLockedAmount",
|
|
21075
|
+
outputs: [
|
|
21076
|
+
{
|
|
21077
|
+
internalType: "uint256",
|
|
21078
|
+
name: "_amountLocked",
|
|
21079
|
+
type: "uint256"
|
|
21080
|
+
}
|
|
21081
|
+
],
|
|
21082
|
+
stateMutability: "view",
|
|
21083
|
+
type: "function"
|
|
21084
|
+
},
|
|
21085
|
+
{
|
|
21086
|
+
inputs: [
|
|
21087
|
+
{
|
|
21088
|
+
internalType: "address",
|
|
21089
|
+
name: "spender",
|
|
21090
|
+
type: "address"
|
|
21091
|
+
},
|
|
21092
|
+
{
|
|
21093
|
+
internalType: "uint256",
|
|
21094
|
+
name: "addedValue",
|
|
21095
|
+
type: "uint256"
|
|
21096
|
+
}
|
|
21097
|
+
],
|
|
21098
|
+
name: "increaseAllowance",
|
|
21099
|
+
outputs: [
|
|
21100
|
+
{
|
|
21101
|
+
internalType: "bool",
|
|
21102
|
+
name: "",
|
|
21103
|
+
type: "bool"
|
|
21104
|
+
}
|
|
21105
|
+
],
|
|
21106
|
+
stateMutability: "nonpayable",
|
|
21107
|
+
type: "function"
|
|
21108
|
+
},
|
|
21109
|
+
{
|
|
21110
|
+
inputs: [
|
|
21111
|
+
{
|
|
21112
|
+
internalType: "contract IFlatcoinVault",
|
|
21113
|
+
name: "_vault",
|
|
21114
|
+
type: "address"
|
|
21115
|
+
},
|
|
21116
|
+
{
|
|
21117
|
+
internalType: "uint256",
|
|
21118
|
+
name: "_stableWithdrawFee",
|
|
21119
|
+
type: "uint256"
|
|
21120
|
+
}
|
|
21121
|
+
],
|
|
21122
|
+
name: "initialize",
|
|
21123
|
+
outputs: [
|
|
21124
|
+
],
|
|
21125
|
+
stateMutability: "nonpayable",
|
|
21126
|
+
type: "function"
|
|
21127
|
+
},
|
|
21128
|
+
{
|
|
21129
|
+
inputs: [
|
|
21130
|
+
{
|
|
21131
|
+
internalType: "address",
|
|
21132
|
+
name: "_account",
|
|
21133
|
+
type: "address"
|
|
21134
|
+
},
|
|
21135
|
+
{
|
|
21136
|
+
internalType: "uint256",
|
|
21137
|
+
name: "_amount",
|
|
21138
|
+
type: "uint256"
|
|
21139
|
+
}
|
|
21140
|
+
],
|
|
21141
|
+
name: "lock",
|
|
21142
|
+
outputs: [
|
|
21143
|
+
],
|
|
21144
|
+
stateMutability: "nonpayable",
|
|
21145
|
+
type: "function"
|
|
21146
|
+
},
|
|
21147
|
+
{
|
|
21148
|
+
inputs: [
|
|
21149
|
+
],
|
|
21150
|
+
name: "name",
|
|
21151
|
+
outputs: [
|
|
21152
|
+
{
|
|
21153
|
+
internalType: "string",
|
|
21154
|
+
name: "",
|
|
21155
|
+
type: "string"
|
|
21156
|
+
}
|
|
21157
|
+
],
|
|
21158
|
+
stateMutability: "view",
|
|
21159
|
+
type: "function"
|
|
21160
|
+
},
|
|
21161
|
+
{
|
|
21162
|
+
inputs: [
|
|
21163
|
+
{
|
|
21164
|
+
internalType: "uint256",
|
|
21165
|
+
name: "_stableWithdrawFee",
|
|
21166
|
+
type: "uint256"
|
|
21167
|
+
}
|
|
21168
|
+
],
|
|
21169
|
+
name: "setStableWithdrawFee",
|
|
21170
|
+
outputs: [
|
|
21171
|
+
],
|
|
21172
|
+
stateMutability: "nonpayable",
|
|
21173
|
+
type: "function"
|
|
21174
|
+
},
|
|
21175
|
+
{
|
|
21176
|
+
inputs: [
|
|
21177
|
+
{
|
|
21178
|
+
internalType: "contract IFlatcoinVault",
|
|
21179
|
+
name: "_vault",
|
|
21180
|
+
type: "address"
|
|
21181
|
+
}
|
|
21182
|
+
],
|
|
21183
|
+
name: "setVault",
|
|
21184
|
+
outputs: [
|
|
21185
|
+
],
|
|
21186
|
+
stateMutability: "nonpayable",
|
|
21187
|
+
type: "function"
|
|
21188
|
+
},
|
|
21189
|
+
{
|
|
21190
|
+
inputs: [
|
|
21191
|
+
{
|
|
21192
|
+
internalType: "uint32",
|
|
21193
|
+
name: "_maxAge",
|
|
21194
|
+
type: "uint32"
|
|
21195
|
+
}
|
|
21196
|
+
],
|
|
21197
|
+
name: "stableCollateralPerShare",
|
|
21198
|
+
outputs: [
|
|
21199
|
+
{
|
|
21200
|
+
internalType: "uint256",
|
|
21201
|
+
name: "_collateralPerShare",
|
|
21202
|
+
type: "uint256"
|
|
21203
|
+
}
|
|
21204
|
+
],
|
|
21205
|
+
stateMutability: "view",
|
|
21206
|
+
type: "function"
|
|
21207
|
+
},
|
|
21208
|
+
{
|
|
21209
|
+
inputs: [
|
|
21210
|
+
],
|
|
21211
|
+
name: "stableCollateralPerShare",
|
|
21212
|
+
outputs: [
|
|
21213
|
+
{
|
|
21214
|
+
internalType: "uint256",
|
|
21215
|
+
name: "_collateralPerShare",
|
|
21216
|
+
type: "uint256"
|
|
21217
|
+
}
|
|
21218
|
+
],
|
|
21219
|
+
stateMutability: "view",
|
|
21220
|
+
type: "function"
|
|
21221
|
+
},
|
|
21222
|
+
{
|
|
21223
|
+
inputs: [
|
|
21224
|
+
],
|
|
21225
|
+
name: "stableCollateralTotalAfterSettlement",
|
|
21226
|
+
outputs: [
|
|
21227
|
+
{
|
|
21228
|
+
internalType: "uint256",
|
|
21229
|
+
name: "_stableCollateralBalance",
|
|
21230
|
+
type: "uint256"
|
|
21231
|
+
}
|
|
21232
|
+
],
|
|
21233
|
+
stateMutability: "view",
|
|
21234
|
+
type: "function"
|
|
21235
|
+
},
|
|
21236
|
+
{
|
|
21237
|
+
inputs: [
|
|
21238
|
+
{
|
|
21239
|
+
internalType: "uint32",
|
|
21240
|
+
name: "_maxAge",
|
|
21241
|
+
type: "uint32"
|
|
21242
|
+
}
|
|
21243
|
+
],
|
|
21244
|
+
name: "stableCollateralTotalAfterSettlement",
|
|
21245
|
+
outputs: [
|
|
21246
|
+
{
|
|
21247
|
+
internalType: "uint256",
|
|
21248
|
+
name: "_stableCollateralBalance",
|
|
21249
|
+
type: "uint256"
|
|
21250
|
+
}
|
|
21251
|
+
],
|
|
21252
|
+
stateMutability: "view",
|
|
21253
|
+
type: "function"
|
|
21254
|
+
},
|
|
21255
|
+
{
|
|
21256
|
+
inputs: [
|
|
21257
|
+
{
|
|
21258
|
+
internalType: "uint256",
|
|
21259
|
+
name: "_depositAmount",
|
|
21260
|
+
type: "uint256"
|
|
21261
|
+
}
|
|
21262
|
+
],
|
|
21263
|
+
name: "stableDepositQuote",
|
|
21264
|
+
outputs: [
|
|
21265
|
+
{
|
|
21266
|
+
internalType: "uint256",
|
|
21267
|
+
name: "_amountOut",
|
|
21268
|
+
type: "uint256"
|
|
21269
|
+
}
|
|
21270
|
+
],
|
|
21271
|
+
stateMutability: "view",
|
|
21272
|
+
type: "function"
|
|
21273
|
+
},
|
|
21274
|
+
{
|
|
21275
|
+
inputs: [
|
|
21276
|
+
],
|
|
21277
|
+
name: "stableWithdrawFee",
|
|
21278
|
+
outputs: [
|
|
21279
|
+
{
|
|
21280
|
+
internalType: "uint256",
|
|
21281
|
+
name: "",
|
|
21282
|
+
type: "uint256"
|
|
21283
|
+
}
|
|
21284
|
+
],
|
|
21285
|
+
stateMutability: "view",
|
|
21286
|
+
type: "function"
|
|
21287
|
+
},
|
|
21288
|
+
{
|
|
21289
|
+
inputs: [
|
|
21290
|
+
{
|
|
21291
|
+
internalType: "uint256",
|
|
21292
|
+
name: "_withdrawAmount",
|
|
21293
|
+
type: "uint256"
|
|
21294
|
+
}
|
|
21295
|
+
],
|
|
21296
|
+
name: "stableWithdrawQuote",
|
|
21297
|
+
outputs: [
|
|
21298
|
+
{
|
|
21299
|
+
internalType: "uint256",
|
|
21300
|
+
name: "_amountOut",
|
|
21301
|
+
type: "uint256"
|
|
21302
|
+
}
|
|
21303
|
+
],
|
|
21304
|
+
stateMutability: "view",
|
|
21305
|
+
type: "function"
|
|
21306
|
+
},
|
|
21307
|
+
{
|
|
21308
|
+
inputs: [
|
|
21309
|
+
],
|
|
21310
|
+
name: "symbol",
|
|
21311
|
+
outputs: [
|
|
21312
|
+
{
|
|
21313
|
+
internalType: "string",
|
|
21314
|
+
name: "",
|
|
21315
|
+
type: "string"
|
|
21316
|
+
}
|
|
21317
|
+
],
|
|
21318
|
+
stateMutability: "view",
|
|
21319
|
+
type: "function"
|
|
21320
|
+
},
|
|
21321
|
+
{
|
|
21322
|
+
inputs: [
|
|
21323
|
+
],
|
|
21324
|
+
name: "totalSupply",
|
|
21325
|
+
outputs: [
|
|
21326
|
+
{
|
|
21327
|
+
internalType: "uint256",
|
|
21328
|
+
name: "",
|
|
21329
|
+
type: "uint256"
|
|
21330
|
+
}
|
|
21331
|
+
],
|
|
21332
|
+
stateMutability: "view",
|
|
21333
|
+
type: "function"
|
|
21334
|
+
},
|
|
21335
|
+
{
|
|
21336
|
+
inputs: [
|
|
21337
|
+
{
|
|
21338
|
+
internalType: "address",
|
|
21339
|
+
name: "to",
|
|
21340
|
+
type: "address"
|
|
21341
|
+
},
|
|
21342
|
+
{
|
|
21343
|
+
internalType: "uint256",
|
|
21344
|
+
name: "amount",
|
|
21345
|
+
type: "uint256"
|
|
21346
|
+
}
|
|
21347
|
+
],
|
|
21348
|
+
name: "transfer",
|
|
21349
|
+
outputs: [
|
|
21350
|
+
{
|
|
21351
|
+
internalType: "bool",
|
|
21352
|
+
name: "",
|
|
21353
|
+
type: "bool"
|
|
21354
|
+
}
|
|
21355
|
+
],
|
|
21356
|
+
stateMutability: "nonpayable",
|
|
21357
|
+
type: "function"
|
|
21358
|
+
},
|
|
21359
|
+
{
|
|
21360
|
+
inputs: [
|
|
21361
|
+
{
|
|
21362
|
+
internalType: "address",
|
|
21363
|
+
name: "from",
|
|
21364
|
+
type: "address"
|
|
21365
|
+
},
|
|
21366
|
+
{
|
|
21367
|
+
internalType: "address",
|
|
21368
|
+
name: "to",
|
|
21369
|
+
type: "address"
|
|
21370
|
+
},
|
|
21371
|
+
{
|
|
21372
|
+
internalType: "uint256",
|
|
21373
|
+
name: "amount",
|
|
21374
|
+
type: "uint256"
|
|
21375
|
+
}
|
|
21376
|
+
],
|
|
21377
|
+
name: "transferFrom",
|
|
21378
|
+
outputs: [
|
|
21379
|
+
{
|
|
21380
|
+
internalType: "bool",
|
|
21381
|
+
name: "",
|
|
21382
|
+
type: "bool"
|
|
21383
|
+
}
|
|
21384
|
+
],
|
|
21385
|
+
stateMutability: "nonpayable",
|
|
21386
|
+
type: "function"
|
|
21387
|
+
},
|
|
21388
|
+
{
|
|
21389
|
+
inputs: [
|
|
21390
|
+
{
|
|
21391
|
+
internalType: "address",
|
|
21392
|
+
name: "_account",
|
|
21393
|
+
type: "address"
|
|
21394
|
+
},
|
|
21395
|
+
{
|
|
21396
|
+
internalType: "uint256",
|
|
21397
|
+
name: "_amount",
|
|
21398
|
+
type: "uint256"
|
|
21399
|
+
}
|
|
21400
|
+
],
|
|
21401
|
+
name: "unlock",
|
|
21402
|
+
outputs: [
|
|
21403
|
+
],
|
|
21404
|
+
stateMutability: "nonpayable",
|
|
21405
|
+
type: "function"
|
|
21406
|
+
},
|
|
21407
|
+
{
|
|
21408
|
+
inputs: [
|
|
21409
|
+
],
|
|
21410
|
+
name: "vault",
|
|
21411
|
+
outputs: [
|
|
21412
|
+
{
|
|
21413
|
+
internalType: "contract IFlatcoinVault",
|
|
21414
|
+
name: "",
|
|
21415
|
+
type: "address"
|
|
21416
|
+
}
|
|
21417
|
+
],
|
|
21418
|
+
stateMutability: "view",
|
|
21419
|
+
type: "function"
|
|
21420
|
+
}
|
|
21421
|
+
];
|
|
21422
|
+
|
|
21423
|
+
var getStableModuleContract = function getStableModuleContract(pool) {
|
|
21424
|
+
var flatMoneyContracts = flatMoneyContractAddresses[pool.network];
|
|
21425
|
+
|
|
21426
|
+
if (!flatMoneyContracts) {
|
|
21427
|
+
throw new Error("getStableModuleContract: network of " + pool.network + " not supported");
|
|
21428
|
+
}
|
|
21429
|
+
|
|
21430
|
+
var stableModuleContract = new Contract(flatMoneyContracts.StableModule, StableModuleAbi, pool.signer);
|
|
21431
|
+
return stableModuleContract;
|
|
21432
|
+
}; /// @notice Quoter function for getting the stable deposit amount out.
|
|
21433
|
+
|
|
21434
|
+
|
|
21435
|
+
var getStableDepositQuote = /*#__PURE__*/function () {
|
|
21436
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, depositAmount) {
|
|
21437
|
+
var stableModuleContract, amountOut;
|
|
21438
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
21439
|
+
while (1) {
|
|
21440
|
+
switch (_context.prev = _context.next) {
|
|
21441
|
+
case 0:
|
|
21442
|
+
stableModuleContract = getStableModuleContract(pool);
|
|
21443
|
+
_context.next = 3;
|
|
21444
|
+
return stableModuleContract.stableDepositQuote(depositAmount.toString());
|
|
21445
|
+
|
|
21446
|
+
case 3:
|
|
21447
|
+
amountOut = _context.sent;
|
|
21448
|
+
return _context.abrupt("return", amountOut);
|
|
21449
|
+
|
|
21450
|
+
case 5:
|
|
21451
|
+
case "end":
|
|
21452
|
+
return _context.stop();
|
|
21453
|
+
}
|
|
21454
|
+
}
|
|
21455
|
+
}, _callee);
|
|
21456
|
+
}));
|
|
21457
|
+
|
|
21458
|
+
return function getStableDepositQuote(_x, _x2) {
|
|
21459
|
+
return _ref.apply(this, arguments);
|
|
21460
|
+
};
|
|
21461
|
+
}(); /// @notice Quoter function for getting the stable withdraw amount out.
|
|
21462
|
+
|
|
21463
|
+
var getStableWithdrawQuote = /*#__PURE__*/function () {
|
|
21464
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, withdrawAmount) {
|
|
21465
|
+
var stableModuleContract, amountOut;
|
|
21466
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
21467
|
+
while (1) {
|
|
21468
|
+
switch (_context2.prev = _context2.next) {
|
|
21469
|
+
case 0:
|
|
21470
|
+
stableModuleContract = getStableModuleContract(pool);
|
|
21471
|
+
_context2.next = 3;
|
|
21472
|
+
return stableModuleContract.stableWithdrawQuote(withdrawAmount.toString());
|
|
21473
|
+
|
|
21474
|
+
case 3:
|
|
21475
|
+
amountOut = _context2.sent;
|
|
21476
|
+
return _context2.abrupt("return", amountOut);
|
|
21477
|
+
|
|
21478
|
+
case 5:
|
|
21479
|
+
case "end":
|
|
21480
|
+
return _context2.stop();
|
|
21481
|
+
}
|
|
21482
|
+
}
|
|
21483
|
+
}, _callee2);
|
|
21484
|
+
}));
|
|
21485
|
+
|
|
21486
|
+
return function getStableWithdrawQuote(_x3, _x4) {
|
|
21487
|
+
return _ref2.apply(this, arguments);
|
|
21488
|
+
};
|
|
21489
|
+
}();
|
|
21490
|
+
|
|
21491
|
+
var IFlatcoinVaultAbi = [
|
|
21492
|
+
{
|
|
21493
|
+
inputs: [
|
|
21494
|
+
{
|
|
21495
|
+
components: [
|
|
21496
|
+
{
|
|
21497
|
+
internalType: "bytes32",
|
|
21498
|
+
name: "moduleKey",
|
|
21499
|
+
type: "bytes32"
|
|
21500
|
+
},
|
|
21501
|
+
{
|
|
21502
|
+
internalType: "address",
|
|
21503
|
+
name: "moduleAddress",
|
|
21504
|
+
type: "address"
|
|
21505
|
+
}
|
|
21506
|
+
],
|
|
21507
|
+
internalType: "struct FlatcoinStructs.AuthorizedModule",
|
|
21508
|
+
name: "_module",
|
|
21509
|
+
type: "tuple"
|
|
21510
|
+
}
|
|
21511
|
+
],
|
|
21512
|
+
name: "addAuthorizedModule",
|
|
21513
|
+
outputs: [
|
|
21514
|
+
],
|
|
21515
|
+
stateMutability: "nonpayable",
|
|
21516
|
+
type: "function"
|
|
21517
|
+
},
|
|
21518
|
+
{
|
|
21519
|
+
inputs: [
|
|
21520
|
+
{
|
|
21521
|
+
components: [
|
|
21522
|
+
{
|
|
21523
|
+
internalType: "bytes32",
|
|
21524
|
+
name: "moduleKey",
|
|
21525
|
+
type: "bytes32"
|
|
21526
|
+
},
|
|
21527
|
+
{
|
|
21528
|
+
internalType: "address",
|
|
21529
|
+
name: "moduleAddress",
|
|
21530
|
+
type: "address"
|
|
21531
|
+
}
|
|
21532
|
+
],
|
|
21533
|
+
internalType: "struct FlatcoinStructs.AuthorizedModule[]",
|
|
21534
|
+
name: "_modules",
|
|
21535
|
+
type: "tuple[]"
|
|
21536
|
+
}
|
|
21537
|
+
],
|
|
21538
|
+
name: "addAuthorizedModules",
|
|
21539
|
+
outputs: [
|
|
21540
|
+
],
|
|
21541
|
+
stateMutability: "nonpayable",
|
|
21542
|
+
type: "function"
|
|
21543
|
+
},
|
|
21544
|
+
{
|
|
21545
|
+
inputs: [
|
|
21546
|
+
{
|
|
21547
|
+
internalType: "uint256",
|
|
21548
|
+
name: "depositAmount",
|
|
21549
|
+
type: "uint256"
|
|
21550
|
+
}
|
|
21551
|
+
],
|
|
21552
|
+
name: "checkCollateralCap",
|
|
21553
|
+
outputs: [
|
|
21554
|
+
],
|
|
21555
|
+
stateMutability: "view",
|
|
21556
|
+
type: "function"
|
|
21557
|
+
},
|
|
21558
|
+
{
|
|
21559
|
+
inputs: [
|
|
21560
|
+
{
|
|
21561
|
+
internalType: "uint256",
|
|
21562
|
+
name: "additionalSkew",
|
|
21563
|
+
type: "uint256"
|
|
21564
|
+
}
|
|
21565
|
+
],
|
|
21566
|
+
name: "checkSkewMax",
|
|
21567
|
+
outputs: [
|
|
21568
|
+
],
|
|
21569
|
+
stateMutability: "view",
|
|
21570
|
+
type: "function"
|
|
21571
|
+
},
|
|
21572
|
+
{
|
|
21573
|
+
inputs: [
|
|
21574
|
+
],
|
|
21575
|
+
name: "collateral",
|
|
21576
|
+
outputs: [
|
|
21577
|
+
{
|
|
21578
|
+
internalType: "contract IERC20Upgradeable",
|
|
21579
|
+
name: "collateral",
|
|
21580
|
+
type: "address"
|
|
21581
|
+
}
|
|
21582
|
+
],
|
|
21583
|
+
stateMutability: "view",
|
|
21584
|
+
type: "function"
|
|
21585
|
+
},
|
|
21586
|
+
{
|
|
21587
|
+
inputs: [
|
|
21588
|
+
],
|
|
21589
|
+
name: "cumulativeFundingRate",
|
|
21590
|
+
outputs: [
|
|
21591
|
+
{
|
|
21592
|
+
internalType: "int256",
|
|
21593
|
+
name: "cumulativeFundingRate",
|
|
21594
|
+
type: "int256"
|
|
21595
|
+
}
|
|
21596
|
+
],
|
|
21597
|
+
stateMutability: "view",
|
|
21598
|
+
type: "function"
|
|
21599
|
+
},
|
|
21600
|
+
{
|
|
21601
|
+
inputs: [
|
|
21602
|
+
{
|
|
21603
|
+
internalType: "uint256",
|
|
21604
|
+
name: "_tokenId",
|
|
21605
|
+
type: "uint256"
|
|
21606
|
+
}
|
|
21607
|
+
],
|
|
21608
|
+
name: "deletePosition",
|
|
21609
|
+
outputs: [
|
|
21610
|
+
],
|
|
21611
|
+
stateMutability: "nonpayable",
|
|
21612
|
+
type: "function"
|
|
21613
|
+
},
|
|
21614
|
+
{
|
|
21615
|
+
inputs: [
|
|
21616
|
+
],
|
|
21617
|
+
name: "getCurrentFundingRate",
|
|
21618
|
+
outputs: [
|
|
21619
|
+
{
|
|
21620
|
+
internalType: "int256",
|
|
21621
|
+
name: "fundingRate",
|
|
21622
|
+
type: "int256"
|
|
21623
|
+
}
|
|
21624
|
+
],
|
|
21625
|
+
stateMutability: "view",
|
|
21626
|
+
type: "function"
|
|
21627
|
+
},
|
|
21628
|
+
{
|
|
21629
|
+
inputs: [
|
|
21630
|
+
],
|
|
21631
|
+
name: "getCurrentSkew",
|
|
21632
|
+
outputs: [
|
|
21633
|
+
{
|
|
21634
|
+
internalType: "int256",
|
|
21635
|
+
name: "skew",
|
|
21636
|
+
type: "int256"
|
|
21637
|
+
}
|
|
21638
|
+
],
|
|
21639
|
+
stateMutability: "view",
|
|
21640
|
+
type: "function"
|
|
21641
|
+
},
|
|
21642
|
+
{
|
|
21643
|
+
inputs: [
|
|
21644
|
+
],
|
|
21645
|
+
name: "getGlobalPositions",
|
|
21646
|
+
outputs: [
|
|
21647
|
+
{
|
|
21648
|
+
components: [
|
|
21649
|
+
{
|
|
21650
|
+
internalType: "uint256",
|
|
21651
|
+
name: "marginDepositedTotal",
|
|
21652
|
+
type: "uint256"
|
|
21653
|
+
},
|
|
21654
|
+
{
|
|
21655
|
+
internalType: "uint256",
|
|
21656
|
+
name: "lastPrice",
|
|
21657
|
+
type: "uint256"
|
|
21658
|
+
},
|
|
21659
|
+
{
|
|
21660
|
+
internalType: "uint256",
|
|
21661
|
+
name: "sizeOpenedTotal",
|
|
21662
|
+
type: "uint256"
|
|
21663
|
+
}
|
|
21664
|
+
],
|
|
21665
|
+
internalType: "struct FlatcoinStructs.GlobalPositions",
|
|
21666
|
+
name: "_globalPositions",
|
|
21667
|
+
type: "tuple"
|
|
21668
|
+
}
|
|
21669
|
+
],
|
|
21670
|
+
stateMutability: "view",
|
|
21671
|
+
type: "function"
|
|
21672
|
+
},
|
|
21673
|
+
{
|
|
21674
|
+
inputs: [
|
|
21675
|
+
{
|
|
21676
|
+
internalType: "uint256",
|
|
21677
|
+
name: "_tokenId",
|
|
21678
|
+
type: "uint256"
|
|
21679
|
+
}
|
|
21680
|
+
],
|
|
21681
|
+
name: "getPosition",
|
|
21682
|
+
outputs: [
|
|
21683
|
+
{
|
|
21684
|
+
components: [
|
|
21685
|
+
{
|
|
21686
|
+
internalType: "uint256",
|
|
21687
|
+
name: "lastPrice",
|
|
21688
|
+
type: "uint256"
|
|
21689
|
+
},
|
|
21690
|
+
{
|
|
21691
|
+
internalType: "uint256",
|
|
21692
|
+
name: "marginDeposited",
|
|
21693
|
+
type: "uint256"
|
|
21694
|
+
},
|
|
21695
|
+
{
|
|
21696
|
+
internalType: "uint256",
|
|
21697
|
+
name: "additionalSize",
|
|
21698
|
+
type: "uint256"
|
|
21699
|
+
},
|
|
21700
|
+
{
|
|
21701
|
+
internalType: "int256",
|
|
21702
|
+
name: "entryCumulativeFunding",
|
|
21703
|
+
type: "int256"
|
|
21704
|
+
}
|
|
21705
|
+
],
|
|
21706
|
+
internalType: "struct FlatcoinStructs.Position",
|
|
21707
|
+
name: "position",
|
|
21708
|
+
type: "tuple"
|
|
21709
|
+
}
|
|
21710
|
+
],
|
|
21711
|
+
stateMutability: "view",
|
|
21712
|
+
type: "function"
|
|
21713
|
+
},
|
|
21714
|
+
{
|
|
21715
|
+
inputs: [
|
|
21716
|
+
],
|
|
21717
|
+
name: "getVaultSummary",
|
|
21718
|
+
outputs: [
|
|
21719
|
+
{
|
|
21720
|
+
components: [
|
|
21721
|
+
{
|
|
21722
|
+
internalType: "int256",
|
|
21723
|
+
name: "marketSkew",
|
|
21724
|
+
type: "int256"
|
|
21725
|
+
},
|
|
21726
|
+
{
|
|
21727
|
+
internalType: "int256",
|
|
21728
|
+
name: "cumulativeFundingRate",
|
|
21729
|
+
type: "int256"
|
|
21730
|
+
},
|
|
21731
|
+
{
|
|
21732
|
+
internalType: "int256",
|
|
21733
|
+
name: "lastRecomputedFundingRate",
|
|
21734
|
+
type: "int256"
|
|
21735
|
+
},
|
|
21736
|
+
{
|
|
21737
|
+
internalType: "uint64",
|
|
21738
|
+
name: "lastRecomputedFundingTimestamp",
|
|
21739
|
+
type: "uint64"
|
|
21740
|
+
},
|
|
21741
|
+
{
|
|
21742
|
+
internalType: "uint256",
|
|
21743
|
+
name: "stableCollateralTotal",
|
|
21744
|
+
type: "uint256"
|
|
21745
|
+
},
|
|
21746
|
+
{
|
|
21747
|
+
components: [
|
|
21748
|
+
{
|
|
21749
|
+
internalType: "uint256",
|
|
21750
|
+
name: "marginDepositedTotal",
|
|
21751
|
+
type: "uint256"
|
|
21752
|
+
},
|
|
21753
|
+
{
|
|
21754
|
+
internalType: "uint256",
|
|
21755
|
+
name: "lastPrice",
|
|
21756
|
+
type: "uint256"
|
|
21757
|
+
},
|
|
21758
|
+
{
|
|
21759
|
+
internalType: "uint256",
|
|
21760
|
+
name: "sizeOpenedTotal",
|
|
21761
|
+
type: "uint256"
|
|
21762
|
+
}
|
|
21763
|
+
],
|
|
21764
|
+
internalType: "struct FlatcoinStructs.GlobalPositions",
|
|
21765
|
+
name: "globalPositions",
|
|
21766
|
+
type: "tuple"
|
|
21767
|
+
}
|
|
21768
|
+
],
|
|
21769
|
+
internalType: "struct FlatcoinStructs.VaultSummary",
|
|
21770
|
+
name: "_vaultSummary",
|
|
21771
|
+
type: "tuple"
|
|
21772
|
+
}
|
|
21773
|
+
],
|
|
21774
|
+
stateMutability: "view",
|
|
21775
|
+
type: "function"
|
|
21776
|
+
},
|
|
21777
|
+
{
|
|
21778
|
+
inputs: [
|
|
21779
|
+
{
|
|
21780
|
+
internalType: "address",
|
|
21781
|
+
name: "_address",
|
|
21782
|
+
type: "address"
|
|
21783
|
+
}
|
|
21784
|
+
],
|
|
21785
|
+
name: "isAuthorizedModule",
|
|
21786
|
+
outputs: [
|
|
21787
|
+
{
|
|
21788
|
+
internalType: "bool",
|
|
21789
|
+
name: "status",
|
|
21790
|
+
type: "bool"
|
|
21791
|
+
}
|
|
21792
|
+
],
|
|
21793
|
+
stateMutability: "view",
|
|
21794
|
+
type: "function"
|
|
21795
|
+
},
|
|
21796
|
+
{
|
|
21797
|
+
inputs: [
|
|
21798
|
+
{
|
|
21799
|
+
internalType: "bytes32",
|
|
21800
|
+
name: "moduleKey",
|
|
21801
|
+
type: "bytes32"
|
|
21802
|
+
}
|
|
21803
|
+
],
|
|
21804
|
+
name: "isModulePaused",
|
|
21805
|
+
outputs: [
|
|
21806
|
+
{
|
|
21807
|
+
internalType: "bool",
|
|
21808
|
+
name: "paused",
|
|
21809
|
+
type: "bool"
|
|
21810
|
+
}
|
|
21811
|
+
],
|
|
21812
|
+
stateMutability: "view",
|
|
21813
|
+
type: "function"
|
|
21814
|
+
},
|
|
21815
|
+
{
|
|
21816
|
+
inputs: [
|
|
21817
|
+
],
|
|
21818
|
+
name: "lastRecomputedFundingRate",
|
|
21819
|
+
outputs: [
|
|
21820
|
+
{
|
|
21821
|
+
internalType: "int256",
|
|
21822
|
+
name: "lastRecomputedFundingRate",
|
|
21823
|
+
type: "int256"
|
|
21824
|
+
}
|
|
21825
|
+
],
|
|
21826
|
+
stateMutability: "view",
|
|
21827
|
+
type: "function"
|
|
21828
|
+
},
|
|
21829
|
+
{
|
|
21830
|
+
inputs: [
|
|
21831
|
+
],
|
|
21832
|
+
name: "lastRecomputedFundingTimestamp",
|
|
21833
|
+
outputs: [
|
|
21834
|
+
{
|
|
21835
|
+
internalType: "uint64",
|
|
21836
|
+
name: "lastRecomputedFundingTimestamp",
|
|
21837
|
+
type: "uint64"
|
|
21838
|
+
}
|
|
21839
|
+
],
|
|
21840
|
+
stateMutability: "view",
|
|
21841
|
+
type: "function"
|
|
21842
|
+
},
|
|
21843
|
+
{
|
|
21844
|
+
inputs: [
|
|
21845
|
+
],
|
|
21846
|
+
name: "maxExecutabilityAge",
|
|
21847
|
+
outputs: [
|
|
21848
|
+
{
|
|
21849
|
+
internalType: "uint64",
|
|
21850
|
+
name: "maxExecutabilityAge",
|
|
21851
|
+
type: "uint64"
|
|
21852
|
+
}
|
|
21853
|
+
],
|
|
21854
|
+
stateMutability: "view",
|
|
21855
|
+
type: "function"
|
|
21856
|
+
},
|
|
21857
|
+
{
|
|
21858
|
+
inputs: [
|
|
21859
|
+
],
|
|
21860
|
+
name: "maxFundingVelocity",
|
|
21861
|
+
outputs: [
|
|
21862
|
+
{
|
|
21863
|
+
internalType: "uint256",
|
|
21864
|
+
name: "maxFundingVelocity",
|
|
21865
|
+
type: "uint256"
|
|
21866
|
+
}
|
|
21867
|
+
],
|
|
21868
|
+
stateMutability: "view",
|
|
21869
|
+
type: "function"
|
|
21870
|
+
},
|
|
21871
|
+
{
|
|
21872
|
+
inputs: [
|
|
21873
|
+
],
|
|
21874
|
+
name: "maxVelocitySkew",
|
|
21875
|
+
outputs: [
|
|
21876
|
+
{
|
|
21877
|
+
internalType: "uint256",
|
|
21878
|
+
name: "maxVelocitySkew",
|
|
21879
|
+
type: "uint256"
|
|
21880
|
+
}
|
|
21881
|
+
],
|
|
21882
|
+
stateMutability: "view",
|
|
21883
|
+
type: "function"
|
|
21884
|
+
},
|
|
21885
|
+
{
|
|
21886
|
+
inputs: [
|
|
21887
|
+
],
|
|
21888
|
+
name: "minExecutabilityAge",
|
|
21889
|
+
outputs: [
|
|
21890
|
+
{
|
|
21891
|
+
internalType: "uint64",
|
|
21892
|
+
name: "minExecutabilityAge",
|
|
21893
|
+
type: "uint64"
|
|
21894
|
+
}
|
|
21895
|
+
],
|
|
21896
|
+
stateMutability: "view",
|
|
21897
|
+
type: "function"
|
|
21898
|
+
},
|
|
21899
|
+
{
|
|
21900
|
+
inputs: [
|
|
21901
|
+
{
|
|
21902
|
+
internalType: "bytes32",
|
|
21903
|
+
name: "_moduleKey",
|
|
21904
|
+
type: "bytes32"
|
|
21905
|
+
}
|
|
21906
|
+
],
|
|
21907
|
+
name: "moduleAddress",
|
|
21908
|
+
outputs: [
|
|
21909
|
+
{
|
|
21910
|
+
internalType: "address",
|
|
21911
|
+
name: "moduleAddress",
|
|
21912
|
+
type: "address"
|
|
21913
|
+
}
|
|
21914
|
+
],
|
|
21915
|
+
stateMutability: "view",
|
|
21916
|
+
type: "function"
|
|
21917
|
+
},
|
|
21918
|
+
{
|
|
21919
|
+
inputs: [
|
|
21920
|
+
{
|
|
21921
|
+
internalType: "bytes32",
|
|
21922
|
+
name: "_moduleKey",
|
|
21923
|
+
type: "bytes32"
|
|
21924
|
+
}
|
|
21925
|
+
],
|
|
21926
|
+
name: "removeAuthorizedModule",
|
|
21927
|
+
outputs: [
|
|
21928
|
+
],
|
|
21929
|
+
stateMutability: "nonpayable",
|
|
21930
|
+
type: "function"
|
|
21931
|
+
},
|
|
21932
|
+
{
|
|
21933
|
+
inputs: [
|
|
21934
|
+
{
|
|
21935
|
+
internalType: "address",
|
|
21936
|
+
name: "to",
|
|
21937
|
+
type: "address"
|
|
21938
|
+
},
|
|
21939
|
+
{
|
|
21940
|
+
internalType: "uint256",
|
|
21941
|
+
name: "amount",
|
|
21942
|
+
type: "uint256"
|
|
21943
|
+
}
|
|
21944
|
+
],
|
|
21945
|
+
name: "sendCollateral",
|
|
21946
|
+
outputs: [
|
|
21947
|
+
],
|
|
21948
|
+
stateMutability: "nonpayable",
|
|
21949
|
+
type: "function"
|
|
21950
|
+
},
|
|
21951
|
+
{
|
|
21952
|
+
inputs: [
|
|
21953
|
+
{
|
|
21954
|
+
components: [
|
|
21955
|
+
{
|
|
21956
|
+
internalType: "uint256",
|
|
21957
|
+
name: "lastPrice",
|
|
21958
|
+
type: "uint256"
|
|
21959
|
+
},
|
|
21960
|
+
{
|
|
21961
|
+
internalType: "uint256",
|
|
21962
|
+
name: "marginDeposited",
|
|
21963
|
+
type: "uint256"
|
|
21964
|
+
},
|
|
21965
|
+
{
|
|
21966
|
+
internalType: "uint256",
|
|
21967
|
+
name: "additionalSize",
|
|
21968
|
+
type: "uint256"
|
|
21969
|
+
},
|
|
21970
|
+
{
|
|
21971
|
+
internalType: "int256",
|
|
21972
|
+
name: "entryCumulativeFunding",
|
|
21973
|
+
type: "int256"
|
|
21974
|
+
}
|
|
21975
|
+
],
|
|
21976
|
+
internalType: "struct FlatcoinStructs.Position",
|
|
21977
|
+
name: "_position",
|
|
21978
|
+
type: "tuple"
|
|
21979
|
+
},
|
|
21980
|
+
{
|
|
21981
|
+
internalType: "uint256",
|
|
21982
|
+
name: "_tokenId",
|
|
21983
|
+
type: "uint256"
|
|
21984
|
+
}
|
|
21985
|
+
],
|
|
21986
|
+
name: "setPosition",
|
|
21987
|
+
outputs: [
|
|
21988
|
+
],
|
|
21989
|
+
stateMutability: "nonpayable",
|
|
21990
|
+
type: "function"
|
|
21991
|
+
},
|
|
21992
|
+
{
|
|
21993
|
+
inputs: [
|
|
21994
|
+
],
|
|
21995
|
+
name: "settleFundingFees",
|
|
21996
|
+
outputs: [
|
|
21997
|
+
{
|
|
21998
|
+
internalType: "int256",
|
|
21999
|
+
name: "fundingFees",
|
|
22000
|
+
type: "int256"
|
|
22001
|
+
}
|
|
22002
|
+
],
|
|
22003
|
+
stateMutability: "nonpayable",
|
|
22004
|
+
type: "function"
|
|
22005
|
+
},
|
|
22006
|
+
{
|
|
22007
|
+
inputs: [
|
|
22008
|
+
],
|
|
22009
|
+
name: "skewFractionMax",
|
|
22010
|
+
outputs: [
|
|
22011
|
+
{
|
|
22012
|
+
internalType: "uint256",
|
|
22013
|
+
name: "skewFractionMax",
|
|
22014
|
+
type: "uint256"
|
|
22015
|
+
}
|
|
22016
|
+
],
|
|
22017
|
+
stateMutability: "view",
|
|
22018
|
+
type: "function"
|
|
22019
|
+
},
|
|
22020
|
+
{
|
|
22021
|
+
inputs: [
|
|
22022
|
+
],
|
|
22023
|
+
name: "stableCollateralCap",
|
|
22024
|
+
outputs: [
|
|
22025
|
+
{
|
|
22026
|
+
internalType: "uint256",
|
|
22027
|
+
name: "collateralCap",
|
|
22028
|
+
type: "uint256"
|
|
22029
|
+
}
|
|
22030
|
+
],
|
|
22031
|
+
stateMutability: "view",
|
|
22032
|
+
type: "function"
|
|
22033
|
+
},
|
|
22034
|
+
{
|
|
22035
|
+
inputs: [
|
|
22036
|
+
],
|
|
22037
|
+
name: "stableCollateralTotal",
|
|
22038
|
+
outputs: [
|
|
22039
|
+
{
|
|
22040
|
+
internalType: "uint256",
|
|
22041
|
+
name: "totalAmount",
|
|
22042
|
+
type: "uint256"
|
|
22043
|
+
}
|
|
22044
|
+
],
|
|
22045
|
+
stateMutability: "view",
|
|
22046
|
+
type: "function"
|
|
22047
|
+
},
|
|
22048
|
+
{
|
|
22049
|
+
inputs: [
|
|
22050
|
+
{
|
|
22051
|
+
internalType: "uint256",
|
|
22052
|
+
name: "price",
|
|
22053
|
+
type: "uint256"
|
|
22054
|
+
},
|
|
22055
|
+
{
|
|
22056
|
+
internalType: "int256",
|
|
22057
|
+
name: "marginDelta",
|
|
22058
|
+
type: "int256"
|
|
22059
|
+
},
|
|
22060
|
+
{
|
|
22061
|
+
internalType: "int256",
|
|
22062
|
+
name: "additionalSizeDelta",
|
|
22063
|
+
type: "int256"
|
|
22064
|
+
}
|
|
22065
|
+
],
|
|
22066
|
+
name: "updateGlobalPositionData",
|
|
22067
|
+
outputs: [
|
|
22068
|
+
],
|
|
22069
|
+
stateMutability: "nonpayable",
|
|
22070
|
+
type: "function"
|
|
22071
|
+
},
|
|
22072
|
+
{
|
|
22073
|
+
inputs: [
|
|
22074
|
+
{
|
|
22075
|
+
internalType: "int256",
|
|
22076
|
+
name: "_stableCollateralAdjustment",
|
|
22077
|
+
type: "int256"
|
|
22078
|
+
}
|
|
22079
|
+
],
|
|
22080
|
+
name: "updateStableCollateralTotal",
|
|
22081
|
+
outputs: [
|
|
22082
|
+
],
|
|
22083
|
+
stateMutability: "nonpayable",
|
|
22084
|
+
type: "function"
|
|
22085
|
+
}
|
|
22086
|
+
];
|
|
22087
|
+
|
|
22088
|
+
var KeeperFeeAbi = [
|
|
22089
|
+
{
|
|
22090
|
+
inputs: [
|
|
22091
|
+
{
|
|
22092
|
+
internalType: "address",
|
|
22093
|
+
name: "owner",
|
|
22094
|
+
type: "address"
|
|
22095
|
+
},
|
|
22096
|
+
{
|
|
22097
|
+
internalType: "address",
|
|
22098
|
+
name: "ethOracle",
|
|
22099
|
+
type: "address"
|
|
22100
|
+
},
|
|
22101
|
+
{
|
|
22102
|
+
internalType: "address",
|
|
22103
|
+
name: "oracleModule",
|
|
22104
|
+
type: "address"
|
|
22105
|
+
},
|
|
22106
|
+
{
|
|
22107
|
+
internalType: "address",
|
|
22108
|
+
name: "assetToPayWith",
|
|
22109
|
+
type: "address"
|
|
22110
|
+
},
|
|
22111
|
+
{
|
|
22112
|
+
internalType: "uint256",
|
|
22113
|
+
name: "profitMarginUSD",
|
|
22114
|
+
type: "uint256"
|
|
22115
|
+
},
|
|
22116
|
+
{
|
|
22117
|
+
internalType: "uint256",
|
|
22118
|
+
name: "profitMarginPercent",
|
|
22119
|
+
type: "uint256"
|
|
22120
|
+
},
|
|
22121
|
+
{
|
|
22122
|
+
internalType: "uint256",
|
|
22123
|
+
name: "keeperFeeUpperBound",
|
|
22124
|
+
type: "uint256"
|
|
22125
|
+
},
|
|
22126
|
+
{
|
|
22127
|
+
internalType: "uint256",
|
|
22128
|
+
name: "keeperFeeLowerBound",
|
|
22129
|
+
type: "uint256"
|
|
22130
|
+
},
|
|
22131
|
+
{
|
|
22132
|
+
internalType: "uint256",
|
|
22133
|
+
name: "gasUnitsL1",
|
|
22134
|
+
type: "uint256"
|
|
22135
|
+
},
|
|
22136
|
+
{
|
|
22137
|
+
internalType: "uint256",
|
|
22138
|
+
name: "gasUnitsL2",
|
|
22139
|
+
type: "uint256"
|
|
22140
|
+
},
|
|
22141
|
+
{
|
|
22142
|
+
internalType: "uint256",
|
|
22143
|
+
name: "stalenessPeriod",
|
|
22144
|
+
type: "uint256"
|
|
22145
|
+
}
|
|
22146
|
+
],
|
|
22147
|
+
stateMutability: "nonpayable",
|
|
22148
|
+
type: "constructor"
|
|
22149
|
+
},
|
|
22150
|
+
{
|
|
22151
|
+
inputs: [
|
|
22152
|
+
],
|
|
22153
|
+
name: "ETHPriceInvalid",
|
|
22154
|
+
type: "error"
|
|
22155
|
+
},
|
|
22156
|
+
{
|
|
22157
|
+
inputs: [
|
|
22158
|
+
],
|
|
22159
|
+
name: "ETHPriceStale",
|
|
22160
|
+
type: "error"
|
|
22161
|
+
},
|
|
22162
|
+
{
|
|
22163
|
+
inputs: [
|
|
22164
|
+
{
|
|
22165
|
+
internalType: "uint256",
|
|
22166
|
+
name: "fee",
|
|
22167
|
+
type: "uint256"
|
|
22168
|
+
}
|
|
22169
|
+
],
|
|
22170
|
+
name: "InvalidFee",
|
|
22171
|
+
type: "error"
|
|
22172
|
+
},
|
|
22173
|
+
{
|
|
22174
|
+
inputs: [
|
|
22175
|
+
],
|
|
22176
|
+
name: "MathOverflowedMulDiv",
|
|
22177
|
+
type: "error"
|
|
22178
|
+
},
|
|
22179
|
+
{
|
|
22180
|
+
inputs: [
|
|
22181
|
+
{
|
|
22182
|
+
internalType: "address",
|
|
22183
|
+
name: "owner",
|
|
22184
|
+
type: "address"
|
|
22185
|
+
}
|
|
22186
|
+
],
|
|
22187
|
+
name: "OwnableInvalidOwner",
|
|
22188
|
+
type: "error"
|
|
22189
|
+
},
|
|
22190
|
+
{
|
|
22191
|
+
inputs: [
|
|
22192
|
+
{
|
|
22193
|
+
internalType: "address",
|
|
22194
|
+
name: "account",
|
|
22195
|
+
type: "address"
|
|
22196
|
+
}
|
|
22197
|
+
],
|
|
22198
|
+
name: "OwnableUnauthorizedAccount",
|
|
22199
|
+
type: "error"
|
|
22200
|
+
},
|
|
22201
|
+
{
|
|
22202
|
+
inputs: [
|
|
22203
|
+
{
|
|
22204
|
+
internalType: "enum FlatcoinErrors.PriceSource",
|
|
22205
|
+
name: "priceSource",
|
|
22206
|
+
type: "uint8"
|
|
22207
|
+
}
|
|
22208
|
+
],
|
|
22209
|
+
name: "PriceInvalid",
|
|
22210
|
+
type: "error"
|
|
22211
|
+
},
|
|
22212
|
+
{
|
|
22213
|
+
inputs: [
|
|
22214
|
+
{
|
|
22215
|
+
internalType: "enum FlatcoinErrors.PriceSource",
|
|
22216
|
+
name: "priceSource",
|
|
22217
|
+
type: "uint8"
|
|
22218
|
+
}
|
|
22219
|
+
],
|
|
22220
|
+
name: "PriceStale",
|
|
22221
|
+
type: "error"
|
|
22222
|
+
},
|
|
22223
|
+
{
|
|
22224
|
+
inputs: [
|
|
22225
|
+
{
|
|
22226
|
+
internalType: "string",
|
|
22227
|
+
name: "variableName",
|
|
22228
|
+
type: "string"
|
|
22229
|
+
}
|
|
22230
|
+
],
|
|
22231
|
+
name: "ZeroAddress",
|
|
22232
|
+
type: "error"
|
|
22233
|
+
},
|
|
22234
|
+
{
|
|
22235
|
+
inputs: [
|
|
22236
|
+
{
|
|
22237
|
+
internalType: "string",
|
|
22238
|
+
name: "variableName",
|
|
22239
|
+
type: "string"
|
|
22240
|
+
}
|
|
22241
|
+
],
|
|
22242
|
+
name: "ZeroValue",
|
|
22243
|
+
type: "error"
|
|
22244
|
+
},
|
|
22245
|
+
{
|
|
22246
|
+
anonymous: false,
|
|
22247
|
+
inputs: [
|
|
22248
|
+
{
|
|
22249
|
+
indexed: true,
|
|
22250
|
+
internalType: "address",
|
|
22251
|
+
name: "previousOwner",
|
|
22252
|
+
type: "address"
|
|
22253
|
+
},
|
|
22254
|
+
{
|
|
22255
|
+
indexed: true,
|
|
22256
|
+
internalType: "address",
|
|
22257
|
+
name: "newOwner",
|
|
22258
|
+
type: "address"
|
|
22259
|
+
}
|
|
22260
|
+
],
|
|
22261
|
+
name: "OwnershipTransferred",
|
|
22262
|
+
type: "event"
|
|
22263
|
+
},
|
|
22264
|
+
{
|
|
22265
|
+
inputs: [
|
|
22266
|
+
],
|
|
22267
|
+
name: "MODULE_KEY",
|
|
22268
|
+
outputs: [
|
|
22269
|
+
{
|
|
22270
|
+
internalType: "bytes32",
|
|
22271
|
+
name: "",
|
|
22272
|
+
type: "bytes32"
|
|
22273
|
+
}
|
|
22274
|
+
],
|
|
22275
|
+
stateMutability: "view",
|
|
22276
|
+
type: "function"
|
|
22277
|
+
},
|
|
22278
|
+
{
|
|
22279
|
+
inputs: [
|
|
22280
|
+
],
|
|
22281
|
+
name: "getConfig",
|
|
22282
|
+
outputs: [
|
|
22283
|
+
{
|
|
22284
|
+
internalType: "address",
|
|
22285
|
+
name: "gasPriceOracle",
|
|
22286
|
+
type: "address"
|
|
22287
|
+
},
|
|
22288
|
+
{
|
|
22289
|
+
internalType: "uint256",
|
|
22290
|
+
name: "profitMarginUSD",
|
|
22291
|
+
type: "uint256"
|
|
22292
|
+
},
|
|
22293
|
+
{
|
|
22294
|
+
internalType: "uint256",
|
|
22295
|
+
name: "profitMarginPercent",
|
|
22296
|
+
type: "uint256"
|
|
22297
|
+
},
|
|
22298
|
+
{
|
|
22299
|
+
internalType: "uint256",
|
|
22300
|
+
name: "keeperFeeUpperBound",
|
|
22301
|
+
type: "uint256"
|
|
22302
|
+
},
|
|
22303
|
+
{
|
|
22304
|
+
internalType: "uint256",
|
|
22305
|
+
name: "keeperFeeLowerBound",
|
|
22306
|
+
type: "uint256"
|
|
22307
|
+
},
|
|
22308
|
+
{
|
|
22309
|
+
internalType: "uint256",
|
|
22310
|
+
name: "gasUnitsL1",
|
|
22311
|
+
type: "uint256"
|
|
22312
|
+
},
|
|
22313
|
+
{
|
|
22314
|
+
internalType: "uint256",
|
|
22315
|
+
name: "gasUnitsL2",
|
|
22316
|
+
type: "uint256"
|
|
22317
|
+
}
|
|
22318
|
+
],
|
|
22319
|
+
stateMutability: "view",
|
|
22320
|
+
type: "function"
|
|
22321
|
+
},
|
|
22322
|
+
{
|
|
22323
|
+
inputs: [
|
|
22324
|
+
],
|
|
22325
|
+
name: "getKeeperFee",
|
|
22326
|
+
outputs: [
|
|
22327
|
+
{
|
|
22328
|
+
internalType: "uint256",
|
|
22329
|
+
name: "keeperFeeCollateral",
|
|
22330
|
+
type: "uint256"
|
|
22331
|
+
}
|
|
22332
|
+
],
|
|
22333
|
+
stateMutability: "view",
|
|
22334
|
+
type: "function"
|
|
22335
|
+
},
|
|
22336
|
+
{
|
|
22337
|
+
inputs: [
|
|
22338
|
+
{
|
|
22339
|
+
internalType: "uint256",
|
|
22340
|
+
name: "baseFee",
|
|
22341
|
+
type: "uint256"
|
|
22342
|
+
}
|
|
22343
|
+
],
|
|
22344
|
+
name: "getKeeperFee",
|
|
22345
|
+
outputs: [
|
|
22346
|
+
{
|
|
22347
|
+
internalType: "uint256",
|
|
22348
|
+
name: "keeperFeeCollateral",
|
|
22349
|
+
type: "uint256"
|
|
22350
|
+
}
|
|
22351
|
+
],
|
|
22352
|
+
stateMutability: "view",
|
|
22353
|
+
type: "function"
|
|
22354
|
+
},
|
|
22355
|
+
{
|
|
22356
|
+
inputs: [
|
|
22357
|
+
],
|
|
22358
|
+
name: "owner",
|
|
22359
|
+
outputs: [
|
|
22360
|
+
{
|
|
22361
|
+
internalType: "address",
|
|
22362
|
+
name: "",
|
|
22363
|
+
type: "address"
|
|
22364
|
+
}
|
|
22365
|
+
],
|
|
22366
|
+
stateMutability: "view",
|
|
22367
|
+
type: "function"
|
|
22368
|
+
},
|
|
22369
|
+
{
|
|
22370
|
+
inputs: [
|
|
22371
|
+
],
|
|
22372
|
+
name: "renounceOwnership",
|
|
22373
|
+
outputs: [
|
|
22374
|
+
],
|
|
22375
|
+
stateMutability: "nonpayable",
|
|
22376
|
+
type: "function"
|
|
22377
|
+
},
|
|
22378
|
+
{
|
|
22379
|
+
inputs: [
|
|
22380
|
+
{
|
|
22381
|
+
internalType: "address",
|
|
22382
|
+
name: "gasPriceOracle",
|
|
22383
|
+
type: "address"
|
|
22384
|
+
}
|
|
22385
|
+
],
|
|
22386
|
+
name: "setGasPriceOracle",
|
|
22387
|
+
outputs: [
|
|
22388
|
+
],
|
|
22389
|
+
stateMutability: "nonpayable",
|
|
22390
|
+
type: "function"
|
|
22391
|
+
},
|
|
22392
|
+
{
|
|
22393
|
+
inputs: [
|
|
22394
|
+
{
|
|
22395
|
+
internalType: "uint256",
|
|
22396
|
+
name: "profitMarginUSD",
|
|
22397
|
+
type: "uint256"
|
|
22398
|
+
},
|
|
22399
|
+
{
|
|
22400
|
+
internalType: "uint256",
|
|
22401
|
+
name: "profitMarginPercent",
|
|
22402
|
+
type: "uint256"
|
|
22403
|
+
},
|
|
22404
|
+
{
|
|
22405
|
+
internalType: "uint256",
|
|
22406
|
+
name: "keeperFeeUpperBound",
|
|
22407
|
+
type: "uint256"
|
|
22408
|
+
},
|
|
22409
|
+
{
|
|
22410
|
+
internalType: "uint256",
|
|
22411
|
+
name: "keeperFeeLowerBound",
|
|
22412
|
+
type: "uint256"
|
|
22413
|
+
},
|
|
22414
|
+
{
|
|
22415
|
+
internalType: "uint256",
|
|
22416
|
+
name: "gasUnitsL1",
|
|
22417
|
+
type: "uint256"
|
|
22418
|
+
},
|
|
22419
|
+
{
|
|
22420
|
+
internalType: "uint256",
|
|
22421
|
+
name: "gasUnitsL2",
|
|
22422
|
+
type: "uint256"
|
|
22423
|
+
}
|
|
22424
|
+
],
|
|
22425
|
+
name: "setParameters",
|
|
22426
|
+
outputs: [
|
|
22427
|
+
],
|
|
22428
|
+
stateMutability: "nonpayable",
|
|
22429
|
+
type: "function"
|
|
22430
|
+
},
|
|
22431
|
+
{
|
|
22432
|
+
inputs: [
|
|
22433
|
+
{
|
|
22434
|
+
internalType: "uint256",
|
|
22435
|
+
name: "keeperFeeUpperBound",
|
|
22436
|
+
type: "uint256"
|
|
22437
|
+
},
|
|
22438
|
+
{
|
|
22439
|
+
internalType: "uint256",
|
|
22440
|
+
name: "keeperFeeLowerBound",
|
|
22441
|
+
type: "uint256"
|
|
22442
|
+
}
|
|
22443
|
+
],
|
|
22444
|
+
name: "setParameters",
|
|
22445
|
+
outputs: [
|
|
22446
|
+
],
|
|
22447
|
+
stateMutability: "nonpayable",
|
|
22448
|
+
type: "function"
|
|
22449
|
+
},
|
|
22450
|
+
{
|
|
22451
|
+
inputs: [
|
|
22452
|
+
{
|
|
22453
|
+
internalType: "address",
|
|
22454
|
+
name: "newOwner",
|
|
22455
|
+
type: "address"
|
|
22456
|
+
}
|
|
22457
|
+
],
|
|
22458
|
+
name: "transferOwnership",
|
|
22459
|
+
outputs: [
|
|
22460
|
+
],
|
|
22461
|
+
stateMutability: "nonpayable",
|
|
22462
|
+
type: "function"
|
|
22463
|
+
}
|
|
22464
|
+
];
|
|
22465
|
+
|
|
22466
|
+
var getKeeperFeeContract = /*#__PURE__*/function () {
|
|
22467
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool) {
|
|
22468
|
+
var flatMoneyContracts, flatcoinVaultContract, key, keeperFeeContractAddress, keeperFeeContract;
|
|
22469
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
22470
|
+
while (1) {
|
|
22471
|
+
switch (_context.prev = _context.next) {
|
|
22472
|
+
case 0:
|
|
22473
|
+
flatMoneyContracts = flatMoneyContractAddresses[pool.network];
|
|
22474
|
+
|
|
22475
|
+
if (flatMoneyContracts) {
|
|
22476
|
+
_context.next = 3;
|
|
22477
|
+
break;
|
|
22478
|
+
}
|
|
22479
|
+
|
|
22480
|
+
throw new Error("getStableModuleContract: network of " + pool.network + " not supported");
|
|
22481
|
+
|
|
22482
|
+
case 3:
|
|
22483
|
+
flatcoinVaultContract = new Contract(flatMoneyContracts.FlatcoinVault, IFlatcoinVaultAbi, pool.signer);
|
|
22484
|
+
key = ethers.utils.formatBytes32String("keeperFee");
|
|
22485
|
+
_context.next = 7;
|
|
22486
|
+
return flatcoinVaultContract.callStatic.moduleAddress(key);
|
|
22487
|
+
|
|
22488
|
+
case 7:
|
|
22489
|
+
keeperFeeContractAddress = _context.sent;
|
|
22490
|
+
keeperFeeContract = new ethers.Contract(keeperFeeContractAddress, KeeperFeeAbi, pool.signer);
|
|
22491
|
+
return _context.abrupt("return", keeperFeeContract);
|
|
22492
|
+
|
|
22493
|
+
case 10:
|
|
22494
|
+
case "end":
|
|
22495
|
+
return _context.stop();
|
|
22496
|
+
}
|
|
22497
|
+
}
|
|
22498
|
+
}, _callee);
|
|
22499
|
+
}));
|
|
22500
|
+
|
|
22501
|
+
return function getKeeperFeeContract(_x) {
|
|
22502
|
+
return _ref.apply(this, arguments);
|
|
22503
|
+
};
|
|
22504
|
+
}();
|
|
22505
|
+
var getKeeperFee = /*#__PURE__*/function () {
|
|
22506
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, maxKeeperFeeInUsd) {
|
|
22507
|
+
var keeperFeeContract, gasPrice, keeperfee, keeperFeeInUsd;
|
|
22508
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
22509
|
+
while (1) {
|
|
22510
|
+
switch (_context2.prev = _context2.next) {
|
|
22511
|
+
case 0:
|
|
22512
|
+
_context2.next = 2;
|
|
22513
|
+
return getKeeperFeeContract(pool);
|
|
22514
|
+
|
|
22515
|
+
case 2:
|
|
22516
|
+
keeperFeeContract = _context2.sent;
|
|
22517
|
+
_context2.next = 5;
|
|
22518
|
+
return pool.signer.provider.getGasPrice();
|
|
22519
|
+
|
|
22520
|
+
case 5:
|
|
22521
|
+
gasPrice = _context2.sent;
|
|
22522
|
+
|
|
22523
|
+
if (!gasPrice) {
|
|
22524
|
+
_context2.next = 12;
|
|
22525
|
+
break;
|
|
22526
|
+
}
|
|
22527
|
+
|
|
22528
|
+
_context2.next = 9;
|
|
22529
|
+
return keeperFeeContract["getKeeperFee(uint256)"](new BigNumber$1(gasPrice.toString()).times(1.2).toFixed(0));
|
|
22530
|
+
|
|
22531
|
+
case 9:
|
|
22532
|
+
keeperfee = _context2.sent;
|
|
22533
|
+
_context2.next = 15;
|
|
22534
|
+
break;
|
|
22535
|
+
|
|
22536
|
+
case 12:
|
|
22537
|
+
_context2.next = 14;
|
|
22538
|
+
return keeperFeeContract["getKeeperFee()"]();
|
|
22539
|
+
|
|
22540
|
+
case 14:
|
|
22541
|
+
keeperfee = _context2.sent;
|
|
22542
|
+
|
|
22543
|
+
case 15:
|
|
22544
|
+
_context2.next = 17;
|
|
22545
|
+
return getKeeperFeeInUsd(pool, keeperfee);
|
|
22546
|
+
|
|
22547
|
+
case 17:
|
|
22548
|
+
keeperFeeInUsd = _context2.sent;
|
|
22549
|
+
|
|
22550
|
+
if (!(Number.isFinite(maxKeeperFeeInUsd) && keeperFeeInUsd.gt(ethers.BigNumber.from(maxKeeperFeeInUsd).toString()))) {
|
|
22551
|
+
_context2.next = 20;
|
|
22552
|
+
break;
|
|
22553
|
+
}
|
|
22554
|
+
|
|
22555
|
+
throw new Error("mintUnitViaFlatMoney: keeperFee too large");
|
|
22556
|
+
|
|
22557
|
+
case 20:
|
|
22558
|
+
return _context2.abrupt("return", keeperfee);
|
|
22559
|
+
|
|
22560
|
+
case 21:
|
|
22561
|
+
case "end":
|
|
22562
|
+
return _context2.stop();
|
|
22563
|
+
}
|
|
22564
|
+
}
|
|
22565
|
+
}, _callee2);
|
|
22566
|
+
}));
|
|
22567
|
+
|
|
22568
|
+
return function getKeeperFee(_x2, _x3) {
|
|
22569
|
+
return _ref2.apply(this, arguments);
|
|
22570
|
+
};
|
|
22571
|
+
}();
|
|
22572
|
+
var getKeeperFeeInUsd = /*#__PURE__*/function () {
|
|
22573
|
+
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, keeperFee) {
|
|
22574
|
+
var flatMoneyContracts, fundComposition, filteredFc, rateD1;
|
|
22575
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
22576
|
+
while (1) {
|
|
22577
|
+
switch (_context3.prev = _context3.next) {
|
|
22578
|
+
case 0:
|
|
22579
|
+
flatMoneyContracts = flatMoneyContractAddresses[pool.network];
|
|
22580
|
+
|
|
22581
|
+
if (flatMoneyContracts) {
|
|
22582
|
+
_context3.next = 3;
|
|
22583
|
+
break;
|
|
22584
|
+
}
|
|
22585
|
+
|
|
22586
|
+
throw new Error("getKeeperFeeInUsd: network of " + pool.network + " not supported");
|
|
22587
|
+
|
|
22588
|
+
case 3:
|
|
22589
|
+
_context3.next = 5;
|
|
22590
|
+
return pool.getComposition();
|
|
22591
|
+
|
|
22592
|
+
case 5:
|
|
22593
|
+
fundComposition = _context3.sent;
|
|
22594
|
+
filteredFc = fundComposition.filter(function (fc) {
|
|
22595
|
+
return fc.asset.toLocaleLowerCase() === flatMoneyContracts.RETH.toLocaleLowerCase();
|
|
22596
|
+
});
|
|
22597
|
+
|
|
22598
|
+
if (filteredFc[0]) {
|
|
22599
|
+
_context3.next = 9;
|
|
22600
|
+
break;
|
|
22601
|
+
}
|
|
22602
|
+
|
|
22603
|
+
throw new Error("getKeeperFeeInUsd: required asset not enabled yet");
|
|
22604
|
+
|
|
22605
|
+
case 9:
|
|
22606
|
+
rateD1 = new BigNumber$1(filteredFc[0].rate.toString()).div(1e18);
|
|
22607
|
+
return _context3.abrupt("return", rateD1.times(keeperFee.toString()).div(1e18));
|
|
22608
|
+
|
|
22609
|
+
case 11:
|
|
22610
|
+
case "end":
|
|
22611
|
+
return _context3.stop();
|
|
22612
|
+
}
|
|
22613
|
+
}
|
|
22614
|
+
}, _callee3);
|
|
22615
|
+
}));
|
|
22616
|
+
|
|
22617
|
+
return function getKeeperFeeInUsd(_x4, _x5) {
|
|
22618
|
+
return _ref3.apply(this, arguments);
|
|
22619
|
+
};
|
|
22620
|
+
}();
|
|
22621
|
+
|
|
22622
|
+
function getAnnounceStableDepositTxData(depositAmount, minAmountOut, keeperFee) {
|
|
22623
|
+
return new ethers.utils.Interface(DelayedOrderAbi).encodeFunctionData("announceStableDeposit", [depositAmount, minAmountOut, keeperFee]);
|
|
22624
|
+
}
|
|
22625
|
+
function getAnnounceStableWithdrawTxData(withdrawAmount, minAmountOut, keeperFee) {
|
|
22626
|
+
return new ethers.utils.Interface(DelayedOrderAbi).encodeFunctionData("announceStableWithdraw", [withdrawAmount, minAmountOut, keeperFee]);
|
|
22627
|
+
}
|
|
22628
|
+
function getCancelExistingOrderTxData(account) {
|
|
22629
|
+
return new ethers.utils.Interface(DelayedOrderAbi).encodeFunctionData("cancelExistingOrder", [account]);
|
|
22630
|
+
}
|
|
22631
|
+
function mintUnitViaFlatMoney(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
22632
|
+
return _mintUnitViaFlatMoney.apply(this, arguments);
|
|
22633
|
+
}
|
|
22634
|
+
|
|
22635
|
+
function _mintUnitViaFlatMoney() {
|
|
22636
|
+
_mintUnitViaFlatMoney = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, depositAmount, slippage, // 0.5 means 0.5%
|
|
22637
|
+
maxKeeperFeeInUsd, options, estimateGas) {
|
|
22638
|
+
var flatMoneyContracts, keeperfee, adjustedDepositAmount, amountOut, minAmountOut, mintUnitTxData, tx;
|
|
22639
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
22640
|
+
while (1) {
|
|
22641
|
+
switch (_context.prev = _context.next) {
|
|
22642
|
+
case 0:
|
|
22643
|
+
if (options === void 0) {
|
|
22644
|
+
options = null;
|
|
22645
|
+
}
|
|
22646
|
+
|
|
22647
|
+
if (estimateGas === void 0) {
|
|
22648
|
+
estimateGas = false;
|
|
22649
|
+
}
|
|
22650
|
+
|
|
22651
|
+
flatMoneyContracts = flatMoneyContractAddresses[pool.network];
|
|
22652
|
+
|
|
22653
|
+
if (flatMoneyContracts) {
|
|
22654
|
+
_context.next = 5;
|
|
22655
|
+
break;
|
|
22656
|
+
}
|
|
22657
|
+
|
|
22658
|
+
throw new Error("mintUnitViaFlatMoney: network not supported");
|
|
22659
|
+
|
|
22660
|
+
case 5:
|
|
22661
|
+
_context.next = 7;
|
|
22662
|
+
return getKeeperFee(pool, maxKeeperFeeInUsd);
|
|
22663
|
+
|
|
22664
|
+
case 7:
|
|
22665
|
+
keeperfee = _context.sent;
|
|
22666
|
+
// in RETH
|
|
22667
|
+
adjustedDepositAmount = new BigNumber$1(depositAmount.toString()).minus(keeperfee.toString() // keeper fee deducted from amountIn
|
|
22668
|
+
);
|
|
22669
|
+
_context.next = 11;
|
|
22670
|
+
return getStableDepositQuote(pool, adjustedDepositAmount.toFixed(0));
|
|
22671
|
+
|
|
22672
|
+
case 11:
|
|
22673
|
+
amountOut = _context.sent;
|
|
22674
|
+
minAmountOut = new BigNumber$1(amountOut.toString()).times(1 - slippage / 100).toFixed(0);
|
|
22675
|
+
_context.next = 15;
|
|
22676
|
+
return getAnnounceStableDepositTxData(adjustedDepositAmount.toFixed(0), minAmountOut, keeperfee);
|
|
22677
|
+
|
|
22678
|
+
case 15:
|
|
22679
|
+
mintUnitTxData = _context.sent;
|
|
22680
|
+
_context.next = 18;
|
|
22681
|
+
return getPoolTxOrGasEstimate(pool, [flatMoneyContracts.DelayedOrder, mintUnitTxData, options], estimateGas);
|
|
22682
|
+
|
|
22683
|
+
case 18:
|
|
22684
|
+
tx = _context.sent;
|
|
22685
|
+
return _context.abrupt("return", tx);
|
|
22686
|
+
|
|
22687
|
+
case 20:
|
|
22688
|
+
case "end":
|
|
22689
|
+
return _context.stop();
|
|
22690
|
+
}
|
|
22691
|
+
}
|
|
22692
|
+
}, _callee);
|
|
22693
|
+
}));
|
|
22694
|
+
return _mintUnitViaFlatMoney.apply(this, arguments);
|
|
22695
|
+
}
|
|
22696
|
+
|
|
22697
|
+
function redeemUnitViaFlatMoney(_x7, _x8, _x9, _x10, _x11, _x12) {
|
|
22698
|
+
return _redeemUnitViaFlatMoney.apply(this, arguments);
|
|
22699
|
+
}
|
|
22700
|
+
|
|
22701
|
+
function _redeemUnitViaFlatMoney() {
|
|
22702
|
+
_redeemUnitViaFlatMoney = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, withdrawAmount, slippage, // 0.5 means 0.5%
|
|
22703
|
+
maxKeeperFeeInUsd, options, estimateGas) {
|
|
22704
|
+
var flatMoneyContracts, keeperfee, amountOut, minAmountOut, redeemUnitTxData, tx;
|
|
22705
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
22706
|
+
while (1) {
|
|
22707
|
+
switch (_context2.prev = _context2.next) {
|
|
22708
|
+
case 0:
|
|
22709
|
+
if (options === void 0) {
|
|
22710
|
+
options = null;
|
|
22711
|
+
}
|
|
22712
|
+
|
|
22713
|
+
if (estimateGas === void 0) {
|
|
22714
|
+
estimateGas = false;
|
|
22715
|
+
}
|
|
22716
|
+
|
|
22717
|
+
flatMoneyContracts = flatMoneyContractAddresses[pool.network];
|
|
22718
|
+
|
|
22719
|
+
if (flatMoneyContracts) {
|
|
22720
|
+
_context2.next = 5;
|
|
22721
|
+
break;
|
|
22722
|
+
}
|
|
22723
|
+
|
|
22724
|
+
throw new Error("redeemUnitViaFlatMoney: network not supported");
|
|
22725
|
+
|
|
22726
|
+
case 5:
|
|
22727
|
+
_context2.next = 7;
|
|
22728
|
+
return getKeeperFee(pool, maxKeeperFeeInUsd);
|
|
22729
|
+
|
|
22730
|
+
case 7:
|
|
22731
|
+
keeperfee = _context2.sent;
|
|
22732
|
+
_context2.next = 10;
|
|
22733
|
+
return getStableWithdrawQuote(pool, withdrawAmount);
|
|
22734
|
+
|
|
22735
|
+
case 10:
|
|
22736
|
+
amountOut = _context2.sent;
|
|
22737
|
+
minAmountOut = new BigNumber$1(amountOut.toString()).times(1 - slippage / 100).minus(keeperfee.toString()) // keeper fee deducted from amountOut
|
|
22738
|
+
.toFixed(0);
|
|
22739
|
+
_context2.next = 14;
|
|
22740
|
+
return getAnnounceStableWithdrawTxData(withdrawAmount, minAmountOut, keeperfee);
|
|
22741
|
+
|
|
22742
|
+
case 14:
|
|
22743
|
+
redeemUnitTxData = _context2.sent;
|
|
22744
|
+
_context2.next = 17;
|
|
22745
|
+
return getPoolTxOrGasEstimate(pool, [flatMoneyContracts.DelayedOrder, redeemUnitTxData, options], estimateGas);
|
|
22746
|
+
|
|
22747
|
+
case 17:
|
|
22748
|
+
tx = _context2.sent;
|
|
22749
|
+
return _context2.abrupt("return", tx);
|
|
22750
|
+
|
|
22751
|
+
case 19:
|
|
22752
|
+
case "end":
|
|
22753
|
+
return _context2.stop();
|
|
22754
|
+
}
|
|
22755
|
+
}
|
|
22756
|
+
}, _callee2);
|
|
22757
|
+
}));
|
|
22758
|
+
return _redeemUnitViaFlatMoney.apply(this, arguments);
|
|
22759
|
+
}
|
|
22760
|
+
|
|
22761
|
+
function cancelOrderViaFlatMoney(_x13, _x14, _x15) {
|
|
22762
|
+
return _cancelOrderViaFlatMoney.apply(this, arguments);
|
|
22763
|
+
}
|
|
22764
|
+
|
|
22765
|
+
function _cancelOrderViaFlatMoney() {
|
|
22766
|
+
_cancelOrderViaFlatMoney = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, options, estimateGas) {
|
|
22767
|
+
var flatMoneyContracts, cancelOrderTxData, tx;
|
|
22768
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
22769
|
+
while (1) {
|
|
22770
|
+
switch (_context3.prev = _context3.next) {
|
|
22771
|
+
case 0:
|
|
22772
|
+
if (options === void 0) {
|
|
22773
|
+
options = null;
|
|
22774
|
+
}
|
|
22775
|
+
|
|
22776
|
+
if (estimateGas === void 0) {
|
|
22777
|
+
estimateGas = false;
|
|
22778
|
+
}
|
|
22779
|
+
|
|
22780
|
+
flatMoneyContracts = flatMoneyContractAddresses[pool.network];
|
|
22781
|
+
|
|
22782
|
+
if (flatMoneyContracts) {
|
|
22783
|
+
_context3.next = 5;
|
|
22784
|
+
break;
|
|
22785
|
+
}
|
|
22786
|
+
|
|
22787
|
+
throw new Error("cancelOrderViaFlatMoney: network not supported");
|
|
22788
|
+
|
|
22789
|
+
case 5:
|
|
22790
|
+
_context3.next = 7;
|
|
22791
|
+
return getCancelExistingOrderTxData(pool.address);
|
|
22792
|
+
|
|
22793
|
+
case 7:
|
|
22794
|
+
cancelOrderTxData = _context3.sent;
|
|
22795
|
+
_context3.next = 10;
|
|
22796
|
+
return getPoolTxOrGasEstimate(pool, [flatMoneyContracts.DelayedOrder, cancelOrderTxData, options], estimateGas);
|
|
22797
|
+
|
|
22798
|
+
case 10:
|
|
22799
|
+
tx = _context3.sent;
|
|
22800
|
+
return _context3.abrupt("return", tx);
|
|
22801
|
+
|
|
22802
|
+
case 12:
|
|
22803
|
+
case "end":
|
|
22804
|
+
return _context3.stop();
|
|
22805
|
+
}
|
|
22806
|
+
}
|
|
22807
|
+
}, _callee3);
|
|
22808
|
+
}));
|
|
22809
|
+
return _cancelOrderViaFlatMoney.apply(this, arguments);
|
|
22810
|
+
}
|
|
22811
|
+
|
|
20061
22812
|
var Pool = /*#__PURE__*/function () {
|
|
20062
22813
|
function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
|
|
20063
22814
|
this.network = network;
|
|
@@ -22845,6 +25596,149 @@ var Pool = /*#__PURE__*/function () {
|
|
|
22845
25596
|
}
|
|
22846
25597
|
|
|
22847
25598
|
return exitVestedToken;
|
|
25599
|
+
}()
|
|
25600
|
+
/** deposit rETH to mint UNIT via the Flat Money protocol
|
|
25601
|
+
*
|
|
25602
|
+
* @param { BigNumber | string } depositAmount Amount of rETH to deposit
|
|
25603
|
+
* @param { number } slippage slippage, 0.5 represents 0.5%
|
|
25604
|
+
* @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
|
|
25605
|
+
* @param {any} options Transaction options
|
|
25606
|
+
* @param {boolean} estimateGas Simulate/estimate gas
|
|
25607
|
+
* @returns {Promise<any>} Transaction
|
|
25608
|
+
*/
|
|
25609
|
+
;
|
|
25610
|
+
|
|
25611
|
+
_proto.mintUnitViaFlatMoney =
|
|
25612
|
+
/*#__PURE__*/
|
|
25613
|
+
function () {
|
|
25614
|
+
var _mintUnitViaFlatMoney2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee47(depositAmount, slippage, maxKeeperFeeInUsd, options, estimateGas) {
|
|
25615
|
+
var tx;
|
|
25616
|
+
return runtime_1.wrap(function _callee47$(_context47) {
|
|
25617
|
+
while (1) {
|
|
25618
|
+
switch (_context47.prev = _context47.next) {
|
|
25619
|
+
case 0:
|
|
25620
|
+
if (slippage === void 0) {
|
|
25621
|
+
slippage = 0.5;
|
|
25622
|
+
}
|
|
25623
|
+
|
|
25624
|
+
if (options === void 0) {
|
|
25625
|
+
options = null;
|
|
25626
|
+
}
|
|
25627
|
+
|
|
25628
|
+
if (estimateGas === void 0) {
|
|
25629
|
+
estimateGas = false;
|
|
25630
|
+
}
|
|
25631
|
+
|
|
25632
|
+
_context47.next = 5;
|
|
25633
|
+
return mintUnitViaFlatMoney(this, depositAmount, slippage, maxKeeperFeeInUsd, options, estimateGas);
|
|
25634
|
+
|
|
25635
|
+
case 5:
|
|
25636
|
+
tx = _context47.sent;
|
|
25637
|
+
return _context47.abrupt("return", tx);
|
|
25638
|
+
|
|
25639
|
+
case 7:
|
|
25640
|
+
case "end":
|
|
25641
|
+
return _context47.stop();
|
|
25642
|
+
}
|
|
25643
|
+
}
|
|
25644
|
+
}, _callee47, this);
|
|
25645
|
+
}));
|
|
25646
|
+
|
|
25647
|
+
function mintUnitViaFlatMoney$1(_x227, _x228, _x229, _x230, _x231) {
|
|
25648
|
+
return _mintUnitViaFlatMoney2.apply(this, arguments);
|
|
25649
|
+
}
|
|
25650
|
+
|
|
25651
|
+
return mintUnitViaFlatMoney$1;
|
|
25652
|
+
}()
|
|
25653
|
+
/** redeem UNIT via the Flat Money protocol
|
|
25654
|
+
*
|
|
25655
|
+
* @param { BigNumber | string } depositAmount Amount of UNIT to withdraw
|
|
25656
|
+
* @param { number } slippage slippage, 0.5 represents 0.5%
|
|
25657
|
+
* @param { number | null } maxKeeperFeeInUsd 5 represents $5; null will skip the maxKeeperFee check
|
|
25658
|
+
* @param {any} options Transaction options
|
|
25659
|
+
* @param {boolean} estimateGas Simulate/estimate gas
|
|
25660
|
+
* @returns {Promise<any>} Transaction
|
|
25661
|
+
*/
|
|
25662
|
+
;
|
|
25663
|
+
|
|
25664
|
+
_proto.redeemUnitViaFlatMoney =
|
|
25665
|
+
/*#__PURE__*/
|
|
25666
|
+
function () {
|
|
25667
|
+
var _redeemUnitViaFlatMoney2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee48(withdrawAmount, slippage, maxKeeperFeeInUsd, options, estimateGas) {
|
|
25668
|
+
var tx;
|
|
25669
|
+
return runtime_1.wrap(function _callee48$(_context48) {
|
|
25670
|
+
while (1) {
|
|
25671
|
+
switch (_context48.prev = _context48.next) {
|
|
25672
|
+
case 0:
|
|
25673
|
+
if (slippage === void 0) {
|
|
25674
|
+
slippage = 0.5;
|
|
25675
|
+
}
|
|
25676
|
+
|
|
25677
|
+
if (options === void 0) {
|
|
25678
|
+
options = null;
|
|
25679
|
+
}
|
|
25680
|
+
|
|
25681
|
+
if (estimateGas === void 0) {
|
|
25682
|
+
estimateGas = false;
|
|
25683
|
+
}
|
|
25684
|
+
|
|
25685
|
+
_context48.next = 5;
|
|
25686
|
+
return redeemUnitViaFlatMoney(this, withdrawAmount, slippage, maxKeeperFeeInUsd, options, estimateGas);
|
|
25687
|
+
|
|
25688
|
+
case 5:
|
|
25689
|
+
tx = _context48.sent;
|
|
25690
|
+
return _context48.abrupt("return", tx);
|
|
25691
|
+
|
|
25692
|
+
case 7:
|
|
25693
|
+
case "end":
|
|
25694
|
+
return _context48.stop();
|
|
25695
|
+
}
|
|
25696
|
+
}
|
|
25697
|
+
}, _callee48, this);
|
|
25698
|
+
}));
|
|
25699
|
+
|
|
25700
|
+
function redeemUnitViaFlatMoney$1(_x232, _x233, _x234, _x235, _x236) {
|
|
25701
|
+
return _redeemUnitViaFlatMoney2.apply(this, arguments);
|
|
25702
|
+
}
|
|
25703
|
+
|
|
25704
|
+
return redeemUnitViaFlatMoney$1;
|
|
25705
|
+
}();
|
|
25706
|
+
|
|
25707
|
+
_proto.cancelOrderViaFlatMoney = /*#__PURE__*/function () {
|
|
25708
|
+
var _cancelOrderViaFlatMoney2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee49(options, estimateGas) {
|
|
25709
|
+
var tx;
|
|
25710
|
+
return runtime_1.wrap(function _callee49$(_context49) {
|
|
25711
|
+
while (1) {
|
|
25712
|
+
switch (_context49.prev = _context49.next) {
|
|
25713
|
+
case 0:
|
|
25714
|
+
if (options === void 0) {
|
|
25715
|
+
options = null;
|
|
25716
|
+
}
|
|
25717
|
+
|
|
25718
|
+
if (estimateGas === void 0) {
|
|
25719
|
+
estimateGas = false;
|
|
25720
|
+
}
|
|
25721
|
+
|
|
25722
|
+
_context49.next = 4;
|
|
25723
|
+
return cancelOrderViaFlatMoney(this, options, estimateGas);
|
|
25724
|
+
|
|
25725
|
+
case 4:
|
|
25726
|
+
tx = _context49.sent;
|
|
25727
|
+
return _context49.abrupt("return", tx);
|
|
25728
|
+
|
|
25729
|
+
case 6:
|
|
25730
|
+
case "end":
|
|
25731
|
+
return _context49.stop();
|
|
25732
|
+
}
|
|
25733
|
+
}
|
|
25734
|
+
}, _callee49, this);
|
|
25735
|
+
}));
|
|
25736
|
+
|
|
25737
|
+
function cancelOrderViaFlatMoney$1(_x237, _x238) {
|
|
25738
|
+
return _cancelOrderViaFlatMoney2.apply(this, arguments);
|
|
25739
|
+
}
|
|
25740
|
+
|
|
25741
|
+
return cancelOrderViaFlatMoney$1;
|
|
22848
25742
|
}();
|
|
22849
25743
|
|
|
22850
25744
|
return Pool;
|