@ember-finance/sdk 2.10.1 → 2.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -477,6 +477,23 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
|
|
|
477
477
|
* that can neither receive ETH nor call claimWithdrawalTo. Owner-only.
|
|
478
478
|
*/
|
|
479
479
|
recoverUnclaimedWithdrawal(vaultAddress: string, receiver: string, to: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
480
|
+
/**
|
|
481
|
+
* Gas floor for atomic-vault user paths that may hit `_ensureLiquidity` —
|
|
482
|
+
* i.e. call into the configured ERC-4626 strategy's `withdraw` to top up the
|
|
483
|
+
* vault's idle collateral before paying the caller. A strategy `withdraw`
|
|
484
|
+
* routinely lands in the 200-400k band on its own; combined with the vault-
|
|
485
|
+
* side accounting an OOG revert at 500k is easy to trip (observed on
|
|
486
|
+
* mainnet: tx 0x93bd9f36…3d8ef34409, 482k / 500k budget, empty revert data).
|
|
487
|
+
*
|
|
488
|
+
* Ethers' auto-estimation can also under-budget when a Timelock proposal
|
|
489
|
+
* freezes the gas limit at scheduling time and the strategy's on-chain
|
|
490
|
+
* state drifts before execution. Enforce a conservative floor here so
|
|
491
|
+
* callers don't need to know the mechanics; explicit `options.gasLimit`
|
|
492
|
+
* still overrides.
|
|
493
|
+
*/
|
|
494
|
+
private static readonly ATOMIC_STRATEGY_PULL_GAS_FLOOR;
|
|
495
|
+
/** Applies the atomic-vault gas floor unless the caller has already set one. */
|
|
496
|
+
private withAtomicGasFloor;
|
|
480
497
|
/** Atomic vault: instant (capped, fee'd) withdraw of `shares` to `receiver`; auto-pulls from strategy. */
|
|
481
498
|
instantWithdraw(vaultAddress: string, shares: NumStr, receiver: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
482
499
|
/**
|
|
@@ -487,6 +504,9 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
|
|
|
487
504
|
* Pass `0` to disable the guard; otherwise call
|
|
488
505
|
* {@link EVMReaderCalls.previewSwapInstantWithdraw} first and derive
|
|
489
506
|
* `minNetOut` from `quote.netAmount` minus your tolerance.
|
|
507
|
+
*
|
|
508
|
+
* A 2M gas floor is applied when the caller doesn't set `options.gasLimit`
|
|
509
|
+
* — see {@link ATOMIC_STRATEGY_PULL_GAS_FLOOR} for the reasoning.
|
|
490
510
|
*/
|
|
491
511
|
swapEmberShares(vaultAddress: string, share: string, shareAmount: NumStr, receiver: string, minNetOut: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
492
512
|
/**
|
|
@@ -732,13 +732,19 @@ export class EVMUserCalls extends EVMOnChainCalls {
|
|
|
732
732
|
async recoverUnclaimedWithdrawal(vaultAddress, receiver, to, options) {
|
|
733
733
|
return this.execCall(this.txBuilder.recoverUnclaimedWithdrawal(vaultAddress, receiver, to), options);
|
|
734
734
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
735
|
+
/** Applies the atomic-vault gas floor unless the caller has already set one. */
|
|
736
|
+
withAtomicGasFloor(options) {
|
|
737
|
+
if (options?.gasLimit && options.gasLimit > 0n)
|
|
738
|
+
return options;
|
|
739
|
+
return {
|
|
740
|
+
...(options ?? {}),
|
|
741
|
+
gasLimit: EVMUserCalls.ATOMIC_STRATEGY_PULL_GAS_FLOOR
|
|
742
|
+
};
|
|
743
|
+
}
|
|
738
744
|
/** Atomic vault: instant (capped, fee'd) withdraw of `shares` to `receiver`; auto-pulls from strategy. */
|
|
739
745
|
async instantWithdraw(vaultAddress, shares, receiver, options) {
|
|
740
746
|
const txCall = this.txBuilder.atomicInstantWithdraw(vaultAddress, shares, receiver);
|
|
741
|
-
return this.execCall(txCall, options);
|
|
747
|
+
return this.execCall(txCall, this.withAtomicGasFloor(options));
|
|
742
748
|
}
|
|
743
749
|
/**
|
|
744
750
|
* Atomic vault: swap `shareAmount` of a whitelisted source EmberShare `share` into collateral.
|
|
@@ -748,10 +754,13 @@ export class EVMUserCalls extends EVMOnChainCalls {
|
|
|
748
754
|
* Pass `0` to disable the guard; otherwise call
|
|
749
755
|
* {@link EVMReaderCalls.previewSwapInstantWithdraw} first and derive
|
|
750
756
|
* `minNetOut` from `quote.netAmount` minus your tolerance.
|
|
757
|
+
*
|
|
758
|
+
* A 2M gas floor is applied when the caller doesn't set `options.gasLimit`
|
|
759
|
+
* — see {@link ATOMIC_STRATEGY_PULL_GAS_FLOOR} for the reasoning.
|
|
751
760
|
*/
|
|
752
761
|
async swapEmberShares(vaultAddress, share, shareAmount, receiver, minNetOut, options) {
|
|
753
762
|
const txCall = this.txBuilder.atomicSwapEmberShares(vaultAddress, share, shareAmount, receiver, minNetOut);
|
|
754
|
-
return this.execCall(txCall, options);
|
|
763
|
+
return this.execCall(txCall, this.withAtomicGasFloor(options));
|
|
755
764
|
}
|
|
756
765
|
/**
|
|
757
766
|
* Atomic vault: claim your own escrowed holdback — collateral that couldn't be
|
|
@@ -786,3 +795,21 @@ export class EVMUserCalls extends EVMOnChainCalls {
|
|
|
786
795
|
return this.execCall(this.txBuilder.atomicRecoverUnclaimedHoldback(vaultAddress, recipient, to), options);
|
|
787
796
|
}
|
|
788
797
|
}
|
|
798
|
+
// ============================================
|
|
799
|
+
// Atomic Liquidity Vault — user actions (BFE-817/818)
|
|
800
|
+
// ============================================
|
|
801
|
+
/**
|
|
802
|
+
* Gas floor for atomic-vault user paths that may hit `_ensureLiquidity` —
|
|
803
|
+
* i.e. call into the configured ERC-4626 strategy's `withdraw` to top up the
|
|
804
|
+
* vault's idle collateral before paying the caller. A strategy `withdraw`
|
|
805
|
+
* routinely lands in the 200-400k band on its own; combined with the vault-
|
|
806
|
+
* side accounting an OOG revert at 500k is easy to trip (observed on
|
|
807
|
+
* mainnet: tx 0x93bd9f36…3d8ef34409, 482k / 500k budget, empty revert data).
|
|
808
|
+
*
|
|
809
|
+
* Ethers' auto-estimation can also under-budget when a Timelock proposal
|
|
810
|
+
* freezes the gas limit at scheduling time and the strategy's on-chain
|
|
811
|
+
* state drifts before execution. Enforce a conservative floor here so
|
|
812
|
+
* callers don't need to know the mechanics; explicit `options.gasLimit`
|
|
813
|
+
* still overrides.
|
|
814
|
+
*/
|
|
815
|
+
EVMUserCalls.ATOMIC_STRATEGY_PULL_GAS_FLOOR = 2000000n;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-finance/sdk",
|
|
3
3
|
"description": "Ember Protocol SDK",
|
|
4
|
-
"version": "2.10.
|
|
4
|
+
"version": "2.10.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -136,7 +136,11 @@
|
|
|
136
136
|
"markdown-it": ">=12.3.2",
|
|
137
137
|
"ajv": "^6.12.6",
|
|
138
138
|
"jsonpointer": ">=5.0.0",
|
|
139
|
-
"form-data": ">=3.0.4"
|
|
139
|
+
"form-data": ">=3.0.4",
|
|
140
|
+
"basic-ftp": "^5.3.1",
|
|
141
|
+
"fast-xml-parser": "^5.3.5",
|
|
142
|
+
"shell-quote": "^1.10.0",
|
|
143
|
+
"tar": "^7.5.19"
|
|
140
144
|
},
|
|
141
145
|
"packageManager": "yarn@4.14.1"
|
|
142
146
|
}
|