@gearbox-protocol/deploy-tools 6.9.4 → 6.9.5
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/index.mjs +21 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -201875,7 +201875,7 @@ async function signRegisterVaultMessages(wallet, messages) {
|
|
|
201875
201875
|
}
|
|
201876
201876
|
return signed;
|
|
201877
201877
|
}
|
|
201878
|
-
var
|
|
201878
|
+
var POOL_LIQUIDITY_STABLE = 1000000n;
|
|
201879
201879
|
async function seedSecuritizePoolLiquidity(sdk, anvil, pool, rpcUrl, logger2) {
|
|
201880
201880
|
const market = sdk.marketRegister.findByPool(pool);
|
|
201881
201881
|
const underlying = market.pool.underlying;
|
|
@@ -201902,22 +201902,23 @@ async function seedDefaultPool(sdk, anvil, pool, rpcUrl, logger2) {
|
|
|
201902
201902
|
const underlyingMeta = sdk.tokensMeta.mustGet(underlying);
|
|
201903
201903
|
if (!sdk.tokensMeta.isRWAUnderlying(underlyingMeta) || underlyingMeta.contractType !== RWA_UNDERLYING_DEFAULT) {
|
|
201904
201904
|
throw new Error(
|
|
201905
|
-
`Pool ${pool} underlying ${underlying} is not a RWA default underlying`
|
|
201905
|
+
`Pool ${sdk.labelAddress(pool)} underlying ${sdk.labelAddress(underlying)} is not a RWA default underlying`
|
|
201906
201906
|
);
|
|
201907
201907
|
}
|
|
201908
201908
|
const asset = underlyingMeta.asset;
|
|
201909
|
+
const amount = POOL_LIQUIDITY_STABLE * 10n ** BigInt(underlyingMeta.decimals);
|
|
201909
201910
|
const wallet = await createInvestorWallet(anvil, sdk.chain, rpcUrl);
|
|
201910
201911
|
const depositor = wallet.account.address;
|
|
201911
201912
|
await anvil.deal({
|
|
201912
201913
|
erc20: asset,
|
|
201913
201914
|
account: depositor,
|
|
201914
|
-
amount
|
|
201915
|
+
amount
|
|
201915
201916
|
});
|
|
201916
201917
|
const poolService = new PoolService(sdk);
|
|
201917
201918
|
const depositMeta = poolService.getDepositMetadata(pool, asset, pool);
|
|
201918
201919
|
if (depositMeta.type !== "rwa-default") {
|
|
201919
201920
|
throw new Error(
|
|
201920
|
-
`Expected rwa-default deposit metadata for pool ${pool}, got ${depositMeta.type}`
|
|
201921
|
+
`Expected rwa-default deposit metadata for pool ${sdk.labelAddress(pool)}, got ${depositMeta.type}`
|
|
201921
201922
|
);
|
|
201922
201923
|
}
|
|
201923
201924
|
let hash4 = await wallet.writeContract({
|
|
@@ -201928,16 +201929,20 @@ async function seedDefaultPool(sdk, anvil, pool, rpcUrl, logger2) {
|
|
|
201928
201929
|
chain: wallet.chain
|
|
201929
201930
|
});
|
|
201930
201931
|
await sdk.client.waitForTransactionReceipt({ hash: hash4, pollingInterval: 100 });
|
|
201931
|
-
logger2?.debug(
|
|
201932
|
+
logger2?.debug(
|
|
201933
|
+
`approved ${depositMeta.approveTarget} for ${sdk.labelAddress(asset)}`
|
|
201934
|
+
);
|
|
201932
201935
|
const depositCall = poolService.addLiquidity({
|
|
201933
|
-
collateral: { token: asset, balance:
|
|
201936
|
+
collateral: { token: asset, balance: amount },
|
|
201934
201937
|
pool,
|
|
201935
201938
|
wallet: depositor,
|
|
201936
201939
|
meta: depositMeta,
|
|
201937
201940
|
referralCode: 0n
|
|
201938
201941
|
});
|
|
201939
201942
|
if (!depositCall) {
|
|
201940
|
-
throw new Error(
|
|
201943
|
+
throw new Error(
|
|
201944
|
+
`addLiquidity returned undefined for default pool ${sdk.labelAddress(pool)}`
|
|
201945
|
+
);
|
|
201941
201946
|
}
|
|
201942
201947
|
hash4 = await wallet.writeContract({
|
|
201943
201948
|
address: depositCall.target,
|
|
@@ -201952,27 +201957,32 @@ async function seedDefaultPool(sdk, anvil, pool, rpcUrl, logger2) {
|
|
|
201952
201957
|
pollingInterval: 100
|
|
201953
201958
|
});
|
|
201954
201959
|
if (receipt.status !== "success") {
|
|
201955
|
-
throw new Error(
|
|
201960
|
+
throw new Error(
|
|
201961
|
+
`Failed to seed default pool ${sdk.labelAddress(pool)}: tx ${hash4} reverted`
|
|
201962
|
+
);
|
|
201956
201963
|
}
|
|
201957
|
-
logger2?.info(
|
|
201964
|
+
logger2?.info(
|
|
201965
|
+
`seeded default pool ${sdk.labelAddress(pool)}, deposit tx ${hash4}, deposited ${sdk.tokensMeta.formatBN(asset, amount, { symbol: true })}`
|
|
201966
|
+
);
|
|
201958
201967
|
}
|
|
201959
201968
|
async function seedOnDemandPool(anvil, meta3, logger2) {
|
|
201960
201969
|
const liquidityProvider = meta3.liquidityProvider.addr;
|
|
201961
201970
|
const depositor = meta3.liquidityProvider.depositor;
|
|
201971
|
+
const amount = POOL_LIQUIDITY_STABLE * 10n ** BigInt(meta3.decimals);
|
|
201962
201972
|
await anvil.impersonateAccount({ address: depositor });
|
|
201963
201973
|
try {
|
|
201964
201974
|
await anvil.setBalance({ address: depositor, value: parseEther("1") });
|
|
201965
201975
|
await anvil.deal({
|
|
201966
201976
|
erc20: meta3.asset,
|
|
201967
201977
|
account: depositor,
|
|
201968
|
-
amount
|
|
201978
|
+
amount
|
|
201969
201979
|
});
|
|
201970
201980
|
const hash4 = await anvil.writeContract({
|
|
201971
201981
|
account: depositor,
|
|
201972
201982
|
address: meta3.asset,
|
|
201973
201983
|
abi: erc20Abi,
|
|
201974
201984
|
functionName: "approve",
|
|
201975
|
-
args: [liquidityProvider,
|
|
201985
|
+
args: [liquidityProvider, amount],
|
|
201976
201986
|
chain: anvil.chain
|
|
201977
201987
|
});
|
|
201978
201988
|
const receipt = await anvil.waitForTransactionReceipt({
|