@ember-finance/sdk 2.5.0 → 2.6.0-pre.0

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.
Files changed (77) hide show
  1. package/dist/src/abis/AtomicLiquidity.json +4050 -0
  2. package/dist/src/abis/ERC20Token.json +2 -2
  3. package/dist/src/abis/EmberETHVault.json +279 -5
  4. package/dist/src/abis/EmberProtocolConfig.json +170 -2
  5. package/dist/src/abis/EmberVault.json +2 -2
  6. package/dist/src/abis/EmberVaultMintBurnOFTAdapter.json +43 -2
  7. package/dist/src/api/v2/apis/accounts-api.d.ts +5 -0
  8. package/dist/src/api/v2/apis/accounts-api.js +6 -1
  9. package/dist/src/api/v2/apis/vaults-api.d.ts +16 -4
  10. package/dist/src/api/v2/apis/vaults-api.js +21 -7
  11. package/dist/src/api/v2/models/account-transaction-transaction-data.d.ts +5 -1
  12. package/dist/src/api/v2/models/account-transaction.d.ts +5 -0
  13. package/dist/src/api/v2/models/account-transaction.js +6 -1
  14. package/dist/src/api/v2/models/chain-vault-details.d.ts +14 -0
  15. package/dist/src/api/v2/models/escrow-claim-transaction.d.ts +56 -0
  16. package/dist/src/api/v2/models/escrow-claim-transaction.js +14 -0
  17. package/dist/src/api/v2/models/evm-atomic-liquidity-lib.d.ts +48 -0
  18. package/dist/src/api/v2/models/evm-atomic-liquidity-lib.js +14 -0
  19. package/dist/src/api/v2/models/evm-atomic-vault.d.ts +102 -0
  20. package/dist/src/api/v2/models/evm-atomic-vault.js +14 -0
  21. package/dist/src/api/v2/models/evm-contracts.d.ts +16 -0
  22. package/dist/src/api/v2/models/fee-multiplier-tier.d.ts +30 -0
  23. package/dist/src/api/v2/models/fee-multiplier-tier.js +14 -0
  24. package/dist/src/api/v2/models/holdback-release-transaction.d.ts +56 -0
  25. package/dist/src/api/v2/models/holdback-release-transaction.js +14 -0
  26. package/dist/src/api/v2/models/index.d.ts +9 -0
  27. package/dist/src/api/v2/models/index.js +9 -0
  28. package/dist/src/api/v2/models/instant-withdraw-config.d.ts +109 -0
  29. package/dist/src/api/v2/models/instant-withdraw-config.js +14 -0
  30. package/dist/src/api/v2/models/instant-withdraw-transaction.d.ts +74 -0
  31. package/dist/src/api/v2/models/instant-withdraw-transaction.js +14 -0
  32. package/dist/src/api/v2/models/instant-withdraw-via-swap-transaction.d.ts +74 -0
  33. package/dist/src/api/v2/models/instant-withdraw-via-swap-transaction.js +14 -0
  34. package/dist/src/api/v2/models/supported-ember-vault.d.ts +42 -0
  35. package/dist/src/api/v2/models/supported-ember-vault.js +14 -0
  36. package/dist/src/api/v2/models/vault-detail.d.ts +11 -0
  37. package/dist/src/api/v2/models/vault-detail.js +4 -0
  38. package/dist/src/atomic/instant-withdraw.d.ts +125 -0
  39. package/dist/src/atomic/instant-withdraw.js +122 -0
  40. package/dist/src/ember-vaults.d.ts +2 -1
  41. package/dist/src/evm-vaults/on-chain-calls/atomic-liquidity.d.ts +98 -0
  42. package/dist/src/evm-vaults/on-chain-calls/atomic-liquidity.js +212 -0
  43. package/dist/src/evm-vaults/on-chain-calls/index.d.ts +1 -0
  44. package/dist/src/evm-vaults/on-chain-calls/index.js +1 -0
  45. package/dist/src/evm-vaults/on-chain-calls/operator.d.ts +10 -0
  46. package/dist/src/evm-vaults/on-chain-calls/operator.js +28 -0
  47. package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +109 -0
  48. package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +281 -0
  49. package/dist/src/evm-vaults/on-chain-calls/user.d.ts +50 -0
  50. package/dist/src/evm-vaults/on-chain-calls/user.js +75 -0
  51. package/dist/src/evm-vaults/on-chain-calls/vault-admin.d.ts +55 -0
  52. package/dist/src/evm-vaults/on-chain-calls/vault-admin.js +122 -0
  53. package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +6 -0
  54. package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +9 -0
  55. package/dist/src/evm-vaults/utils/deployment-parser.d.ts +8 -0
  56. package/dist/src/evm-vaults/utils/deployment-parser.js +11 -0
  57. package/dist/src/sui-vaults/interfaces/index.d.ts +15 -0
  58. package/dist/src/sui-vaults/on-chain-calls/admin.d.ts +37 -1
  59. package/dist/src/sui-vaults/on-chain-calls/admin.js +56 -0
  60. package/dist/src/sui-vaults/on-chain-calls/atomic-liquidity.d.ts +62 -0
  61. package/dist/src/sui-vaults/on-chain-calls/atomic-liquidity.js +174 -0
  62. package/dist/src/sui-vaults/on-chain-calls/index.d.ts +1 -0
  63. package/dist/src/sui-vaults/on-chain-calls/index.js +1 -0
  64. package/dist/src/sui-vaults/on-chain-calls/onchain-calls.d.ts +2 -1
  65. package/dist/src/sui-vaults/on-chain-calls/operator.d.ts +129 -1
  66. package/dist/src/sui-vaults/on-chain-calls/operator.js +210 -0
  67. package/dist/src/sui-vaults/on-chain-calls/tx-builder.d.ts +482 -0
  68. package/dist/src/sui-vaults/on-chain-calls/tx-builder.js +1430 -0
  69. package/dist/src/sui-vaults/on-chain-calls/user.d.ts +107 -1
  70. package/dist/src/sui-vaults/on-chain-calls/user.js +190 -0
  71. package/dist/src/sui-vaults/on-chain-calls/vault-admin.d.ts +229 -1
  72. package/dist/src/sui-vaults/on-chain-calls/vault-admin.js +391 -0
  73. package/dist/src/sui-vaults/on-chain-calls/vault.d.ts +2 -1
  74. package/dist/src/sui-vaults/utils/common.d.ts +2 -1
  75. package/dist/src/sui-vaults/utils/deployment-parser.d.ts +12 -0
  76. package/dist/src/sui-vaults/utils/deployment-parser.js +24 -0
  77. package/package.json +3 -2
@@ -5,3 +5,4 @@ export * from "./operator.js";
5
5
  export * from "./vault-admin.js";
6
6
  export * from "./user.js";
7
7
  export * from "./vault-reader.js";
8
+ export * from "./atomic-liquidity.js";
@@ -99,4 +99,14 @@ export declare class EVMOperatorCalls extends EVMOnChainCalls {
99
99
  * @returns EvmOnChainCallResponse
100
100
  */
101
101
  setDepositAllowList(vaultAddress: string, user: string, status: boolean, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
102
+ /** Atomic vault: supply `assets` of idle collateral into the external ERC-4626 strategy. */
103
+ supplyToStrategy(vaultAddress: string, assets: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
104
+ /** Atomic vault: withdraw `assets` of collateral back from the strategy into the vault. */
105
+ withdrawFromStrategy(vaultAddress: string, assets: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
106
+ /** Atomic vault: submit `amount` of collected source `share` for redemption on the source vault. */
107
+ redeemCollectedEmberShares(vaultAddress: string, share: string, amount: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
108
+ /** Atomic vault: release the holdback FIFO for `share` at `unwindingPercentage` (1e18=100%), up to `maxEntries`. */
109
+ releaseUsersHoldback(vaultAddress: string, share: string, unwindingPercentage: NumStr, maxEntries: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
110
+ /** Atomic vault: move `amount` of collateral to a registered sub-account. */
111
+ supplyToSubAccount(vaultAddress: string, subAccount: string, amount: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
102
112
  }
@@ -136,4 +136,32 @@ export class EVMOperatorCalls extends EVMOnChainCalls {
136
136
  const txCall = this.txBuilder.setVaultDepositAllowList(vaultAddress, user, status);
137
137
  return this.execCall(txCall, options);
138
138
  }
139
+ // ============================================
140
+ // Atomic Liquidity Vault — operator actions (BFE-817/818)
141
+ // ============================================
142
+ /** Atomic vault: supply `assets` of idle collateral into the external ERC-4626 strategy. */
143
+ async supplyToStrategy(vaultAddress, assets, options) {
144
+ const txCall = this.txBuilder.atomicSupplyToStrategy(vaultAddress, assets);
145
+ return this.execCall(txCall, options);
146
+ }
147
+ /** Atomic vault: withdraw `assets` of collateral back from the strategy into the vault. */
148
+ async withdrawFromStrategy(vaultAddress, assets, options) {
149
+ const txCall = this.txBuilder.atomicWithdrawFromStrategy(vaultAddress, assets);
150
+ return this.execCall(txCall, options);
151
+ }
152
+ /** Atomic vault: submit `amount` of collected source `share` for redemption on the source vault. */
153
+ async redeemCollectedEmberShares(vaultAddress, share, amount, options) {
154
+ const txCall = this.txBuilder.atomicRedeemCollectedEmberShares(vaultAddress, share, amount);
155
+ return this.execCall(txCall, options);
156
+ }
157
+ /** Atomic vault: release the holdback FIFO for `share` at `unwindingPercentage` (1e18=100%), up to `maxEntries`. */
158
+ async releaseUsersHoldback(vaultAddress, share, unwindingPercentage, maxEntries, options) {
159
+ const txCall = this.txBuilder.atomicReleaseUsersHoldback(vaultAddress, share, unwindingPercentage, maxEntries);
160
+ return this.execCall(txCall, options);
161
+ }
162
+ /** Atomic vault: move `amount` of collateral to a registered sub-account. */
163
+ async supplyToSubAccount(vaultAddress, subAccount, amount, options) {
164
+ const txCall = this.txBuilder.atomicSupplyToSubAccount(vaultAddress, subAccount, amount);
165
+ return this.execCall(txCall, options);
166
+ }
139
167
  }
@@ -280,6 +280,27 @@ export declare class EVMTxBuilder {
280
280
  * @returns Transaction call object
281
281
  */
282
282
  collectPlatformFee(vaultAddress: string, isETHVault?: boolean): ITransactionCall;
283
+ /**
284
+ * EmberETHVault: claim the caller's own escrowed (deferred) ETH withdrawal — accrued
285
+ * when a withdrawal couldn't be sent (receiver rejected the transfer). EmberETHVault only.
286
+ */
287
+ claimWithdrawal(vaultAddress: string): ITransactionCall;
288
+ /**
289
+ * EmberETHVault: deliver `receiver`'s escrowed ETH withdrawal on their behalf
290
+ * (permissionless — funds can only go to `receiver`). EmberETHVault only.
291
+ */
292
+ claimWithdrawalFor(vaultAddress: string, receiver: string): ITransactionCall;
293
+ /**
294
+ * EmberETHVault: redirect the CALLER's own escrowed ETH withdrawal to `to`. For a
295
+ * receiver that can transact but can no longer receive ETH; delivers only the
296
+ * caller's own escrow. EmberETHVault only.
297
+ */
298
+ claimWithdrawalTo(vaultAddress: string, to: string): ITransactionCall;
299
+ /**
300
+ * EmberETHVault: owner recovery of `receiver`'s escrowed ETH to `to` (a permanently
301
+ * unpayable receiver). Owner-only (called directly on the vault). EmberETHVault only.
302
+ */
303
+ recoverUnclaimedWithdrawal(vaultAddress: string, receiver: string, to: string): ITransactionCall;
283
304
  /**
284
305
  * Withdraws assets from the vault without redeeming shares (operator only)
285
306
  * Used by operators to move funds to sub-accounts for strategy execution
@@ -501,4 +522,92 @@ export declare class EVMTxBuilder {
501
522
  * @returns Transaction call object
502
523
  */
503
524
  bridgeSend(adapterAddress: string, sendParam: IOFTSendParam, fee: IOFTMessagingFee, refundAddress: string): ITransactionCall;
525
+ private atomicCall;
526
+ /** Claim the caller's own escrowed (deferred) holdback collateral. */
527
+ atomicClaimHoldback(vaultAddress: string): ITransactionCall;
528
+ /** Deliver `recipient`'s escrowed holdback on their behalf (permissionless). */
529
+ atomicClaimHoldbackFor(vaultAddress: string, recipient: string): ITransactionCall;
530
+ /**
531
+ * Redirect the CALLER's own escrowed holdback to `to`. For a recipient that can
532
+ * transact but can no longer receive the collateral token (e.g. token blacklist);
533
+ * moves only the caller's own escrow.
534
+ */
535
+ atomicClaimHoldbackTo(vaultAddress: string, to: string): ITransactionCall;
536
+ /**
537
+ * Owner recovery of `recipient`'s escrowed holdback to `to` (a permanently unpayable
538
+ * recipient). Owner-only, called directly on the vault (not via protocol config).
539
+ */
540
+ atomicRecoverUnclaimedHoldback(vaultAddress: string, recipient: string, to: string): ITransactionCall;
541
+ /**
542
+ * Builds an atomic-vault ADMIN call routed through the vault's protocol config. Atomic admin
543
+ * setters are `onlyProtocolConfig`, so they must be invoked on the EmberProtocolConfig (which
544
+ * forwards msg.sender as `caller`) — never on the vault directly. Targets the vault's OWN
545
+ * protocol config (atomic vaults may use a config distinct from the global one). Each config
546
+ * forwarder takes the vault address as its first argument and derives `caller` from msg.sender.
547
+ */
548
+ private atomicConfigCall;
549
+ /** Instant (capped, fee'd) withdraw of `shares` to `receiver`; auto-pulls from strategy. */
550
+ atomicInstantWithdraw(vaultAddress: string, shares: NumStr, receiver: string): ITransactionCall;
551
+ /** Swap `shareAmount` of a whitelisted source EmberShare into this vault's collateral. */
552
+ atomicSwapEmberShares(vaultAddress: string, share: string, shareAmount: NumStr, receiver: string): ITransactionCall;
553
+ /** Supply `assets` of idle collateral into the external ERC-4626 strategy. */
554
+ atomicSupplyToStrategy(vaultAddress: string, assets: NumStr): ITransactionCall;
555
+ /** Withdraw `assets` of collateral back from the strategy into the vault. */
556
+ atomicWithdrawFromStrategy(vaultAddress: string, assets: NumStr): ITransactionCall;
557
+ /** Submit `amount` of collected source `share` for redemption on the source EmberVault. */
558
+ atomicRedeemCollectedEmberShares(vaultAddress: string, share: string, amount: NumStr): ITransactionCall;
559
+ /** Release the holdback FIFO for `share` at `unwindingPercentage` (1e18 = 100%), up to `maxEntries`. */
560
+ atomicReleaseUsersHoldback(vaultAddress: string, share: string, unwindingPercentage: NumStr, maxEntries: NumStr): ITransactionCall;
561
+ /** Set the external ERC-4626 strategy (address(0) to disable). Drain the old strategy first. */
562
+ atomicSetStrategy(vaultAddress: string, _caller: string, newStrategy: string): ITransactionCall;
563
+ /**
564
+ * Whitelist (or update) a source EmberShare with fee / capacity / holdback / utilization
565
+ * percentages, a per-swap minimum gross floor (`minSwapGross`, 0 disables), and a
566
+ * TVL-independent absolute held-value cap (`maxHeldValueAbsolute`, 0 disables).
567
+ */
568
+ atomicSetEmberShareWhitelist(vaultAddress: string, _caller: string, share: string, whitelisted: boolean, feePercentage: NumStr, maxCapacityPercentage: NumStr, holdbackPercentage: NumStr, maxUtilizationPercentage: NumStr, minSwapGross: NumStr, maxHeldValueAbsolute: NumStr): ITransactionCall;
569
+ /** Set per-account swap waivers (fee and/or holdback); (false,false) removes them. */
570
+ atomicSetSwapWaiver(vaultAddress: string, _caller: string, account: string, feeWaived: boolean, holdbackWaived: boolean): ITransactionCall;
571
+ /**
572
+ * Add/update (remove=false) or remove (remove=true) a fee-multiplier curve
573
+ * tier for an EmberShare. threshold is a utilization percentage (1e18 = 100%);
574
+ * multiplier is a fee multiplier (1e18 = 1x, must be >= 1e18 on upsert).
575
+ */
576
+ atomicUpdateEmberShareFeeMultiplierTier(vaultAddress: string, _caller: string, share: string, threshold: NumStr, multiplier: NumStr, remove: boolean): ITransactionCall;
577
+ /** Set the cumulative instant-withdraw cap (in shares). */
578
+ atomicSetMaxInstantWithdrawShares(vaultAddress: string, _caller: string, newMax: NumStr): ITransactionCall;
579
+ /** Set the instant-withdraw fee percentage. */
580
+ atomicSetInstantWithdrawFeePercentage(vaultAddress: string, _caller: string, newFeePercentage: NumStr): ITransactionCall;
581
+ /** Set the platform fee percentage. */
582
+ atomicSetFeePercentage(vaultAddress: string, _caller: string, newFeePercentage: NumStr): ITransactionCall;
583
+ /** Set the maximum TVL. */
584
+ atomicSetMaxTVL(vaultAddress: string, _caller: string, newMaxTVL: NumStr): ITransactionCall;
585
+ /** Set the minimum withdrawable shares. */
586
+ atomicSetMinWithdrawableShares(vaultAddress: string, _caller: string, newMinWithdrawableShares: NumStr): ITransactionCall;
587
+ /** Set the max rate change per update bound. */
588
+ atomicSetMaxRateChangePerUpdate(vaultAddress: string, _caller: string, newMaxRateChangePerUpdate: NumStr): ITransactionCall;
589
+ /** Set the minimum interval between rate updates (ms). */
590
+ atomicSetRateUpdateInterval(vaultAddress: string, _caller: string, newInterval: NumStr): ITransactionCall;
591
+ /** Rename the vault. */
592
+ atomicSetVaultName(vaultAddress: string, _caller: string, newName: string): ITransactionCall;
593
+ /** Set the vault validator contract. */
594
+ atomicSetVaultValidator(vaultAddress: string, _caller: string, validator: string): ITransactionCall;
595
+ /** Add/remove a sub-account. */
596
+ atomicSetSubAccountStatus(vaultAddress: string, _caller: string, account: string, isSubAccount: boolean): ITransactionCall;
597
+ /** Pause/unpause one operation ("deposits" | "withdrawals" | "privilegedOperations"). */
598
+ atomicSetPausedStatus(vaultAddress: string, _caller: string, operation: string, paused: boolean): ITransactionCall;
599
+ /** Move `amount` of collateral to a registered sub-account (operator). */
600
+ atomicSupplyToSubAccount(vaultAddress: string, subAccount: string, amount: NumStr): ITransactionCall;
601
+ /** Rotate the admin role. */
602
+ atomicSetAdmin(vaultAddress: string, _caller: string, newAdmin: string): ITransactionCall;
603
+ /** Rotate the operator role. */
604
+ atomicSetOperator(vaultAddress: string, _caller: string, newOperator: string): ITransactionCall;
605
+ /** Rotate the rate-manager role. */
606
+ atomicSetRateManager(vaultAddress: string, _caller: string, newRateManager: string): ITransactionCall;
607
+ /** Transfer contract ownership (UUPS owner). */
608
+ atomicTransferOwnership(vaultAddress: string, newOwner: string): ITransactionCall;
609
+ /** Renounce ownership (irreversible). */
610
+ atomicRenounceOwnership(vaultAddress: string): ITransactionCall;
611
+ /** Upgrade the implementation and optionally call init data (UUPS). */
612
+ atomicUpgradeToAndCall(vaultAddress: string, newImplementation: string, data: string): ITransactionCall;
504
613
  }
@@ -4,6 +4,7 @@ import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json"
4
4
  import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
5
5
  import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
6
6
  import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
7
+ import AtomicLiquidityABI from "../../abis/AtomicLiquidity.json" with { type: "json" };
7
8
  import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
8
9
  import OpenCoverVaultABI from "../../abis/OpenCoverVault.json" with { type: "json" };
9
10
  /**
@@ -574,6 +575,63 @@ export class EVMTxBuilder {
574
575
  chainId: this.getChainId()
575
576
  };
576
577
  }
578
+ /**
579
+ * EmberETHVault: claim the caller's own escrowed (deferred) ETH withdrawal — accrued
580
+ * when a withdrawal couldn't be sent (receiver rejected the transfer). EmberETHVault only.
581
+ */
582
+ claimWithdrawal(vaultAddress) {
583
+ return {
584
+ to: vaultAddress,
585
+ functionName: "claimWithdrawal",
586
+ args: [],
587
+ abi: EmberETHVaultABI.abi,
588
+ value: 0n,
589
+ chainId: this.getChainId()
590
+ };
591
+ }
592
+ /**
593
+ * EmberETHVault: deliver `receiver`'s escrowed ETH withdrawal on their behalf
594
+ * (permissionless — funds can only go to `receiver`). EmberETHVault only.
595
+ */
596
+ claimWithdrawalFor(vaultAddress, receiver) {
597
+ return {
598
+ to: vaultAddress,
599
+ functionName: "claimWithdrawalFor",
600
+ args: [receiver],
601
+ abi: EmberETHVaultABI.abi,
602
+ value: 0n,
603
+ chainId: this.getChainId()
604
+ };
605
+ }
606
+ /**
607
+ * EmberETHVault: redirect the CALLER's own escrowed ETH withdrawal to `to`. For a
608
+ * receiver that can transact but can no longer receive ETH; delivers only the
609
+ * caller's own escrow. EmberETHVault only.
610
+ */
611
+ claimWithdrawalTo(vaultAddress, to) {
612
+ return {
613
+ to: vaultAddress,
614
+ functionName: "claimWithdrawalTo",
615
+ args: [to],
616
+ abi: EmberETHVaultABI.abi,
617
+ value: 0n,
618
+ chainId: this.getChainId()
619
+ };
620
+ }
621
+ /**
622
+ * EmberETHVault: owner recovery of `receiver`'s escrowed ETH to `to` (a permanently
623
+ * unpayable receiver). Owner-only (called directly on the vault). EmberETHVault only.
624
+ */
625
+ recoverUnclaimedWithdrawal(vaultAddress, receiver, to) {
626
+ return {
627
+ to: vaultAddress,
628
+ functionName: "recoverUnclaimedWithdrawal",
629
+ args: [receiver, to],
630
+ abi: EmberETHVaultABI.abi,
631
+ value: 0n,
632
+ chainId: this.getChainId()
633
+ };
634
+ }
577
635
  /**
578
636
  * Withdraws assets from the vault without redeeming shares (operator only)
579
637
  * Used by operators to move funds to sub-accounts for strategy execution
@@ -1050,4 +1108,227 @@ export class EVMTxBuilder {
1050
1108
  chainId: this.getChainId()
1051
1109
  };
1052
1110
  }
1111
+ // ============================================
1112
+ // Atomic Liquidity Vault methods (BFE-817/818)
1113
+ //
1114
+ // Atomic vaults are a sibling of EmberVault with instant-withdraw + cross-vault
1115
+ // EmberShare swap, backed by an ERC-4626 strategy. Shares are non-transferable
1116
+ // (no receipt token). These encode against the AtomicLiquidity ABI; admin
1117
+ // setters take `caller` because access is gated via the protocol-config role.
1118
+ // ============================================
1119
+ atomicCall(vaultAddress, functionName, args) {
1120
+ return {
1121
+ to: vaultAddress,
1122
+ functionName,
1123
+ args,
1124
+ abi: AtomicLiquidityABI.abi,
1125
+ value: 0n,
1126
+ chainId: this.getChainId()
1127
+ };
1128
+ }
1129
+ /** Claim the caller's own escrowed (deferred) holdback collateral. */
1130
+ atomicClaimHoldback(vaultAddress) {
1131
+ return this.atomicCall(vaultAddress, "claimHoldback", []);
1132
+ }
1133
+ /** Deliver `recipient`'s escrowed holdback on their behalf (permissionless). */
1134
+ atomicClaimHoldbackFor(vaultAddress, recipient) {
1135
+ return this.atomicCall(vaultAddress, "claimHoldbackFor", [recipient]);
1136
+ }
1137
+ /**
1138
+ * Redirect the CALLER's own escrowed holdback to `to`. For a recipient that can
1139
+ * transact but can no longer receive the collateral token (e.g. token blacklist);
1140
+ * moves only the caller's own escrow.
1141
+ */
1142
+ atomicClaimHoldbackTo(vaultAddress, to) {
1143
+ return this.atomicCall(vaultAddress, "claimHoldbackTo", [to]);
1144
+ }
1145
+ /**
1146
+ * Owner recovery of `recipient`'s escrowed holdback to `to` (a permanently unpayable
1147
+ * recipient). Owner-only, called directly on the vault (not via protocol config).
1148
+ */
1149
+ atomicRecoverUnclaimedHoldback(vaultAddress, recipient, to) {
1150
+ return this.atomicCall(vaultAddress, "recoverUnclaimedHoldback", [recipient, to]);
1151
+ }
1152
+ /**
1153
+ * Builds an atomic-vault ADMIN call routed through the vault's protocol config. Atomic admin
1154
+ * setters are `onlyProtocolConfig`, so they must be invoked on the EmberProtocolConfig (which
1155
+ * forwards msg.sender as `caller`) — never on the vault directly. Targets the vault's OWN
1156
+ * protocol config (atomic vaults may use a config distinct from the global one). Each config
1157
+ * forwarder takes the vault address as its first argument and derives `caller` from msg.sender.
1158
+ */
1159
+ atomicConfigCall(vaultAddress, forwarderName, forwarderArgs) {
1160
+ return {
1161
+ to: this.parser.getProtocolConfigAddressForVault(vaultAddress),
1162
+ functionName: forwarderName,
1163
+ args: [vaultAddress, ...forwarderArgs],
1164
+ abi: EmberProtocolConfigABI.abi,
1165
+ value: 0n,
1166
+ chainId: this.getChainId()
1167
+ };
1168
+ }
1169
+ /** Instant (capped, fee'd) withdraw of `shares` to `receiver`; auto-pulls from strategy. */
1170
+ atomicInstantWithdraw(vaultAddress, shares, receiver) {
1171
+ return this.atomicCall(vaultAddress, "instantWithdraw", [shares, receiver]);
1172
+ }
1173
+ /** Swap `shareAmount` of a whitelisted source EmberShare into this vault's collateral. */
1174
+ atomicSwapEmberShares(vaultAddress, share, shareAmount, receiver) {
1175
+ return this.atomicCall(vaultAddress, "swapEmberShares", [
1176
+ share,
1177
+ shareAmount,
1178
+ receiver
1179
+ ]);
1180
+ }
1181
+ /** Supply `assets` of idle collateral into the external ERC-4626 strategy. */
1182
+ atomicSupplyToStrategy(vaultAddress, assets) {
1183
+ return this.atomicCall(vaultAddress, "supplyToStrategy", [assets]);
1184
+ }
1185
+ /** Withdraw `assets` of collateral back from the strategy into the vault. */
1186
+ atomicWithdrawFromStrategy(vaultAddress, assets) {
1187
+ return this.atomicCall(vaultAddress, "withdrawFromStrategy", [assets]);
1188
+ }
1189
+ /** Submit `amount` of collected source `share` for redemption on the source EmberVault. */
1190
+ atomicRedeemCollectedEmberShares(vaultAddress, share, amount) {
1191
+ return this.atomicCall(vaultAddress, "redeemCollectedEmberShares", [
1192
+ share,
1193
+ amount
1194
+ ]);
1195
+ }
1196
+ /** Release the holdback FIFO for `share` at `unwindingPercentage` (1e18 = 100%), up to `maxEntries`. */
1197
+ atomicReleaseUsersHoldback(vaultAddress, share, unwindingPercentage, maxEntries) {
1198
+ return this.atomicCall(vaultAddress, "releaseUsersHoldback", [
1199
+ share,
1200
+ unwindingPercentage,
1201
+ maxEntries
1202
+ ]);
1203
+ }
1204
+ /** Set the external ERC-4626 strategy (address(0) to disable). Drain the old strategy first. */
1205
+ atomicSetStrategy(vaultAddress, _caller, newStrategy) {
1206
+ return this.atomicConfigCall(vaultAddress, "setVaultStrategy", [newStrategy]);
1207
+ }
1208
+ /**
1209
+ * Whitelist (or update) a source EmberShare with fee / capacity / holdback / utilization
1210
+ * percentages, a per-swap minimum gross floor (`minSwapGross`, 0 disables), and a
1211
+ * TVL-independent absolute held-value cap (`maxHeldValueAbsolute`, 0 disables).
1212
+ */
1213
+ atomicSetEmberShareWhitelist(vaultAddress, _caller, share, whitelisted, feePercentage, maxCapacityPercentage, holdbackPercentage, maxUtilizationPercentage, minSwapGross, maxHeldValueAbsolute) {
1214
+ return this.atomicConfigCall(vaultAddress, "setVaultEmberShareWhitelist", [
1215
+ share,
1216
+ whitelisted,
1217
+ feePercentage,
1218
+ maxCapacityPercentage,
1219
+ holdbackPercentage,
1220
+ maxUtilizationPercentage,
1221
+ minSwapGross,
1222
+ maxHeldValueAbsolute
1223
+ ]);
1224
+ }
1225
+ /** Set per-account swap waivers (fee and/or holdback); (false,false) removes them. */
1226
+ atomicSetSwapWaiver(vaultAddress, _caller, account, feeWaived, holdbackWaived) {
1227
+ return this.atomicConfigCall(vaultAddress, "setVaultSwapWaiver", [
1228
+ account,
1229
+ feeWaived,
1230
+ holdbackWaived
1231
+ ]);
1232
+ }
1233
+ /**
1234
+ * Add/update (remove=false) or remove (remove=true) a fee-multiplier curve
1235
+ * tier for an EmberShare. threshold is a utilization percentage (1e18 = 100%);
1236
+ * multiplier is a fee multiplier (1e18 = 1x, must be >= 1e18 on upsert).
1237
+ */
1238
+ atomicUpdateEmberShareFeeMultiplierTier(vaultAddress, _caller, share, threshold, multiplier, remove) {
1239
+ return this.atomicConfigCall(vaultAddress, "updateVaultEmberShareFeeMultiplierTier", [share, threshold, multiplier, remove]);
1240
+ }
1241
+ /** Set the cumulative instant-withdraw cap (in shares). */
1242
+ atomicSetMaxInstantWithdrawShares(vaultAddress, _caller, newMax) {
1243
+ return this.atomicConfigCall(vaultAddress, "setVaultMaxInstantWithdrawShares", [
1244
+ newMax
1245
+ ]);
1246
+ }
1247
+ /** Set the instant-withdraw fee percentage. */
1248
+ atomicSetInstantWithdrawFeePercentage(vaultAddress, _caller, newFeePercentage) {
1249
+ return this.atomicConfigCall(vaultAddress, "setVaultInstantWithdrawFeePercentage", [newFeePercentage]);
1250
+ }
1251
+ /** Set the platform fee percentage. */
1252
+ atomicSetFeePercentage(vaultAddress, _caller, newFeePercentage) {
1253
+ return this.atomicConfigCall(vaultAddress, "updateVaultFeePercentage", [
1254
+ newFeePercentage
1255
+ ]);
1256
+ }
1257
+ /** Set the maximum TVL. */
1258
+ atomicSetMaxTVL(vaultAddress, _caller, newMaxTVL) {
1259
+ return this.atomicConfigCall(vaultAddress, "updateVaultMaxTVL", [newMaxTVL]);
1260
+ }
1261
+ /** Set the minimum withdrawable shares. */
1262
+ atomicSetMinWithdrawableShares(vaultAddress, _caller, newMinWithdrawableShares) {
1263
+ return this.atomicConfigCall(vaultAddress, "updateVaultMinWithdrawableShares", [
1264
+ newMinWithdrawableShares
1265
+ ]);
1266
+ }
1267
+ /** Set the max rate change per update bound. */
1268
+ atomicSetMaxRateChangePerUpdate(vaultAddress, _caller, newMaxRateChangePerUpdate) {
1269
+ return this.atomicConfigCall(vaultAddress, "updateVaultMaxRateChangePerUpdate", [
1270
+ newMaxRateChangePerUpdate
1271
+ ]);
1272
+ }
1273
+ /** Set the minimum interval between rate updates (ms). */
1274
+ atomicSetRateUpdateInterval(vaultAddress, _caller, newInterval) {
1275
+ return this.atomicConfigCall(vaultAddress, "updateVaultRateUpdateInterval", [
1276
+ newInterval
1277
+ ]);
1278
+ }
1279
+ /** Rename the vault. */
1280
+ atomicSetVaultName(vaultAddress, _caller, newName) {
1281
+ return this.atomicConfigCall(vaultAddress, "updateVaultName", [newName]);
1282
+ }
1283
+ /** Set the vault validator contract. */
1284
+ atomicSetVaultValidator(vaultAddress, _caller, validator) {
1285
+ return this.atomicConfigCall(vaultAddress, "setVaultValidator", [validator]);
1286
+ }
1287
+ /** Add/remove a sub-account. */
1288
+ atomicSetSubAccountStatus(vaultAddress, _caller, account, isSubAccount) {
1289
+ return this.atomicConfigCall(vaultAddress, "setVaultSubAccount", [
1290
+ account,
1291
+ isSubAccount
1292
+ ]);
1293
+ }
1294
+ /** Pause/unpause one operation ("deposits" | "withdrawals" | "privilegedOperations"). */
1295
+ atomicSetPausedStatus(vaultAddress, _caller, operation, paused) {
1296
+ return this.atomicConfigCall(vaultAddress, "setVaultPausedStatus", [
1297
+ operation,
1298
+ paused
1299
+ ]);
1300
+ }
1301
+ /** Move `amount` of collateral to a registered sub-account (operator). */
1302
+ atomicSupplyToSubAccount(vaultAddress, subAccount, amount) {
1303
+ return this.atomicCall(vaultAddress, "supplyToSubAccount", [subAccount, amount]);
1304
+ }
1305
+ /** Rotate the admin role. */
1306
+ atomicSetAdmin(vaultAddress, _caller, newAdmin) {
1307
+ return this.atomicConfigCall(vaultAddress, "updateVaultAdmin", [newAdmin]);
1308
+ }
1309
+ /** Rotate the operator role. */
1310
+ atomicSetOperator(vaultAddress, _caller, newOperator) {
1311
+ return this.atomicConfigCall(vaultAddress, "updateVaultOperator", [newOperator]);
1312
+ }
1313
+ /** Rotate the rate-manager role. */
1314
+ atomicSetRateManager(vaultAddress, _caller, newRateManager) {
1315
+ return this.atomicConfigCall(vaultAddress, "updateVaultRateManager", [
1316
+ newRateManager
1317
+ ]);
1318
+ }
1319
+ /** Transfer contract ownership (UUPS owner). */
1320
+ atomicTransferOwnership(vaultAddress, newOwner) {
1321
+ return this.atomicCall(vaultAddress, "transferOwnership", [newOwner]);
1322
+ }
1323
+ /** Renounce ownership (irreversible). */
1324
+ atomicRenounceOwnership(vaultAddress) {
1325
+ return this.atomicCall(vaultAddress, "renounceOwnership", []);
1326
+ }
1327
+ /** Upgrade the implementation and optionally call init data (UUPS). */
1328
+ atomicUpgradeToAndCall(vaultAddress, newImplementation, data) {
1329
+ return this.atomicCall(vaultAddress, "upgradeToAndCall", [
1330
+ newImplementation,
1331
+ data
1332
+ ]);
1333
+ }
1053
1334
  }
@@ -455,4 +455,54 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
455
455
  * @returns The allowance as bigint
456
456
  */
457
457
  getTokenAllowance(tokenAddress: string, spender: string, owner?: string): Promise<bigint>;
458
+ /**
459
+ * EmberETHVault: claim your own escrowed (deferred) ETH withdrawal — ETH that couldn't be
460
+ * sent when your withdrawal was processed (your receiver rejected the transfer) and is now
461
+ * escrowed. Reverts if nothing is escrowed. Query via the reader's `getUnclaimedWithdrawals`.
462
+ */
463
+ claimWithdrawal(vaultAddress: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
464
+ /**
465
+ * EmberETHVault: deliver `receiver`'s escrowed ETH withdrawal on their behalf.
466
+ * Permissionless — the funds can only ever go to `receiver`.
467
+ */
468
+ claimWithdrawalFor(vaultAddress: string, receiver: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
469
+ /**
470
+ * EmberETHVault: redirect YOUR OWN escrowed ETH withdrawal to `to`. Use when you can
471
+ * transact but can no longer receive ETH at your original address (e.g. a contract
472
+ * receiver that now reverts). Delivers only the caller's own escrow.
473
+ */
474
+ claimWithdrawalTo(vaultAddress: string, to: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
475
+ /**
476
+ * EmberETHVault: owner recovery of `receiver`'s escrowed ETH to `to`, for a receiver
477
+ * that can neither receive ETH nor call claimWithdrawalTo. Owner-only.
478
+ */
479
+ recoverUnclaimedWithdrawal(vaultAddress: string, receiver: string, to: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
480
+ /** Atomic vault: instant (capped, fee'd) withdraw of `shares` to `receiver`; auto-pulls from strategy. */
481
+ instantWithdraw(vaultAddress: string, shares: NumStr, receiver: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
482
+ /** Atomic vault: swap `shareAmount` of a whitelisted source EmberShare `share` into collateral. */
483
+ swapEmberShares(vaultAddress: string, share: string, shareAmount: NumStr, receiver: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
484
+ /**
485
+ * Atomic vault: claim your own escrowed holdback — collateral that couldn't be
486
+ * delivered during `releaseUsersHoldback` (e.g. you were blocklisted on the
487
+ * collateral token at release time and are now payable again). Reverts if nothing
488
+ * is escrowed for you. Query the amount via the reader's `unclaimedHoldback`.
489
+ */
490
+ claimHoldback(vaultAddress: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
491
+ /**
492
+ * Atomic vault: deliver a recipient's escrowed holdback on their behalf. Permissionless
493
+ * — the funds can only ever go to `recipient` — so anyone (e.g. the operator) may
494
+ * trigger delivery once the recipient is payable again.
495
+ */
496
+ claimHoldbackFor(vaultAddress: string, recipient: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
497
+ /**
498
+ * Atomic vault: redirect YOUR OWN escrowed holdback to `to`. Use when you can transact
499
+ * but can no longer receive the collateral token at your original address (e.g. a
500
+ * token-level blacklist). Delivers only the caller's own escrow.
501
+ */
502
+ claimHoldbackTo(vaultAddress: string, to: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
503
+ /**
504
+ * Atomic vault: owner recovery of `recipient`'s escrowed holdback to `to`, for a
505
+ * recipient that can neither receive the collateral nor call claimHoldbackTo. Owner-only.
506
+ */
507
+ recoverUnclaimedHoldback(vaultAddress: string, recipient: string, to: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
458
508
  }
@@ -702,4 +702,79 @@ export class EVMUserCalls extends EVMOnChainCalls {
702
702
  const token = this.getERC20Contract(tokenAddress);
703
703
  return token.allowance(ownerAddress, spender);
704
704
  }
705
+ /**
706
+ * EmberETHVault: claim your own escrowed (deferred) ETH withdrawal — ETH that couldn't be
707
+ * sent when your withdrawal was processed (your receiver rejected the transfer) and is now
708
+ * escrowed. Reverts if nothing is escrowed. Query via the reader's `getUnclaimedWithdrawals`.
709
+ */
710
+ async claimWithdrawal(vaultAddress, options) {
711
+ return this.execCall(this.txBuilder.claimWithdrawal(vaultAddress), options);
712
+ }
713
+ /**
714
+ * EmberETHVault: deliver `receiver`'s escrowed ETH withdrawal on their behalf.
715
+ * Permissionless — the funds can only ever go to `receiver`.
716
+ */
717
+ async claimWithdrawalFor(vaultAddress, receiver, options) {
718
+ return this.execCall(this.txBuilder.claimWithdrawalFor(vaultAddress, receiver), options);
719
+ }
720
+ /**
721
+ * EmberETHVault: redirect YOUR OWN escrowed ETH withdrawal to `to`. Use when you can
722
+ * transact but can no longer receive ETH at your original address (e.g. a contract
723
+ * receiver that now reverts). Delivers only the caller's own escrow.
724
+ */
725
+ async claimWithdrawalTo(vaultAddress, to, options) {
726
+ return this.execCall(this.txBuilder.claimWithdrawalTo(vaultAddress, to), options);
727
+ }
728
+ /**
729
+ * EmberETHVault: owner recovery of `receiver`'s escrowed ETH to `to`, for a receiver
730
+ * that can neither receive ETH nor call claimWithdrawalTo. Owner-only.
731
+ */
732
+ async recoverUnclaimedWithdrawal(vaultAddress, receiver, to, options) {
733
+ return this.execCall(this.txBuilder.recoverUnclaimedWithdrawal(vaultAddress, receiver, to), options);
734
+ }
735
+ // ============================================
736
+ // Atomic Liquidity Vault — user actions (BFE-817/818)
737
+ // ============================================
738
+ /** Atomic vault: instant (capped, fee'd) withdraw of `shares` to `receiver`; auto-pulls from strategy. */
739
+ async instantWithdraw(vaultAddress, shares, receiver, options) {
740
+ const txCall = this.txBuilder.atomicInstantWithdraw(vaultAddress, shares, receiver);
741
+ return this.execCall(txCall, options);
742
+ }
743
+ /** Atomic vault: swap `shareAmount` of a whitelisted source EmberShare `share` into collateral. */
744
+ async swapEmberShares(vaultAddress, share, shareAmount, receiver, options) {
745
+ const txCall = this.txBuilder.atomicSwapEmberShares(vaultAddress, share, shareAmount, receiver);
746
+ return this.execCall(txCall, options);
747
+ }
748
+ /**
749
+ * Atomic vault: claim your own escrowed holdback — collateral that couldn't be
750
+ * delivered during `releaseUsersHoldback` (e.g. you were blocklisted on the
751
+ * collateral token at release time and are now payable again). Reverts if nothing
752
+ * is escrowed for you. Query the amount via the reader's `unclaimedHoldback`.
753
+ */
754
+ async claimHoldback(vaultAddress, options) {
755
+ return this.execCall(this.txBuilder.atomicClaimHoldback(vaultAddress), options);
756
+ }
757
+ /**
758
+ * Atomic vault: deliver a recipient's escrowed holdback on their behalf. Permissionless
759
+ * — the funds can only ever go to `recipient` — so anyone (e.g. the operator) may
760
+ * trigger delivery once the recipient is payable again.
761
+ */
762
+ async claimHoldbackFor(vaultAddress, recipient, options) {
763
+ return this.execCall(this.txBuilder.atomicClaimHoldbackFor(vaultAddress, recipient), options);
764
+ }
765
+ /**
766
+ * Atomic vault: redirect YOUR OWN escrowed holdback to `to`. Use when you can transact
767
+ * but can no longer receive the collateral token at your original address (e.g. a
768
+ * token-level blacklist). Delivers only the caller's own escrow.
769
+ */
770
+ async claimHoldbackTo(vaultAddress, to, options) {
771
+ return this.execCall(this.txBuilder.atomicClaimHoldbackTo(vaultAddress, to), options);
772
+ }
773
+ /**
774
+ * Atomic vault: owner recovery of `recipient`'s escrowed holdback to `to`, for a
775
+ * recipient that can neither receive the collateral nor call claimHoldbackTo. Owner-only.
776
+ */
777
+ async recoverUnclaimedHoldback(vaultAddress, recipient, to, options) {
778
+ return this.execCall(this.txBuilder.atomicRecoverUnclaimedHoldback(vaultAddress, recipient, to), options);
779
+ }
705
780
  }