@gearbox-protocol/sdk 15.1.0-next.12 → 15.1.0-next.14
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/dist/cjs/dev/AccountOpener.js +1 -8
- package/dist/cjs/dev/index.js +2 -3
- package/dist/cjs/dev/midasUtils.js +0 -96
- package/dist/cjs/new-sdk/index.js +3 -3
- package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +8 -8
- package/dist/cjs/new-sdk/{simulate/SimulateApi.js → prepare/PrepareApi.js} +21 -49
- package/dist/cjs/new-sdk/prepare/index.js +4 -0
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +7 -35
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +5 -26
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +16 -2
- package/dist/cjs/sdk/accounts/utils/midasUtils.js +70 -0
- package/dist/cjs/sdk/index.js +4 -0
- package/dist/cjs/sdk/market/adapters/createAdapter.js +8 -1
- package/dist/cjs/sdk/market/adapters/index.js +5 -0
- package/dist/cjs/sdk/market/adapters/midas/PlaceholderMidasGatewayAdapterContract.js +81 -0
- package/dist/cjs/sdk/market/adapters/midas/PlaceholderMidasIssuanceVaultAdapterContract.js +59 -0
- package/dist/cjs/sdk/market/adapters/midas/index.js +6 -0
- package/dist/cjs/sdk/market/adapters/midas/types.js +1 -0
- package/dist/cjs/sdk/market/index.js +4 -0
- package/dist/esm/common-utils/index.js +3 -3
- package/dist/esm/common-utils/utils/index.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -8
- package/dist/esm/dev/index.js +3 -3
- package/dist/esm/dev/midasUtils.js +2 -97
- package/dist/esm/new-sdk/index.js +3 -3
- package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +8 -8
- package/dist/esm/new-sdk/{simulate/SimulateApi.js → prepare/PrepareApi.js} +21 -49
- package/dist/esm/new-sdk/prepare/index.js +3 -0
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +8 -36
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +5 -26
- package/dist/esm/plugins/apy/ApyPlugin.js +2 -2
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +16 -2
- package/dist/esm/sdk/accounts/utils/midasUtils.js +69 -0
- package/dist/esm/sdk/index.js +3 -1
- package/dist/esm/sdk/market/adapters/createAdapter.js +8 -1
- package/dist/esm/sdk/market/adapters/index.js +4 -1
- package/dist/esm/sdk/market/adapters/midas/PlaceholderMidasGatewayAdapterContract.js +80 -0
- package/dist/esm/sdk/market/adapters/midas/PlaceholderMidasIssuanceVaultAdapterContract.js +58 -0
- package/dist/esm/sdk/market/adapters/midas/index.js +4 -0
- package/dist/esm/sdk/market/adapters/midas/types.js +1 -0
- package/dist/esm/sdk/market/index.js +3 -1
- package/dist/types/dev/index.d.ts +2 -2
- package/dist/types/dev/midasUtils.d.ts +2 -35
- package/dist/types/new-sdk/execute/ExecuteApi.d.ts +9 -9
- package/dist/types/new-sdk/index.d.ts +4 -4
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +4 -4
- package/dist/types/new-sdk/opportunities/types.d.ts +5 -5
- package/dist/types/new-sdk/{simulate/SimulateApi.d.ts → prepare/PrepareApi.d.ts} +19 -19
- package/dist/types/new-sdk/prepare/index.d.ts +3 -0
- package/dist/types/new-sdk/{simulate → prepare}/types.d.ts +35 -61
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +2 -1
- package/dist/types/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.d.ts +2 -1
- package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +1 -1
- package/dist/types/sdk/accounts/intents/types.d.ts +12 -12
- package/dist/types/sdk/accounts/utils/midasUtils.d.ts +38 -0
- package/dist/types/sdk/index.d.ts +4 -1
- package/dist/types/sdk/market/adapters/index.d.ts +5 -1
- package/dist/types/sdk/market/adapters/midas/PlaceholderMidasGatewayAdapterContract.d.ts +17 -0
- package/dist/types/sdk/market/adapters/midas/PlaceholderMidasIssuanceVaultAdapterContract.d.ts +15 -0
- package/dist/types/sdk/market/adapters/midas/index.d.ts +4 -0
- package/dist/types/sdk/market/adapters/midas/types.d.ts +24 -0
- package/dist/types/sdk/market/index.d.ts +4 -1
- package/package.json +1 -1
- package/dist/cjs/new-sdk/simulate/index.js +0 -4
- package/dist/esm/new-sdk/simulate/index.js +0 -3
- package/dist/types/new-sdk/simulate/index.d.ts +0 -3
- /package/dist/cjs/new-sdk/{simulate → prepare}/types.js +0 -0
- /package/dist/esm/new-sdk/{simulate → prepare}/types.js +0 -0
|
@@ -14,7 +14,6 @@ require("../sdk/index.js");
|
|
|
14
14
|
const require_dev_abi = require("./abi.js");
|
|
15
15
|
const require_dev_claimFromFaucet = require("./claimFromFaucet.js");
|
|
16
16
|
const require_dev_createAnvilClient = require("./createAnvilClient.js");
|
|
17
|
-
const require_dev_midasUtils = require("./midasUtils.js");
|
|
18
17
|
const require_dev_mint_factory = require("./mint/factory.js");
|
|
19
18
|
require("./mint/index.js");
|
|
20
19
|
let viem = require("viem");
|
|
@@ -253,12 +252,6 @@ var AccountOpener = class extends require_sdk_base_SDKConstruct.SDKConstruct {
|
|
|
253
252
|
target
|
|
254
253
|
});
|
|
255
254
|
logger?.debug(strategy, "found open strategy");
|
|
256
|
-
const strategyCalls = await require_dev_midasUtils.prependMidasReceiveGreenlist({
|
|
257
|
-
cm,
|
|
258
|
-
client: this.#anvil,
|
|
259
|
-
calls: strategy.calls,
|
|
260
|
-
logger
|
|
261
|
-
});
|
|
262
255
|
const debt = minDebt * (leverage - require_sdk_constants_math.PERCENTAGE_FACTOR) / require_sdk_constants_math.PERCENTAGE_FACTOR;
|
|
263
256
|
const averageQuota = this.#getCollateralQuota(cm, target, strategy.amount, debt, logger);
|
|
264
257
|
const minQuota = this.#getCollateralQuota(cm, target, strategy.minAmount, debt, logger);
|
|
@@ -285,7 +278,7 @@ var AccountOpener = class extends require_sdk_base_SDKConstruct.SDKConstruct {
|
|
|
285
278
|
balance: minDebt
|
|
286
279
|
}],
|
|
287
280
|
debt,
|
|
288
|
-
calls:
|
|
281
|
+
calls: strategy.calls,
|
|
289
282
|
ethAmount: 0n,
|
|
290
283
|
permits: {},
|
|
291
284
|
to: borrower.address,
|
package/dist/cjs/dev/index.js
CHANGED
|
@@ -2,8 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_dev_abi = require("./abi.js");
|
|
3
3
|
const require_dev_claimFromFaucet = require("./claimFromFaucet.js");
|
|
4
4
|
const require_dev_createAnvilClient = require("./createAnvilClient.js");
|
|
5
|
-
const require_dev_kycUtils = require("./kycUtils.js");
|
|
6
|
-
const require_dev_midasUtils = require("./midasUtils.js");
|
|
7
5
|
const require_dev_mint_factory = require("./mint/factory.js");
|
|
8
6
|
require("./mint/index.js");
|
|
9
7
|
const require_dev_AccountOpener = require("./AccountOpener.js");
|
|
@@ -16,8 +14,10 @@ const require_dev_detectChain = require("./detectChain.js");
|
|
|
16
14
|
const require_dev_isOutOfSyncError = require("./isOutOfSyncError.js");
|
|
17
15
|
const require_dev_isRateLimitError = require("./isRateLimitError.js");
|
|
18
16
|
const require_dev_isTransientError = require("./isTransientError.js");
|
|
17
|
+
const require_dev_kycUtils = require("./kycUtils.js");
|
|
19
18
|
const require_dev_logSplitterTransport = require("./logSplitterTransport.js");
|
|
20
19
|
const require_dev_ltUtils = require("./ltUtils.js");
|
|
20
|
+
const require_dev_midasUtils = require("./midasUtils.js");
|
|
21
21
|
const require_dev_migrateFaucet = require("./migrateFaucet.js");
|
|
22
22
|
const require_dev_providers = require("./providers.js");
|
|
23
23
|
const require_dev_replaceStorage = require("./replaceStorage.js");
|
|
@@ -72,7 +72,6 @@ exports.isTransientError = require_dev_isTransientError.isTransientError;
|
|
|
72
72
|
exports.logSplitterTransport = require_dev_logSplitterTransport.logSplitterTransport;
|
|
73
73
|
exports.makePendingWithdrawalsClaimable = require_dev_withdrawalUtils.makePendingWithdrawalsClaimable;
|
|
74
74
|
exports.migrateFaucet = require_dev_migrateFaucet.migrateFaucet;
|
|
75
|
-
exports.prependMidasReceiveGreenlist = require_dev_midasUtils.prependMidasReceiveGreenlist;
|
|
76
75
|
exports.providerConfigSchema = require_dev_RevolverTransport.providerConfigSchema;
|
|
77
76
|
exports.registerMidasInvestor = require_dev_kycUtils.registerMidasInvestor;
|
|
78
77
|
exports.registerRWAInvestor = require_dev_kycUtils.registerRWAInvestor;
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dev_withdrawalAbi = require("./withdrawalAbi.js");
|
|
3
2
|
const require_dev_kycUtils = require("./kycUtils.js");
|
|
4
3
|
let viem = require("viem");
|
|
5
4
|
//#region src/dev/midasUtils.ts
|
|
6
|
-
const ADAPTER_MIDAS_GATEWAY = "ADAPTER::MIDAS_GATEWAY";
|
|
7
|
-
const ADAPTER_MIDAS_ISSUANCE_VAULT = "ADAPTER::MIDAS_ISSUANCE_VAULT";
|
|
8
|
-
/**
|
|
9
|
-
* Permissionless gateways have no greenlist and reject `receiveGreenlist`,
|
|
10
|
-
* see MidasMode in integrations-v3
|
|
11
|
-
*/
|
|
12
|
-
const MIDAS_MODE_PERMISSIONLESS = 0;
|
|
13
|
-
/**
|
|
14
|
-
* Gateways and issuance vaults both expose their mToken, but only on-chain:
|
|
15
|
-
* without the adapters plugin the SDK represents adapters as placeholders that
|
|
16
|
-
* expose nothing but their target contract
|
|
17
|
-
*/
|
|
18
|
-
const iMidasMTokenAbi = (0, viem.parseAbi)(["function mToken() external view returns (address)"]);
|
|
19
|
-
const iMidasGatewayAdapterExtAbi = (0, viem.parseAbi)(["function receiveGreenlist() external returns (bool)"]);
|
|
20
5
|
/**
|
|
21
6
|
* Midas vaults inherit their own `Pausable`, whose global pause is guarded by
|
|
22
7
|
* `pauseAdminRole()` in the vault's access control instead of `Ownable`
|
|
@@ -29,76 +14,6 @@ const iMidasPausableVaultAbi = (0, viem.parseAbi)([
|
|
|
29
14
|
"function accessControl() external view returns (address)"
|
|
30
15
|
]);
|
|
31
16
|
const iMidasAccessControlAbi = (0, viem.parseAbi)(["function hasRole(bytes32 role, address account) external view returns (bool)", "function grantRole(bytes32 role, address account) external"]);
|
|
32
|
-
const receiveGreenlistCallData = (0, viem.encodeFunctionData)({
|
|
33
|
-
abi: iMidasGatewayAdapterExtAbi,
|
|
34
|
-
functionName: "receiveGreenlist"
|
|
35
|
-
});
|
|
36
|
-
/**
|
|
37
|
-
* Prepends `MidasGatewayAdapter.receiveGreenlist()` to a credit facade
|
|
38
|
-
* multicall that mints an mToken through a Midas issuance vault.
|
|
39
|
-
*
|
|
40
|
-
* Permissioned and restricted-interface mTokens can only be held by greenlisted
|
|
41
|
-
* accounts, and a freshly opened credit account is never greenlisted, so the
|
|
42
|
-
* mint reverts with `WMAC: hasnt role` unless the account asks the gateway for
|
|
43
|
-
* the greenlist first. Greenlisting the borrower (see `registerMidasInvestor`)
|
|
44
|
-
* is not enough — the role is checked on the token holder, which is the credit
|
|
45
|
-
* account.
|
|
46
|
-
*
|
|
47
|
-
* Returns `calls` unchanged when nothing has to be greenlisted: no issuance
|
|
48
|
-
* vault is called, its mToken has no gateway adapter on this credit manager,
|
|
49
|
-
* the gateway is permissionless, or the call is already there.
|
|
50
|
-
*/
|
|
51
|
-
async function prependMidasReceiveGreenlist(props) {
|
|
52
|
-
const { cm, client, calls, logger } = props;
|
|
53
|
-
const gatewayAdapters = [];
|
|
54
|
-
const issuanceAdapters = [];
|
|
55
|
-
for (const adapter of cm.creditManager.adapters.values()) switch (adapter.contractType) {
|
|
56
|
-
case ADAPTER_MIDAS_GATEWAY:
|
|
57
|
-
gatewayAdapters.push(adapter);
|
|
58
|
-
break;
|
|
59
|
-
case ADAPTER_MIDAS_ISSUANCE_VAULT: issuanceAdapters.push(adapter);
|
|
60
|
-
}
|
|
61
|
-
if (gatewayAdapters.length === 0) return calls;
|
|
62
|
-
const calledIssuanceAdapters = issuanceAdapters.filter((adapter) => calls.some((call) => (0, viem.isAddressEqual)(call.target, adapter.address)));
|
|
63
|
-
if (calledIssuanceAdapters.length === 0) return calls;
|
|
64
|
-
const [gatewayMTokens, issuanceMTokens] = await Promise.all([readMTokens(client, gatewayAdapters), readMTokens(client, calledIssuanceAdapters)]);
|
|
65
|
-
const gateways = [];
|
|
66
|
-
for (const [i, mToken] of issuanceMTokens.entries()) {
|
|
67
|
-
const gateway = gatewayAdapters.find((_, j) => (0, viem.isAddressEqual)(gatewayMTokens[j], mToken));
|
|
68
|
-
if (!gateway) {
|
|
69
|
-
logger?.debug(`midas: no gateway adapter for mToken ${mToken} minted by ${calledIssuanceAdapters[i].address} on ${cm.name}, cannot greenlist the credit account`);
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
if (gateways.some((g) => (0, viem.isAddressEqual)(g.address, gateway.address))) continue;
|
|
73
|
-
if (calls.some((call) => (0, viem.isAddressEqual)(call.target, gateway.address) && call.callData === receiveGreenlistCallData)) {
|
|
74
|
-
logger?.debug(`midas: gateway adapter ${gateway.address} already receives the greenlist`);
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
gateways.push(gateway);
|
|
78
|
-
}
|
|
79
|
-
if (gateways.length === 0) return calls;
|
|
80
|
-
const modes = await client.multicall({
|
|
81
|
-
allowFailure: false,
|
|
82
|
-
contracts: gateways.map(({ targetContract }) => ({
|
|
83
|
-
address: targetContract,
|
|
84
|
-
abi: require_dev_withdrawalAbi.midasGatewayAbi,
|
|
85
|
-
functionName: "mode"
|
|
86
|
-
}))
|
|
87
|
-
});
|
|
88
|
-
const prepended = [];
|
|
89
|
-
for (const [i, gateway] of gateways.entries()) {
|
|
90
|
-
if (modes[i] === MIDAS_MODE_PERMISSIONLESS) {
|
|
91
|
-
logger?.debug(`midas: gateway ${gateway.targetContract} is permissionless, nothing to greenlist`);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
logger?.debug(`midas: greenlisting the credit account via gateway adapter ${gateway.address}`);
|
|
95
|
-
prepended.push({
|
|
96
|
-
target: gateway.address,
|
|
97
|
-
callData: receiveGreenlistCallData
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return prepended.length > 0 ? [...prepended, ...calls] : calls;
|
|
101
|
-
}
|
|
102
17
|
/**
|
|
103
18
|
* Unpauses a globally paused Midas issuance vault on an anvil fork, so that
|
|
104
19
|
* `depositInstant` stops reverting with `Pausable: paused`, and returns a
|
|
@@ -189,16 +104,5 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
189
104
|
}
|
|
190
105
|
};
|
|
191
106
|
}
|
|
192
|
-
async function readMTokens(client, adapters) {
|
|
193
|
-
return await client.multicall({
|
|
194
|
-
allowFailure: false,
|
|
195
|
-
contracts: adapters.map(({ targetContract }) => ({
|
|
196
|
-
address: targetContract,
|
|
197
|
-
abi: iMidasMTokenAbi,
|
|
198
|
-
functionName: "mToken"
|
|
199
|
-
}))
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
107
|
//#endregion
|
|
203
|
-
exports.prependMidasReceiveGreenlist = prependMidasReceiveGreenlist;
|
|
204
108
|
exports.unpauseMidasIssuanceVault = unpauseMidasIssuanceVault;
|
|
@@ -10,8 +10,8 @@ require("./errors/index.js");
|
|
|
10
10
|
const require_new_sdk_AbstractNamespace = require("./AbstractNamespace.js");
|
|
11
11
|
const require_new_sdk_execute_ExecuteApi = require("./execute/ExecuteApi.js");
|
|
12
12
|
require("./execute/index.js");
|
|
13
|
-
const
|
|
14
|
-
require("./
|
|
13
|
+
const require_new_sdk_prepare_PrepareApi = require("./prepare/PrepareApi.js");
|
|
14
|
+
require("./prepare/index.js");
|
|
15
15
|
const require_new_sdk_utils_filterResponse = require("./utils/filterResponse.js");
|
|
16
16
|
const require_new_sdk_utils_mergeChains = require("./utils/mergeChains.js");
|
|
17
17
|
require("./utils/index.js");
|
|
@@ -31,7 +31,7 @@ exports.MissingSourceError = require_new_sdk_errors_MissingSourceError.MissingSo
|
|
|
31
31
|
exports.NoSourceServedError = require_new_sdk_errors_NoSourceServedError.NoSourceServedError;
|
|
32
32
|
exports.OpportunitiesNamespace = require_new_sdk_opportunities_OpportunitiesNamespace.OpportunitiesNamespace;
|
|
33
33
|
exports.PositionsNamespace = require_new_sdk_positions_PositionsNamespace.PositionsNamespace;
|
|
34
|
-
exports.
|
|
34
|
+
exports.PrepareApi = require_new_sdk_prepare_PrepareApi.PrepareApi;
|
|
35
35
|
exports.SourceChainMismatchError = require_new_sdk_errors_SourceChainMismatchError.SourceChainMismatchError;
|
|
36
36
|
exports.SourceUnavailableError = require_new_sdk_errors_SourceUnavailableError.SourceUnavailableError;
|
|
37
37
|
exports.assertSameChains = require_new_sdk_errors_assertSameChains.assertSameChains;
|
|
@@ -6,8 +6,8 @@ require("../errors/index.js");
|
|
|
6
6
|
const require_new_sdk_AbstractNamespace = require("../AbstractNamespace.js");
|
|
7
7
|
const require_new_sdk_execute_ExecuteApi = require("../execute/ExecuteApi.js");
|
|
8
8
|
require("../execute/index.js");
|
|
9
|
-
const
|
|
10
|
-
require("../
|
|
9
|
+
const require_new_sdk_prepare_PrepareApi = require("../prepare/PrepareApi.js");
|
|
10
|
+
require("../prepare/index.js");
|
|
11
11
|
const require_new_sdk_utils_filterResponse = require("../utils/filterResponse.js");
|
|
12
12
|
const require_new_sdk_utils_mergeChains = require("../utils/mergeChains.js");
|
|
13
13
|
require("../utils/index.js");
|
|
@@ -25,19 +25,19 @@ var OpportunitiesNamespace = class extends require_new_sdk_AbstractNamespace.Abs
|
|
|
25
25
|
pool: (onchain, offchain) => require_new_sdk_utils_mergeChains.mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds),
|
|
26
26
|
strategy: (onchain, offchain) => require_new_sdk_utils_mergeChains.mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds)
|
|
27
27
|
};
|
|
28
|
-
#
|
|
28
|
+
#prepare;
|
|
29
29
|
#execute;
|
|
30
30
|
constructor(onchain, offchain, options) {
|
|
31
31
|
super("Opportunities", onchain?.opportunities, offchain?.opportunities, options);
|
|
32
|
-
this.#
|
|
32
|
+
this.#prepare = onchain && new require_new_sdk_prepare_PrepareApi.PrepareApi(onchain, options.ensureFresh);
|
|
33
33
|
this.#execute = onchain && new require_new_sdk_execute_ExecuteApi.ExecuteApi((chainId) => onchain.chain(chainId));
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* {@inheritDoc OpportunitiesOnchainOnly.
|
|
36
|
+
* {@inheritDoc OpportunitiesOnchainOnly.prepare}
|
|
37
37
|
**/
|
|
38
|
-
get
|
|
39
|
-
if (!this.#
|
|
40
|
-
return this.#
|
|
38
|
+
get prepare() {
|
|
39
|
+
if (!this.#prepare) throw new require_new_sdk_errors_SourceUnavailableError.SourceUnavailableError("Opportunities", "onchain");
|
|
40
|
+
return this.#prepare;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* {@inheritDoc OpportunitiesOnchainOnly.execute}
|
|
@@ -4,9 +4,9 @@ const require_sdk_base_MultichainConstruct = require("../../sdk/base/MultichainC
|
|
|
4
4
|
const require_sdk_accounts_intents_utils_credit_account_slice = require("../../sdk/accounts/intents/utils/credit-account-slice.js");
|
|
5
5
|
const require_sdk_accounts_intents_index = require("../../sdk/accounts/intents/index.js");
|
|
6
6
|
require("../../sdk/index.js");
|
|
7
|
-
//#region src/new-sdk/
|
|
7
|
+
//#region src/new-sdk/prepare/PrepareApi.ts
|
|
8
8
|
/**
|
|
9
|
-
* {@inheritDoc
|
|
9
|
+
* {@inheritDoc OpportunitiesPrepare}
|
|
10
10
|
*
|
|
11
11
|
* Holds no state of its own: it owns the mapping from the public,
|
|
12
12
|
* read-model-shaped request to the engine's intent, and nothing else. All
|
|
@@ -18,7 +18,7 @@ require("../../sdk/index.js");
|
|
|
18
18
|
* to, hence a chain the SDK does not cover, or one that fails the read, throws
|
|
19
19
|
* rather than answering with empty metadata.
|
|
20
20
|
**/
|
|
21
|
-
var
|
|
21
|
+
var PrepareApi = class extends require_sdk_base_MultichainConstruct.MultichainConstruct {
|
|
22
22
|
#ensureFresh;
|
|
23
23
|
constructor(sdk, ensureFresh) {
|
|
24
24
|
super(sdk);
|
|
@@ -29,22 +29,10 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
29
29
|
return super.queryChain(props);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* {@inheritDoc
|
|
32
|
+
* {@inheritDoc OpportunitiesPrepare.finalize}
|
|
33
33
|
**/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type: "WITHDRAW",
|
|
37
|
-
amount: params.amount,
|
|
38
|
-
to: params.to,
|
|
39
|
-
tokenOut: params.tokenOut,
|
|
40
|
-
sourceToken: params.sourceToken
|
|
41
|
-
}),
|
|
42
|
-
adjustLeverage: (position, params) => this.#startDelayedIntent(position, params, {
|
|
43
|
-
type: "ADJUST_LEVERAGE",
|
|
44
|
-
targetLeverage: params.targetLeverage,
|
|
45
|
-
token: params.token
|
|
46
|
-
}),
|
|
47
|
-
finish: (position, params) => this.queryChain({
|
|
34
|
+
async finalize(position, params) {
|
|
35
|
+
return this.queryChain({
|
|
48
36
|
network: position.chainId,
|
|
49
37
|
run: async (sdk) => {
|
|
50
38
|
const intent = resumable(params.intent ?? params.claimable.intent);
|
|
@@ -61,10 +49,10 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
61
49
|
quotaReserve: params.quotaReserve
|
|
62
50
|
});
|
|
63
51
|
}
|
|
64
|
-
})
|
|
65
|
-
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
66
54
|
/**
|
|
67
|
-
* {@inheritDoc
|
|
55
|
+
* {@inheritDoc OpportunitiesPrepare.deposit}
|
|
68
56
|
**/
|
|
69
57
|
deposit(pool, params) {
|
|
70
58
|
const { marketRegister, pools } = this.sdk.chain(pool.chainId);
|
|
@@ -98,7 +86,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
98
86
|
};
|
|
99
87
|
}
|
|
100
88
|
/**
|
|
101
|
-
* {@inheritDoc
|
|
89
|
+
* {@inheritDoc OpportunitiesPrepare.withdraw}
|
|
102
90
|
**/
|
|
103
91
|
withdraw(pool, params) {
|
|
104
92
|
const { pools } = this.sdk.chain(pool.chainId);
|
|
@@ -130,7 +118,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
130
118
|
};
|
|
131
119
|
}
|
|
132
120
|
/**
|
|
133
|
-
* {@inheritDoc
|
|
121
|
+
* {@inheritDoc OpportunitiesPrepare.redeem}
|
|
134
122
|
**/
|
|
135
123
|
redeem(pool, params) {
|
|
136
124
|
const { pools } = this.sdk.chain(pool.chainId);
|
|
@@ -162,7 +150,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
162
150
|
};
|
|
163
151
|
}
|
|
164
152
|
/**
|
|
165
|
-
* {@inheritDoc
|
|
153
|
+
* {@inheritDoc OpportunitiesPrepare.openNewStrategy}
|
|
166
154
|
**/
|
|
167
155
|
async openNewStrategy(strategy, params) {
|
|
168
156
|
return this.queryChain({
|
|
@@ -180,7 +168,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
180
168
|
});
|
|
181
169
|
}
|
|
182
170
|
/**
|
|
183
|
-
* {@inheritDoc
|
|
171
|
+
* {@inheritDoc OpportunitiesPrepare.depositStrategy}
|
|
184
172
|
**/
|
|
185
173
|
async depositStrategy(position, params) {
|
|
186
174
|
return this.#startIntent(position, params, {
|
|
@@ -193,7 +181,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
193
181
|
});
|
|
194
182
|
}
|
|
195
183
|
/**
|
|
196
|
-
* {@inheritDoc
|
|
184
|
+
* {@inheritDoc OpportunitiesPrepare.withdrawStrategy}
|
|
197
185
|
**/
|
|
198
186
|
async withdrawStrategy(position, params) {
|
|
199
187
|
return this.#startRoutes(position, params, {
|
|
@@ -205,7 +193,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
205
193
|
});
|
|
206
194
|
}
|
|
207
195
|
/**
|
|
208
|
-
* {@inheritDoc
|
|
196
|
+
* {@inheritDoc OpportunitiesPrepare.maxWithdraw}
|
|
209
197
|
**/
|
|
210
198
|
async maxWithdraw(position) {
|
|
211
199
|
return this.queryChain({
|
|
@@ -217,7 +205,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
217
205
|
});
|
|
218
206
|
}
|
|
219
207
|
/**
|
|
220
|
-
* {@inheritDoc
|
|
208
|
+
* {@inheritDoc OpportunitiesPrepare.repayStrategy}
|
|
221
209
|
**/
|
|
222
210
|
async repayStrategy(position, params) {
|
|
223
211
|
return this.#startIntent(position, params, {
|
|
@@ -228,7 +216,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
228
216
|
});
|
|
229
217
|
}
|
|
230
218
|
/**
|
|
231
|
-
* {@inheritDoc
|
|
219
|
+
* {@inheritDoc OpportunitiesPrepare.maxRepay}
|
|
232
220
|
**/
|
|
233
221
|
async maxRepay(position) {
|
|
234
222
|
return this.queryChain({
|
|
@@ -240,7 +228,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
240
228
|
});
|
|
241
229
|
}
|
|
242
230
|
/**
|
|
243
|
-
* {@inheritDoc
|
|
231
|
+
* {@inheritDoc OpportunitiesPrepare.adjustLeverage}
|
|
244
232
|
**/
|
|
245
233
|
async adjustLeverage(position, params) {
|
|
246
234
|
return this.#startRoutes(position, params, {
|
|
@@ -250,7 +238,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
250
238
|
});
|
|
251
239
|
}
|
|
252
240
|
/**
|
|
253
|
-
* {@inheritDoc
|
|
241
|
+
* {@inheritDoc OpportunitiesPrepare.addCollateral}
|
|
254
242
|
**/
|
|
255
243
|
async addCollateral(position, params) {
|
|
256
244
|
return this.#startIntent(position, params, {
|
|
@@ -261,7 +249,7 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
261
249
|
});
|
|
262
250
|
}
|
|
263
251
|
/**
|
|
264
|
-
* {@inheritDoc
|
|
252
|
+
* {@inheritDoc OpportunitiesPrepare.withdrawCollateral}
|
|
265
253
|
**/
|
|
266
254
|
async withdrawCollateral(position, params) {
|
|
267
255
|
return this.#startIntent(position, params, {
|
|
@@ -288,22 +276,6 @@ var SimulateApi = class extends require_sdk_base_MultichainConstruct.MultichainC
|
|
|
288
276
|
});
|
|
289
277
|
}
|
|
290
278
|
/**
|
|
291
|
-
* Shared path of the same two flows when only the delayed route is asked for:
|
|
292
|
-
* a planner that requests a redemption instead of swapping.
|
|
293
|
-
**/
|
|
294
|
-
async #startDelayedIntent(position, options, intent) {
|
|
295
|
-
return this.queryChain({
|
|
296
|
-
network: position.chainId,
|
|
297
|
-
run: async (sdk) => service(sdk).startDelayedIntent({
|
|
298
|
-
intent,
|
|
299
|
-
creditAccount: await slice(sdk, position.creditAccount),
|
|
300
|
-
sdk,
|
|
301
|
-
slippage: options.slippage,
|
|
302
|
-
quotaReserve: options.quotaReserve
|
|
303
|
-
})
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
279
|
* Shared path of the five flows that act on an existing account: read the
|
|
308
280
|
* account, then run the intent through the engine.
|
|
309
281
|
**/
|
|
@@ -358,4 +330,4 @@ function lpRoute(requested, routes) {
|
|
|
358
330
|
return options.length === 1 ? options[0] : void 0;
|
|
359
331
|
}
|
|
360
332
|
//#endregion
|
|
361
|
-
exports.
|
|
333
|
+
exports.PrepareApi = PrepareApi;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_base_errors = require("../../../sdk/base/errors.js");
|
|
3
|
+
const require_sdk_market_adapters_midas_PlaceholderMidasGatewayAdapterContract = require("../../../sdk/market/adapters/midas/PlaceholderMidasGatewayAdapterContract.js");
|
|
3
4
|
require("../../../sdk/index.js");
|
|
4
5
|
const require_plugins_adapters_contracts_AbstractAdapter = require("./AbstractAdapter.js");
|
|
5
6
|
const require_plugins_adapters_abi_adapters_iMidasGatewayAdapterV311 = require("../abi/adapters/iMidasGatewayAdapterV311.js");
|
|
@@ -23,41 +24,12 @@ var MidasGatewayAdapterContract = class extends require_plugins_adapters_contrac
|
|
|
23
24
|
protocolAbi
|
|
24
25
|
});
|
|
25
26
|
if (args.baseParams.serializedParams) {
|
|
26
|
-
const decoded = (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: "address",
|
|
33
|
-
name: "targetContract"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: "address",
|
|
37
|
-
name: "gateway"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: "address",
|
|
41
|
-
name: "mToken"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
type: "address",
|
|
45
|
-
name: "quoteToken"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
type: "address",
|
|
49
|
-
name: "phantomToken"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
type: "bytes32",
|
|
53
|
-
name: "referrerId"
|
|
54
|
-
}
|
|
55
|
-
], args.baseParams.serializedParams);
|
|
56
|
-
this.#gateway = decoded[2];
|
|
57
|
-
this.#mToken = decoded[3];
|
|
58
|
-
this.#quoteToken = decoded[4];
|
|
59
|
-
this.#phantomToken = decoded[5];
|
|
60
|
-
this.#referrerId = decoded[6];
|
|
27
|
+
const decoded = require_sdk_market_adapters_midas_PlaceholderMidasGatewayAdapterContract.PlaceholderMidasGatewayAdapterContract.decodeSerializedParams(args.baseParams.serializedParams);
|
|
28
|
+
this.#gateway = decoded.gateway;
|
|
29
|
+
this.#mToken = decoded.mToken;
|
|
30
|
+
this.#quoteToken = decoded.quoteToken;
|
|
31
|
+
this.#phantomToken = decoded.phantomToken;
|
|
32
|
+
this.#referrerId = decoded.referrerId;
|
|
61
33
|
}
|
|
62
34
|
}
|
|
63
35
|
get gateway() {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_base_errors = require("../../../sdk/base/errors.js");
|
|
3
|
+
const require_sdk_market_adapters_midas_PlaceholderMidasIssuanceVaultAdapterContract = require("../../../sdk/market/adapters/midas/PlaceholderMidasIssuanceVaultAdapterContract.js");
|
|
3
4
|
require("../../../sdk/index.js");
|
|
4
5
|
const require_plugins_adapters_contracts_AbstractAdapter = require("./AbstractAdapter.js");
|
|
5
6
|
const require_plugins_adapters_abi_adapters_iMidasIssuanceVaultAdapterV310 = require("../abi/adapters/iMidasIssuanceVaultAdapterV310.js");
|
|
6
7
|
require("../abi/adapters/index.js");
|
|
7
8
|
const require_plugins_adapters_abi_targetContractAbi = require("../abi/targetContractAbi.js");
|
|
8
|
-
let viem = require("viem");
|
|
9
9
|
//#region src/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.ts
|
|
10
10
|
const abi = require_plugins_adapters_abi_adapters_iMidasIssuanceVaultAdapterV310.iMidasIssuanceVaultAdapterV310Abi;
|
|
11
11
|
const protocolAbi = require_plugins_adapters_abi_targetContractAbi.iMidasIssuanceVaultV310Abi;
|
|
@@ -20,31 +20,10 @@ var MidasIssuanceVaultAdapterContract = class extends require_plugins_adapters_c
|
|
|
20
20
|
protocolAbi
|
|
21
21
|
});
|
|
22
22
|
if (args.baseParams.serializedParams) {
|
|
23
|
-
const decoded = (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
type: "address",
|
|
30
|
-
name: "targetContract"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
type: "address",
|
|
34
|
-
name: "mToken"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: "bytes32",
|
|
38
|
-
name: "referrerId"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: "address[]",
|
|
42
|
-
name: "allowedTokens"
|
|
43
|
-
}
|
|
44
|
-
], args.baseParams.serializedParams);
|
|
45
|
-
this.#mToken = decoded[2];
|
|
46
|
-
this.#referrerId = decoded[3];
|
|
47
|
-
this.#allowedTokens = [...decoded[4]];
|
|
23
|
+
const decoded = require_sdk_market_adapters_midas_PlaceholderMidasIssuanceVaultAdapterContract.PlaceholderMidasIssuanceVaultAdapterContract.decodeSerializedParams(args.baseParams.serializedParams);
|
|
24
|
+
this.#mToken = decoded.mToken;
|
|
25
|
+
this.#referrerId = decoded.referrerId;
|
|
26
|
+
this.#allowedTokens = decoded.allowedTokens;
|
|
48
27
|
}
|
|
49
28
|
}
|
|
50
29
|
get mToken() {
|
|
@@ -16,6 +16,7 @@ require("../market/index.js");
|
|
|
16
16
|
const require_sdk_accounts_credit_account_compressor_CreditAccountCompressor = require("./credit-account-compressor/CreditAccountCompressor.js");
|
|
17
17
|
require("./credit-account-compressor/index.js");
|
|
18
18
|
const require_sdk_accounts_multicall_utils = require("./multicall-utils.js");
|
|
19
|
+
const require_sdk_accounts_utils_midasUtils = require("./utils/midasUtils.js");
|
|
19
20
|
let viem = require("viem");
|
|
20
21
|
//#region src/sdk/accounts/CreditAccountsServiceV310.ts
|
|
21
22
|
/**
|
|
@@ -213,7 +214,7 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
213
214
|
if (withdrawToken === true) tokenToWithdraw = cm.underlying;
|
|
214
215
|
else if (typeof withdrawToken === "string") tokenToWithdraw = withdrawToken;
|
|
215
216
|
const { creditFacade } = cmSuite;
|
|
216
|
-
|
|
217
|
+
let calls = [
|
|
217
218
|
creditFacade.prepareIncreaseDebt(debt),
|
|
218
219
|
...creditFacade.prepareAddCollateral(collateral, permits),
|
|
219
220
|
...openPathCalls,
|
|
@@ -224,7 +225,8 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
224
225
|
}),
|
|
225
226
|
...callsAfter ?? []
|
|
226
227
|
];
|
|
227
|
-
|
|
228
|
+
calls = await this.#prependMidasReceiveGreenlist(cm.address, calls);
|
|
229
|
+
calls = await this.prependPriceUpdates(cm.address, calls);
|
|
228
230
|
const tx = reopenCreditAccount ? cmSuite.multicallTx(reopenCreditAccount, calls) : cmSuite.openCreditAccountTx(to, calls, referralCode, rwaOptions);
|
|
229
231
|
tx.value = ethAmount.toString(10);
|
|
230
232
|
return tx;
|
|
@@ -450,6 +452,18 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
450
452
|
return this.sdk.addressProvider.mustGetLatest(require_sdk_constants_address_provider.AP_REWARDS_COMPRESSOR, require_sdk_constants_versions.VERSION_RANGE_310)[0];
|
|
451
453
|
}
|
|
452
454
|
/**
|
|
455
|
+
* {@inheritDoc ICreditAccountsService.prependMidasReceiveGreenlist}
|
|
456
|
+
*/
|
|
457
|
+
async #prependMidasReceiveGreenlist(creditManager, calls) {
|
|
458
|
+
const cm = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
459
|
+
return require_sdk_accounts_utils_midasUtils.prependMidasReceiveGreenlist({
|
|
460
|
+
cm,
|
|
461
|
+
client: this.client,
|
|
462
|
+
calls,
|
|
463
|
+
logger: this.logger
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
453
467
|
* Withdrawal compressor of the current chain.
|
|
454
468
|
* @throws If no withdrawal compressor is supported on the current chain.
|
|
455
469
|
**/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_AddressMap = require("../../utils/AddressMap.js");
|
|
3
|
+
let viem = require("viem");
|
|
4
|
+
//#region src/sdk/accounts/utils/midasUtils.ts
|
|
5
|
+
const ADAPTER_MIDAS_GATEWAY = "ADAPTER::MIDAS_GATEWAY";
|
|
6
|
+
const ADAPTER_MIDAS_ISSUANCE_VAULT = "ADAPTER::MIDAS_ISSUANCE_VAULT";
|
|
7
|
+
/**
|
|
8
|
+
* Permissionless gateways have no greenlist and reject `receiveGreenlist`,
|
|
9
|
+
* see MidasMode in integrations-v3
|
|
10
|
+
*/
|
|
11
|
+
const MIDAS_MODE_PERMISSIONLESS = 0;
|
|
12
|
+
const iMidasGatewayAdapterExtAbi = (0, viem.parseAbi)(["function receiveGreenlist() external returns (bool)"]);
|
|
13
|
+
const iMidasGatewayModeAbi = (0, viem.parseAbi)(["function mode() external view returns (uint8)"]);
|
|
14
|
+
const receiveGreenlistCallData = (0, viem.encodeFunctionData)({
|
|
15
|
+
abi: iMidasGatewayAdapterExtAbi,
|
|
16
|
+
functionName: "receiveGreenlist"
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Prepends `MidasGatewayAdapter.receiveGreenlist()` to a credit facade
|
|
20
|
+
* multicall that mints an mToken through a Midas issuance vault.
|
|
21
|
+
*
|
|
22
|
+
* Permissioned and restricted-interface mTokens can only be held by greenlisted
|
|
23
|
+
* accounts, and a freshly opened credit account is never greenlisted, so the
|
|
24
|
+
* mint reverts with `WMAC: hasnt role` unless the account asks the gateway for
|
|
25
|
+
* the greenlist first. Greenlisting the borrower is not enough — the role is
|
|
26
|
+
* checked on the token holder, which is the credit account.
|
|
27
|
+
*
|
|
28
|
+
* Returns `calls` unchanged when nothing has to be greenlisted: no issuance
|
|
29
|
+
* vault is called, its mToken has no gateway adapter on this credit manager,
|
|
30
|
+
* the gateway is permissionless, or the call is already there.
|
|
31
|
+
*/
|
|
32
|
+
async function prependMidasReceiveGreenlist(props) {
|
|
33
|
+
const { cm, client, calls, logger } = props;
|
|
34
|
+
const adapters = Array.from(cm.creditManager.adapters.values());
|
|
35
|
+
const gatewayByMToken = require_sdk_utils_AddressMap.AddressMap.fromMappedArray(adapters.filter((a) => a.contractType === ADAPTER_MIDAS_GATEWAY), (a) => a.mToken);
|
|
36
|
+
const calledVaults = adapters.filter((a) => a.contractType === ADAPTER_MIDAS_ISSUANCE_VAULT).filter((vault) => calls.some((call) => (0, viem.isAddressEqual)(call.target, vault.address)));
|
|
37
|
+
if (gatewayByMToken.size === 0 || calledVaults.length === 0) return calls;
|
|
38
|
+
const gateways = new require_sdk_utils_AddressMap.AddressMap();
|
|
39
|
+
for (const vault of calledVaults) {
|
|
40
|
+
const gateway = gatewayByMToken.get(vault.mToken);
|
|
41
|
+
if (!gateway) logger?.debug(`midas: no gateway adapter for mToken ${vault.mToken} minted by ${vault.address} on ${cm.name}, cannot greenlist the credit account`);
|
|
42
|
+
else if (calls.some((call) => (0, viem.isAddressEqual)(call.target, gateway.address) && call.callData === receiveGreenlistCallData)) logger?.debug(`midas: gateway adapter ${gateway.address} already receives the greenlist`);
|
|
43
|
+
else gateways.upsert(gateway.address, gateway);
|
|
44
|
+
}
|
|
45
|
+
if (gateways.size === 0) return calls;
|
|
46
|
+
const uniqueGateways = gateways.values();
|
|
47
|
+
const modes = await client.multicall({
|
|
48
|
+
allowFailure: false,
|
|
49
|
+
contracts: uniqueGateways.map(({ targetContract }) => ({
|
|
50
|
+
address: targetContract,
|
|
51
|
+
abi: iMidasGatewayModeAbi,
|
|
52
|
+
functionName: "mode"
|
|
53
|
+
}))
|
|
54
|
+
});
|
|
55
|
+
const prepended = [];
|
|
56
|
+
for (const [i, gateway] of uniqueGateways.entries()) {
|
|
57
|
+
if (modes[i] === MIDAS_MODE_PERMISSIONLESS) {
|
|
58
|
+
logger?.debug(`midas: gateway ${gateway.targetContract} is permissionless, nothing to greenlist`);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
logger?.debug(`midas: greenlisting the credit account via gateway adapter ${gateway.address}`);
|
|
62
|
+
prepended.push({
|
|
63
|
+
target: gateway.address,
|
|
64
|
+
callData: receiveGreenlistCallData
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return prepended.length > 0 ? [...prepended, ...calls] : calls;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
exports.prependMidasReceiveGreenlist = prependMidasReceiveGreenlist;
|
package/dist/cjs/sdk/index.js
CHANGED
|
@@ -46,6 +46,8 @@ require("./base/index.js");
|
|
|
46
46
|
const require_sdk_accounts_bots_PeripheryCompressorV310Contract = require("./accounts/bots/PeripheryCompressorV310Contract.js");
|
|
47
47
|
const require_sdk_accounts_bots_AccountBotsService = require("./accounts/bots/AccountBotsService.js");
|
|
48
48
|
const require_sdk_market_adapters_PlaceholderAdapterContracts = require("./market/adapters/PlaceholderAdapterContracts.js");
|
|
49
|
+
const require_sdk_market_adapters_midas_PlaceholderMidasGatewayAdapterContract = require("./market/adapters/midas/PlaceholderMidasGatewayAdapterContract.js");
|
|
50
|
+
const require_sdk_market_adapters_midas_PlaceholderMidasIssuanceVaultAdapterContract = require("./market/adapters/midas/PlaceholderMidasIssuanceVaultAdapterContract.js");
|
|
49
51
|
const require_sdk_market_adapters_createAdapter = require("./market/adapters/createAdapter.js");
|
|
50
52
|
const require_sdk_market_credit_CreditConfiguratorV310Contract = require("./market/credit/CreditConfiguratorV310Contract.js");
|
|
51
53
|
const require_sdk_market_credit_CreditFacadeV310BaseContract = require("./market/credit/CreditFacadeV310BaseContract.js");
|
|
@@ -279,6 +281,8 @@ exports.PendleTWAPPTPriceFeed = require_sdk_market_pricefeeds_PendleTWAPPTPriceF
|
|
|
279
281
|
exports.PeripheryCompressorV310Contract = require_sdk_accounts_bots_PeripheryCompressorV310Contract.PeripheryCompressorV310Contract;
|
|
280
282
|
exports.PlaceholderAdapterContract = require_sdk_market_adapters_PlaceholderAdapterContracts.PlaceholderAdapterContract;
|
|
281
283
|
exports.PlaceholderContract = require_sdk_base_PlaceholderContract.PlaceholderContract;
|
|
284
|
+
exports.PlaceholderMidasGatewayAdapterContract = require_sdk_market_adapters_midas_PlaceholderMidasGatewayAdapterContract.PlaceholderMidasGatewayAdapterContract;
|
|
285
|
+
exports.PlaceholderMidasIssuanceVaultAdapterContract = require_sdk_market_adapters_midas_PlaceholderMidasIssuanceVaultAdapterContract.PlaceholderMidasIssuanceVaultAdapterContract;
|
|
282
286
|
exports.PluginStateVersionError = require_sdk_plugins_errors.PluginStateVersionError;
|
|
283
287
|
exports.PoolService = require_sdk_pools_PoolService.PoolService;
|
|
284
288
|
exports.PoolSuite = require_sdk_market_pool_PoolSuite.PoolSuite;
|