@forevermoney/sdk 0.4.0 → 0.5.1
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/CHANGELOG.md +22 -0
- package/README.md +40 -3
- package/dist/index.cjs +123 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -7
- package/dist/index.d.ts +32 -7
- package/dist/index.js +123 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -16,7 +16,7 @@ declare function feeWithBuffer(fee: bigint): bigint;
|
|
|
16
16
|
declare function gasLimitWithBuffer(gasLimit: bigint): bigint;
|
|
17
17
|
|
|
18
18
|
declare const foreverMoneyAbis: Readonly<{
|
|
19
|
-
alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
|
|
19
|
+
alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)", "function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function minStakeRequired() view returns (uint256)", "function MAX_STAKE_SOURCES() view returns (uint256)", "function GATEWAY_COLDKEY() view returns (bytes32)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
|
|
20
20
|
alphaVault: readonly ["function isPaused() view returns (bool)", "function pausedUntil() view returns (uint256)", "function isListed(address token) view returns (bool)", "function backing(address token) view returns (uint256 stakedAlpha)", "function positionOf(address token) view returns (bytes32 validator,uint256 netuid)"];
|
|
21
21
|
ccipExecution: readonly ["event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,bytes32 messageHash,uint8 state,bytes returnData,uint256 gasUsed)"];
|
|
22
22
|
ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)"];
|
|
@@ -36,9 +36,9 @@ declare const SUBTENSOR_CCIP_SELECTOR = 2135107236357186872n;
|
|
|
36
36
|
declare const RAO_PER_TAO = 1000000000n;
|
|
37
37
|
declare const EVM_WEI_PER_RAO = 1000000000n;
|
|
38
38
|
declare const SN80_NETUID = 80n;
|
|
39
|
-
declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.
|
|
39
|
+
declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.3.0";
|
|
40
40
|
declare const foreverMoneyDeployment: Readonly<{
|
|
41
|
-
version: "1.
|
|
41
|
+
version: "1.3.0";
|
|
42
42
|
base: Readonly<{
|
|
43
43
|
key: "base";
|
|
44
44
|
name: "Base";
|
|
@@ -46,7 +46,7 @@ declare const foreverMoneyDeployment: Readonly<{
|
|
|
46
46
|
ccipSelector: 15971525489660198786n;
|
|
47
47
|
contracts: Readonly<{
|
|
48
48
|
gateway: `0x${string}`;
|
|
49
|
-
|
|
49
|
+
legacyGateways: readonly `0x${string}`[];
|
|
50
50
|
wrappedTao: `0x${string}`;
|
|
51
51
|
wrappedSn80: `0x${string}`;
|
|
52
52
|
ccipRouter: `0x${string}`;
|
|
@@ -65,7 +65,7 @@ declare const foreverMoneyDeployment: Readonly<{
|
|
|
65
65
|
ccipSelector: 6180753054346818345n;
|
|
66
66
|
contracts: Readonly<{
|
|
67
67
|
gateway: `0x${string}`;
|
|
68
|
-
|
|
68
|
+
legacyGateways: readonly `0x${string}`[];
|
|
69
69
|
wrappedTao: `0x${string}`;
|
|
70
70
|
ccipRouter: `0x${string}`;
|
|
71
71
|
ccipOffRampFromSubtensor: `0x${string}`;
|
|
@@ -76,7 +76,7 @@ declare const foreverMoneyDeployment: Readonly<{
|
|
|
76
76
|
ccipSelector: 2135107236357186872n;
|
|
77
77
|
contracts: Readonly<{
|
|
78
78
|
gateway: `0x${string}`;
|
|
79
|
-
|
|
79
|
+
legacyGateways: readonly `0x${string}`[];
|
|
80
80
|
alphaVault: `0x${string}`;
|
|
81
81
|
wrappedTao: `0x${string}`;
|
|
82
82
|
wrappedSn80: `0x${string}`;
|
|
@@ -132,6 +132,18 @@ interface PartnerFee {
|
|
|
132
132
|
readonly bps: number;
|
|
133
133
|
}
|
|
134
134
|
declare const MAX_PARTNER_FEE_BPS = 10000;
|
|
135
|
+
/**
|
|
136
|
+
* One staked position to pull from when bridging staked alpha from Subtensor:
|
|
137
|
+
* the validator hotkey the caller's stake sits on and how much of it to take.
|
|
138
|
+
* The gateway re-delegates every pull to the token's canonical validator
|
|
139
|
+
* before depositing, so stake with any validator can be bridged.
|
|
140
|
+
*/
|
|
141
|
+
interface StakePull {
|
|
142
|
+
readonly hotkey: string;
|
|
143
|
+
readonly amountRao: bigint;
|
|
144
|
+
}
|
|
145
|
+
/** Gateway limit on positions per bridge (`AlphaGateway.MAX_STAKE_SOURCES`). */
|
|
146
|
+
declare const MAX_STAKE_PULLS = 16;
|
|
135
147
|
interface EvmToSubtensorRequest {
|
|
136
148
|
readonly evmChain: ForeverMoneyEvmChain;
|
|
137
149
|
readonly asset?: BridgeAsset;
|
|
@@ -142,6 +154,11 @@ interface EvmToSubtensorRequest {
|
|
|
142
154
|
readonly delivery: SubtensorDelivery;
|
|
143
155
|
}
|
|
144
156
|
interface SubtensorToEvmRequest {
|
|
157
|
+
/** Minimum destination-token output in 18-decimal wei, after partner fees.
|
|
158
|
+
* Defaults to amountWei. Must be positive and no greater than amountWei.
|
|
159
|
+
* Callers choose their tolerance explicitly, including staking rounding dust.
|
|
160
|
+
*/
|
|
161
|
+
readonly minAmountOutWei?: bigint;
|
|
145
162
|
readonly evmChain: ForeverMoneyEvmChain;
|
|
146
163
|
readonly asset?: BridgeAsset;
|
|
147
164
|
readonly partnerFee?: PartnerFee;
|
|
@@ -150,6 +167,14 @@ interface SubtensorToEvmRequest {
|
|
|
150
167
|
readonly amountWei: bigint;
|
|
151
168
|
readonly source: SubtensorSource;
|
|
152
169
|
readonly netuid?: bigint;
|
|
170
|
+
/**
|
|
171
|
+
* For a staked source: the positions to pull, summing to `amountWei` in
|
|
172
|
+
* RAO. Omit when the stake already sits on the token's canonical validator.
|
|
173
|
+
* With a partner fee, the cut is charged on top and spread across the pulls
|
|
174
|
+
* in proportion to their amounts, so each position must hold its amount
|
|
175
|
+
* plus its share of the cut.
|
|
176
|
+
*/
|
|
177
|
+
readonly stakePulls?: readonly StakePull[];
|
|
153
178
|
}
|
|
154
179
|
type BaseToSubtensorRequest = Omit<EvmToSubtensorRequest, 'evmChain'>;
|
|
155
180
|
type SubtensorToBaseRequest = Omit<SubtensorToEvmRequest, 'evmChain'>;
|
|
@@ -363,4 +388,4 @@ interface ViemTransactionRequest {
|
|
|
363
388
|
}
|
|
364
389
|
declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
|
|
365
390
|
|
|
366
|
-
export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
|
|
391
|
+
export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MAX_STAKE_PULLS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type StakePull, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare function feeWithBuffer(fee: bigint): bigint;
|
|
|
16
16
|
declare function gasLimitWithBuffer(gasLimit: bigint): bigint;
|
|
17
17
|
|
|
18
18
|
declare const foreverMoneyAbis: Readonly<{
|
|
19
|
-
alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
|
|
19
|
+
alphaGateway: readonly ["function ROUTER() view returns (address)", "function allowedLane(uint64 selector) view returns (bool)", "function maxIntegratorFeeBps() view returns (uint16)", "function bridgeFeeBps() view returns (uint16)", "function integratorTaoTopUp(uint256 taoAmount,uint16 bps) pure returns (uint256)", "function quoteBridgeOut(uint64 destSelector,address token,address recipient,uint256 mintedAmount) view returns (uint256 fee)", "function bridgeOut(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut) payable returns (bytes32 messageId)", "function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)", "function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)", "function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)", "function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)", "function minStakeRequired() view returns (uint256)", "function MAX_STAKE_SOURCES() view returns (uint256)", "function GATEWAY_COLDKEY() view returns (bytes32)", "function claimLiquid(address token,uint256 minTaoOut,address to)", "function claimNative(address to)", "function claimStaked(address token,bytes32 destColdkey,address to)", "function claimToken(address token,address to)", "function claimableNative(address account) view returns (uint256)", "function claimableToken(address token,address account) view returns (uint256)", "event BridgedOut(uint64 destChainSelector,address indexed token,address indexed sender,address indexed recipient,uint256 minted,bytes32 messageId)", "event Claimable(address indexed token,address indexed user,uint256 native,uint256 wsn)", "event NotDelivered(uint64 indexed sourceChainSelector,address indexed token,uint256 amount,uint8 reason)", "event DeliveredLiquid(address indexed token,bytes32 indexed ss58,uint256 taoOut)", "event DeliveredStaked(address indexed token,bytes32 indexed ss58,uint256 alphaRao)"];
|
|
20
20
|
alphaVault: readonly ["function isPaused() view returns (bool)", "function pausedUntil() view returns (uint256)", "function isListed(address token) view returns (bool)", "function backing(address token) view returns (uint256 stakedAlpha)", "function positionOf(address token) view returns (bytes32 validator,uint256 netuid)"];
|
|
21
21
|
ccipExecution: readonly ["event ExecutionStateChanged(uint64 indexed sourceChainSelector,uint64 indexed sequenceNumber,bytes32 indexed messageId,bytes32 messageHash,uint8 state,bytes returnData,uint256 gasUsed)"];
|
|
22
22
|
ccipRouter: readonly ["function isOffRamp(uint64 sourceChainSelector,address offRamp) view returns (bool)"];
|
|
@@ -36,9 +36,9 @@ declare const SUBTENSOR_CCIP_SELECTOR = 2135107236357186872n;
|
|
|
36
36
|
declare const RAO_PER_TAO = 1000000000n;
|
|
37
37
|
declare const EVM_WEI_PER_RAO = 1000000000n;
|
|
38
38
|
declare const SN80_NETUID = 80n;
|
|
39
|
-
declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.
|
|
39
|
+
declare const FOREVERMONEY_DEPLOYMENT_VERSION: "1.3.0";
|
|
40
40
|
declare const foreverMoneyDeployment: Readonly<{
|
|
41
|
-
version: "1.
|
|
41
|
+
version: "1.3.0";
|
|
42
42
|
base: Readonly<{
|
|
43
43
|
key: "base";
|
|
44
44
|
name: "Base";
|
|
@@ -46,7 +46,7 @@ declare const foreverMoneyDeployment: Readonly<{
|
|
|
46
46
|
ccipSelector: 15971525489660198786n;
|
|
47
47
|
contracts: Readonly<{
|
|
48
48
|
gateway: `0x${string}`;
|
|
49
|
-
|
|
49
|
+
legacyGateways: readonly `0x${string}`[];
|
|
50
50
|
wrappedTao: `0x${string}`;
|
|
51
51
|
wrappedSn80: `0x${string}`;
|
|
52
52
|
ccipRouter: `0x${string}`;
|
|
@@ -65,7 +65,7 @@ declare const foreverMoneyDeployment: Readonly<{
|
|
|
65
65
|
ccipSelector: 6180753054346818345n;
|
|
66
66
|
contracts: Readonly<{
|
|
67
67
|
gateway: `0x${string}`;
|
|
68
|
-
|
|
68
|
+
legacyGateways: readonly `0x${string}`[];
|
|
69
69
|
wrappedTao: `0x${string}`;
|
|
70
70
|
ccipRouter: `0x${string}`;
|
|
71
71
|
ccipOffRampFromSubtensor: `0x${string}`;
|
|
@@ -76,7 +76,7 @@ declare const foreverMoneyDeployment: Readonly<{
|
|
|
76
76
|
ccipSelector: 2135107236357186872n;
|
|
77
77
|
contracts: Readonly<{
|
|
78
78
|
gateway: `0x${string}`;
|
|
79
|
-
|
|
79
|
+
legacyGateways: readonly `0x${string}`[];
|
|
80
80
|
alphaVault: `0x${string}`;
|
|
81
81
|
wrappedTao: `0x${string}`;
|
|
82
82
|
wrappedSn80: `0x${string}`;
|
|
@@ -132,6 +132,18 @@ interface PartnerFee {
|
|
|
132
132
|
readonly bps: number;
|
|
133
133
|
}
|
|
134
134
|
declare const MAX_PARTNER_FEE_BPS = 10000;
|
|
135
|
+
/**
|
|
136
|
+
* One staked position to pull from when bridging staked alpha from Subtensor:
|
|
137
|
+
* the validator hotkey the caller's stake sits on and how much of it to take.
|
|
138
|
+
* The gateway re-delegates every pull to the token's canonical validator
|
|
139
|
+
* before depositing, so stake with any validator can be bridged.
|
|
140
|
+
*/
|
|
141
|
+
interface StakePull {
|
|
142
|
+
readonly hotkey: string;
|
|
143
|
+
readonly amountRao: bigint;
|
|
144
|
+
}
|
|
145
|
+
/** Gateway limit on positions per bridge (`AlphaGateway.MAX_STAKE_SOURCES`). */
|
|
146
|
+
declare const MAX_STAKE_PULLS = 16;
|
|
135
147
|
interface EvmToSubtensorRequest {
|
|
136
148
|
readonly evmChain: ForeverMoneyEvmChain;
|
|
137
149
|
readonly asset?: BridgeAsset;
|
|
@@ -142,6 +154,11 @@ interface EvmToSubtensorRequest {
|
|
|
142
154
|
readonly delivery: SubtensorDelivery;
|
|
143
155
|
}
|
|
144
156
|
interface SubtensorToEvmRequest {
|
|
157
|
+
/** Minimum destination-token output in 18-decimal wei, after partner fees.
|
|
158
|
+
* Defaults to amountWei. Must be positive and no greater than amountWei.
|
|
159
|
+
* Callers choose their tolerance explicitly, including staking rounding dust.
|
|
160
|
+
*/
|
|
161
|
+
readonly minAmountOutWei?: bigint;
|
|
145
162
|
readonly evmChain: ForeverMoneyEvmChain;
|
|
146
163
|
readonly asset?: BridgeAsset;
|
|
147
164
|
readonly partnerFee?: PartnerFee;
|
|
@@ -150,6 +167,14 @@ interface SubtensorToEvmRequest {
|
|
|
150
167
|
readonly amountWei: bigint;
|
|
151
168
|
readonly source: SubtensorSource;
|
|
152
169
|
readonly netuid?: bigint;
|
|
170
|
+
/**
|
|
171
|
+
* For a staked source: the positions to pull, summing to `amountWei` in
|
|
172
|
+
* RAO. Omit when the stake already sits on the token's canonical validator.
|
|
173
|
+
* With a partner fee, the cut is charged on top and spread across the pulls
|
|
174
|
+
* in proportion to their amounts, so each position must hold its amount
|
|
175
|
+
* plus its share of the cut.
|
|
176
|
+
*/
|
|
177
|
+
readonly stakePulls?: readonly StakePull[];
|
|
153
178
|
}
|
|
154
179
|
type BaseToSubtensorRequest = Omit<EvmToSubtensorRequest, 'evmChain'>;
|
|
155
180
|
type SubtensorToBaseRequest = Omit<SubtensorToEvmRequest, 'evmChain'>;
|
|
@@ -363,4 +388,4 @@ interface ViemTransactionRequest {
|
|
|
363
388
|
}
|
|
364
389
|
declare function toViemTransaction(transaction: PreparedTransaction): Readonly<ViemTransactionRequest>;
|
|
365
390
|
|
|
366
|
-
export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
|
|
391
|
+
export { BASE_CCIP_SELECTOR, BASE_CHAIN_ID, BASIS_POINTS, type BaseToSubtensorRequest, type BridgeAsset, type BridgeDirection, type BridgePreparation, type BridgeSourceStatus, type BridgeSourceStatusRequest, type BridgeSourceTransactionStatus, type BuildBaseToSubtensorPlanRequest, type BuildEvmToSubtensorPlanRequest, type BuildSubtensorToBasePlanRequest, type BuildSubtensorToEvmPlanRequest, type CcipDeliveryCheckpoint, type CcipDeliveryStatus, type CcipDeliveryStatusRequest, type CreateVaultRequest, type DepositVaultRequest, EVM_WEI_PER_RAO, type Eip1193TransactionRequest, type EthersCompatibleTransactionRequest, type EvmToSubtensorRequest, FOREVERMONEY_DEPLOYMENT_VERSION, type ForeverMoneyClient, type ForeverMoneyClientOptions, type ForeverMoneyDeployment, ForeverMoneyError, type ForeverMoneyErrorCode, type ForeverMoneyEvmChain, GAS_LIMIT_BUFFER_BPS, type HttpTransportOptions, type LegacyRpcProvider, MAX_PARTNER_FEE_BPS, MAX_STAKE_PULLS, MIN_LIQUID_BASE_TO_SUBTENSOR_WEI, MIN_LIQUID_EVM_TO_SUBTENSOR_WEI, MIN_LIQUID_SUBTENSOR_TO_EVM_WEI, NETWORK_FEE_BUFFER_BPS, type PartnerFee, type PreparedTransaction, RAO_PER_TAO, ROBINHOOD_CCIP_SELECTOR, ROBINHOOD_CHAIN_ID, type ReceiptLog, type RpcRequest, type RpcTransport, SN80_NETUID, SUBTENSOR_CCIP_SELECTOR, SUBTENSOR_CHAIN_ID, type StakePull, type SubtensorDelivery, type SubtensorSource, type SubtensorToBaseRequest, type SubtensorToEvmRequest, type TrackingProvider, type TransactionAction, type TransactionPlan, type TransactionReceiptLike, type TransactionStep, type TransactionStepKind, type VaultStashToken, type VaultTokenAllowance, type ViemTransactionRequest, type WithdrawVaultRequest, assertWholeRao, bridgeMessageIdFromReceipt, buildBaseToSubtensorPlan, buildClaimVaultFeesPlan, buildCreateVaultPlan, buildDepositVaultPlan, buildEvmToSubtensorPlan, buildSetVaultStakingPlan, buildSubtensorToBasePlan, buildSubtensorToEvmPlan, buildWithdrawVaultPlan, createForeverMoneyClient, destinationChainId, evmChainFromBridgeDirection, evmToMirrorSS58, feeWithBuffer, foreverMoneyAbis, foreverMoneyDeployment, formatTaoAmount, gasLimitWithBuffer, getBridgeSourceStatus, getCcipDeliveryCheckpoint, getCcipDeliveryStatus, getForeverMoneyEvmDeployment, http, isBittensorSS58, isEvmToSubtensorDirection, normalizeEvmAddress, normalizeSS58, parseTaoAmount, partnerFeeCut, partnerFeeTaoTopUp, sourceChainId, ss58ToPublicKey, toEip1193Transaction, toEthersTransaction, toViemTransaction, vaultManagerFromCreationReceipt };
|
package/dist/index.js
CHANGED
|
@@ -93,7 +93,7 @@ var SUBTENSOR_CCIP_SELECTOR = 2135107236357186872n;
|
|
|
93
93
|
var RAO_PER_TAO = 1000000000n;
|
|
94
94
|
var EVM_WEI_PER_RAO = 1000000000n;
|
|
95
95
|
var SN80_NETUID = 80n;
|
|
96
|
-
var FOREVERMONEY_DEPLOYMENT_VERSION = "1.
|
|
96
|
+
var FOREVERMONEY_DEPLOYMENT_VERSION = "1.3.0";
|
|
97
97
|
var foreverMoneyDeployment = Object.freeze({
|
|
98
98
|
version: FOREVERMONEY_DEPLOYMENT_VERSION,
|
|
99
99
|
base: Object.freeze({
|
|
@@ -103,9 +103,11 @@ var foreverMoneyDeployment = Object.freeze({
|
|
|
103
103
|
ccipSelector: BASE_CCIP_SELECTOR,
|
|
104
104
|
contracts: Object.freeze({
|
|
105
105
|
gateway: getAddress2("0x1da2415229b614C787e145D1D7346eb496319C52"),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
// Retired gateways, oldest first; kept only to track transfers sent
|
|
107
|
+
// through them.
|
|
108
|
+
legacyGateways: [
|
|
109
|
+
getAddress2("0x5EF3d7D19e4b233a1A169DA0d5CB02ec6b160a2C")
|
|
110
|
+
],
|
|
109
111
|
wrappedTao: getAddress2(
|
|
110
112
|
"0xf3081494b87e8d5fb7960f066e931d1d0e6e3d67"
|
|
111
113
|
),
|
|
@@ -138,9 +140,9 @@ var foreverMoneyDeployment = Object.freeze({
|
|
|
138
140
|
ccipSelector: ROBINHOOD_CCIP_SELECTOR,
|
|
139
141
|
contracts: Object.freeze({
|
|
140
142
|
gateway: getAddress2("0xf27fdA637131E25B2A1b4865ED9597d881980c7E"),
|
|
141
|
-
|
|
142
|
-
"0x53Dcc4FE04193e489BE537F722F65317DB1E65d8"
|
|
143
|
-
|
|
143
|
+
legacyGateways: [
|
|
144
|
+
getAddress2("0x53Dcc4FE04193e489BE537F722F65317DB1E65d8")
|
|
145
|
+
],
|
|
144
146
|
wrappedTao: getAddress2(
|
|
145
147
|
"0xf3081494B87e8D5fb7960f066E931D1D0e6E3d67"
|
|
146
148
|
),
|
|
@@ -156,10 +158,14 @@ var foreverMoneyDeployment = Object.freeze({
|
|
|
156
158
|
chainId: SUBTENSOR_CHAIN_ID,
|
|
157
159
|
ccipSelector: SUBTENSOR_CCIP_SELECTOR,
|
|
158
160
|
contracts: Object.freeze({
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
),
|
|
161
|
+
// V5.1 AlphaGateway: multi-validator staked input (tao-bridge 485c898).
|
|
162
|
+
gateway: getAddress2("0xd5Fa238aa4177f6c1341491969d9cBeec94EEd69"),
|
|
163
|
+
// V4 and V5 hubs. The spokes still deliver to the V5 hub (their hub
|
|
164
|
+
// pointer is immutable), so it stays here for delivery tracking.
|
|
165
|
+
legacyGateways: [
|
|
166
|
+
getAddress2("0x998f20Fea90bF7792774dECc7f994716442B1705"),
|
|
167
|
+
getAddress2("0xcd0C6d98D0A126B1c113d15b4c28F38321437787")
|
|
168
|
+
],
|
|
163
169
|
alphaVault: getAddress2(
|
|
164
170
|
"0x11837459896D96F821a8D88eC93a3C8D152033D4"
|
|
165
171
|
),
|
|
@@ -368,6 +374,11 @@ var ALPHA_GATEWAY_ABI = Object.freeze([
|
|
|
368
374
|
"function integratorCut(uint256 amount,uint16 bps) pure returns (uint256)",
|
|
369
375
|
"function quoteBridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 mintedAmount,uint256 taoAmount,uint256 stakedAlphaRao,(address recipient,uint16 bps) integrator) view returns (uint256 fee,uint256 nativeTopUp,uint256 alphaTopUp,uint256 amountCrossing)",
|
|
370
376
|
"function bridgeOutWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,uint256 stakedAlphaRao,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)",
|
|
377
|
+
"function bridgeOutFromValidators(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut) payable returns (bytes32 messageId)",
|
|
378
|
+
"function bridgeOutFromValidatorsWithFee(uint64 destSelector,address token,address recipient,uint256 taoAmount,(bytes32 validator,uint256 alphaRao)[] sources,uint256 minTokenOut,(address recipient,uint16 bps) integrator) payable returns (bytes32 messageId)",
|
|
379
|
+
"function minStakeRequired() view returns (uint256)",
|
|
380
|
+
"function MAX_STAKE_SOURCES() view returns (uint256)",
|
|
381
|
+
"function GATEWAY_COLDKEY() view returns (bytes32)",
|
|
371
382
|
"function claimLiquid(address token,uint256 minTaoOut,address to)",
|
|
372
383
|
"function claimNative(address to)",
|
|
373
384
|
"function claimStaked(address token,bytes32 destColdkey,address to)",
|
|
@@ -536,6 +547,7 @@ var MIN_LIQUID_EVM_TO_SUBTENSOR_WEI = 10000000000000000n;
|
|
|
536
547
|
var MIN_LIQUID_BASE_TO_SUBTENSOR_WEI = MIN_LIQUID_EVM_TO_SUBTENSOR_WEI;
|
|
537
548
|
var MIN_LIQUID_SUBTENSOR_TO_EVM_WEI = 2000000n * EVM_WEI_PER_RAO;
|
|
538
549
|
var MAX_PARTNER_FEE_BPS = 1e4;
|
|
550
|
+
var MAX_STAKE_PULLS = 16;
|
|
539
551
|
var NO_PARTNER_FEE = {
|
|
540
552
|
recipient: "0x0000000000000000000000000000000000000000",
|
|
541
553
|
bps: 0
|
|
@@ -629,6 +641,27 @@ function sourceNetuid(input) {
|
|
|
629
641
|
}
|
|
630
642
|
return netuid;
|
|
631
643
|
}
|
|
644
|
+
function stakePullsFor(input, amountRao) {
|
|
645
|
+
if (input.stakePulls === void 0) return void 0;
|
|
646
|
+
if (input.source !== "staked") {
|
|
647
|
+
throw new ForeverMoneyError(
|
|
648
|
+
"INVALID_TRANSACTION_PLAN",
|
|
649
|
+
"Stake pulls are only valid for a staked source."
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
return resolveStakePulls(input.stakePulls, amountRao);
|
|
653
|
+
}
|
|
654
|
+
function minimumSubtensorOutput(input) {
|
|
655
|
+
const minimum = input.minAmountOutWei ?? input.amountWei;
|
|
656
|
+
assertNonNegativeAmount(minimum, "Minimum output");
|
|
657
|
+
if (minimum === 0n || minimum > input.amountWei) {
|
|
658
|
+
throw new ForeverMoneyError(
|
|
659
|
+
"INVALID_TRANSACTION_PLAN",
|
|
660
|
+
"Minimum output must be positive and no greater than the input amount."
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
return minimum;
|
|
664
|
+
}
|
|
632
665
|
function assertDelivery(value) {
|
|
633
666
|
if (value !== "liquid" && value !== "staked") {
|
|
634
667
|
throw new ForeverMoneyError(
|
|
@@ -700,7 +733,72 @@ function encodeSpokeBridge(token, amountWei, exit, fee) {
|
|
|
700
733
|
args: [token, amountWei, exit, 0n, fee]
|
|
701
734
|
});
|
|
702
735
|
}
|
|
703
|
-
function
|
|
736
|
+
function resolveStakePulls(pulls, amountRao) {
|
|
737
|
+
if (pulls.length === 0 || pulls.length > MAX_STAKE_PULLS) {
|
|
738
|
+
throw new ForeverMoneyError(
|
|
739
|
+
"INVALID_TRANSACTION_PLAN",
|
|
740
|
+
`Between 1 and ${MAX_STAKE_PULLS} stake pulls are required.`,
|
|
741
|
+
{ count: pulls.length }
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
const seen = /* @__PURE__ */ new Set();
|
|
745
|
+
let total = 0n;
|
|
746
|
+
const resolved = pulls.map((pull) => {
|
|
747
|
+
const validator = normalizeBytes32(pull.hotkey, "Stake pull hotkey");
|
|
748
|
+
if (validator === `0x${"0".repeat(64)}`) {
|
|
749
|
+
throw new ForeverMoneyError(
|
|
750
|
+
"INVALID_TRANSACTION_PLAN",
|
|
751
|
+
"Stake pull hotkey must not be zero."
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
const key = validator.toLowerCase();
|
|
755
|
+
if (seen.has(key)) {
|
|
756
|
+
throw new ForeverMoneyError(
|
|
757
|
+
"INVALID_TRANSACTION_PLAN",
|
|
758
|
+
"Stake pulls must not repeat a hotkey.",
|
|
759
|
+
{ hotkey: validator }
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
seen.add(key);
|
|
763
|
+
if (typeof pull.amountRao !== "bigint" || pull.amountRao <= 0n) {
|
|
764
|
+
throw new ForeverMoneyError(
|
|
765
|
+
"INVALID_TRANSACTION_PLAN",
|
|
766
|
+
"Each stake pull must take a positive amount of RAO.",
|
|
767
|
+
{ hotkey: validator }
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
total += pull.amountRao;
|
|
771
|
+
return { validator, alphaRao: pull.amountRao };
|
|
772
|
+
});
|
|
773
|
+
if (total !== amountRao) {
|
|
774
|
+
throw new ForeverMoneyError(
|
|
775
|
+
"INVALID_TRANSACTION_PLAN",
|
|
776
|
+
"Stake pulls must sum to the bridged amount.",
|
|
777
|
+
{ pulledRao: total.toString(), amountRao: amountRao.toString() }
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
return resolved;
|
|
781
|
+
}
|
|
782
|
+
function encodeHubBridge(destSelector, token, recipient, taoAmount, stakedAlphaRao, minTokenOut, fee, pulls) {
|
|
783
|
+
if (pulls !== void 0) {
|
|
784
|
+
const args2 = [
|
|
785
|
+
destSelector,
|
|
786
|
+
token,
|
|
787
|
+
recipient,
|
|
788
|
+
taoAmount,
|
|
789
|
+
pulls,
|
|
790
|
+
minTokenOut
|
|
791
|
+
];
|
|
792
|
+
return fee.bps === 0 ? encodeFunctionData({
|
|
793
|
+
abi: alphaAbi,
|
|
794
|
+
functionName: "bridgeOutFromValidators",
|
|
795
|
+
args: args2
|
|
796
|
+
}) : encodeFunctionData({
|
|
797
|
+
abi: alphaAbi,
|
|
798
|
+
functionName: "bridgeOutFromValidatorsWithFee",
|
|
799
|
+
args: [...args2, fee]
|
|
800
|
+
});
|
|
801
|
+
}
|
|
704
802
|
const args = [
|
|
705
803
|
destSelector,
|
|
706
804
|
token,
|
|
@@ -842,6 +940,7 @@ function buildSubtensorToEvmPlan(input) {
|
|
|
842
940
|
assertAssetMode(input.asset, input.source);
|
|
843
941
|
const netuid = sourceNetuid(input);
|
|
844
942
|
assertSubtensorToEvmAmount(input.amountWei, input.source);
|
|
943
|
+
const minAmountOutWei = minimumSubtensorOutput(input);
|
|
845
944
|
assertNonNegativeAmount(input.exactNetworkFeeWei, "Network fee");
|
|
846
945
|
const { subtensor } = foreverMoneyDeployment;
|
|
847
946
|
const evm = getForeverMoneyEvmDeployment(input.evmChain);
|
|
@@ -890,6 +989,7 @@ function buildSubtensorToEvmPlan(input) {
|
|
|
890
989
|
}
|
|
891
990
|
const taoAmount = input.source === "liquid" ? input.amountWei : 0n;
|
|
892
991
|
const stakedAlphaRao = input.source === "staked" ? amountRao : 0n;
|
|
992
|
+
const pulls = stakePullsFor(input, amountRao);
|
|
893
993
|
const value = taoAmount + taoTopUp + feeWithBuffer(input.exactNetworkFeeWei);
|
|
894
994
|
assertNonNegativeAmount(value, "Transaction value");
|
|
895
995
|
steps.push(
|
|
@@ -905,8 +1005,9 @@ function buildSubtensorToEvmPlan(input) {
|
|
|
905
1005
|
recipient,
|
|
906
1006
|
taoAmount,
|
|
907
1007
|
stakedAlphaRao,
|
|
908
|
-
|
|
909
|
-
partnerFee
|
|
1008
|
+
minAmountOutWei,
|
|
1009
|
+
partnerFee,
|
|
1010
|
+
pulls
|
|
910
1011
|
),
|
|
911
1012
|
value,
|
|
912
1013
|
input.estimatedBridgeGas === void 0 ? void 0 : gasLimitWithBuffer(input.estimatedBridgeGas)
|
|
@@ -1004,6 +1105,7 @@ async function prepareSubtensorToEvm(provider, input) {
|
|
|
1004
1105
|
assertAssetMode(input.asset, input.source);
|
|
1005
1106
|
const netuid = sourceNetuid(input);
|
|
1006
1107
|
assertSubtensorToEvmAmount(input.amountWei, input.source);
|
|
1108
|
+
const minAmountOutWei = minimumSubtensorOutput(input);
|
|
1007
1109
|
const { subtensor } = foreverMoneyDeployment;
|
|
1008
1110
|
const evm = getForeverMoneyEvmDeployment(input.evmChain);
|
|
1009
1111
|
const partnerFee = resolvePartnerFee(
|
|
@@ -1057,8 +1159,9 @@ async function prepareSubtensorToEvm(provider, input) {
|
|
|
1057
1159
|
recipient,
|
|
1058
1160
|
taoAmount,
|
|
1059
1161
|
stakedAlphaRao,
|
|
1060
|
-
|
|
1061
|
-
partnerFee
|
|
1162
|
+
minAmountOutWei,
|
|
1163
|
+
partnerFee,
|
|
1164
|
+
stakePullsFor(input, stakedAlphaRao)
|
|
1062
1165
|
),
|
|
1063
1166
|
value
|
|
1064
1167
|
});
|
|
@@ -1673,12 +1776,12 @@ function bridgeMessageIdFromReceipt(direction, receipt) {
|
|
|
1673
1776
|
);
|
|
1674
1777
|
const evmToSubtensor = isEvmToSubtensorDirection(direction);
|
|
1675
1778
|
const [addresses, contractAbi, eventName] = evmToSubtensor ? [
|
|
1676
|
-
[evm.contracts.
|
|
1779
|
+
[...evm.contracts.legacyGateways, evm.contracts.gateway],
|
|
1677
1780
|
spokeGatewayAbi,
|
|
1678
1781
|
"BridgedToFinney"
|
|
1679
1782
|
] : [
|
|
1680
1783
|
[
|
|
1681
|
-
foreverMoneyDeployment.subtensor.contracts.
|
|
1784
|
+
...foreverMoneyDeployment.subtensor.contracts.legacyGateways,
|
|
1682
1785
|
foreverMoneyDeployment.subtensor.contracts.gateway
|
|
1683
1786
|
],
|
|
1684
1787
|
alphaGatewayAbi,
|
|
@@ -1840,7 +1943,7 @@ async function getCcipDeliveryStatus(provider, input) {
|
|
|
1840
1943
|
);
|
|
1841
1944
|
}
|
|
1842
1945
|
const subtensorGateways = [
|
|
1843
|
-
foreverMoneyDeployment.subtensor.contracts.
|
|
1946
|
+
...foreverMoneyDeployment.subtensor.contracts.legacyGateways,
|
|
1844
1947
|
foreverMoneyDeployment.subtensor.contracts.gateway
|
|
1845
1948
|
];
|
|
1846
1949
|
for (const log of receipt.logs) {
|
|
@@ -2142,6 +2245,7 @@ export {
|
|
|
2142
2245
|
ForeverMoneyError,
|
|
2143
2246
|
GAS_LIMIT_BUFFER_BPS,
|
|
2144
2247
|
MAX_PARTNER_FEE_BPS,
|
|
2248
|
+
MAX_STAKE_PULLS,
|
|
2145
2249
|
MIN_LIQUID_BASE_TO_SUBTENSOR_WEI,
|
|
2146
2250
|
MIN_LIQUID_EVM_TO_SUBTENSOR_WEI,
|
|
2147
2251
|
MIN_LIQUID_SUBTENSOR_TO_EVM_WEI,
|