@paraswap/dex-lib 3.8.32-inception.2 → 3.8.32-inception.3
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/dex/inception/inception-event-pool.d.ts +4 -4
- package/build/dex/inception/inception-event-pool.js +9 -7
- package/build/dex/inception/inception-event-pool.js.map +1 -1
- package/build/dex/inception/inception.d.ts +6 -6
- package/build/dex/inception/inception.js +31 -15
- package/build/dex/inception/inception.js.map +1 -1
- package/build/dex/inception/tokens.d.ts +1 -1
- package/package.json +1 -1
- package/src/dex/inception/inception-event-pool.ts +9 -7
- package/src/dex/inception/inception-events.test.ts +1 -4
- package/src/dex/inception/inception.ts +52 -19
- package/src/dex/inception/tokens.ts +1 -1
- package/src/abi/inception/inception-ineth.json +0 -609
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
2
|
-
import { BlockHeader, Log, Logger } from '../../types';
|
|
2
|
+
import { Address, BlockHeader, Log, Logger } from '../../types';
|
|
3
3
|
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
4
4
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
-
import {
|
|
5
|
+
import { PoolState } from './types';
|
|
6
6
|
import { Interface } from '@ethersproject/abi';
|
|
7
7
|
export declare class InceptionEventPool extends StatefulEventSubscriber<PoolState> {
|
|
8
8
|
protected network: number;
|
|
9
9
|
protected dexHelper: IDexHelper;
|
|
10
|
-
|
|
10
|
+
protected ratioFeedAddress: Address;
|
|
11
11
|
poolInterface: Interface;
|
|
12
12
|
protected ratioFeedInterface: Interface;
|
|
13
|
-
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger,
|
|
13
|
+
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, ratioFeedAddress: Address, poolInterface: Interface);
|
|
14
14
|
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): AsyncOrSync<DeepReadonly<PoolState> | null>;
|
|
15
15
|
generateState(blockNumber: number): Promise<Readonly<PoolState>>;
|
|
16
16
|
}
|
|
@@ -11,14 +11,14 @@ const abi_1 = require("@ethersproject/abi");
|
|
|
11
11
|
const inception_ratio_feed_json_1 = __importDefault(require("../../abi/inception/inception-ratio-feed.json"));
|
|
12
12
|
const tokens_1 = require("./tokens");
|
|
13
13
|
class InceptionEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
14
|
-
constructor(parentName, network, dexHelper, logger,
|
|
15
|
-
super(parentName,
|
|
14
|
+
constructor(parentName, network, dexHelper, logger, ratioFeedAddress, poolInterface) {
|
|
15
|
+
super(parentName, ratioFeedAddress, dexHelper, logger);
|
|
16
16
|
this.network = network;
|
|
17
17
|
this.dexHelper = dexHelper;
|
|
18
|
-
this.
|
|
18
|
+
this.ratioFeedAddress = ratioFeedAddress;
|
|
19
19
|
this.poolInterface = poolInterface;
|
|
20
20
|
this.ratioFeedInterface = new abi_1.Interface(inception_ratio_feed_json_1.default);
|
|
21
|
-
this.addressesSubscribed = [
|
|
21
|
+
this.addressesSubscribed = [ratioFeedAddress];
|
|
22
22
|
}
|
|
23
23
|
processLog(state, log, blockHeader) {
|
|
24
24
|
try {
|
|
@@ -27,9 +27,11 @@ class InceptionEventPool extends stateful_event_subscriber_1.StatefulEventSubscr
|
|
|
27
27
|
switch (parsed.name) {
|
|
28
28
|
case 'RatioUpdated': {
|
|
29
29
|
const tokenInfo = (0, tokens_1.getTokenFromAddress)(this.network, parsed.args[0]);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
if (tokenInfo) {
|
|
31
|
+
_state[tokenInfo.symbol.toLowerCase()] = {
|
|
32
|
+
ratio: BigInt(parsed.args[2].toString()),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
33
35
|
return _state;
|
|
34
36
|
}
|
|
35
37
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inception-event-pool.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-event-pool.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAGvB,+EAA0E;AAG1E,mCAA0C;AAC1C,4CAA+C;AAC/C,8GAAiF;AACjF,qCAA+C;AAE/C,MAAa,kBAAmB,SAAQ,mDAAkC;IAExE,YACE,UAAkB,EACR,OAAe,EACf,SAAqB,EAC/B,MAAc,
|
|
1
|
+
{"version":3,"file":"inception-event-pool.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-event-pool.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAGvB,+EAA0E;AAG1E,mCAA0C;AAC1C,4CAA+C;AAC/C,8GAAiF;AACjF,qCAA+C;AAE/C,MAAa,kBAAmB,SAAQ,mDAAkC;IAExE,YACE,UAAkB,EACR,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,gBAAyB,EAC5B,aAAwB;QAE/B,KAAK,CAAC,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAN7C,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,qBAAgB,GAAhB,gBAAgB,CAAS;QAC5B,kBAAa,GAAb,aAAa,CAAW;QAPvB,uBAAkB,GAAc,IAAI,eAAS,CAAC,mCAAoB,CAAC,CAAC;QAW5E,IAAI,CAAC,mBAAmB,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAChD,CAAC;IAES,UAAU,CAClB,KAA8B,EAC9B,GAAkB,EAClB,WAAkC;QAElC,IAAI;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACrD,MAAM,MAAM,GAAc,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC7C,QAAQ,MAAM,CAAC,IAAI,EAAE;gBACnB,KAAK,cAAc,CAAC,CAAC;oBACnB,MAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpE,IAAI,SAAS,EAAE;wBACb,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG;4BACvC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;yBACzC,CAAC;qBACH;oBACD,OAAO,MAAM,CAAC;iBACf;gBACD;oBACE,OAAO,MAAM,CAAC;aACjB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,OAAO,IAAA,uBAAe,EACpB,IAAI,CAAC,SAAS,CAAC,aAAa,EAC5B,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,WAAW,CACZ,CAAC;IACJ,CAAC;CACF;AAlDD,gDAkDC"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { Interface } from '@ethersproject/abi';
|
|
2
2
|
import { AsyncOrSync } from 'ts-essentials';
|
|
3
3
|
import { NumberAsString, SwapSide } from '@paraswap/core';
|
|
4
|
-
import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, Logger, PoolLiquidity, PoolPrices, Token } from '../../types';
|
|
4
|
+
import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, Logger, PoolLiquidity, PoolPrices, Token, TransferFeeParams } from '../../types';
|
|
5
5
|
import { Network } from '../../constants';
|
|
6
6
|
import { IDex } from '../../dex/idex';
|
|
7
7
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
8
|
-
import {
|
|
8
|
+
import { InceptionDexData, PoolState } from './types';
|
|
9
9
|
import { SimpleExchange } from '../simple-exchange';
|
|
10
10
|
import { InceptionEventPool } from './inception-event-pool';
|
|
11
11
|
export declare class Inception extends SimpleExchange implements IDex<InceptionDexData> {
|
|
12
12
|
readonly network: Network;
|
|
13
13
|
readonly dexKey: string;
|
|
14
14
|
readonly dexHelper: IDexHelper;
|
|
15
|
-
protected config: DexParams[];
|
|
15
|
+
protected config: import("./types").DexParams[];
|
|
16
16
|
protected vaultInterface: Interface;
|
|
17
17
|
protected poolInterface: Interface;
|
|
18
18
|
readonly hasConstantPriceLargeAmounts = false;
|
|
19
19
|
readonly needWrapNative = false;
|
|
20
|
-
readonly isFeeOnTransferSupported =
|
|
20
|
+
readonly isFeeOnTransferSupported = true;
|
|
21
21
|
static dexKeysWithNetwork: {
|
|
22
22
|
key: string;
|
|
23
23
|
networks: Network[];
|
|
24
24
|
}[];
|
|
25
25
|
logger: Logger;
|
|
26
26
|
private eventPool;
|
|
27
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, config?: DexParams[]);
|
|
27
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, config?: import("./types").DexParams[]);
|
|
28
28
|
initializePricing(blockNumber: number): Promise<void>;
|
|
29
29
|
initializeTokens(): Promise<void>;
|
|
30
30
|
getAdapters(side: SwapSide): {
|
|
@@ -33,7 +33,7 @@ export declare class Inception extends SimpleExchange implements IDex<InceptionD
|
|
|
33
33
|
}[] | null;
|
|
34
34
|
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
35
35
|
getPoolState(pool: InceptionEventPool, blockNumber: number): Promise<PoolState>;
|
|
36
|
-
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<InceptionDexData>>;
|
|
36
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[], transferFees?: TransferFeeParams): Promise<null | ExchangePrices<InceptionDexData>>;
|
|
37
37
|
getCalldataGasCost(poolPrices: PoolPrices<InceptionDexData>): number | number[];
|
|
38
38
|
getAdapterParam(): AdapterExchangeParam;
|
|
39
39
|
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: InceptionDexData, side: SwapSide): DexExchangeParam;
|
|
@@ -39,6 +39,7 @@ const config_1 = require("./config");
|
|
|
39
39
|
const tokens_1 = require("./tokens");
|
|
40
40
|
const utils_2 = require("./utils");
|
|
41
41
|
const inception_event_pool_1 = require("./inception-event-pool");
|
|
42
|
+
const token_transfer_fee_1 = require("../../lib/token-transfer-fee");
|
|
42
43
|
const DECIMALS = BigInt(1e18);
|
|
43
44
|
class Inception extends simple_exchange_1.SimpleExchange {
|
|
44
45
|
constructor(network, dexKey, dexHelper, config = config_1.InceptionConfig[dexKey][network]) {
|
|
@@ -49,14 +50,11 @@ class Inception extends simple_exchange_1.SimpleExchange {
|
|
|
49
50
|
this.config = config;
|
|
50
51
|
this.hasConstantPriceLargeAmounts = false;
|
|
51
52
|
this.needWrapNative = false;
|
|
52
|
-
this.isFeeOnTransferSupported =
|
|
53
|
+
this.isFeeOnTransferSupported = true;
|
|
53
54
|
this.logger = dexHelper.getLogger(dexKey);
|
|
54
55
|
this.vaultInterface = new abi_1.Interface(inception_vault_json_1.default);
|
|
55
56
|
this.poolInterface = new abi_1.Interface(inception_ineth_pool_json_1.default);
|
|
56
|
-
this.eventPool = new inception_event_pool_1.InceptionEventPool(dexKey, network, dexHelper, this.logger,
|
|
57
|
-
ratioFeedAddress: config_1.InceptionPricePoolConfig[dexKey][network].ratioFeed,
|
|
58
|
-
initState: {},
|
|
59
|
-
}, this.poolInterface);
|
|
57
|
+
this.eventPool = new inception_event_pool_1.InceptionEventPool(dexKey, network, dexHelper, this.logger, config_1.InceptionPricePoolConfig[dexKey][network].ratioFeed, this.poolInterface);
|
|
60
58
|
}
|
|
61
59
|
async initializePricing(blockNumber) {
|
|
62
60
|
const poolState = await (0, utils_2.getOnChainState)(this.dexHelper.multiContract, this.vaultInterface, this.network, blockNumber);
|
|
@@ -89,31 +87,41 @@ class Inception extends simple_exchange_1.SimpleExchange {
|
|
|
89
87
|
pool.setState(onChainState, blockNumber);
|
|
90
88
|
return onChainState;
|
|
91
89
|
}
|
|
92
|
-
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools
|
|
90
|
+
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools, transferFees = {
|
|
91
|
+
srcFee: 0,
|
|
92
|
+
destFee: 0,
|
|
93
|
+
srcDexFee: 0,
|
|
94
|
+
destDexFee: 0,
|
|
95
|
+
}) {
|
|
93
96
|
if (side === core_1.SwapSide.BUY) {
|
|
94
97
|
return null;
|
|
95
98
|
}
|
|
96
99
|
const src = (0, tokens_1.getTokenFromAddress)(this.network, srcToken.address);
|
|
97
100
|
const dest = (0, tokens_1.getTokenFromAddress)(this.network, destToken.address);
|
|
98
|
-
if (src !== dest) {
|
|
101
|
+
if (!src || !dest || src !== dest) {
|
|
99
102
|
return null;
|
|
100
103
|
}
|
|
101
104
|
const poolState = await this.getPoolState(this.eventPool, blockNumber);
|
|
102
105
|
if (!poolState)
|
|
103
106
|
return null;
|
|
107
|
+
const unitPrice = DECIMALS;
|
|
108
|
+
const prices = amounts.map(amount => {
|
|
109
|
+
const ratio = poolState[src.symbol.toLowerCase()].ratio;
|
|
110
|
+
return (ratio * amount) / DECIMALS;
|
|
111
|
+
});
|
|
112
|
+
const [unitPriceWithFee, ...pricesWithFee] = (0, token_transfer_fee_1.applyTransferFee)([unitPrice, ...prices], side, side === core_1.SwapSide.SELL ? transferFees.srcFee : transferFees.destFee, side === core_1.SwapSide.SELL
|
|
113
|
+
? constants_1.SRC_TOKEN_PARASWAP_TRANSFERS
|
|
114
|
+
: constants_1.DEST_TOKEN_PARASWAP_TRANSFERS);
|
|
104
115
|
return [
|
|
105
116
|
{
|
|
106
|
-
prices:
|
|
107
|
-
|
|
108
|
-
return (ratio * amount) / DECIMALS;
|
|
109
|
-
}),
|
|
110
|
-
unit: DECIMALS,
|
|
117
|
+
prices: pricesWithFee,
|
|
118
|
+
unit: unitPriceWithFee,
|
|
111
119
|
gasCost: 120000,
|
|
112
120
|
exchange: this.dexKey,
|
|
113
121
|
data: {
|
|
114
122
|
exchange: dest.vault,
|
|
115
123
|
},
|
|
116
|
-
poolAddresses: [
|
|
124
|
+
poolAddresses: [dest.vault],
|
|
117
125
|
},
|
|
118
126
|
];
|
|
119
127
|
}
|
|
@@ -129,12 +137,17 @@ class Inception extends simple_exchange_1.SimpleExchange {
|
|
|
129
137
|
}
|
|
130
138
|
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
131
139
|
const dexParams = (0, tokens_1.getTokenFromAddress)(this.network, srcToken);
|
|
140
|
+
if (!dexParams) {
|
|
141
|
+
throw new Error('Unknown token');
|
|
142
|
+
}
|
|
132
143
|
const isNative = dexParams.baseTokenSlug === 'ETH';
|
|
133
144
|
let swapData;
|
|
134
145
|
let dexFuncHasRecipient;
|
|
146
|
+
let swappedAmountNotPresentInExchangeData;
|
|
135
147
|
if (isNative) {
|
|
136
148
|
swapData = this.poolInterface.encodeFunctionData('stake()', []);
|
|
137
149
|
dexFuncHasRecipient = false;
|
|
150
|
+
swappedAmountNotPresentInExchangeData = true;
|
|
138
151
|
}
|
|
139
152
|
else {
|
|
140
153
|
swapData = this.vaultInterface.encodeFunctionData('deposit', [
|
|
@@ -142,13 +155,14 @@ class Inception extends simple_exchange_1.SimpleExchange {
|
|
|
142
155
|
recipient,
|
|
143
156
|
]);
|
|
144
157
|
dexFuncHasRecipient = true;
|
|
158
|
+
swappedAmountNotPresentInExchangeData = false;
|
|
145
159
|
}
|
|
146
160
|
return {
|
|
147
161
|
needWrapNative: false,
|
|
148
162
|
dexFuncHasRecipient,
|
|
149
163
|
exchangeData: swapData,
|
|
150
164
|
targetExchange: dexParams.vault,
|
|
151
|
-
swappedAmountNotPresentInExchangeData
|
|
165
|
+
swappedAmountNotPresentInExchangeData,
|
|
152
166
|
returnAmountPos: undefined,
|
|
153
167
|
};
|
|
154
168
|
}
|
|
@@ -164,7 +178,9 @@ class Inception extends simple_exchange_1.SimpleExchange {
|
|
|
164
178
|
address: token.vault,
|
|
165
179
|
connectorTokens: [
|
|
166
180
|
{
|
|
167
|
-
address: token.token
|
|
181
|
+
address: tokenAddress.toLowerCase() === token.token.toLowerCase()
|
|
182
|
+
? token.baseToken
|
|
183
|
+
: token.token,
|
|
168
184
|
decimals: 1e18,
|
|
169
185
|
},
|
|
170
186
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inception.js","sourceRoot":"","sources":["../../../src/dex/inception/inception.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;AAE7D,yCAA0D;
|
|
1
|
+
{"version":3,"file":"inception.js","sourceRoot":"","sources":["../../../src/dex/inception/inception.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;AAE7D,yCAA0D;AAY1D,oGAAqE;AACrE,8GAA+E;AAC/E,+CAKyB;AACzB,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAAqE;AACrE,qCAAmE;AACnE,mCAAwD;AACxD,iEAA4D;AAC5D,qEAAgE;AAGhE,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAE9B,MAAa,SACX,SAAQ,gCAAc;IAiBtB,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACpB,SAAS,wBAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;QAEnD,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QALhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QACpB,WAAM,GAAN,MAAM,CAAmC;QAf5C,iCAA4B,GAAG,KAAK,CAAC;QACrC,mBAAc,GAAG,K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B,QAAQ,EAAE,IAAI,CAAC,MAAM;oBACrB,OAAO,EAAE,KAAK,CAAC,KAAK;oBACpB,eAAe,EAAE;wBACf;4BACE,OAAO,EACL,YAAY,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE;gCACtD,CAAC,CAAC,KAAK,CAAC,SAAS;gCACjB,CAAC,CAAC,KAAK,CAAC,KAAK;4BACjB,QAAQ,EAAE,IAAI;yBACf;qBACF;iBACF;aACF,CAAC;SACH;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,gBAAgB,KAAuB,CAAC;;AAxO1C,8BAyOC;AA9Ne,4BAAkB,GAC9B,IAAA,6BAAqB,EAAC,wBAAe,CAAC,CAAC"}
|
|
@@ -6,4 +6,4 @@ export declare const Tokens: {
|
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
8
|
export declare function setTokensOnNetwork(network: Network, tokens: DexParams[]): void;
|
|
9
|
-
export declare function getTokenFromAddress(network: Network, address: string): DexParams;
|
|
9
|
+
export declare function getTokenFromAddress(network: Network, address: string): DexParams | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
3
|
-
import { BlockHeader, Log, Logger } from '../../types';
|
|
3
|
+
import { Address, BlockHeader, Log, Logger } from '../../types';
|
|
4
4
|
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
5
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
6
6
|
import { PoolConfig, PoolState } from './types';
|
|
@@ -16,12 +16,12 @@ export class InceptionEventPool extends StatefulEventSubscriber<PoolState> {
|
|
|
16
16
|
protected network: number,
|
|
17
17
|
protected dexHelper: IDexHelper,
|
|
18
18
|
logger: Logger,
|
|
19
|
-
|
|
19
|
+
protected ratioFeedAddress: Address,
|
|
20
20
|
public poolInterface: Interface,
|
|
21
21
|
) {
|
|
22
|
-
super(parentName,
|
|
22
|
+
super(parentName, ratioFeedAddress, dexHelper, logger);
|
|
23
23
|
|
|
24
|
-
this.addressesSubscribed = [
|
|
24
|
+
this.addressesSubscribed = [ratioFeedAddress];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
protected processLog(
|
|
@@ -35,9 +35,11 @@ export class InceptionEventPool extends StatefulEventSubscriber<PoolState> {
|
|
|
35
35
|
switch (parsed.name) {
|
|
36
36
|
case 'RatioUpdated': {
|
|
37
37
|
const tokenInfo = getTokenFromAddress(this.network, parsed.args[0]);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
if (tokenInfo) {
|
|
39
|
+
_state[tokenInfo.symbol.toLowerCase()] = {
|
|
40
|
+
ratio: BigInt(parsed.args[2].toString()),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
41
43
|
return _state;
|
|
42
44
|
}
|
|
43
45
|
default:
|
|
@@ -10,20 +10,28 @@ import {
|
|
|
10
10
|
PoolLiquidity,
|
|
11
11
|
PoolPrices,
|
|
12
12
|
Token,
|
|
13
|
+
TransferFeeParams,
|
|
13
14
|
} from '../../types';
|
|
14
15
|
import INCEPTION_ABI from '../../abi/inception/inception-vault.json';
|
|
15
16
|
import INCEPTION_POOL_ABI from '../../abi/inception/inception-ineth-pool.json';
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
DEST_TOKEN_PARASWAP_TRANSFERS,
|
|
19
|
+
Network,
|
|
20
|
+
NULL_ADDRESS,
|
|
21
|
+
SRC_TOKEN_PARASWAP_TRANSFERS,
|
|
22
|
+
} from '../../constants';
|
|
17
23
|
import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
|
|
18
|
-
import { getDexKeysWithNetwork
|
|
24
|
+
import { getDexKeysWithNetwork } from '../../utils';
|
|
19
25
|
import { IDex } from '../../dex/idex';
|
|
20
26
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
21
|
-
import {
|
|
27
|
+
import { InceptionDexData, PoolState } from './types';
|
|
22
28
|
import { SimpleExchange } from '../simple-exchange';
|
|
23
29
|
import { InceptionConfig, InceptionPricePoolConfig } from './config';
|
|
24
|
-
import { getTokenFromAddress, setTokensOnNetwork
|
|
30
|
+
import { getTokenFromAddress, setTokensOnNetwork } from './tokens';
|
|
25
31
|
import { getOnChainState, getTokenList } from './utils';
|
|
26
32
|
import { InceptionEventPool } from './inception-event-pool';
|
|
33
|
+
import { applyTransferFee } from '../../lib/token-transfer-fee';
|
|
34
|
+
import { RETURN_AMOUNT_POS_0 } from '../../executor/constants';
|
|
27
35
|
|
|
28
36
|
const DECIMALS = BigInt(1e18);
|
|
29
37
|
|
|
@@ -36,7 +44,7 @@ export class Inception
|
|
|
36
44
|
|
|
37
45
|
readonly hasConstantPriceLargeAmounts = false;
|
|
38
46
|
readonly needWrapNative = false;
|
|
39
|
-
readonly isFeeOnTransferSupported =
|
|
47
|
+
readonly isFeeOnTransferSupported = true;
|
|
40
48
|
|
|
41
49
|
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
42
50
|
getDexKeysWithNetwork(InceptionConfig);
|
|
@@ -60,10 +68,7 @@ export class Inception
|
|
|
60
68
|
network,
|
|
61
69
|
dexHelper,
|
|
62
70
|
this.logger,
|
|
63
|
-
|
|
64
|
-
ratioFeedAddress: InceptionPricePoolConfig[dexKey][network].ratioFeed,
|
|
65
|
-
initState: {},
|
|
66
|
-
},
|
|
71
|
+
InceptionPricePoolConfig[dexKey][network].ratioFeed,
|
|
67
72
|
this.poolInterface,
|
|
68
73
|
);
|
|
69
74
|
}
|
|
@@ -125,6 +130,12 @@ export class Inception
|
|
|
125
130
|
side: SwapSide,
|
|
126
131
|
blockNumber: number,
|
|
127
132
|
limitPools?: string[],
|
|
133
|
+
transferFees: TransferFeeParams = {
|
|
134
|
+
srcFee: 0,
|
|
135
|
+
destFee: 0,
|
|
136
|
+
srcDexFee: 0,
|
|
137
|
+
destDexFee: 0,
|
|
138
|
+
},
|
|
128
139
|
): Promise<null | ExchangePrices<InceptionDexData>> {
|
|
129
140
|
if (side === SwapSide.BUY) {
|
|
130
141
|
return null;
|
|
@@ -133,26 +144,38 @@ export class Inception
|
|
|
133
144
|
const src = getTokenFromAddress(this.network, srcToken.address);
|
|
134
145
|
const dest = getTokenFromAddress(this.network, destToken.address);
|
|
135
146
|
|
|
136
|
-
if (src !== dest) {
|
|
147
|
+
if (!src || !dest || src !== dest) {
|
|
137
148
|
return null;
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
const poolState = await this.getPoolState(this.eventPool, blockNumber);
|
|
141
152
|
if (!poolState) return null;
|
|
142
153
|
|
|
154
|
+
const unitPrice = DECIMALS;
|
|
155
|
+
const prices = amounts.map(amount => {
|
|
156
|
+
const ratio = poolState[src.symbol.toLowerCase()].ratio;
|
|
157
|
+
return (ratio * amount) / DECIMALS;
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const [unitPriceWithFee, ...pricesWithFee] = applyTransferFee(
|
|
161
|
+
[unitPrice, ...prices],
|
|
162
|
+
side,
|
|
163
|
+
side === SwapSide.SELL ? transferFees.srcFee : transferFees.destFee,
|
|
164
|
+
side === SwapSide.SELL
|
|
165
|
+
? SRC_TOKEN_PARASWAP_TRANSFERS
|
|
166
|
+
: DEST_TOKEN_PARASWAP_TRANSFERS,
|
|
167
|
+
);
|
|
168
|
+
|
|
143
169
|
return [
|
|
144
170
|
{
|
|
145
|
-
prices:
|
|
146
|
-
|
|
147
|
-
return (ratio * amount) / DECIMALS;
|
|
148
|
-
}),
|
|
149
|
-
unit: DECIMALS,
|
|
171
|
+
prices: pricesWithFee,
|
|
172
|
+
unit: unitPriceWithFee,
|
|
150
173
|
gasCost: 120_000,
|
|
151
174
|
exchange: this.dexKey,
|
|
152
175
|
data: {
|
|
153
176
|
exchange: dest.vault,
|
|
154
177
|
},
|
|
155
|
-
poolAddresses: [
|
|
178
|
+
poolAddresses: [dest.vault],
|
|
156
179
|
},
|
|
157
180
|
];
|
|
158
181
|
}
|
|
@@ -182,18 +205,25 @@ export class Inception
|
|
|
182
205
|
): DexExchangeParam {
|
|
183
206
|
const dexParams = getTokenFromAddress(this.network, srcToken);
|
|
184
207
|
|
|
208
|
+
if (!dexParams) {
|
|
209
|
+
throw new Error('Unknown token');
|
|
210
|
+
}
|
|
211
|
+
|
|
185
212
|
const isNative = dexParams.baseTokenSlug === 'ETH';
|
|
186
213
|
let swapData;
|
|
187
214
|
let dexFuncHasRecipient;
|
|
215
|
+
let swappedAmountNotPresentInExchangeData;
|
|
188
216
|
if (isNative) {
|
|
189
217
|
swapData = this.poolInterface.encodeFunctionData('stake()', []);
|
|
190
218
|
dexFuncHasRecipient = false;
|
|
219
|
+
swappedAmountNotPresentInExchangeData = true;
|
|
191
220
|
} else {
|
|
192
221
|
swapData = this.vaultInterface.encodeFunctionData('deposit', [
|
|
193
222
|
srcAmount,
|
|
194
223
|
recipient,
|
|
195
224
|
]);
|
|
196
225
|
dexFuncHasRecipient = true;
|
|
226
|
+
swappedAmountNotPresentInExchangeData = false;
|
|
197
227
|
}
|
|
198
228
|
|
|
199
229
|
return {
|
|
@@ -201,7 +231,7 @@ export class Inception
|
|
|
201
231
|
dexFuncHasRecipient,
|
|
202
232
|
exchangeData: swapData,
|
|
203
233
|
targetExchange: dexParams.vault,
|
|
204
|
-
swappedAmountNotPresentInExchangeData
|
|
234
|
+
swappedAmountNotPresentInExchangeData,
|
|
205
235
|
returnAmountPos: undefined,
|
|
206
236
|
};
|
|
207
237
|
}
|
|
@@ -214,7 +244,7 @@ export class Inception
|
|
|
214
244
|
): Promise<PoolLiquidity[]> {
|
|
215
245
|
await this.initializeTokens();
|
|
216
246
|
|
|
217
|
-
const token
|
|
247
|
+
const token = getTokenFromAddress(this.network, tokenAddress);
|
|
218
248
|
|
|
219
249
|
if (token) {
|
|
220
250
|
return [
|
|
@@ -224,7 +254,10 @@ export class Inception
|
|
|
224
254
|
address: token.vault,
|
|
225
255
|
connectorTokens: [
|
|
226
256
|
{
|
|
227
|
-
address:
|
|
257
|
+
address:
|
|
258
|
+
tokenAddress.toLowerCase() === token.token.toLowerCase()
|
|
259
|
+
? token.baseToken
|
|
260
|
+
: token.token,
|
|
228
261
|
decimals: 1e18,
|
|
229
262
|
},
|
|
230
263
|
],
|
|
@@ -32,6 +32,6 @@ export function setTokensOnNetwork(network: Network, tokens: DexParams[]) {
|
|
|
32
32
|
export function getTokenFromAddress(
|
|
33
33
|
network: Network,
|
|
34
34
|
address: string,
|
|
35
|
-
): DexParams {
|
|
35
|
+
): DexParams | undefined {
|
|
36
36
|
return TokensByAddress[network]?.[address.toLowerCase()];
|
|
37
37
|
}
|
|
@@ -1,609 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [],
|
|
4
|
-
"stateMutability": "nonpayable",
|
|
5
|
-
"type": "constructor"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"inputs": [
|
|
9
|
-
{
|
|
10
|
-
"internalType": "address",
|
|
11
|
-
"name": "spender",
|
|
12
|
-
"type": "address"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"internalType": "uint256",
|
|
16
|
-
"name": "allowance",
|
|
17
|
-
"type": "uint256"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"internalType": "uint256",
|
|
21
|
-
"name": "needed",
|
|
22
|
-
"type": "uint256"
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"name": "ERC20InsufficientAllowance",
|
|
26
|
-
"type": "error"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"inputs": [
|
|
30
|
-
{
|
|
31
|
-
"internalType": "address",
|
|
32
|
-
"name": "sender",
|
|
33
|
-
"type": "address"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"internalType": "uint256",
|
|
37
|
-
"name": "balance",
|
|
38
|
-
"type": "uint256"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"internalType": "uint256",
|
|
42
|
-
"name": "needed",
|
|
43
|
-
"type": "uint256"
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
"name": "ERC20InsufficientBalance",
|
|
47
|
-
"type": "error"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"inputs": [
|
|
51
|
-
{
|
|
52
|
-
"internalType": "address",
|
|
53
|
-
"name": "approver",
|
|
54
|
-
"type": "address"
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
"name": "ERC20InvalidApprover",
|
|
58
|
-
"type": "error"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"inputs": [
|
|
62
|
-
{
|
|
63
|
-
"internalType": "address",
|
|
64
|
-
"name": "receiver",
|
|
65
|
-
"type": "address"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"name": "ERC20InvalidReceiver",
|
|
69
|
-
"type": "error"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"inputs": [
|
|
73
|
-
{
|
|
74
|
-
"internalType": "address",
|
|
75
|
-
"name": "sender",
|
|
76
|
-
"type": "address"
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"name": "ERC20InvalidSender",
|
|
80
|
-
"type": "error"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"inputs": [
|
|
84
|
-
{
|
|
85
|
-
"internalType": "address",
|
|
86
|
-
"name": "spender",
|
|
87
|
-
"type": "address"
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
"name": "ERC20InvalidSpender",
|
|
91
|
-
"type": "error"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"inputs": [],
|
|
95
|
-
"name": "EnforcedPause",
|
|
96
|
-
"type": "error"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"inputs": [],
|
|
100
|
-
"name": "ExpectedPause",
|
|
101
|
-
"type": "error"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"inputs": [],
|
|
105
|
-
"name": "InvalidInitialization",
|
|
106
|
-
"type": "error"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"inputs": [],
|
|
110
|
-
"name": "MathOverflowedMulDiv",
|
|
111
|
-
"type": "error"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"inputs": [],
|
|
115
|
-
"name": "NotInitializing",
|
|
116
|
-
"type": "error"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"inputs": [],
|
|
120
|
-
"name": "OnlyGovernanceAllowed",
|
|
121
|
-
"type": "error"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"inputs": [],
|
|
125
|
-
"name": "OnlyOperatorAllowed",
|
|
126
|
-
"type": "error"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"inputs": [],
|
|
130
|
-
"name": "OnlyRestakingPoolAllowed",
|
|
131
|
-
"type": "error"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"anonymous": false,
|
|
135
|
-
"inputs": [
|
|
136
|
-
{
|
|
137
|
-
"indexed": true,
|
|
138
|
-
"internalType": "address",
|
|
139
|
-
"name": "owner",
|
|
140
|
-
"type": "address"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"indexed": true,
|
|
144
|
-
"internalType": "address",
|
|
145
|
-
"name": "spender",
|
|
146
|
-
"type": "address"
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
"indexed": false,
|
|
150
|
-
"internalType": "uint256",
|
|
151
|
-
"name": "value",
|
|
152
|
-
"type": "uint256"
|
|
153
|
-
}
|
|
154
|
-
],
|
|
155
|
-
"name": "Approval",
|
|
156
|
-
"type": "event"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"anonymous": false,
|
|
160
|
-
"inputs": [
|
|
161
|
-
{
|
|
162
|
-
"indexed": false,
|
|
163
|
-
"internalType": "uint64",
|
|
164
|
-
"name": "version",
|
|
165
|
-
"type": "uint64"
|
|
166
|
-
}
|
|
167
|
-
],
|
|
168
|
-
"name": "Initialized",
|
|
169
|
-
"type": "event"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"anonymous": false,
|
|
173
|
-
"inputs": [
|
|
174
|
-
{
|
|
175
|
-
"indexed": false,
|
|
176
|
-
"internalType": "string",
|
|
177
|
-
"name": "newName",
|
|
178
|
-
"type": "string"
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
|
-
"name": "NameChanged",
|
|
182
|
-
"type": "event"
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"anonymous": false,
|
|
186
|
-
"inputs": [
|
|
187
|
-
{
|
|
188
|
-
"indexed": false,
|
|
189
|
-
"internalType": "address",
|
|
190
|
-
"name": "account",
|
|
191
|
-
"type": "address"
|
|
192
|
-
}
|
|
193
|
-
],
|
|
194
|
-
"name": "Paused",
|
|
195
|
-
"type": "event"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"anonymous": false,
|
|
199
|
-
"inputs": [
|
|
200
|
-
{
|
|
201
|
-
"indexed": false,
|
|
202
|
-
"internalType": "string",
|
|
203
|
-
"name": "newSymbol",
|
|
204
|
-
"type": "string"
|
|
205
|
-
}
|
|
206
|
-
],
|
|
207
|
-
"name": "SymbolChanged",
|
|
208
|
-
"type": "event"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"anonymous": false,
|
|
212
|
-
"inputs": [
|
|
213
|
-
{
|
|
214
|
-
"indexed": true,
|
|
215
|
-
"internalType": "address",
|
|
216
|
-
"name": "from",
|
|
217
|
-
"type": "address"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"indexed": true,
|
|
221
|
-
"internalType": "address",
|
|
222
|
-
"name": "to",
|
|
223
|
-
"type": "address"
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"indexed": false,
|
|
227
|
-
"internalType": "uint256",
|
|
228
|
-
"name": "value",
|
|
229
|
-
"type": "uint256"
|
|
230
|
-
}
|
|
231
|
-
],
|
|
232
|
-
"name": "Transfer",
|
|
233
|
-
"type": "event"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"anonymous": false,
|
|
237
|
-
"inputs": [
|
|
238
|
-
{
|
|
239
|
-
"indexed": false,
|
|
240
|
-
"internalType": "address",
|
|
241
|
-
"name": "account",
|
|
242
|
-
"type": "address"
|
|
243
|
-
}
|
|
244
|
-
],
|
|
245
|
-
"name": "Unpaused",
|
|
246
|
-
"type": "event"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
"inputs": [
|
|
250
|
-
{
|
|
251
|
-
"internalType": "address",
|
|
252
|
-
"name": "owner",
|
|
253
|
-
"type": "address"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"internalType": "address",
|
|
257
|
-
"name": "spender",
|
|
258
|
-
"type": "address"
|
|
259
|
-
}
|
|
260
|
-
],
|
|
261
|
-
"name": "allowance",
|
|
262
|
-
"outputs": [
|
|
263
|
-
{
|
|
264
|
-
"internalType": "uint256",
|
|
265
|
-
"name": "",
|
|
266
|
-
"type": "uint256"
|
|
267
|
-
}
|
|
268
|
-
],
|
|
269
|
-
"stateMutability": "view",
|
|
270
|
-
"type": "function"
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
"inputs": [
|
|
274
|
-
{
|
|
275
|
-
"internalType": "address",
|
|
276
|
-
"name": "spender",
|
|
277
|
-
"type": "address"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
"internalType": "uint256",
|
|
281
|
-
"name": "value",
|
|
282
|
-
"type": "uint256"
|
|
283
|
-
}
|
|
284
|
-
],
|
|
285
|
-
"name": "approve",
|
|
286
|
-
"outputs": [
|
|
287
|
-
{
|
|
288
|
-
"internalType": "bool",
|
|
289
|
-
"name": "",
|
|
290
|
-
"type": "bool"
|
|
291
|
-
}
|
|
292
|
-
],
|
|
293
|
-
"stateMutability": "nonpayable",
|
|
294
|
-
"type": "function"
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
"inputs": [
|
|
298
|
-
{
|
|
299
|
-
"internalType": "address",
|
|
300
|
-
"name": "account",
|
|
301
|
-
"type": "address"
|
|
302
|
-
}
|
|
303
|
-
],
|
|
304
|
-
"name": "balanceOf",
|
|
305
|
-
"outputs": [
|
|
306
|
-
{
|
|
307
|
-
"internalType": "uint256",
|
|
308
|
-
"name": "",
|
|
309
|
-
"type": "uint256"
|
|
310
|
-
}
|
|
311
|
-
],
|
|
312
|
-
"stateMutability": "view",
|
|
313
|
-
"type": "function"
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"inputs": [
|
|
317
|
-
{
|
|
318
|
-
"internalType": "address",
|
|
319
|
-
"name": "account",
|
|
320
|
-
"type": "address"
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
"internalType": "uint256",
|
|
324
|
-
"name": "shares",
|
|
325
|
-
"type": "uint256"
|
|
326
|
-
}
|
|
327
|
-
],
|
|
328
|
-
"name": "burn",
|
|
329
|
-
"outputs": [],
|
|
330
|
-
"stateMutability": "nonpayable",
|
|
331
|
-
"type": "function"
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
"inputs": [
|
|
335
|
-
{
|
|
336
|
-
"internalType": "string",
|
|
337
|
-
"name": "newName",
|
|
338
|
-
"type": "string"
|
|
339
|
-
}
|
|
340
|
-
],
|
|
341
|
-
"name": "changeName",
|
|
342
|
-
"outputs": [],
|
|
343
|
-
"stateMutability": "nonpayable",
|
|
344
|
-
"type": "function"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
"inputs": [
|
|
348
|
-
{
|
|
349
|
-
"internalType": "string",
|
|
350
|
-
"name": "newSymbol",
|
|
351
|
-
"type": "string"
|
|
352
|
-
}
|
|
353
|
-
],
|
|
354
|
-
"name": "changeSymbol",
|
|
355
|
-
"outputs": [],
|
|
356
|
-
"stateMutability": "nonpayable",
|
|
357
|
-
"type": "function"
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
"inputs": [],
|
|
361
|
-
"name": "config",
|
|
362
|
-
"outputs": [
|
|
363
|
-
{
|
|
364
|
-
"internalType": "contract IProtocolConfig",
|
|
365
|
-
"name": "",
|
|
366
|
-
"type": "address"
|
|
367
|
-
}
|
|
368
|
-
],
|
|
369
|
-
"stateMutability": "view",
|
|
370
|
-
"type": "function"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"inputs": [
|
|
374
|
-
{
|
|
375
|
-
"internalType": "uint256",
|
|
376
|
-
"name": "shares",
|
|
377
|
-
"type": "uint256"
|
|
378
|
-
}
|
|
379
|
-
],
|
|
380
|
-
"name": "convertToAmount",
|
|
381
|
-
"outputs": [
|
|
382
|
-
{
|
|
383
|
-
"internalType": "uint256",
|
|
384
|
-
"name": "",
|
|
385
|
-
"type": "uint256"
|
|
386
|
-
}
|
|
387
|
-
],
|
|
388
|
-
"stateMutability": "view",
|
|
389
|
-
"type": "function"
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
"inputs": [
|
|
393
|
-
{
|
|
394
|
-
"internalType": "uint256",
|
|
395
|
-
"name": "amount",
|
|
396
|
-
"type": "uint256"
|
|
397
|
-
}
|
|
398
|
-
],
|
|
399
|
-
"name": "convertToShares",
|
|
400
|
-
"outputs": [
|
|
401
|
-
{
|
|
402
|
-
"internalType": "uint256",
|
|
403
|
-
"name": "",
|
|
404
|
-
"type": "uint256"
|
|
405
|
-
}
|
|
406
|
-
],
|
|
407
|
-
"stateMutability": "view",
|
|
408
|
-
"type": "function"
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
"inputs": [],
|
|
412
|
-
"name": "decimals",
|
|
413
|
-
"outputs": [
|
|
414
|
-
{
|
|
415
|
-
"internalType": "uint8",
|
|
416
|
-
"name": "",
|
|
417
|
-
"type": "uint8"
|
|
418
|
-
}
|
|
419
|
-
],
|
|
420
|
-
"stateMutability": "view",
|
|
421
|
-
"type": "function"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"inputs": [
|
|
425
|
-
{
|
|
426
|
-
"internalType": "contract IProtocolConfig",
|
|
427
|
-
"name": "config",
|
|
428
|
-
"type": "address"
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
"internalType": "string",
|
|
432
|
-
"name": "name",
|
|
433
|
-
"type": "string"
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
"internalType": "string",
|
|
437
|
-
"name": "symbol",
|
|
438
|
-
"type": "string"
|
|
439
|
-
}
|
|
440
|
-
],
|
|
441
|
-
"name": "initialize",
|
|
442
|
-
"outputs": [],
|
|
443
|
-
"stateMutability": "nonpayable",
|
|
444
|
-
"type": "function"
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
"inputs": [
|
|
448
|
-
{
|
|
449
|
-
"internalType": "address",
|
|
450
|
-
"name": "account",
|
|
451
|
-
"type": "address"
|
|
452
|
-
},
|
|
453
|
-
{
|
|
454
|
-
"internalType": "uint256",
|
|
455
|
-
"name": "shares",
|
|
456
|
-
"type": "uint256"
|
|
457
|
-
}
|
|
458
|
-
],
|
|
459
|
-
"name": "mint",
|
|
460
|
-
"outputs": [],
|
|
461
|
-
"stateMutability": "nonpayable",
|
|
462
|
-
"type": "function"
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
"inputs": [],
|
|
466
|
-
"name": "name",
|
|
467
|
-
"outputs": [
|
|
468
|
-
{
|
|
469
|
-
"internalType": "string",
|
|
470
|
-
"name": "",
|
|
471
|
-
"type": "string"
|
|
472
|
-
}
|
|
473
|
-
],
|
|
474
|
-
"stateMutability": "view",
|
|
475
|
-
"type": "function"
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
"inputs": [],
|
|
479
|
-
"name": "pause",
|
|
480
|
-
"outputs": [],
|
|
481
|
-
"stateMutability": "nonpayable",
|
|
482
|
-
"type": "function"
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
"inputs": [],
|
|
486
|
-
"name": "paused",
|
|
487
|
-
"outputs": [
|
|
488
|
-
{
|
|
489
|
-
"internalType": "bool",
|
|
490
|
-
"name": "",
|
|
491
|
-
"type": "bool"
|
|
492
|
-
}
|
|
493
|
-
],
|
|
494
|
-
"stateMutability": "view",
|
|
495
|
-
"type": "function"
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
"inputs": [],
|
|
499
|
-
"name": "ratio",
|
|
500
|
-
"outputs": [
|
|
501
|
-
{
|
|
502
|
-
"internalType": "uint256",
|
|
503
|
-
"name": "",
|
|
504
|
-
"type": "uint256"
|
|
505
|
-
}
|
|
506
|
-
],
|
|
507
|
-
"stateMutability": "view",
|
|
508
|
-
"type": "function"
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
"inputs": [],
|
|
512
|
-
"name": "symbol",
|
|
513
|
-
"outputs": [
|
|
514
|
-
{
|
|
515
|
-
"internalType": "string",
|
|
516
|
-
"name": "",
|
|
517
|
-
"type": "string"
|
|
518
|
-
}
|
|
519
|
-
],
|
|
520
|
-
"stateMutability": "view",
|
|
521
|
-
"type": "function"
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
"inputs": [],
|
|
525
|
-
"name": "totalAssets",
|
|
526
|
-
"outputs": [
|
|
527
|
-
{
|
|
528
|
-
"internalType": "uint256",
|
|
529
|
-
"name": "totalManagedEth",
|
|
530
|
-
"type": "uint256"
|
|
531
|
-
}
|
|
532
|
-
],
|
|
533
|
-
"stateMutability": "view",
|
|
534
|
-
"type": "function"
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
"inputs": [],
|
|
538
|
-
"name": "totalSupply",
|
|
539
|
-
"outputs": [
|
|
540
|
-
{
|
|
541
|
-
"internalType": "uint256",
|
|
542
|
-
"name": "",
|
|
543
|
-
"type": "uint256"
|
|
544
|
-
}
|
|
545
|
-
],
|
|
546
|
-
"stateMutability": "view",
|
|
547
|
-
"type": "function"
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
"inputs": [
|
|
551
|
-
{
|
|
552
|
-
"internalType": "address",
|
|
553
|
-
"name": "to",
|
|
554
|
-
"type": "address"
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
"internalType": "uint256",
|
|
558
|
-
"name": "value",
|
|
559
|
-
"type": "uint256"
|
|
560
|
-
}
|
|
561
|
-
],
|
|
562
|
-
"name": "transfer",
|
|
563
|
-
"outputs": [
|
|
564
|
-
{
|
|
565
|
-
"internalType": "bool",
|
|
566
|
-
"name": "",
|
|
567
|
-
"type": "bool"
|
|
568
|
-
}
|
|
569
|
-
],
|
|
570
|
-
"stateMutability": "nonpayable",
|
|
571
|
-
"type": "function"
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
"inputs": [
|
|
575
|
-
{
|
|
576
|
-
"internalType": "address",
|
|
577
|
-
"name": "from",
|
|
578
|
-
"type": "address"
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
"internalType": "address",
|
|
582
|
-
"name": "to",
|
|
583
|
-
"type": "address"
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
"internalType": "uint256",
|
|
587
|
-
"name": "value",
|
|
588
|
-
"type": "uint256"
|
|
589
|
-
}
|
|
590
|
-
],
|
|
591
|
-
"name": "transferFrom",
|
|
592
|
-
"outputs": [
|
|
593
|
-
{
|
|
594
|
-
"internalType": "bool",
|
|
595
|
-
"name": "",
|
|
596
|
-
"type": "bool"
|
|
597
|
-
}
|
|
598
|
-
],
|
|
599
|
-
"stateMutability": "nonpayable",
|
|
600
|
-
"type": "function"
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
"inputs": [],
|
|
604
|
-
"name": "unpause",
|
|
605
|
-
"outputs": [],
|
|
606
|
-
"stateMutability": "nonpayable",
|
|
607
|
-
"type": "function"
|
|
608
|
-
}
|
|
609
|
-
]
|