@gearbox-protocol/sdk 14.12.0-next.64 → 14.12.0-next.65
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 +1 -0
- package/dist/cjs/dev/securitizeUtils.js +95 -2
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/index.js +2 -2
- package/dist/esm/dev/securitizeUtils.js +95 -3
- package/dist/esm/dev/withdrawalUtils.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 +1 -1
- 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 +2 -2
- package/dist/types/dev/securitizeUtils.d.ts +21 -3
- package/package.json +1 -1
package/dist/cjs/dev/index.js
CHANGED
|
@@ -46,6 +46,7 @@ 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.enableDSTokenBackDating = require_dev_securitizeUtils.enableDSTokenBackDating;
|
|
49
50
|
exports.evmMineDetailed = require_dev_createAnvilClient.evmMineDetailed;
|
|
50
51
|
exports.extendAnvilClient = require_dev_createAnvilClient.extendAnvilClient;
|
|
51
52
|
exports.faucetAbi = require_dev_abi.faucetAbi;
|
|
@@ -1,4 +1,5 @@
|
|
|
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");
|
|
@@ -14,7 +15,9 @@ const iDSComplianceConfigurationServiceAbi = (0, viem.parseAbi)([
|
|
|
14
15
|
"function getUSLockPeriod() external view returns (uint256)",
|
|
15
16
|
"function getNonUSLockPeriod() external view returns (uint256)",
|
|
16
17
|
"function setUSLockPeriod(uint256) external",
|
|
17
|
-
"function setNonUSLockPeriod(uint256) external"
|
|
18
|
+
"function setNonUSLockPeriod(uint256) external",
|
|
19
|
+
"function getDisallowBackDating() external view returns (bool)",
|
|
20
|
+
"function setDisallowBackDating(bool) external"
|
|
18
21
|
]);
|
|
19
22
|
/**
|
|
20
23
|
* Returns the longest of US and non-US compliance lock periods, or `undefined`
|
|
@@ -62,7 +65,7 @@ async function issueDSTokens(props) {
|
|
|
62
65
|
const { timestamp } = await anvil.getBlock();
|
|
63
66
|
const issuanceTime = timestamp - lockPeriod - 1n;
|
|
64
67
|
try {
|
|
65
|
-
await require_dev_kycUtils.writeAndWait(anvil, {
|
|
68
|
+
const hash = await require_dev_kycUtils.writeAndWait(anvil, {
|
|
66
69
|
account,
|
|
67
70
|
chain: anvil.chain,
|
|
68
71
|
address: token,
|
|
@@ -82,6 +85,7 @@ async function issueDSTokens(props) {
|
|
|
82
85
|
investor,
|
|
83
86
|
amount
|
|
84
87
|
}, "issueTokensCustom successful");
|
|
88
|
+
return hash;
|
|
85
89
|
} catch (e) {
|
|
86
90
|
logger?.debug(`issueTokensCustom failed: ${e}`);
|
|
87
91
|
}
|
|
@@ -99,6 +103,94 @@ async function issueDSTokens(props) {
|
|
|
99
103
|
args: [investor, amount]
|
|
100
104
|
});
|
|
101
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolves unique compliance configuration services of `tokens`: several
|
|
108
|
+
* DSTokens can share one service, and it's the service that holds the flags.
|
|
109
|
+
* Tokens without one (e.g. MockDSToken) are skipped
|
|
110
|
+
*/
|
|
111
|
+
async function getComplianceConfigurationServices({ anvil, tokens, logger }) {
|
|
112
|
+
const services = new require_sdk_utils_AddressSet.AddressSet();
|
|
113
|
+
for (const token of new require_sdk_utils_AddressSet.AddressSet(tokens)) try {
|
|
114
|
+
const service = await anvil.readContract({
|
|
115
|
+
address: token,
|
|
116
|
+
abi: require_abi_rwa_iDSToken.iDSTokenAbi,
|
|
117
|
+
functionName: "getDSService",
|
|
118
|
+
args: [COMPLIANCE_CONFIGURATION_SERVICE]
|
|
119
|
+
});
|
|
120
|
+
if ((0, viem.isAddressEqual)(service, viem.zeroAddress)) {
|
|
121
|
+
logger?.debug(`${token} has no compliance configuration service`);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
services.add(service);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
logger?.debug(`Failed to get compliance configuration service of ${token}: ${e}`);
|
|
127
|
+
}
|
|
128
|
+
return [...services];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Sets `disallowBackDating` to false on compliance configuration services of
|
|
132
|
+
* `tokens`, so that the issuance time passed to `issueTokensCustom` is
|
|
133
|
+
* honoured: DS protocol silently replaces it with `block.timestamp` otherwise,
|
|
134
|
+
* and freshly minted tokens stay under lock-up.
|
|
135
|
+
*
|
|
136
|
+
* Must be signed by a DS admin with sufficient trust (same key as
|
|
137
|
+
* `issueTokens` / registerInvestor); Ownable `owner()` alone is not enough.
|
|
138
|
+
*
|
|
139
|
+
* The flag is only read while tokens are issued, so restoring it does not
|
|
140
|
+
* re-lock tokens minted in the meantime.
|
|
141
|
+
*/
|
|
142
|
+
async function enableDSTokenBackDating(props) {
|
|
143
|
+
const { anvil, adminPrivateKey, logger } = props;
|
|
144
|
+
const account = (0, viem_accounts.privateKeyToAccount)(adminPrivateKey);
|
|
145
|
+
const services = await getComplianceConfigurationServices(props);
|
|
146
|
+
let toRestore = [];
|
|
147
|
+
for (const service of services) {
|
|
148
|
+
let disallowBackDating;
|
|
149
|
+
try {
|
|
150
|
+
disallowBackDating = await anvil.readContract({
|
|
151
|
+
address: service,
|
|
152
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
153
|
+
functionName: "getDisallowBackDating"
|
|
154
|
+
});
|
|
155
|
+
} catch (e) {
|
|
156
|
+
logger?.debug(`Failed to read disallowBackDating of ${service}: ${e}`);
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (!disallowBackDating) {
|
|
160
|
+
logger?.debug(`Back-dating is already allowed by ${service}`);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
logger?.info(`Allowing back-dating on ${service}`);
|
|
164
|
+
await require_dev_kycUtils.writeAndWait(anvil, {
|
|
165
|
+
account,
|
|
166
|
+
chain: anvil.chain,
|
|
167
|
+
address: service,
|
|
168
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
169
|
+
functionName: "setDisallowBackDating",
|
|
170
|
+
args: [false]
|
|
171
|
+
});
|
|
172
|
+
toRestore.push(service);
|
|
173
|
+
}
|
|
174
|
+
return async () => {
|
|
175
|
+
const services = toRestore;
|
|
176
|
+
toRestore = [];
|
|
177
|
+
for (const service of services) {
|
|
178
|
+
logger?.info(`Disallowing back-dating on ${service}`);
|
|
179
|
+
try {
|
|
180
|
+
await require_dev_kycUtils.writeAndWait(anvil, {
|
|
181
|
+
account,
|
|
182
|
+
chain: anvil.chain,
|
|
183
|
+
address: service,
|
|
184
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
185
|
+
functionName: "setDisallowBackDating",
|
|
186
|
+
args: [true]
|
|
187
|
+
});
|
|
188
|
+
} catch (e) {
|
|
189
|
+
logger?.warn(`Failed to restore disallowBackDating on ${service}: ${e}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
102
194
|
async function claimDSToken(props) {
|
|
103
195
|
const { anvil, investor, adminPrivateKey, token, marketConfigurators, rwaFactories, usdAmount: usdAmountProp = "100000" } = props;
|
|
104
196
|
const account = (0, viem_accounts.privateKeyToAccount)(adminPrivateKey);
|
|
@@ -164,3 +256,4 @@ async function claimDSTokens(props) {
|
|
|
164
256
|
//#endregion
|
|
165
257
|
exports.claimDSToken = claimDSToken;
|
|
166
258
|
exports.claimDSTokens = claimDSTokens;
|
|
259
|
+
exports.enableDSTokenBackDating = enableDSTokenBackDating;
|
|
@@ -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
|
@@ -21,8 +21,8 @@ import { migrateFaucet } from "./migrateFaucet.js";
|
|
|
21
21
|
import { SUPPORTED_RPC_PROVIDERS, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getRpcProviderUrl, getThirdWebUrl, rpcProvidersSchema } from "./providers.js";
|
|
22
22
|
import { replaceStorage } from "./replaceStorage.js";
|
|
23
23
|
import { resilientTransport, resilientTransportOptionsSchema } from "./resilientTransport.js";
|
|
24
|
-
import { claimDSToken, claimDSTokens } from "./securitizeUtils.js";
|
|
24
|
+
import { claimDSToken, claimDSTokens, enableDSTokenBackDating } 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, enableDSTokenBackDating, 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 };
|
|
@@ -1,3 +1,4 @@
|
|
|
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";
|
|
@@ -13,7 +14,9 @@ const iDSComplianceConfigurationServiceAbi = parseAbi([
|
|
|
13
14
|
"function getUSLockPeriod() external view returns (uint256)",
|
|
14
15
|
"function getNonUSLockPeriod() external view returns (uint256)",
|
|
15
16
|
"function setUSLockPeriod(uint256) external",
|
|
16
|
-
"function setNonUSLockPeriod(uint256) external"
|
|
17
|
+
"function setNonUSLockPeriod(uint256) external",
|
|
18
|
+
"function getDisallowBackDating() external view returns (bool)",
|
|
19
|
+
"function setDisallowBackDating(bool) external"
|
|
17
20
|
]);
|
|
18
21
|
/**
|
|
19
22
|
* Returns the longest of US and non-US compliance lock periods, or `undefined`
|
|
@@ -61,7 +64,7 @@ async function issueDSTokens(props) {
|
|
|
61
64
|
const { timestamp } = await anvil.getBlock();
|
|
62
65
|
const issuanceTime = timestamp - lockPeriod - 1n;
|
|
63
66
|
try {
|
|
64
|
-
await writeAndWait(anvil, {
|
|
67
|
+
const hash = await writeAndWait(anvil, {
|
|
65
68
|
account,
|
|
66
69
|
chain: anvil.chain,
|
|
67
70
|
address: token,
|
|
@@ -81,6 +84,7 @@ async function issueDSTokens(props) {
|
|
|
81
84
|
investor,
|
|
82
85
|
amount
|
|
83
86
|
}, "issueTokensCustom successful");
|
|
87
|
+
return hash;
|
|
84
88
|
} catch (e) {
|
|
85
89
|
logger?.debug(`issueTokensCustom failed: ${e}`);
|
|
86
90
|
}
|
|
@@ -98,6 +102,94 @@ async function issueDSTokens(props) {
|
|
|
98
102
|
args: [investor, amount]
|
|
99
103
|
});
|
|
100
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Resolves unique compliance configuration services of `tokens`: several
|
|
107
|
+
* DSTokens can share one service, and it's the service that holds the flags.
|
|
108
|
+
* Tokens without one (e.g. MockDSToken) are skipped
|
|
109
|
+
*/
|
|
110
|
+
async function getComplianceConfigurationServices({ anvil, tokens, logger }) {
|
|
111
|
+
const services = new AddressSet();
|
|
112
|
+
for (const token of new AddressSet(tokens)) try {
|
|
113
|
+
const service = await anvil.readContract({
|
|
114
|
+
address: token,
|
|
115
|
+
abi: iDSTokenAbi,
|
|
116
|
+
functionName: "getDSService",
|
|
117
|
+
args: [COMPLIANCE_CONFIGURATION_SERVICE]
|
|
118
|
+
});
|
|
119
|
+
if (isAddressEqual(service, zeroAddress)) {
|
|
120
|
+
logger?.debug(`${token} has no compliance configuration service`);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
services.add(service);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
logger?.debug(`Failed to get compliance configuration service of ${token}: ${e}`);
|
|
126
|
+
}
|
|
127
|
+
return [...services];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Sets `disallowBackDating` to false on compliance configuration services of
|
|
131
|
+
* `tokens`, so that the issuance time passed to `issueTokensCustom` is
|
|
132
|
+
* honoured: DS protocol silently replaces it with `block.timestamp` otherwise,
|
|
133
|
+
* and freshly minted tokens stay under lock-up.
|
|
134
|
+
*
|
|
135
|
+
* Must be signed by a DS admin with sufficient trust (same key as
|
|
136
|
+
* `issueTokens` / registerInvestor); Ownable `owner()` alone is not enough.
|
|
137
|
+
*
|
|
138
|
+
* The flag is only read while tokens are issued, so restoring it does not
|
|
139
|
+
* re-lock tokens minted in the meantime.
|
|
140
|
+
*/
|
|
141
|
+
async function enableDSTokenBackDating(props) {
|
|
142
|
+
const { anvil, adminPrivateKey, logger } = props;
|
|
143
|
+
const account = privateKeyToAccount(adminPrivateKey);
|
|
144
|
+
const services = await getComplianceConfigurationServices(props);
|
|
145
|
+
let toRestore = [];
|
|
146
|
+
for (const service of services) {
|
|
147
|
+
let disallowBackDating;
|
|
148
|
+
try {
|
|
149
|
+
disallowBackDating = await anvil.readContract({
|
|
150
|
+
address: service,
|
|
151
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
152
|
+
functionName: "getDisallowBackDating"
|
|
153
|
+
});
|
|
154
|
+
} catch (e) {
|
|
155
|
+
logger?.debug(`Failed to read disallowBackDating of ${service}: ${e}`);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (!disallowBackDating) {
|
|
159
|
+
logger?.debug(`Back-dating is already allowed by ${service}`);
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
logger?.info(`Allowing back-dating on ${service}`);
|
|
163
|
+
await writeAndWait(anvil, {
|
|
164
|
+
account,
|
|
165
|
+
chain: anvil.chain,
|
|
166
|
+
address: service,
|
|
167
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
168
|
+
functionName: "setDisallowBackDating",
|
|
169
|
+
args: [false]
|
|
170
|
+
});
|
|
171
|
+
toRestore.push(service);
|
|
172
|
+
}
|
|
173
|
+
return async () => {
|
|
174
|
+
const services = toRestore;
|
|
175
|
+
toRestore = [];
|
|
176
|
+
for (const service of services) {
|
|
177
|
+
logger?.info(`Disallowing back-dating on ${service}`);
|
|
178
|
+
try {
|
|
179
|
+
await writeAndWait(anvil, {
|
|
180
|
+
account,
|
|
181
|
+
chain: anvil.chain,
|
|
182
|
+
address: service,
|
|
183
|
+
abi: iDSComplianceConfigurationServiceAbi,
|
|
184
|
+
functionName: "setDisallowBackDating",
|
|
185
|
+
args: [true]
|
|
186
|
+
});
|
|
187
|
+
} catch (e) {
|
|
188
|
+
logger?.warn(`Failed to restore disallowBackDating on ${service}: ${e}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
101
193
|
async function claimDSToken(props) {
|
|
102
194
|
const { anvil, investor, adminPrivateKey, token, marketConfigurators, rwaFactories, usdAmount: usdAmountProp = "100000" } = props;
|
|
103
195
|
const account = privateKeyToAccount(adminPrivateKey);
|
|
@@ -161,4 +253,4 @@ async function claimDSTokens(props) {
|
|
|
161
253
|
});
|
|
162
254
|
}
|
|
163
255
|
//#endregion
|
|
164
|
-
export { claimDSToken, claimDSTokens };
|
|
256
|
+
export { claimDSToken, claimDSTokens, enableDSTokenBackDating };
|
|
@@ -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,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
|
/**
|
|
@@ -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";
|
|
@@ -22,8 +22,8 @@ import "./mint/index.js";
|
|
|
22
22
|
import { RpcProvider, SUPPORTED_RPC_PROVIDERS, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getRpcProviderUrl, getThirdWebUrl, rpcProvidersSchema } from "./providers.js";
|
|
23
23
|
import { ReplaceStorageParams, replaceStorage } from "./replaceStorage.js";
|
|
24
24
|
import { ResilientTransportOptions, resilientTransport, resilientTransportOptionsSchema } from "./resilientTransport.js";
|
|
25
|
-
import {
|
|
25
|
+
import { EnableDSTokenBackDatingProps, RestoreDSTokenBackDating, claimDSToken, claimDSTokens, enableDSTokenBackDating } 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,
|
|
29
|
+
export { AccountOpener, AccountOpenerOptions, AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, CheckMulticallFn, Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, DetectedCall, EnableDSTokenBackDatingProps, 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, RestoreDSTokenBackDating, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, RpcErrorResult, RpcProvider, RpcResponse, RpcSuccessResult, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, TargetAccount, VerifyTestnetParams, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, 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 };
|
|
@@ -22,7 +22,7 @@ interface ClaimDSTokenProps {
|
|
|
22
22
|
type ClaimDSTokensProps = Omit<ClaimDSTokenProps, "token"> & {
|
|
23
23
|
tokens: Address[];
|
|
24
24
|
};
|
|
25
|
-
interface
|
|
25
|
+
interface EnableDSTokenBackDatingProps {
|
|
26
26
|
anvil: AnvilClient;
|
|
27
27
|
/**
|
|
28
28
|
* Securitize DS admin with sufficient trust to call compliance setters
|
|
@@ -30,11 +30,29 @@ interface DisableDSTokenLockPeriodsProps {
|
|
|
30
30
|
*/
|
|
31
31
|
adminPrivateKey: Hex;
|
|
32
32
|
/**
|
|
33
|
-
* DSToken addresses whose compliance
|
|
33
|
+
* DSToken addresses whose compliance configuration should allow back-dating
|
|
34
34
|
*/
|
|
35
35
|
tokens: Address[];
|
|
36
36
|
logger?: ILogger;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Restores `disallowBackDating` to its previous value on every compliance
|
|
40
|
+
* configuration service that was changed. Safe to call more than once.
|
|
41
|
+
*/
|
|
42
|
+
type RestoreDSTokenBackDating = () => Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Sets `disallowBackDating` to false on compliance configuration services of
|
|
45
|
+
* `tokens`, so that the issuance time passed to `issueTokensCustom` is
|
|
46
|
+
* honoured: DS protocol silently replaces it with `block.timestamp` otherwise,
|
|
47
|
+
* and freshly minted tokens stay under lock-up.
|
|
48
|
+
*
|
|
49
|
+
* Must be signed by a DS admin with sufficient trust (same key as
|
|
50
|
+
* `issueTokens` / registerInvestor); Ownable `owner()` alone is not enough.
|
|
51
|
+
*
|
|
52
|
+
* The flag is only read while tokens are issued, so restoring it does not
|
|
53
|
+
* re-lock tokens minted in the meantime.
|
|
54
|
+
*/
|
|
55
|
+
declare function enableDSTokenBackDating(props: EnableDSTokenBackDatingProps): Promise<RestoreDSTokenBackDating>;
|
|
38
56
|
declare function claimDSToken(props: ClaimDSTokenProps): Promise<void>;
|
|
39
57
|
/**
|
|
40
58
|
* Helper function to claim DSToken from the faucet.
|
|
@@ -46,4 +64,4 @@ declare function claimDSToken(props: ClaimDSTokenProps): Promise<void>;
|
|
|
46
64
|
*/
|
|
47
65
|
declare function claimDSTokens(props: ClaimDSTokensProps): Promise<void>;
|
|
48
66
|
//#endregion
|
|
49
|
-
export {
|
|
67
|
+
export { EnableDSTokenBackDatingProps, RestoreDSTokenBackDating, claimDSToken, claimDSTokens, enableDSTokenBackDating };
|