@gearbox-protocol/sdk 14.12.0-next.60 → 14.12.0-next.62
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/index.js +5 -4
- package/dist/cjs/dev/kycUtils.js +1 -1
- package/dist/cjs/dev/{claimDSToken.js → securitizeUtils.js} +88 -2
- package/dist/cjs/permissionless/bindings/factory/credit-factory.js +1 -1
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/cjs/sdk/accounts/liquidations/helpers.js +18 -7
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/index.js +3 -3
- package/dist/esm/dev/kycUtils.js +1 -1
- package/dist/esm/dev/{claimDSToken.js → securitizeUtils.js} +88 -3
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/permissionless/bindings/factory/credit-factory.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +2 -2
- package/dist/esm/sdk/accounts/liquidations/helpers.js +18 -7
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +2 -2
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/dev/index.d.ts +3 -3
- package/dist/types/dev/securitizeUtils.d.ts +59 -0
- package/dist/types/sdk/accounts/liquidations/helpers.d.ts +1 -1
- package/dist/types/sdk/accounts/liquidations/types.d.ts +11 -3
- package/package.json +1 -1
- package/dist/types/dev/claimDSToken.d.ts +0 -36
package/dist/cjs/dev/index.js
CHANGED
|
@@ -10,19 +10,19 @@ const require_dev_EthCallSpy = require("./EthCallSpy.js");
|
|
|
10
10
|
const require_dev_transports = require("./transports.js");
|
|
11
11
|
const require_dev_RevolverTransport = require("./RevolverTransport.js");
|
|
12
12
|
const require_dev_calcLiquidatableLTs = require("./calcLiquidatableLTs.js");
|
|
13
|
-
const require_dev_kycUtils = require("./kycUtils.js");
|
|
14
|
-
const require_dev_claimDSToken = require("./claimDSToken.js");
|
|
15
13
|
const require_dev_create2 = require("./create2.js");
|
|
16
14
|
const require_dev_detectChain = require("./detectChain.js");
|
|
17
15
|
const require_dev_isOutOfSyncError = require("./isOutOfSyncError.js");
|
|
18
16
|
const require_dev_isRateLimitError = require("./isRateLimitError.js");
|
|
19
17
|
const require_dev_isTransientError = require("./isTransientError.js");
|
|
18
|
+
const require_dev_kycUtils = require("./kycUtils.js");
|
|
20
19
|
const require_dev_logSplitterTransport = require("./logSplitterTransport.js");
|
|
21
20
|
const require_dev_ltUtils = require("./ltUtils.js");
|
|
22
21
|
const require_dev_migrateFaucet = require("./migrateFaucet.js");
|
|
23
22
|
const require_dev_providers = require("./providers.js");
|
|
24
23
|
const require_dev_replaceStorage = require("./replaceStorage.js");
|
|
25
24
|
const require_dev_resilientTransport = require("./resilientTransport.js");
|
|
25
|
+
const require_dev_securitizeUtils = require("./securitizeUtils.js");
|
|
26
26
|
require("./types.js");
|
|
27
27
|
const require_dev_verifyTestnet = require("./verifyTestnet.js");
|
|
28
28
|
const require_dev_withdrawalUtils = require("./withdrawalUtils.js");
|
|
@@ -39,13 +39,14 @@ exports.SUPPORTED_RPC_PROVIDERS = require_dev_providers.SUPPORTED_RPC_PROVIDERS;
|
|
|
39
39
|
exports.SelectionStrategy = require_dev_RevolverTransport.SelectionStrategy;
|
|
40
40
|
exports.anvilNodeInfo = require_dev_createAnvilClient.anvilNodeInfo;
|
|
41
41
|
exports.calcLiquidatableLTs = require_dev_calcLiquidatableLTs.calcLiquidatableLTs;
|
|
42
|
-
exports.claimDSToken =
|
|
43
|
-
exports.claimDSTokens =
|
|
42
|
+
exports.claimDSToken = require_dev_securitizeUtils.claimDSToken;
|
|
43
|
+
exports.claimDSTokens = require_dev_securitizeUtils.claimDSTokens;
|
|
44
44
|
exports.claimFromFaucet = require_dev_claimFromFaucet.claimFromFaucet;
|
|
45
45
|
exports.createAnvilClient = require_dev_createAnvilClient.createAnvilClient;
|
|
46
46
|
exports.createMinter = require_dev_mint_factory.createMinter;
|
|
47
47
|
exports.deployUsingPublicCreate2 = require_dev_create2.deployUsingPublicCreate2;
|
|
48
48
|
exports.detectChain = require_dev_detectChain.detectChain;
|
|
49
|
+
exports.disableDSTokenLockPeriods = require_dev_securitizeUtils.disableDSTokenLockPeriods;
|
|
49
50
|
exports.evmMineDetailed = require_dev_createAnvilClient.evmMineDetailed;
|
|
50
51
|
exports.extendAnvilClient = require_dev_createAnvilClient.extendAnvilClient;
|
|
51
52
|
exports.faucetAbi = require_dev_abi.faucetAbi;
|
package/dist/cjs/dev/kycUtils.js
CHANGED
|
@@ -4,8 +4,8 @@ const require_sdk_constants_math = require("../sdk/constants/math.js");
|
|
|
4
4
|
const require_sdk_OnchainSDK = require("../sdk/OnchainSDK.js");
|
|
5
5
|
require("../sdk/index.js");
|
|
6
6
|
const require_dev_withdrawalAbi = require("./withdrawalAbi.js");
|
|
7
|
-
const require_abi_rwa_iDSToken = require("../abi/rwa/iDSToken.js");
|
|
8
7
|
const require_abi_rwa_iDSRegistryService = require("../abi/rwa/iDSRegistryService.js");
|
|
8
|
+
const require_abi_rwa_iDSToken = require("../abi/rwa/iDSToken.js");
|
|
9
9
|
let viem = require("viem");
|
|
10
10
|
let viem_accounts = require("viem/accounts");
|
|
11
11
|
//#region src/dev/kycUtils.ts
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_AddressSet = require("../sdk/utils/AddressSet.js");
|
|
2
3
|
const require_sdk_OnchainSDK = require("../sdk/OnchainSDK.js");
|
|
3
4
|
require("../sdk/index.js");
|
|
4
5
|
const require_abi_rwa_iDSToken = require("../abi/rwa/iDSToken.js");
|
|
5
6
|
const require_dev_kycUtils = require("./kycUtils.js");
|
|
6
7
|
let viem = require("viem");
|
|
7
8
|
let viem_accounts = require("viem/accounts");
|
|
8
|
-
//#region src/dev/
|
|
9
|
+
//#region src/dev/securitizeUtils.ts
|
|
9
10
|
/**
|
|
10
11
|
* `COMPLIANCE_CONFIGURATION_SERVICE` id in the DS protocol service registry
|
|
11
12
|
*/
|
|
12
13
|
const COMPLIANCE_CONFIGURATION_SERVICE = 256n;
|
|
13
|
-
const iDSComplianceConfigurationServiceAbi = (0, viem.parseAbi)([
|
|
14
|
+
const iDSComplianceConfigurationServiceAbi = (0, viem.parseAbi)([
|
|
15
|
+
"function getUSLockPeriod() external view returns (uint256)",
|
|
16
|
+
"function getNonUSLockPeriod() external view returns (uint256)",
|
|
17
|
+
"function setUSLockPeriod(uint256) external",
|
|
18
|
+
"function setNonUSLockPeriod(uint256) external"
|
|
19
|
+
]);
|
|
14
20
|
/**
|
|
15
21
|
* Returns issuance time that is old enough for the issued tokens to be past
|
|
16
22
|
* both US and non-US compliance lock periods, or `undefined` when the token
|
|
@@ -85,6 +91,85 @@ async function issueDSTokens(props) {
|
|
|
85
91
|
args: [investor, amount]
|
|
86
92
|
});
|
|
87
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Zeros US and non-US compliance lock periods on each DSToken's compliance
|
|
96
|
+
* configuration service so collateral can be transferred during testnet
|
|
97
|
+
* liquidations (e.g. STAC). No-ops for tokens without a compliance service
|
|
98
|
+
* (MockDSToken) or when both periods are already 0.
|
|
99
|
+
*
|
|
100
|
+
* Must be signed by a DS admin with sufficient trust (same key as
|
|
101
|
+
* `issueTokens` / registerInvestor); Ownable `owner()` alone is not enough.
|
|
102
|
+
*/
|
|
103
|
+
async function disableDSTokenLockPeriods(props) {
|
|
104
|
+
const { anvil, adminPrivateKey, logger } = props;
|
|
105
|
+
const account = (0, viem_accounts.privateKeyToAccount)(adminPrivateKey);
|
|
106
|
+
const tokens = [...new require_sdk_utils_AddressSet.AddressSet(props.tokens)];
|
|
107
|
+
for (const token of tokens) {
|
|
108
|
+
const symbol = await anvil.readContract({
|
|
109
|
+
address: token,
|
|
110
|
+
abi: viem.erc20Abi,
|
|
111
|
+
functionName: "symbol",
|
|
112
|
+
args: []
|
|
113
|
+
}).catch(() => token);
|
|
114
|
+
const tokenLogger = logger?.child?.({ symbol }) ?? logger;
|
|
115
|
+
let complianceConfiguration;
|
|
116
|
+
try {
|
|
117
|
+
complianceConfiguration = await anvil.readContract({
|
|
118
|
+
address: token,
|
|
119
|
+
abi: require_abi_rwa_iDSToken.iDSTokenAbi,
|
|
120
|
+
functionName: "getDSService",
|
|
121
|
+
args: [COMPLIANCE_CONFIGURATION_SERVICE]
|
|
122
|
+
});
|
|
123
|
+
} catch (e) {
|
|
124
|
+
tokenLogger?.debug(`Skipping lock-period disable for ${symbol}: no compliance service (${e})`);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if ((0, viem.isAddressEqual)(complianceConfiguration, viem.zeroAddress)) {
|
|
128
|
+
tokenLogger?.debug(`Skipping lock-period disable for ${symbol}: compliance configuration service is zero`);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
let usLockPeriod;
|
|
132
|
+
let nonUSLockPeriod;
|
|
133
|
+
try {
|
|
134
|
+
[usLockPeriod, nonUSLockPeriod] = await anvil.multicall({
|
|
135
|
+
contracts: [{
|
|
136
|
+
address: complianceConfiguration,
|
|
137
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
138
|
+
functionName: "getUSLockPeriod"
|
|
139
|
+
}, {
|
|
140
|
+
address: complianceConfiguration,
|
|
141
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
142
|
+
functionName: "getNonUSLockPeriod"
|
|
143
|
+
}],
|
|
144
|
+
allowFailure: false
|
|
145
|
+
});
|
|
146
|
+
} catch (e) {
|
|
147
|
+
tokenLogger?.debug(`Skipping lock-period disable for ${symbol}: failed to read lock periods (${e})`);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (usLockPeriod === 0n && nonUSLockPeriod === 0n) {
|
|
151
|
+
tokenLogger?.debug(`Lock periods already 0 for ${symbol} (${complianceConfiguration})`);
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
tokenLogger?.info(`Zeroing lock periods for ${symbol}: US ${usLockPeriod} → 0, non-US ${nonUSLockPeriod} → 0 (${complianceConfiguration})`);
|
|
155
|
+
if (usLockPeriod !== 0n) await require_dev_kycUtils.writeAndWait(anvil, {
|
|
156
|
+
account,
|
|
157
|
+
chain: anvil.chain,
|
|
158
|
+
address: complianceConfiguration,
|
|
159
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
160
|
+
functionName: "setUSLockPeriod",
|
|
161
|
+
args: [0n]
|
|
162
|
+
});
|
|
163
|
+
if (nonUSLockPeriod !== 0n) await require_dev_kycUtils.writeAndWait(anvil, {
|
|
164
|
+
account,
|
|
165
|
+
chain: anvil.chain,
|
|
166
|
+
address: complianceConfiguration,
|
|
167
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
168
|
+
functionName: "setNonUSLockPeriod",
|
|
169
|
+
args: [0n]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
88
173
|
async function claimDSToken(props) {
|
|
89
174
|
const { anvil, investor, adminPrivateKey, token, marketConfigurators, rwaFactories, usdAmount: usdAmountProp = "100000" } = props;
|
|
90
175
|
const account = (0, viem_accounts.privateKeyToAccount)(adminPrivateKey);
|
|
@@ -150,3 +235,4 @@ async function claimDSTokens(props) {
|
|
|
150
235
|
//#endregion
|
|
151
236
|
exports.claimDSToken = claimDSToken;
|
|
152
237
|
exports.claimDSTokens = claimDSTokens;
|
|
238
|
+
exports.disableDSTokenLockPeriods = disableDSTokenLockPeriods;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_abi_310_configure_iCreditConfigureActions = require("../../../abi/310/configure/iCreditConfigureActions.js");
|
|
3
2
|
const require_plugins_adapters_abi_conctructorAbi = require("../../../plugins/adapters/abi/conctructorAbi.js");
|
|
4
3
|
const require_plugins_adapters_abi_utils = require("../../../plugins/adapters/abi/utils.js");
|
|
5
4
|
require("../../../plugins/adapters/index.js");
|
|
5
|
+
const require_abi_310_configure_iCreditConfigureActions = require("../../../abi/310/configure/iCreditConfigureActions.js");
|
|
6
6
|
const require_permissionless_bindings_factory_abstract_factory = require("./abstract-factory.js");
|
|
7
7
|
let viem = require("viem");
|
|
8
8
|
//#region src/permissionless/bindings/factory/credit-factory.ts
|
|
@@ -101,7 +101,7 @@ var LiquidationsService = class extends require_sdk_base_SDKConstruct.SDKConstru
|
|
|
101
101
|
await compressor.loadWithdrawableAssets();
|
|
102
102
|
const phantomTokens = new require_sdk_utils_AddressSet.AddressSet(compressor.getWithdrawableAssets().map((a) => a.withdrawalPhantomToken));
|
|
103
103
|
const current = await compressor.getExternalAccountCurrentWithdrawals(props.liquidator, ...phantomTokens.asArray());
|
|
104
|
-
return require_sdk_accounts_liquidations_helpers.toLiquidatorWithdrawals(current, this.sdk.networkType);
|
|
104
|
+
return require_sdk_accounts_liquidations_helpers.toLiquidatorWithdrawals(current, this.sdk.networkType, this.sdk.chainId);
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* {@inheritDoc ILiquidationsService.loadRWALiquidators}
|
|
@@ -70,20 +70,31 @@ function pickMainAsset(ca, convert) {
|
|
|
70
70
|
* @param current - Claimable and pending withdrawals from the withdrawal compressor
|
|
71
71
|
* @param network - Network the withdrawals live on
|
|
72
72
|
**/
|
|
73
|
-
function toLiquidatorWithdrawals(current, network) {
|
|
73
|
+
function toLiquidatorWithdrawals(current, network, chainId) {
|
|
74
74
|
const rows = [];
|
|
75
|
-
for (const w of current.claimable)
|
|
75
|
+
for (const w of current.claimable) rows.push({
|
|
76
76
|
network,
|
|
77
|
+
chainId,
|
|
77
78
|
sourceToken: w.token,
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
outputs: w.outputs.map((o) => {
|
|
80
|
+
return {
|
|
81
|
+
balance: o.amount,
|
|
82
|
+
token: o.token
|
|
83
|
+
};
|
|
84
|
+
}),
|
|
85
|
+
claimCalls: w.claimCalls,
|
|
80
86
|
redeemer: w.redeemer
|
|
81
87
|
});
|
|
82
|
-
for (const w of current.pending)
|
|
88
|
+
for (const w of current.pending) rows.push({
|
|
83
89
|
network,
|
|
90
|
+
chainId,
|
|
84
91
|
sourceToken: w.token,
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
outputs: w.expectedOutputs.map((o) => {
|
|
93
|
+
return {
|
|
94
|
+
balance: o.amount,
|
|
95
|
+
token: o.token
|
|
96
|
+
};
|
|
97
|
+
}),
|
|
87
98
|
claimableAt: w.claimableAt,
|
|
88
99
|
redeemer: w.redeemer
|
|
89
100
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ierc20Abi } from "../abi/iERC20.js";
|
|
2
1
|
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../sdk/utils/AddressMap.js";
|
|
4
3
|
import { AddressSet } from "../sdk/utils/AddressSet.js";
|
|
5
4
|
import { AssetsMap } from "../sdk/utils/AssetsMap.js";
|
|
6
5
|
import { childLogger } from "../sdk/utils/childLogger.js";
|
|
6
|
+
import { ierc20Abi } from "../abi/iERC20.js";
|
|
7
7
|
import "../sdk/constants/addresses.js";
|
|
8
8
|
import { MAX_UINT256, PERCENTAGE_FACTOR } from "../sdk/constants/math.js";
|
|
9
9
|
import { SDKConstruct } from "../sdk/base/SDKConstruct.js";
|
package/dist/esm/dev/index.js
CHANGED
|
@@ -9,20 +9,20 @@ import { EthCallSpy } from "./EthCallSpy.js";
|
|
|
9
9
|
import { httpTransportOptionsSchema } from "./transports.js";
|
|
10
10
|
import { NoAvailableTransportsError, RevolverTransport, SelectionStrategy, providerConfigSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema } from "./RevolverTransport.js";
|
|
11
11
|
import { calcLiquidatableLTs } from "./calcLiquidatableLTs.js";
|
|
12
|
-
import { greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, writeAndWait } from "./kycUtils.js";
|
|
13
|
-
import { claimDSToken, claimDSTokens } from "./claimDSToken.js";
|
|
14
12
|
import { Create2Deployer, DEFAULT_CREATE2_SALT, PUBLIC_CREATE2_FACTORY, deployUsingPublicCreate2, getPublicCreate2Address, isDeployedUsingPublicCreate2 } from "./create2.js";
|
|
15
13
|
import { detectChain } from "./detectChain.js";
|
|
16
14
|
import { isOutOfSyncError } from "./isOutOfSyncError.js";
|
|
17
15
|
import { isRateLimitError } from "./isRateLimitError.js";
|
|
18
16
|
import { isTransientError } from "./isTransientError.js";
|
|
17
|
+
import { greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, writeAndWait } from "./kycUtils.js";
|
|
19
18
|
import { isRangeError, logSplitterTransport } from "./logSplitterTransport.js";
|
|
20
19
|
import { setLTZero, setLTs } from "./ltUtils.js";
|
|
21
20
|
import { migrateFaucet } from "./migrateFaucet.js";
|
|
22
21
|
import { SUPPORTED_RPC_PROVIDERS, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getRpcProviderUrl, getThirdWebUrl, rpcProvidersSchema } from "./providers.js";
|
|
23
22
|
import { replaceStorage } from "./replaceStorage.js";
|
|
24
23
|
import { resilientTransport, resilientTransportOptionsSchema } from "./resilientTransport.js";
|
|
24
|
+
import { claimDSToken, claimDSTokens, disableDSTokenLockPeriods } from "./securitizeUtils.js";
|
|
25
25
|
import "./types.js";
|
|
26
26
|
import { ONCHAIN_EXECUTION_ID_ADDRESS, verifyTestnet } from "./verifyTestnet.js";
|
|
27
27
|
import { makePendingWithdrawalsClaimable } from "./withdrawalUtils.js";
|
|
28
|
-
export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, evmMineDetailed, extendAnvilClient, faucetAbi, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, prependMidasReceiveGreenlist, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, verifyTestnet, writeAndWait };
|
|
28
|
+
export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, disableDSTokenLockPeriods, evmMineDetailed, extendAnvilClient, faucetAbi, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, prependMidasReceiveGreenlist, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, verifyTestnet, writeAndWait };
|
package/dist/esm/dev/kycUtils.js
CHANGED
|
@@ -3,8 +3,8 @@ import { MAX_UINT256 } from "../sdk/constants/math.js";
|
|
|
3
3
|
import { OnchainSDK } from "../sdk/OnchainSDK.js";
|
|
4
4
|
import "../sdk/index.js";
|
|
5
5
|
import { midasGatewayAbi } from "./withdrawalAbi.js";
|
|
6
|
-
import { iDSTokenAbi } from "../abi/rwa/iDSToken.js";
|
|
7
6
|
import { iDSRegistryServiceAbi } from "../abi/rwa/iDSRegistryService.js";
|
|
7
|
+
import { iDSTokenAbi } from "../abi/rwa/iDSToken.js";
|
|
8
8
|
import { isAddressEqual, parseAbi, parseEther, zeroAddress } from "viem";
|
|
9
9
|
import { privateKeyToAccount } from "viem/accounts";
|
|
10
10
|
//#region src/dev/kycUtils.ts
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
import { AddressSet } from "../sdk/utils/AddressSet.js";
|
|
1
2
|
import { OnchainSDK } from "../sdk/OnchainSDK.js";
|
|
2
3
|
import "../sdk/index.js";
|
|
3
4
|
import { iDSTokenAbi } from "../abi/rwa/iDSToken.js";
|
|
4
5
|
import { registerSecuritizeInvestor, writeAndWait } from "./kycUtils.js";
|
|
5
6
|
import { erc20Abi, isAddressEqual, parseAbi, zeroAddress } from "viem";
|
|
6
7
|
import { privateKeyToAccount } from "viem/accounts";
|
|
7
|
-
//#region src/dev/
|
|
8
|
+
//#region src/dev/securitizeUtils.ts
|
|
8
9
|
/**
|
|
9
10
|
* `COMPLIANCE_CONFIGURATION_SERVICE` id in the DS protocol service registry
|
|
10
11
|
*/
|
|
11
12
|
const COMPLIANCE_CONFIGURATION_SERVICE = 256n;
|
|
12
|
-
const iDSComplianceConfigurationServiceAbi = parseAbi([
|
|
13
|
+
const iDSComplianceConfigurationServiceAbi = parseAbi([
|
|
14
|
+
"function getUSLockPeriod() external view returns (uint256)",
|
|
15
|
+
"function getNonUSLockPeriod() external view returns (uint256)",
|
|
16
|
+
"function setUSLockPeriod(uint256) external",
|
|
17
|
+
"function setNonUSLockPeriod(uint256) external"
|
|
18
|
+
]);
|
|
13
19
|
/**
|
|
14
20
|
* Returns issuance time that is old enough for the issued tokens to be past
|
|
15
21
|
* both US and non-US compliance lock periods, or `undefined` when the token
|
|
@@ -84,6 +90,85 @@ async function issueDSTokens(props) {
|
|
|
84
90
|
args: [investor, amount]
|
|
85
91
|
});
|
|
86
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Zeros US and non-US compliance lock periods on each DSToken's compliance
|
|
95
|
+
* configuration service so collateral can be transferred during testnet
|
|
96
|
+
* liquidations (e.g. STAC). No-ops for tokens without a compliance service
|
|
97
|
+
* (MockDSToken) or when both periods are already 0.
|
|
98
|
+
*
|
|
99
|
+
* Must be signed by a DS admin with sufficient trust (same key as
|
|
100
|
+
* `issueTokens` / registerInvestor); Ownable `owner()` alone is not enough.
|
|
101
|
+
*/
|
|
102
|
+
async function disableDSTokenLockPeriods(props) {
|
|
103
|
+
const { anvil, adminPrivateKey, logger } = props;
|
|
104
|
+
const account = privateKeyToAccount(adminPrivateKey);
|
|
105
|
+
const tokens = [...new AddressSet(props.tokens)];
|
|
106
|
+
for (const token of tokens) {
|
|
107
|
+
const symbol = await anvil.readContract({
|
|
108
|
+
address: token,
|
|
109
|
+
abi: erc20Abi,
|
|
110
|
+
functionName: "symbol",
|
|
111
|
+
args: []
|
|
112
|
+
}).catch(() => token);
|
|
113
|
+
const tokenLogger = logger?.child?.({ symbol }) ?? logger;
|
|
114
|
+
let complianceConfiguration;
|
|
115
|
+
try {
|
|
116
|
+
complianceConfiguration = await anvil.readContract({
|
|
117
|
+
address: token,
|
|
118
|
+
abi: iDSTokenAbi,
|
|
119
|
+
functionName: "getDSService",
|
|
120
|
+
args: [COMPLIANCE_CONFIGURATION_SERVICE]
|
|
121
|
+
});
|
|
122
|
+
} catch (e) {
|
|
123
|
+
tokenLogger?.debug(`Skipping lock-period disable for ${symbol}: no compliance service (${e})`);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (isAddressEqual(complianceConfiguration, zeroAddress)) {
|
|
127
|
+
tokenLogger?.debug(`Skipping lock-period disable for ${symbol}: compliance configuration service is zero`);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
let usLockPeriod;
|
|
131
|
+
let nonUSLockPeriod;
|
|
132
|
+
try {
|
|
133
|
+
[usLockPeriod, nonUSLockPeriod] = await anvil.multicall({
|
|
134
|
+
contracts: [{
|
|
135
|
+
address: complianceConfiguration,
|
|
136
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
137
|
+
functionName: "getUSLockPeriod"
|
|
138
|
+
}, {
|
|
139
|
+
address: complianceConfiguration,
|
|
140
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
141
|
+
functionName: "getNonUSLockPeriod"
|
|
142
|
+
}],
|
|
143
|
+
allowFailure: false
|
|
144
|
+
});
|
|
145
|
+
} catch (e) {
|
|
146
|
+
tokenLogger?.debug(`Skipping lock-period disable for ${symbol}: failed to read lock periods (${e})`);
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (usLockPeriod === 0n && nonUSLockPeriod === 0n) {
|
|
150
|
+
tokenLogger?.debug(`Lock periods already 0 for ${symbol} (${complianceConfiguration})`);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
tokenLogger?.info(`Zeroing lock periods for ${symbol}: US ${usLockPeriod} → 0, non-US ${nonUSLockPeriod} → 0 (${complianceConfiguration})`);
|
|
154
|
+
if (usLockPeriod !== 0n) await writeAndWait(anvil, {
|
|
155
|
+
account,
|
|
156
|
+
chain: anvil.chain,
|
|
157
|
+
address: complianceConfiguration,
|
|
158
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
159
|
+
functionName: "setUSLockPeriod",
|
|
160
|
+
args: [0n]
|
|
161
|
+
});
|
|
162
|
+
if (nonUSLockPeriod !== 0n) await writeAndWait(anvil, {
|
|
163
|
+
account,
|
|
164
|
+
chain: anvil.chain,
|
|
165
|
+
address: complianceConfiguration,
|
|
166
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
167
|
+
functionName: "setNonUSLockPeriod",
|
|
168
|
+
args: [0n]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
87
172
|
async function claimDSToken(props) {
|
|
88
173
|
const { anvil, investor, adminPrivateKey, token, marketConfigurators, rwaFactories, usdAmount: usdAmountProp = "100000" } = props;
|
|
89
174
|
const account = privateKeyToAccount(adminPrivateKey);
|
|
@@ -147,4 +232,4 @@ async function claimDSTokens(props) {
|
|
|
147
232
|
});
|
|
148
233
|
}
|
|
149
234
|
//#endregion
|
|
150
|
-
export { claimDSToken, claimDSTokens };
|
|
235
|
+
export { claimDSToken, claimDSTokens, disableDSTokenLockPeriods };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
2
1
|
import { getNetworkType } from "../sdk/chain/chains.js";
|
|
3
2
|
import { getWithdrawalCompressorAddress } from "../sdk/accounts/withdrawal-compressor/addresses.js";
|
|
3
|
+
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import "../sdk/index.js";
|
|
5
5
|
import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
|
|
6
6
|
import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { iCreditConfigureActionsAbi } from "../../../abi/310/configure/iCreditConfigureActions.js";
|
|
1
2
|
import { adapterConstructorAbi } from "../../../plugins/adapters/abi/conctructorAbi.js";
|
|
2
3
|
import { parseAdapterAction, parseAdapterDeployParams } from "../../../plugins/adapters/abi/utils.js";
|
|
3
4
|
import "../../../plugins/adapters/index.js";
|
|
4
|
-
import { iCreditConfigureActionsAbi } from "../../../abi/310/configure/iCreditConfigureActions.js";
|
|
5
5
|
import { AbstractFactory } from "./abstract-factory.js";
|
|
6
6
|
import { decodeFunctionData, hexToString } from "viem";
|
|
7
7
|
//#region src/permissionless/bindings/factory/credit-factory.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
2
|
+
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
3
3
|
import { asPreviewSimulationError } from "./errors.js";
|
|
4
4
|
//#region src/preview/simulate/simulatePoolOperation.ts
|
|
5
5
|
function previewRead(operation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
1
|
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../sdk/utils/AddressMap.js";
|
|
3
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
4
4
|
import "../../sdk/index.js";
|
|
5
5
|
import { UnexpectedFacadeEventOrderError } from "./errors.js";
|
|
6
6
|
import { getAddress, isAddressEqual, parseEventLogs } from "viem";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
2
|
-
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
3
1
|
import { iBotListV310Abi, iCreditFacadeMulticallV310Abi } from "../../abi/310/generated.js";
|
|
4
2
|
import { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountCompressor.js";
|
|
5
3
|
import { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
|
|
6
4
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
5
|
+
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
6
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
7
7
|
import { iRWAFactoryAbi } from "../../abi/rwa/iRWAFactory.js";
|
|
8
8
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
9
9
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
2
1
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
3
2
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
4
3
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
@@ -15,6 +14,7 @@ import { RWA_LIQUIDATOR_SECURITIZE } from "../../market/rwa/securitize/constants
|
|
|
15
14
|
import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/SecuritizeLiquidatorContract.js";
|
|
16
15
|
import "../../market/rwa/securitize/index.js";
|
|
17
16
|
import { LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
17
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
18
18
|
import { calcEstimatedProfit, calcRepaymentAmount, liquidationCallToRawTx, pickMainAsset, toLiquidationApproval, toLiquidatorWithdrawals, toReceivedAssets } from "./helpers.js";
|
|
19
19
|
//#region src/sdk/accounts/liquidations/LiquidationsService.ts
|
|
20
20
|
/**
|
|
@@ -100,7 +100,7 @@ var LiquidationsService = class extends SDKConstruct {
|
|
|
100
100
|
await compressor.loadWithdrawableAssets();
|
|
101
101
|
const phantomTokens = new AddressSet(compressor.getWithdrawableAssets().map((a) => a.withdrawalPhantomToken));
|
|
102
102
|
const current = await compressor.getExternalAccountCurrentWithdrawals(props.liquidator, ...phantomTokens.asArray());
|
|
103
|
-
return toLiquidatorWithdrawals(current, this.sdk.networkType);
|
|
103
|
+
return toLiquidatorWithdrawals(current, this.sdk.networkType, this.sdk.chainId);
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* {@inheritDoc ILiquidationsService.loadRWALiquidators}
|
|
@@ -69,20 +69,31 @@ function pickMainAsset(ca, convert) {
|
|
|
69
69
|
* @param current - Claimable and pending withdrawals from the withdrawal compressor
|
|
70
70
|
* @param network - Network the withdrawals live on
|
|
71
71
|
**/
|
|
72
|
-
function toLiquidatorWithdrawals(current, network) {
|
|
72
|
+
function toLiquidatorWithdrawals(current, network, chainId) {
|
|
73
73
|
const rows = [];
|
|
74
|
-
for (const w of current.claimable)
|
|
74
|
+
for (const w of current.claimable) rows.push({
|
|
75
75
|
network,
|
|
76
|
+
chainId,
|
|
76
77
|
sourceToken: w.token,
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
outputs: w.outputs.map((o) => {
|
|
79
|
+
return {
|
|
80
|
+
balance: o.amount,
|
|
81
|
+
token: o.token
|
|
82
|
+
};
|
|
83
|
+
}),
|
|
84
|
+
claimCalls: w.claimCalls,
|
|
79
85
|
redeemer: w.redeemer
|
|
80
86
|
});
|
|
81
|
-
for (const w of current.pending)
|
|
87
|
+
for (const w of current.pending) rows.push({
|
|
82
88
|
network,
|
|
89
|
+
chainId,
|
|
83
90
|
sourceToken: w.token,
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
outputs: w.expectedOutputs.map((o) => {
|
|
92
|
+
return {
|
|
93
|
+
balance: o.amount,
|
|
94
|
+
token: o.token
|
|
95
|
+
};
|
|
96
|
+
}),
|
|
86
97
|
claimableAt: w.claimableAt,
|
|
87
98
|
redeemer: w.redeemer
|
|
88
99
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
4
3
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
4
|
+
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
5
5
|
import { InvalidDelayedIntentError } from "./errors.js";
|
|
6
6
|
//#region src/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
7
7
|
const abi = iRedemptionLoggerV310Abi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
3
3
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV310Abi;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
3
3
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV311Abi;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
2
1
|
import { encodeDelayedIntent } from "./intent-codec.js";
|
|
3
2
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
|
+
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import { toWithdrawalStatus } from "./types.js";
|
|
5
5
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
|
|
6
6
|
const abi = iWithdrawalCompressorV313Abi;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
2
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
3
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
4
2
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
5
3
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
6
4
|
import { formatBN } from "../utils/formatter.js";
|
|
7
5
|
import "../utils/index.js";
|
|
6
|
+
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
7
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
8
8
|
//#region src/sdk/base/TokensMeta.ts
|
|
9
9
|
/**
|
|
10
10
|
* Registry of token metadata (symbol, decimals, phantom type) keyed by address.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
2
1
|
import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
|
|
3
2
|
import { isV310 } from "../constants/versions.js";
|
|
4
3
|
import "../constants/index.js";
|
|
5
4
|
import { hexEq } from "../utils/hex.js";
|
|
5
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
6
6
|
import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
|
|
7
7
|
//#region src/sdk/core/createAddressProvider.ts
|
|
8
8
|
const OVERRIDE_ADDRESSES = { Mainnet: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
4
3
|
import "../../base/index.js";
|
|
4
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
5
5
|
//#region src/sdk/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
6
|
const abi = [
|
|
7
7
|
...iCreditFacadeV310Abi,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
4
3
|
import { formatBN, formatBNvalue, percentFmt } from "../../utils/formatter.js";
|
|
5
4
|
import "../../utils/index.js";
|
|
6
5
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
7
6
|
import "../../base/index.js";
|
|
7
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
8
8
|
//#region src/sdk/market/pool/PoolV310Contract.ts
|
|
9
9
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
10
10
|
var PoolV310Contract = class extends BaseContract {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
1
|
import { ZapperContract } from "./ZapperContract.js";
|
|
2
|
+
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
3
3
|
//#region src/sdk/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
3
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
4
4
|
import { UnsupportedZapperFunctionError } from "./errors.js";
|
|
5
5
|
//#region src/sdk/market/zapper/ZapperContract.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorAbis } from "../../../abi/errors.js";
|
|
2
|
-
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
2
|
import { generateCastTraceCall } from "./cast.js";
|
|
3
|
+
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
4
4
|
import { simulateMulticall } from "./simulateMulticall.js";
|
|
5
5
|
import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
|
6
6
|
import { getAction, parseAccount } from "viem/utils";
|
|
@@ -4,10 +4,9 @@ import { CheckMulticallFn, DetectedCall, EthCallMethod, EthCallRequest, EthCallS
|
|
|
4
4
|
import { NoAvailableTransportsError, ProviderConfig, ProviderStatus, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, SelectionStrategy, providerConfigSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema } from "./RevolverTransport.js";
|
|
5
5
|
import { faucetAbi, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi } from "./abi.js";
|
|
6
6
|
import { calcLiquidatableLTs } from "./calcLiquidatableLTs.js";
|
|
7
|
-
import { AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, anvilNodeInfo, createAnvilClient, evmMineDetailed, extendAnvilClient, isAnvil } from "./createAnvilClient.js";
|
|
8
|
-
import { claimDSToken, claimDSTokens } from "./claimDSToken.js";
|
|
9
7
|
import { claimFromFaucet } from "./claimFromFaucet.js";
|
|
10
8
|
import { Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, EnsureExistsUsingPublicCreate2ReturnType, GetCreate2AddressParameters, PUBLIC_CREATE2_FACTORY, deployUsingPublicCreate2, getPublicCreate2Address, isDeployedUsingPublicCreate2 } from "./create2.js";
|
|
9
|
+
import { AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, anvilNodeInfo, createAnvilClient, evmMineDetailed, extendAnvilClient, isAnvil } from "./createAnvilClient.js";
|
|
11
10
|
import { detectChain } from "./detectChain.js";
|
|
12
11
|
import { isOutOfSyncError } from "./isOutOfSyncError.js";
|
|
13
12
|
import { isRateLimitError } from "./isRateLimitError.js";
|
|
@@ -23,7 +22,8 @@ import "./mint/index.js";
|
|
|
23
22
|
import { RpcProvider, SUPPORTED_RPC_PROVIDERS, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getRpcProviderUrl, getThirdWebUrl, rpcProvidersSchema } from "./providers.js";
|
|
24
23
|
import { ReplaceStorageParams, replaceStorage } from "./replaceStorage.js";
|
|
25
24
|
import { ResilientTransportOptions, resilientTransport, resilientTransportOptionsSchema } from "./resilientTransport.js";
|
|
25
|
+
import { DisableDSTokenLockPeriodsProps, claimDSToken, claimDSTokens, disableDSTokenLockPeriods } from "./securitizeUtils.js";
|
|
26
26
|
import { httpTransportOptionsSchema } from "./transports.js";
|
|
27
27
|
import { ONCHAIN_EXECUTION_ID_ADDRESS, VerifyTestnetParams, verifyTestnet } from "./verifyTestnet.js";
|
|
28
28
|
import { MakePendingWithdrawalsClaimableOptions, makePendingWithdrawalsClaimable } from "./withdrawalUtils.js";
|
|
29
|
-
export { AccountOpener, AccountOpenerOptions, AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, CheckMulticallFn, Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, DetectedCall, EnsureExistsUsingPublicCreate2ReturnType, EthCallMethod, EthCallRequest, EthCallSpy, GetCreate2AddressParameters, GreenlistMidasGatewayProps, IMinter, type LogSplitterTransportOptions, MakePendingWithdrawalsClaimableOptions, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenAccountHumanizedPreview, OpenAccountResult, OpenAccountsResult, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, PoolDepositResult, PrependMidasReceiveGreenlistProps, ProviderConfig, ProviderStatus, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, ReplaceStorageParams, ResilientTransportOptions, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, RpcErrorResult, RpcProvider, RpcResponse, RpcSuccessResult, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, TargetAccount, VerifyTestnetParams, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, evmMineDetailed, extendAnvilClient, faucetAbi, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, prependMidasReceiveGreenlist, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, verifyTestnet, writeAndWait };
|
|
29
|
+
export { AccountOpener, AccountOpenerOptions, AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, CheckMulticallFn, Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, DetectedCall, DisableDSTokenLockPeriodsProps, EnsureExistsUsingPublicCreate2ReturnType, EthCallMethod, EthCallRequest, EthCallSpy, GetCreate2AddressParameters, GreenlistMidasGatewayProps, IMinter, type LogSplitterTransportOptions, MakePendingWithdrawalsClaimableOptions, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenAccountHumanizedPreview, OpenAccountResult, OpenAccountsResult, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, PoolDepositResult, PrependMidasReceiveGreenlistProps, ProviderConfig, ProviderStatus, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, ReplaceStorageParams, ResilientTransportOptions, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, RpcErrorResult, RpcProvider, RpcResponse, RpcSuccessResult, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, TargetAccount, VerifyTestnetParams, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, disableDSTokenLockPeriods, evmMineDetailed, extendAnvilClient, faucetAbi, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, prependMidasReceiveGreenlist, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, verifyTestnet, writeAndWait };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ILogger } from "../sdk/types/logger.js";
|
|
2
|
+
import "../sdk/index.js";
|
|
3
|
+
import { AnvilClient } from "./createAnvilClient.js";
|
|
4
|
+
import { Address, Hex } from "viem";
|
|
5
|
+
//#region src/dev/securitizeUtils.d.ts
|
|
6
|
+
interface ClaimDSTokenProps {
|
|
7
|
+
anvil: AnvilClient;
|
|
8
|
+
investor: Address;
|
|
9
|
+
adminPrivateKey: Hex;
|
|
10
|
+
/**
|
|
11
|
+
* DSToken addresses
|
|
12
|
+
*/
|
|
13
|
+
token: Address;
|
|
14
|
+
/**
|
|
15
|
+
* USD amount without decimals
|
|
16
|
+
*/
|
|
17
|
+
usdAmount?: string;
|
|
18
|
+
marketConfigurators?: Address[];
|
|
19
|
+
rwaFactories?: Address[];
|
|
20
|
+
logger?: ILogger;
|
|
21
|
+
}
|
|
22
|
+
type ClaimDSTokensProps = Omit<ClaimDSTokenProps, "token"> & {
|
|
23
|
+
tokens: Address[];
|
|
24
|
+
};
|
|
25
|
+
interface DisableDSTokenLockPeriodsProps {
|
|
26
|
+
anvil: AnvilClient;
|
|
27
|
+
/**
|
|
28
|
+
* Securitize DS admin with sufficient trust to call compliance setters
|
|
29
|
+
* (same key used for issueTokens / registerInvestor)
|
|
30
|
+
*/
|
|
31
|
+
adminPrivateKey: Hex;
|
|
32
|
+
/**
|
|
33
|
+
* DSToken addresses whose compliance lock periods should be zeroed
|
|
34
|
+
*/
|
|
35
|
+
tokens: Address[];
|
|
36
|
+
logger?: ILogger;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Zeros US and non-US compliance lock periods on each DSToken's compliance
|
|
40
|
+
* configuration service so collateral can be transferred during testnet
|
|
41
|
+
* liquidations (e.g. STAC). No-ops for tokens without a compliance service
|
|
42
|
+
* (MockDSToken) or when both periods are already 0.
|
|
43
|
+
*
|
|
44
|
+
* Must be signed by a DS admin with sufficient trust (same key as
|
|
45
|
+
* `issueTokens` / registerInvestor); Ownable `owner()` alone is not enough.
|
|
46
|
+
*/
|
|
47
|
+
declare function disableDSTokenLockPeriods(props: DisableDSTokenLockPeriodsProps): Promise<void>;
|
|
48
|
+
declare function claimDSToken(props: ClaimDSTokenProps): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to claim DSToken from the faucet.
|
|
51
|
+
* Works both for MockDStoken and real DSToken connected by securitize-deploy script
|
|
52
|
+
* @param forkStatus
|
|
53
|
+
* @param publicClient
|
|
54
|
+
* @param investor
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
declare function claimDSTokens(props: ClaimDSTokensProps): Promise<void>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { DisableDSTokenLockPeriodsProps, claimDSToken, claimDSTokens, disableDSTokenLockPeriods };
|
|
@@ -75,7 +75,7 @@ declare function pickMainAsset(ca: CreditAccountData, convert: (token: Address,
|
|
|
75
75
|
* @param current - Claimable and pending withdrawals from the withdrawal compressor
|
|
76
76
|
* @param network - Network the withdrawals live on
|
|
77
77
|
**/
|
|
78
|
-
declare function toLiquidatorWithdrawals(current: CurrentWithdrawals, network: NetworkType): LiquidatorWithdrawal[];
|
|
78
|
+
declare function toLiquidatorWithdrawals(current: CurrentWithdrawals, network: NetworkType, chainId: number): LiquidatorWithdrawal[];
|
|
79
79
|
/**
|
|
80
80
|
* Normalizes the liquidation compressor outputs into assets the liquidator
|
|
81
81
|
* receives. Zero `redeemerAddress` and `claimableAt` (used by the contracts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NetworkType } from "../../chain/chains.js";
|
|
2
2
|
import "../../chain/index.js";
|
|
3
3
|
import { Asset } from "../../base/types.js";
|
|
4
|
-
import { RawTx } from "../../types/transactions.js";
|
|
4
|
+
import { MultiCall, RawTx } from "../../types/transactions.js";
|
|
5
5
|
import "../../types/index.js";
|
|
6
6
|
import "../../base/index.js";
|
|
7
7
|
import { Address } from "viem";
|
|
@@ -224,6 +224,10 @@ interface LiquidatorWithdrawal {
|
|
|
224
224
|
* Network the withdrawal lives on.
|
|
225
225
|
**/
|
|
226
226
|
network: NetworkType;
|
|
227
|
+
/**
|
|
228
|
+
* Chain id the withdrawal lives on.
|
|
229
|
+
**/
|
|
230
|
+
chainId: number;
|
|
227
231
|
/**
|
|
228
232
|
* Source asset spent by the delayed withdrawal (e.g. ACRED).
|
|
229
233
|
**/
|
|
@@ -231,17 +235,21 @@ interface LiquidatorWithdrawal {
|
|
|
231
235
|
/**
|
|
232
236
|
* Receivable asset (e.g. USDC).
|
|
233
237
|
**/
|
|
234
|
-
token: Address;
|
|
235
238
|
/**
|
|
236
239
|
* Amount of `token` receivable: exact for claimable withdrawals, estimated
|
|
237
240
|
* for pending ones.
|
|
238
241
|
**/
|
|
239
|
-
|
|
242
|
+
outputs: Array<Asset>;
|
|
240
243
|
/**
|
|
241
244
|
* Estimated unix timestamp (in seconds) when a pending withdrawal becomes
|
|
242
245
|
* claimable. `undefined` means the withdrawal is claimable now.
|
|
243
246
|
**/
|
|
244
247
|
claimableAt?: bigint;
|
|
248
|
+
/**
|
|
249
|
+
* Estimated unix timestamp (in seconds) when a pending withdrawal becomes
|
|
250
|
+
* claimable. `undefined` means the withdrawal is claimable now.
|
|
251
|
+
**/
|
|
252
|
+
claimCalls?: Array<MultiCall>;
|
|
245
253
|
/**
|
|
246
254
|
* Redeemer contract the withdrawal is claimed from, owned by the liquidator.
|
|
247
255
|
* `undefined` on compressor versions below 313, which do not report it.
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ILogger } from "../sdk/types/logger.js";
|
|
2
|
-
import "../sdk/index.js";
|
|
3
|
-
import { AnvilClient } from "./createAnvilClient.js";
|
|
4
|
-
import { Address, Hex } from "viem";
|
|
5
|
-
//#region src/dev/claimDSToken.d.ts
|
|
6
|
-
interface ClaimDSTokenProps {
|
|
7
|
-
anvil: AnvilClient;
|
|
8
|
-
investor: Address;
|
|
9
|
-
adminPrivateKey: Hex;
|
|
10
|
-
/**
|
|
11
|
-
* DSToken addresses
|
|
12
|
-
*/
|
|
13
|
-
token: Address;
|
|
14
|
-
/**
|
|
15
|
-
* USD amount without decimals
|
|
16
|
-
*/
|
|
17
|
-
usdAmount?: string;
|
|
18
|
-
marketConfigurators?: Address[];
|
|
19
|
-
rwaFactories?: Address[];
|
|
20
|
-
logger?: ILogger;
|
|
21
|
-
}
|
|
22
|
-
type ClaimDSTokensProps = Omit<ClaimDSTokenProps, "token"> & {
|
|
23
|
-
tokens: Address[];
|
|
24
|
-
};
|
|
25
|
-
declare function claimDSToken(props: ClaimDSTokenProps): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Helper function to claim DSToken from the faucet.
|
|
28
|
-
* Works both for MockDStoken and real DSToken connected by securitize-deploy script
|
|
29
|
-
* @param forkStatus
|
|
30
|
-
* @param publicClient
|
|
31
|
-
* @param investor
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
declare function claimDSTokens(props: ClaimDSTokensProps): Promise<void>;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { claimDSToken, claimDSTokens };
|