@axonfi/sdk 0.4.0 → 0.4.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/README.md +2 -3
- package/dist/index.cjs +4325 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3256 -0
- package/dist/index.d.ts +3256 -21
- package/dist/index.js +4261 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/abis/AxonRegistry.d.ts +0 -294
- package/dist/abis/AxonRegistry.d.ts.map +0 -1
- package/dist/abis/AxonRegistry.js +0 -381
- package/dist/abis/AxonRegistry.js.map +0 -1
- package/dist/abis/AxonVault.d.ts +0 -1577
- package/dist/abis/AxonVault.d.ts.map +0 -1
- package/dist/abis/AxonVault.js +0 -2026
- package/dist/abis/AxonVault.js.map +0 -1
- package/dist/abis/AxonVaultFactory.d.ts +0 -207
- package/dist/abis/AxonVaultFactory.d.ts.map +0 -1
- package/dist/abis/AxonVaultFactory.js +0 -269
- package/dist/abis/AxonVaultFactory.js.map +0 -1
- package/dist/amounts.d.ts +0 -37
- package/dist/amounts.d.ts.map +0 -1
- package/dist/amounts.js +0 -72
- package/dist/amounts.js.map +0 -1
- package/dist/amounts.spec.d.ts +0 -2
- package/dist/amounts.spec.d.ts.map +0 -1
- package/dist/amounts.spec.js +0 -92
- package/dist/amounts.spec.js.map +0 -1
- package/dist/client.d.ts +0 -196
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -621
- package/dist/client.js.map +0 -1
- package/dist/client.spec.d.ts +0 -2
- package/dist/client.spec.d.ts.map +0 -1
- package/dist/client.spec.js +0 -437
- package/dist/client.spec.js.map +0 -1
- package/dist/constants.d.ts +0 -110
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -172
- package/dist/constants.js.map +0 -1
- package/dist/constants.spec.d.ts +0 -2
- package/dist/constants.spec.d.ts.map +0 -1
- package/dist/constants.spec.js +0 -95
- package/dist/constants.spec.js.map +0 -1
- package/dist/eip3009.d.ts +0 -45
- package/dist/eip3009.d.ts.map +0 -1
- package/dist/eip3009.js +0 -85
- package/dist/eip3009.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/keystore.d.ts +0 -60
- package/dist/keystore.d.ts.map +0 -1
- package/dist/keystore.js +0 -182
- package/dist/keystore.js.map +0 -1
- package/dist/keystore.spec.d.ts +0 -2
- package/dist/keystore.spec.d.ts.map +0 -1
- package/dist/keystore.spec.js +0 -71
- package/dist/keystore.spec.js.map +0 -1
- package/dist/permit2.d.ts +0 -45
- package/dist/permit2.d.ts.map +0 -1
- package/dist/permit2.js +0 -81
- package/dist/permit2.js.map +0 -1
- package/dist/signer.d.ts +0 -35
- package/dist/signer.d.ts.map +0 -1
- package/dist/signer.js +0 -132
- package/dist/signer.js.map +0 -1
- package/dist/signer.spec.d.ts +0 -2
- package/dist/signer.spec.d.ts.map +0 -1
- package/dist/signer.spec.js +0 -94
- package/dist/signer.spec.js.map +0 -1
- package/dist/tokens.d.ts +0 -215
- package/dist/tokens.d.ts.map +0 -1
- package/dist/tokens.js +0 -247
- package/dist/tokens.js.map +0 -1
- package/dist/types.d.ts +0 -302
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -8
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -29
- package/dist/utils.js.map +0 -1
- package/dist/vault.d.ts +0 -60
- package/dist/vault.d.ts.map +0 -1
- package/dist/vault.js +0 -267
- package/dist/vault.js.map +0 -1
- package/dist/vault.spec.d.ts +0 -2
- package/dist/vault.spec.d.ts.map +0 -1
- package/dist/vault.spec.js +0 -162
- package/dist/vault.spec.js.map +0 -1
- package/dist/x402.d.ts +0 -88
- package/dist/x402.d.ts.map +0 -1
- package/dist/x402.js +0 -124
- package/dist/x402.js.map +0 -1
- package/dist/x402.spec.d.ts +0 -2
- package/dist/x402.spec.d.ts.map +0 -1
- package/dist/x402.spec.js +0 -411
- package/dist/x402.spec.js.map +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,4325 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var viem = require('viem');
|
|
4
|
+
var accounts = require('viem/accounts');
|
|
5
|
+
var chains = require('viem/chains');
|
|
6
|
+
var scrypt = require('@noble/hashes/scrypt');
|
|
7
|
+
var sha3 = require('@noble/hashes/sha3');
|
|
8
|
+
var aes = require('@noble/ciphers/aes');
|
|
9
|
+
|
|
10
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
11
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
12
|
+
}) : x)(function(x) {
|
|
13
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
|
+
});
|
|
16
|
+
var PAYMENT_INTENT_TYPEHASH = viem.keccak256(
|
|
17
|
+
viem.stringToBytes("PaymentIntent(address bot,address to,address token,uint256 amount,uint256 deadline,bytes32 ref)")
|
|
18
|
+
);
|
|
19
|
+
var EXECUTE_INTENT_TYPEHASH = viem.keccak256(
|
|
20
|
+
viem.stringToBytes(
|
|
21
|
+
"ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 deadline,bytes32 ref)"
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
var SWAP_INTENT_TYPEHASH = viem.keccak256(
|
|
25
|
+
viem.stringToBytes("SwapIntent(address bot,address toToken,uint256 minToAmount,uint256 deadline,bytes32 ref)")
|
|
26
|
+
);
|
|
27
|
+
var EIP712_DOMAIN_NAME = "AxonVault";
|
|
28
|
+
var EIP712_DOMAIN_VERSION = "1";
|
|
29
|
+
var NATIVE_ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
30
|
+
var USDC = {
|
|
31
|
+
// Base mainnet
|
|
32
|
+
8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
33
|
+
// Base Sepolia
|
|
34
|
+
84532: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
35
|
+
// Arbitrum One
|
|
36
|
+
42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
37
|
+
// Arbitrum Sepolia
|
|
38
|
+
421614: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"
|
|
39
|
+
};
|
|
40
|
+
var Chain = /* @__PURE__ */ ((Chain2) => {
|
|
41
|
+
Chain2[Chain2["Base"] = 8453] = "Base";
|
|
42
|
+
Chain2[Chain2["BaseSepolia"] = 84532] = "BaseSepolia";
|
|
43
|
+
Chain2[Chain2["Arbitrum"] = 42161] = "Arbitrum";
|
|
44
|
+
Chain2[Chain2["ArbitrumSepolia"] = 421614] = "ArbitrumSepolia";
|
|
45
|
+
return Chain2;
|
|
46
|
+
})(Chain || {});
|
|
47
|
+
var SUPPORTED_CHAIN_IDS = [8453, 84532, 42161, 421614];
|
|
48
|
+
var CHAIN_NAMES = {
|
|
49
|
+
[8453 /* Base */]: "Base",
|
|
50
|
+
[84532 /* BaseSepolia */]: "Base Sepolia",
|
|
51
|
+
[42161 /* Arbitrum */]: "Arbitrum One",
|
|
52
|
+
[421614 /* ArbitrumSepolia */]: "Arbitrum Sepolia",
|
|
53
|
+
// Future v1 chains (metadata only — not in SUPPORTED_CHAIN_IDS yet)
|
|
54
|
+
10: "Optimism",
|
|
55
|
+
11155420: "OP Sepolia",
|
|
56
|
+
137: "Polygon",
|
|
57
|
+
80002: "Polygon Amoy"
|
|
58
|
+
};
|
|
59
|
+
var EXPLORER_TX = {
|
|
60
|
+
[8453 /* Base */]: "https://basescan.org/tx/",
|
|
61
|
+
[84532 /* BaseSepolia */]: "https://sepolia.basescan.org/tx/",
|
|
62
|
+
[42161 /* Arbitrum */]: "https://arbiscan.io/tx/",
|
|
63
|
+
[421614 /* ArbitrumSepolia */]: "https://sepolia.arbiscan.io/tx/",
|
|
64
|
+
10: "https://optimistic.etherscan.io/tx/",
|
|
65
|
+
11155420: "https://sepolia-optimism.etherscan.io/tx/",
|
|
66
|
+
137: "https://polygonscan.com/tx/",
|
|
67
|
+
80002: "https://amoy.polygonscan.com/tx/"
|
|
68
|
+
};
|
|
69
|
+
var EXPLORER_ADDR = {
|
|
70
|
+
[8453 /* Base */]: "https://basescan.org/address/",
|
|
71
|
+
[84532 /* BaseSepolia */]: "https://sepolia.basescan.org/address/",
|
|
72
|
+
[42161 /* Arbitrum */]: "https://arbiscan.io/address/",
|
|
73
|
+
[421614 /* ArbitrumSepolia */]: "https://sepolia.arbiscan.io/address/",
|
|
74
|
+
10: "https://optimistic.etherscan.io/address/",
|
|
75
|
+
11155420: "https://sepolia-optimism.etherscan.io/address/",
|
|
76
|
+
137: "https://polygonscan.com/address/",
|
|
77
|
+
80002: "https://amoy.polygonscan.com/address/"
|
|
78
|
+
};
|
|
79
|
+
var DEFAULT_DEADLINE_SECONDS = 300;
|
|
80
|
+
var WINDOW = {
|
|
81
|
+
ONE_HOUR: 3600n,
|
|
82
|
+
ONE_DAY: 86400n,
|
|
83
|
+
ONE_WEEK: 604800n,
|
|
84
|
+
THIRTY_DAYS: 2592000n
|
|
85
|
+
};
|
|
86
|
+
var PaymentErrorCode = {
|
|
87
|
+
/** Payment destination is the vault itself */
|
|
88
|
+
SELF_PAYMENT: "SELF_PAYMENT",
|
|
89
|
+
/** Payment destination is the zero address */
|
|
90
|
+
ZERO_ADDRESS: "ZERO_ADDRESS",
|
|
91
|
+
/** Payment amount is zero */
|
|
92
|
+
ZERO_AMOUNT: "ZERO_AMOUNT",
|
|
93
|
+
/** Vault does not hold enough of the requested token */
|
|
94
|
+
INSUFFICIENT_BALANCE: "INSUFFICIENT_BALANCE",
|
|
95
|
+
/** EIP-712 signature verification failed */
|
|
96
|
+
INVALID_SIGNATURE: "INVALID_SIGNATURE",
|
|
97
|
+
/** Payment intent deadline has passed */
|
|
98
|
+
DEADLINE_EXPIRED: "DEADLINE_EXPIRED",
|
|
99
|
+
/** Bot is temporarily paused by the operator */
|
|
100
|
+
BOT_PAUSED: "BOT_PAUSED",
|
|
101
|
+
/** Bot address is not registered/active in the vault */
|
|
102
|
+
BOT_NOT_ACTIVE: "BOT_NOT_ACTIVE",
|
|
103
|
+
/** Destination address is on the global or vault blacklist */
|
|
104
|
+
BLACKLISTED: "BLACKLISTED",
|
|
105
|
+
/** Rolling-window spending limit (USD amount) exceeded */
|
|
106
|
+
SPENDING_LIMIT_EXCEEDED: "SPENDING_LIMIT_EXCEEDED",
|
|
107
|
+
/** Rolling-window transaction count limit exceeded */
|
|
108
|
+
TX_COUNT_EXCEEDED: "TX_COUNT_EXCEEDED",
|
|
109
|
+
/** Single transaction exceeds the bot's on-chain maxPerTxAmount */
|
|
110
|
+
MAX_PER_TX_EXCEEDED: "MAX_PER_TX_EXCEEDED",
|
|
111
|
+
/** Vault-level daily aggregate spending limit exceeded */
|
|
112
|
+
VAULT_AGGREGATE_EXCEEDED: "VAULT_AGGREGATE_EXCEEDED",
|
|
113
|
+
/** eth_call simulation of the on-chain transaction reverted */
|
|
114
|
+
SIMULATION_FAILED: "SIMULATION_FAILED",
|
|
115
|
+
/** Routed to human review (AI scan flagged or no consensus) */
|
|
116
|
+
PENDING_REVIEW: "PENDING_REVIEW",
|
|
117
|
+
/** Relayer wallet has insufficient gas to submit the transaction */
|
|
118
|
+
RELAYER_OUT_OF_GAS: "RELAYER_OUT_OF_GAS",
|
|
119
|
+
/** On-chain transaction submission failed */
|
|
120
|
+
SUBMISSION_FAILED: "SUBMISSION_FAILED",
|
|
121
|
+
/** Destination not in the vault/bot whitelist */
|
|
122
|
+
DESTINATION_NOT_WHITELISTED: "DESTINATION_NOT_WHITELISTED",
|
|
123
|
+
/** Vault address is not a valid AxonVault or was not deployed by a known factory */
|
|
124
|
+
INVALID_VAULT: "INVALID_VAULT",
|
|
125
|
+
/** Rebalance output token is not in the whitelist (on-chain or relayer default) */
|
|
126
|
+
REBALANCE_TOKEN_NOT_ALLOWED: "REBALANCE_TOKEN_NOT_ALLOWED",
|
|
127
|
+
/** Rebalance input amount exceeds the bot's maxRebalanceAmount cap */
|
|
128
|
+
MAX_REBALANCE_AMOUNT_EXCEEDED: "MAX_REBALANCE_AMOUNT_EXCEEDED",
|
|
129
|
+
/** Unknown or internal error */
|
|
130
|
+
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
131
|
+
};
|
|
132
|
+
var RELAYER_API = {
|
|
133
|
+
PAYMENTS: "/v1/payments",
|
|
134
|
+
payment: (requestId) => `/v1/payments/${requestId}`,
|
|
135
|
+
EXECUTE: "/v1/execute",
|
|
136
|
+
execute: (requestId) => `/v1/execute/${requestId}`,
|
|
137
|
+
SWAP: "/v1/swap",
|
|
138
|
+
swap: (requestId) => `/v1/swap/${requestId}`,
|
|
139
|
+
// Vault read endpoints (relayer reads chain on behalf of bots)
|
|
140
|
+
vaultBalance: (vault, token, chainId) => `/v1/vault/${vault}/balance/${token}?chainId=${chainId}`,
|
|
141
|
+
vaultBalances: (vault, chainId) => `/v1/vault/${vault}/balances`,
|
|
142
|
+
vaultInfo: (vault, chainId) => `/v1/vault/${vault}/info?chainId=${chainId}`,
|
|
143
|
+
botStatus: (vault, bot, chainId) => `/v1/vault/${vault}/bot/${bot}/status?chainId=${chainId}`,
|
|
144
|
+
destinationCheck: (vault, bot, destination, chainId) => `/v1/vault/${vault}/bot/${bot}/destination/${destination}?chainId=${chainId}`,
|
|
145
|
+
protocolCheck: (vault, protocol, chainId) => `/v1/vault/${vault}/protocol/${protocol}?chainId=${chainId}`,
|
|
146
|
+
rebalanceTokens: (vault, chainId) => `/v1/vault/${vault}/rebalance-tokens?chainId=${chainId}`,
|
|
147
|
+
rebalanceTokenCheck: (vault, token, chainId) => `/v1/vault/${vault}/rebalance-token/${token}?chainId=${chainId}`,
|
|
148
|
+
// TOS endpoints
|
|
149
|
+
tosStatus: (wallet) => `/v1/tos/status?wallet=${wallet}`,
|
|
150
|
+
TOS_ACCEPT: "/v1/tos/accept"
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// src/signer.ts
|
|
154
|
+
var PAYMENT_INTENT_TYPES = {
|
|
155
|
+
PaymentIntent: [
|
|
156
|
+
{ name: "bot", type: "address" },
|
|
157
|
+
{ name: "to", type: "address" },
|
|
158
|
+
{ name: "token", type: "address" },
|
|
159
|
+
{ name: "amount", type: "uint256" },
|
|
160
|
+
{ name: "deadline", type: "uint256" },
|
|
161
|
+
{ name: "ref", type: "bytes32" }
|
|
162
|
+
]
|
|
163
|
+
};
|
|
164
|
+
var EXECUTE_INTENT_TYPES = {
|
|
165
|
+
ExecuteIntent: [
|
|
166
|
+
{ name: "bot", type: "address" },
|
|
167
|
+
{ name: "protocol", type: "address" },
|
|
168
|
+
{ name: "calldataHash", type: "bytes32" },
|
|
169
|
+
{ name: "token", type: "address" },
|
|
170
|
+
{ name: "amount", type: "uint256" },
|
|
171
|
+
{ name: "deadline", type: "uint256" },
|
|
172
|
+
{ name: "ref", type: "bytes32" }
|
|
173
|
+
]
|
|
174
|
+
};
|
|
175
|
+
var SWAP_INTENT_TYPES = {
|
|
176
|
+
SwapIntent: [
|
|
177
|
+
{ name: "bot", type: "address" },
|
|
178
|
+
{ name: "toToken", type: "address" },
|
|
179
|
+
{ name: "minToAmount", type: "uint256" },
|
|
180
|
+
{ name: "deadline", type: "uint256" },
|
|
181
|
+
{ name: "ref", type: "bytes32" }
|
|
182
|
+
]
|
|
183
|
+
};
|
|
184
|
+
function makeDomain(vaultAddress, chainId) {
|
|
185
|
+
return {
|
|
186
|
+
name: EIP712_DOMAIN_NAME,
|
|
187
|
+
version: EIP712_DOMAIN_VERSION,
|
|
188
|
+
chainId,
|
|
189
|
+
verifyingContract: vaultAddress
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
async function signPayment(walletClient, vaultAddress, chainId, intent) {
|
|
193
|
+
if (!walletClient.account) {
|
|
194
|
+
throw new Error("walletClient has no account attached");
|
|
195
|
+
}
|
|
196
|
+
return walletClient.signTypedData({
|
|
197
|
+
account: walletClient.account,
|
|
198
|
+
domain: makeDomain(vaultAddress, chainId),
|
|
199
|
+
types: PAYMENT_INTENT_TYPES,
|
|
200
|
+
primaryType: "PaymentIntent",
|
|
201
|
+
message: {
|
|
202
|
+
bot: intent.bot,
|
|
203
|
+
to: intent.to,
|
|
204
|
+
token: intent.token,
|
|
205
|
+
amount: intent.amount,
|
|
206
|
+
deadline: intent.deadline,
|
|
207
|
+
ref: intent.ref
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async function signExecuteIntent(walletClient, vaultAddress, chainId, intent) {
|
|
212
|
+
if (!walletClient.account) {
|
|
213
|
+
throw new Error("walletClient has no account attached");
|
|
214
|
+
}
|
|
215
|
+
return walletClient.signTypedData({
|
|
216
|
+
account: walletClient.account,
|
|
217
|
+
domain: makeDomain(vaultAddress, chainId),
|
|
218
|
+
types: EXECUTE_INTENT_TYPES,
|
|
219
|
+
primaryType: "ExecuteIntent",
|
|
220
|
+
message: {
|
|
221
|
+
bot: intent.bot,
|
|
222
|
+
protocol: intent.protocol,
|
|
223
|
+
calldataHash: intent.calldataHash,
|
|
224
|
+
token: intent.token,
|
|
225
|
+
amount: intent.amount,
|
|
226
|
+
deadline: intent.deadline,
|
|
227
|
+
ref: intent.ref
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
async function signSwapIntent(walletClient, vaultAddress, chainId, intent) {
|
|
232
|
+
if (!walletClient.account) {
|
|
233
|
+
throw new Error("walletClient has no account attached");
|
|
234
|
+
}
|
|
235
|
+
return walletClient.signTypedData({
|
|
236
|
+
account: walletClient.account,
|
|
237
|
+
domain: makeDomain(vaultAddress, chainId),
|
|
238
|
+
types: SWAP_INTENT_TYPES,
|
|
239
|
+
primaryType: "SwapIntent",
|
|
240
|
+
message: {
|
|
241
|
+
bot: intent.bot,
|
|
242
|
+
toToken: intent.toToken,
|
|
243
|
+
minToAmount: intent.minToAmount,
|
|
244
|
+
deadline: intent.deadline,
|
|
245
|
+
ref: intent.ref
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
function encodeRef(memo) {
|
|
250
|
+
return viem.keccak256(viem.stringToBytes(memo));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// src/abis/AxonVault.ts
|
|
254
|
+
var AxonVaultAbi = [
|
|
255
|
+
{
|
|
256
|
+
"type": "constructor",
|
|
257
|
+
"inputs": [
|
|
258
|
+
{
|
|
259
|
+
"name": "_owner",
|
|
260
|
+
"type": "address",
|
|
261
|
+
"internalType": "address"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "_axonRegistry",
|
|
265
|
+
"type": "address",
|
|
266
|
+
"internalType": "address"
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"stateMutability": "nonpayable"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"type": "receive",
|
|
273
|
+
"stateMutability": "payable"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"type": "function",
|
|
277
|
+
"name": "DOMAIN_SEPARATOR",
|
|
278
|
+
"inputs": [],
|
|
279
|
+
"outputs": [
|
|
280
|
+
{
|
|
281
|
+
"name": "",
|
|
282
|
+
"type": "bytes32",
|
|
283
|
+
"internalType": "bytes32"
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
"stateMutability": "view"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"type": "function",
|
|
290
|
+
"name": "MAX_SPENDING_LIMITS",
|
|
291
|
+
"inputs": [],
|
|
292
|
+
"outputs": [
|
|
293
|
+
{
|
|
294
|
+
"name": "",
|
|
295
|
+
"type": "uint8",
|
|
296
|
+
"internalType": "uint8"
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"stateMutability": "view"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"type": "function",
|
|
303
|
+
"name": "NATIVE_ETH",
|
|
304
|
+
"inputs": [],
|
|
305
|
+
"outputs": [
|
|
306
|
+
{
|
|
307
|
+
"name": "",
|
|
308
|
+
"type": "address",
|
|
309
|
+
"internalType": "address"
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"stateMutability": "view"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"type": "function",
|
|
316
|
+
"name": "VERSION",
|
|
317
|
+
"inputs": [],
|
|
318
|
+
"outputs": [
|
|
319
|
+
{
|
|
320
|
+
"name": "",
|
|
321
|
+
"type": "uint16",
|
|
322
|
+
"internalType": "uint16"
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"stateMutability": "view"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"type": "function",
|
|
329
|
+
"name": "acceptOwnership",
|
|
330
|
+
"inputs": [],
|
|
331
|
+
"outputs": [],
|
|
332
|
+
"stateMutability": "nonpayable"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"type": "function",
|
|
336
|
+
"name": "addBot",
|
|
337
|
+
"inputs": [
|
|
338
|
+
{
|
|
339
|
+
"name": "bot",
|
|
340
|
+
"type": "address",
|
|
341
|
+
"internalType": "address"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"name": "params",
|
|
345
|
+
"type": "tuple",
|
|
346
|
+
"internalType": "struct AxonVault.BotConfigParams",
|
|
347
|
+
"components": [
|
|
348
|
+
{
|
|
349
|
+
"name": "maxPerTxAmount",
|
|
350
|
+
"type": "uint256",
|
|
351
|
+
"internalType": "uint256"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"name": "maxRebalanceAmount",
|
|
355
|
+
"type": "uint256",
|
|
356
|
+
"internalType": "uint256"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"name": "spendingLimits",
|
|
360
|
+
"type": "tuple[]",
|
|
361
|
+
"internalType": "struct AxonVault.SpendingLimit[]",
|
|
362
|
+
"components": [
|
|
363
|
+
{
|
|
364
|
+
"name": "amount",
|
|
365
|
+
"type": "uint256",
|
|
366
|
+
"internalType": "uint256"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"name": "maxCount",
|
|
370
|
+
"type": "uint256",
|
|
371
|
+
"internalType": "uint256"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"name": "windowSeconds",
|
|
375
|
+
"type": "uint256",
|
|
376
|
+
"internalType": "uint256"
|
|
377
|
+
}
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"name": "aiTriggerThreshold",
|
|
382
|
+
"type": "uint256",
|
|
383
|
+
"internalType": "uint256"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"name": "requireAiVerification",
|
|
387
|
+
"type": "bool",
|
|
388
|
+
"internalType": "bool"
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
"outputs": [],
|
|
394
|
+
"stateMutability": "nonpayable"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"type": "function",
|
|
398
|
+
"name": "addBotDestination",
|
|
399
|
+
"inputs": [
|
|
400
|
+
{
|
|
401
|
+
"name": "bot",
|
|
402
|
+
"type": "address",
|
|
403
|
+
"internalType": "address"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"name": "destination",
|
|
407
|
+
"type": "address",
|
|
408
|
+
"internalType": "address"
|
|
409
|
+
}
|
|
410
|
+
],
|
|
411
|
+
"outputs": [],
|
|
412
|
+
"stateMutability": "nonpayable"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"type": "function",
|
|
416
|
+
"name": "addGlobalBlacklist",
|
|
417
|
+
"inputs": [
|
|
418
|
+
{
|
|
419
|
+
"name": "destination",
|
|
420
|
+
"type": "address",
|
|
421
|
+
"internalType": "address"
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"outputs": [],
|
|
425
|
+
"stateMutability": "nonpayable"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"type": "function",
|
|
429
|
+
"name": "addGlobalDestination",
|
|
430
|
+
"inputs": [
|
|
431
|
+
{
|
|
432
|
+
"name": "destination",
|
|
433
|
+
"type": "address",
|
|
434
|
+
"internalType": "address"
|
|
435
|
+
}
|
|
436
|
+
],
|
|
437
|
+
"outputs": [],
|
|
438
|
+
"stateMutability": "nonpayable"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"type": "function",
|
|
442
|
+
"name": "addProtocol",
|
|
443
|
+
"inputs": [
|
|
444
|
+
{
|
|
445
|
+
"name": "protocol",
|
|
446
|
+
"type": "address",
|
|
447
|
+
"internalType": "address"
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
"outputs": [],
|
|
451
|
+
"stateMutability": "nonpayable"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"type": "function",
|
|
455
|
+
"name": "addRebalanceTokens",
|
|
456
|
+
"inputs": [
|
|
457
|
+
{
|
|
458
|
+
"name": "tokens",
|
|
459
|
+
"type": "address[]",
|
|
460
|
+
"internalType": "address[]"
|
|
461
|
+
}
|
|
462
|
+
],
|
|
463
|
+
"outputs": [],
|
|
464
|
+
"stateMutability": "nonpayable"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"type": "function",
|
|
468
|
+
"name": "approvedProtocolCount",
|
|
469
|
+
"inputs": [],
|
|
470
|
+
"outputs": [
|
|
471
|
+
{
|
|
472
|
+
"name": "",
|
|
473
|
+
"type": "uint256",
|
|
474
|
+
"internalType": "uint256"
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
"stateMutability": "view"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"type": "function",
|
|
481
|
+
"name": "approvedProtocols",
|
|
482
|
+
"inputs": [
|
|
483
|
+
{
|
|
484
|
+
"name": "",
|
|
485
|
+
"type": "address",
|
|
486
|
+
"internalType": "address"
|
|
487
|
+
}
|
|
488
|
+
],
|
|
489
|
+
"outputs": [
|
|
490
|
+
{
|
|
491
|
+
"name": "",
|
|
492
|
+
"type": "bool",
|
|
493
|
+
"internalType": "bool"
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
"stateMutability": "view"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"type": "function",
|
|
500
|
+
"name": "axonRegistry",
|
|
501
|
+
"inputs": [],
|
|
502
|
+
"outputs": [
|
|
503
|
+
{
|
|
504
|
+
"name": "",
|
|
505
|
+
"type": "address",
|
|
506
|
+
"internalType": "address"
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"stateMutability": "view"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"type": "function",
|
|
513
|
+
"name": "botAddedByOperator",
|
|
514
|
+
"inputs": [
|
|
515
|
+
{
|
|
516
|
+
"name": "",
|
|
517
|
+
"type": "address",
|
|
518
|
+
"internalType": "address"
|
|
519
|
+
}
|
|
520
|
+
],
|
|
521
|
+
"outputs": [
|
|
522
|
+
{
|
|
523
|
+
"name": "",
|
|
524
|
+
"type": "bool",
|
|
525
|
+
"internalType": "bool"
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
"stateMutability": "view"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"type": "function",
|
|
532
|
+
"name": "botDestinationCount",
|
|
533
|
+
"inputs": [
|
|
534
|
+
{
|
|
535
|
+
"name": "",
|
|
536
|
+
"type": "address",
|
|
537
|
+
"internalType": "address"
|
|
538
|
+
}
|
|
539
|
+
],
|
|
540
|
+
"outputs": [
|
|
541
|
+
{
|
|
542
|
+
"name": "",
|
|
543
|
+
"type": "uint256",
|
|
544
|
+
"internalType": "uint256"
|
|
545
|
+
}
|
|
546
|
+
],
|
|
547
|
+
"stateMutability": "view"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"type": "function",
|
|
551
|
+
"name": "botDestinationWhitelist",
|
|
552
|
+
"inputs": [
|
|
553
|
+
{
|
|
554
|
+
"name": "",
|
|
555
|
+
"type": "address",
|
|
556
|
+
"internalType": "address"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"name": "",
|
|
560
|
+
"type": "address",
|
|
561
|
+
"internalType": "address"
|
|
562
|
+
}
|
|
563
|
+
],
|
|
564
|
+
"outputs": [
|
|
565
|
+
{
|
|
566
|
+
"name": "",
|
|
567
|
+
"type": "bool",
|
|
568
|
+
"internalType": "bool"
|
|
569
|
+
}
|
|
570
|
+
],
|
|
571
|
+
"stateMutability": "view"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
"type": "function",
|
|
575
|
+
"name": "deposit",
|
|
576
|
+
"inputs": [
|
|
577
|
+
{
|
|
578
|
+
"name": "token",
|
|
579
|
+
"type": "address",
|
|
580
|
+
"internalType": "address"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"name": "amount",
|
|
584
|
+
"type": "uint256",
|
|
585
|
+
"internalType": "uint256"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
"name": "ref",
|
|
589
|
+
"type": "bytes32",
|
|
590
|
+
"internalType": "bytes32"
|
|
591
|
+
}
|
|
592
|
+
],
|
|
593
|
+
"outputs": [],
|
|
594
|
+
"stateMutability": "payable"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"type": "function",
|
|
598
|
+
"name": "eip712Domain",
|
|
599
|
+
"inputs": [],
|
|
600
|
+
"outputs": [
|
|
601
|
+
{
|
|
602
|
+
"name": "fields",
|
|
603
|
+
"type": "bytes1",
|
|
604
|
+
"internalType": "bytes1"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"name": "name",
|
|
608
|
+
"type": "string",
|
|
609
|
+
"internalType": "string"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"name": "version",
|
|
613
|
+
"type": "string",
|
|
614
|
+
"internalType": "string"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"name": "chainId",
|
|
618
|
+
"type": "uint256",
|
|
619
|
+
"internalType": "uint256"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "verifyingContract",
|
|
623
|
+
"type": "address",
|
|
624
|
+
"internalType": "address"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
"name": "salt",
|
|
628
|
+
"type": "bytes32",
|
|
629
|
+
"internalType": "bytes32"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
"name": "extensions",
|
|
633
|
+
"type": "uint256[]",
|
|
634
|
+
"internalType": "uint256[]"
|
|
635
|
+
}
|
|
636
|
+
],
|
|
637
|
+
"stateMutability": "view"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"type": "function",
|
|
641
|
+
"name": "executePayment",
|
|
642
|
+
"inputs": [
|
|
643
|
+
{
|
|
644
|
+
"name": "intent",
|
|
645
|
+
"type": "tuple",
|
|
646
|
+
"internalType": "struct AxonVault.PaymentIntent",
|
|
647
|
+
"components": [
|
|
648
|
+
{
|
|
649
|
+
"name": "bot",
|
|
650
|
+
"type": "address",
|
|
651
|
+
"internalType": "address"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"name": "to",
|
|
655
|
+
"type": "address",
|
|
656
|
+
"internalType": "address"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"name": "token",
|
|
660
|
+
"type": "address",
|
|
661
|
+
"internalType": "address"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"name": "amount",
|
|
665
|
+
"type": "uint256",
|
|
666
|
+
"internalType": "uint256"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"name": "deadline",
|
|
670
|
+
"type": "uint256",
|
|
671
|
+
"internalType": "uint256"
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"name": "ref",
|
|
675
|
+
"type": "bytes32",
|
|
676
|
+
"internalType": "bytes32"
|
|
677
|
+
}
|
|
678
|
+
]
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"name": "signature",
|
|
682
|
+
"type": "bytes",
|
|
683
|
+
"internalType": "bytes"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
"name": "fromToken",
|
|
687
|
+
"type": "address",
|
|
688
|
+
"internalType": "address"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
"name": "maxFromAmount",
|
|
692
|
+
"type": "uint256",
|
|
693
|
+
"internalType": "uint256"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"name": "swapRouter",
|
|
697
|
+
"type": "address",
|
|
698
|
+
"internalType": "address"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"name": "swapCalldata",
|
|
702
|
+
"type": "bytes",
|
|
703
|
+
"internalType": "bytes"
|
|
704
|
+
}
|
|
705
|
+
],
|
|
706
|
+
"outputs": [],
|
|
707
|
+
"stateMutability": "nonpayable"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"type": "function",
|
|
711
|
+
"name": "executeProtocol",
|
|
712
|
+
"inputs": [
|
|
713
|
+
{
|
|
714
|
+
"name": "intent",
|
|
715
|
+
"type": "tuple",
|
|
716
|
+
"internalType": "struct AxonVault.ExecuteIntent",
|
|
717
|
+
"components": [
|
|
718
|
+
{
|
|
719
|
+
"name": "bot",
|
|
720
|
+
"type": "address",
|
|
721
|
+
"internalType": "address"
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
"name": "protocol",
|
|
725
|
+
"type": "address",
|
|
726
|
+
"internalType": "address"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"name": "calldataHash",
|
|
730
|
+
"type": "bytes32",
|
|
731
|
+
"internalType": "bytes32"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"name": "token",
|
|
735
|
+
"type": "address",
|
|
736
|
+
"internalType": "address"
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
"name": "amount",
|
|
740
|
+
"type": "uint256",
|
|
741
|
+
"internalType": "uint256"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
"name": "deadline",
|
|
745
|
+
"type": "uint256",
|
|
746
|
+
"internalType": "uint256"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"name": "ref",
|
|
750
|
+
"type": "bytes32",
|
|
751
|
+
"internalType": "bytes32"
|
|
752
|
+
}
|
|
753
|
+
]
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"name": "signature",
|
|
757
|
+
"type": "bytes",
|
|
758
|
+
"internalType": "bytes"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"name": "callData",
|
|
762
|
+
"type": "bytes",
|
|
763
|
+
"internalType": "bytes"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"name": "fromToken",
|
|
767
|
+
"type": "address",
|
|
768
|
+
"internalType": "address"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
"name": "maxFromAmount",
|
|
772
|
+
"type": "uint256",
|
|
773
|
+
"internalType": "uint256"
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
"name": "swapRouter",
|
|
777
|
+
"type": "address",
|
|
778
|
+
"internalType": "address"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"name": "swapCalldata",
|
|
782
|
+
"type": "bytes",
|
|
783
|
+
"internalType": "bytes"
|
|
784
|
+
}
|
|
785
|
+
],
|
|
786
|
+
"outputs": [
|
|
787
|
+
{
|
|
788
|
+
"name": "",
|
|
789
|
+
"type": "bytes",
|
|
790
|
+
"internalType": "bytes"
|
|
791
|
+
}
|
|
792
|
+
],
|
|
793
|
+
"stateMutability": "nonpayable"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"type": "function",
|
|
797
|
+
"name": "executeSwap",
|
|
798
|
+
"inputs": [
|
|
799
|
+
{
|
|
800
|
+
"name": "intent",
|
|
801
|
+
"type": "tuple",
|
|
802
|
+
"internalType": "struct AxonVault.SwapIntent",
|
|
803
|
+
"components": [
|
|
804
|
+
{
|
|
805
|
+
"name": "bot",
|
|
806
|
+
"type": "address",
|
|
807
|
+
"internalType": "address"
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
"name": "toToken",
|
|
811
|
+
"type": "address",
|
|
812
|
+
"internalType": "address"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"name": "minToAmount",
|
|
816
|
+
"type": "uint256",
|
|
817
|
+
"internalType": "uint256"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
"name": "deadline",
|
|
821
|
+
"type": "uint256",
|
|
822
|
+
"internalType": "uint256"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
"name": "ref",
|
|
826
|
+
"type": "bytes32",
|
|
827
|
+
"internalType": "bytes32"
|
|
828
|
+
}
|
|
829
|
+
]
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
"name": "signature",
|
|
833
|
+
"type": "bytes",
|
|
834
|
+
"internalType": "bytes"
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
"name": "fromToken",
|
|
838
|
+
"type": "address",
|
|
839
|
+
"internalType": "address"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"name": "maxFromAmount",
|
|
843
|
+
"type": "uint256",
|
|
844
|
+
"internalType": "uint256"
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"name": "swapRouter",
|
|
848
|
+
"type": "address",
|
|
849
|
+
"internalType": "address"
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
"name": "swapCalldata",
|
|
853
|
+
"type": "bytes",
|
|
854
|
+
"internalType": "bytes"
|
|
855
|
+
}
|
|
856
|
+
],
|
|
857
|
+
"outputs": [],
|
|
858
|
+
"stateMutability": "nonpayable"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
"type": "function",
|
|
862
|
+
"name": "getBotConfig",
|
|
863
|
+
"inputs": [
|
|
864
|
+
{
|
|
865
|
+
"name": "bot",
|
|
866
|
+
"type": "address",
|
|
867
|
+
"internalType": "address"
|
|
868
|
+
}
|
|
869
|
+
],
|
|
870
|
+
"outputs": [
|
|
871
|
+
{
|
|
872
|
+
"name": "",
|
|
873
|
+
"type": "tuple",
|
|
874
|
+
"internalType": "struct AxonVault.BotConfig",
|
|
875
|
+
"components": [
|
|
876
|
+
{
|
|
877
|
+
"name": "isActive",
|
|
878
|
+
"type": "bool",
|
|
879
|
+
"internalType": "bool"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"name": "registeredAt",
|
|
883
|
+
"type": "uint256",
|
|
884
|
+
"internalType": "uint256"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"name": "maxPerTxAmount",
|
|
888
|
+
"type": "uint256",
|
|
889
|
+
"internalType": "uint256"
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
"name": "maxRebalanceAmount",
|
|
893
|
+
"type": "uint256",
|
|
894
|
+
"internalType": "uint256"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
"name": "spendingLimits",
|
|
898
|
+
"type": "tuple[]",
|
|
899
|
+
"internalType": "struct AxonVault.SpendingLimit[]",
|
|
900
|
+
"components": [
|
|
901
|
+
{
|
|
902
|
+
"name": "amount",
|
|
903
|
+
"type": "uint256",
|
|
904
|
+
"internalType": "uint256"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
"name": "maxCount",
|
|
908
|
+
"type": "uint256",
|
|
909
|
+
"internalType": "uint256"
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
"name": "windowSeconds",
|
|
913
|
+
"type": "uint256",
|
|
914
|
+
"internalType": "uint256"
|
|
915
|
+
}
|
|
916
|
+
]
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"name": "aiTriggerThreshold",
|
|
920
|
+
"type": "uint256",
|
|
921
|
+
"internalType": "uint256"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"name": "requireAiVerification",
|
|
925
|
+
"type": "bool",
|
|
926
|
+
"internalType": "bool"
|
|
927
|
+
}
|
|
928
|
+
]
|
|
929
|
+
}
|
|
930
|
+
],
|
|
931
|
+
"stateMutability": "view"
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
"type": "function",
|
|
935
|
+
"name": "globalBlacklistCount",
|
|
936
|
+
"inputs": [],
|
|
937
|
+
"outputs": [
|
|
938
|
+
{
|
|
939
|
+
"name": "",
|
|
940
|
+
"type": "uint256",
|
|
941
|
+
"internalType": "uint256"
|
|
942
|
+
}
|
|
943
|
+
],
|
|
944
|
+
"stateMutability": "view"
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
"type": "function",
|
|
948
|
+
"name": "globalDestinationBlacklist",
|
|
949
|
+
"inputs": [
|
|
950
|
+
{
|
|
951
|
+
"name": "",
|
|
952
|
+
"type": "address",
|
|
953
|
+
"internalType": "address"
|
|
954
|
+
}
|
|
955
|
+
],
|
|
956
|
+
"outputs": [
|
|
957
|
+
{
|
|
958
|
+
"name": "",
|
|
959
|
+
"type": "bool",
|
|
960
|
+
"internalType": "bool"
|
|
961
|
+
}
|
|
962
|
+
],
|
|
963
|
+
"stateMutability": "view"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
"type": "function",
|
|
967
|
+
"name": "globalDestinationCount",
|
|
968
|
+
"inputs": [],
|
|
969
|
+
"outputs": [
|
|
970
|
+
{
|
|
971
|
+
"name": "",
|
|
972
|
+
"type": "uint256",
|
|
973
|
+
"internalType": "uint256"
|
|
974
|
+
}
|
|
975
|
+
],
|
|
976
|
+
"stateMutability": "view"
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
"type": "function",
|
|
980
|
+
"name": "globalDestinationWhitelist",
|
|
981
|
+
"inputs": [
|
|
982
|
+
{
|
|
983
|
+
"name": "",
|
|
984
|
+
"type": "address",
|
|
985
|
+
"internalType": "address"
|
|
986
|
+
}
|
|
987
|
+
],
|
|
988
|
+
"outputs": [
|
|
989
|
+
{
|
|
990
|
+
"name": "",
|
|
991
|
+
"type": "bool",
|
|
992
|
+
"internalType": "bool"
|
|
993
|
+
}
|
|
994
|
+
],
|
|
995
|
+
"stateMutability": "view"
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
"type": "function",
|
|
999
|
+
"name": "isBotActive",
|
|
1000
|
+
"inputs": [
|
|
1001
|
+
{
|
|
1002
|
+
"name": "bot",
|
|
1003
|
+
"type": "address",
|
|
1004
|
+
"internalType": "address"
|
|
1005
|
+
}
|
|
1006
|
+
],
|
|
1007
|
+
"outputs": [
|
|
1008
|
+
{
|
|
1009
|
+
"name": "",
|
|
1010
|
+
"type": "bool",
|
|
1011
|
+
"internalType": "bool"
|
|
1012
|
+
}
|
|
1013
|
+
],
|
|
1014
|
+
"stateMutability": "view"
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
"type": "function",
|
|
1018
|
+
"name": "isProtocolApproved",
|
|
1019
|
+
"inputs": [
|
|
1020
|
+
{
|
|
1021
|
+
"name": "protocol",
|
|
1022
|
+
"type": "address",
|
|
1023
|
+
"internalType": "address"
|
|
1024
|
+
}
|
|
1025
|
+
],
|
|
1026
|
+
"outputs": [
|
|
1027
|
+
{
|
|
1028
|
+
"name": "",
|
|
1029
|
+
"type": "bool",
|
|
1030
|
+
"internalType": "bool"
|
|
1031
|
+
}
|
|
1032
|
+
],
|
|
1033
|
+
"stateMutability": "view"
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
"type": "function",
|
|
1037
|
+
"name": "operator",
|
|
1038
|
+
"inputs": [],
|
|
1039
|
+
"outputs": [
|
|
1040
|
+
{
|
|
1041
|
+
"name": "",
|
|
1042
|
+
"type": "address",
|
|
1043
|
+
"internalType": "address"
|
|
1044
|
+
}
|
|
1045
|
+
],
|
|
1046
|
+
"stateMutability": "view"
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
"type": "function",
|
|
1050
|
+
"name": "operatorBotCount",
|
|
1051
|
+
"inputs": [],
|
|
1052
|
+
"outputs": [
|
|
1053
|
+
{
|
|
1054
|
+
"name": "",
|
|
1055
|
+
"type": "uint256",
|
|
1056
|
+
"internalType": "uint256"
|
|
1057
|
+
}
|
|
1058
|
+
],
|
|
1059
|
+
"stateMutability": "view"
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
"type": "function",
|
|
1063
|
+
"name": "operatorCeilings",
|
|
1064
|
+
"inputs": [],
|
|
1065
|
+
"outputs": [
|
|
1066
|
+
{
|
|
1067
|
+
"name": "maxPerTxAmount",
|
|
1068
|
+
"type": "uint256",
|
|
1069
|
+
"internalType": "uint256"
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
"name": "maxBotDailyLimit",
|
|
1073
|
+
"type": "uint256",
|
|
1074
|
+
"internalType": "uint256"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
"name": "maxOperatorBots",
|
|
1078
|
+
"type": "uint256",
|
|
1079
|
+
"internalType": "uint256"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
"name": "vaultDailyAggregate",
|
|
1083
|
+
"type": "uint256",
|
|
1084
|
+
"internalType": "uint256"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"name": "minAiTriggerFloor",
|
|
1088
|
+
"type": "uint256",
|
|
1089
|
+
"internalType": "uint256"
|
|
1090
|
+
}
|
|
1091
|
+
],
|
|
1092
|
+
"stateMutability": "view"
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
"type": "function",
|
|
1096
|
+
"name": "operatorMaxDrainPerDay",
|
|
1097
|
+
"inputs": [],
|
|
1098
|
+
"outputs": [
|
|
1099
|
+
{
|
|
1100
|
+
"name": "",
|
|
1101
|
+
"type": "uint256",
|
|
1102
|
+
"internalType": "uint256"
|
|
1103
|
+
}
|
|
1104
|
+
],
|
|
1105
|
+
"stateMutability": "view"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
"type": "function",
|
|
1109
|
+
"name": "owner",
|
|
1110
|
+
"inputs": [],
|
|
1111
|
+
"outputs": [
|
|
1112
|
+
{
|
|
1113
|
+
"name": "",
|
|
1114
|
+
"type": "address",
|
|
1115
|
+
"internalType": "address"
|
|
1116
|
+
}
|
|
1117
|
+
],
|
|
1118
|
+
"stateMutability": "view"
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
"type": "function",
|
|
1122
|
+
"name": "pause",
|
|
1123
|
+
"inputs": [],
|
|
1124
|
+
"outputs": [],
|
|
1125
|
+
"stateMutability": "nonpayable"
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
"type": "function",
|
|
1129
|
+
"name": "paused",
|
|
1130
|
+
"inputs": [],
|
|
1131
|
+
"outputs": [
|
|
1132
|
+
{
|
|
1133
|
+
"name": "",
|
|
1134
|
+
"type": "bool",
|
|
1135
|
+
"internalType": "bool"
|
|
1136
|
+
}
|
|
1137
|
+
],
|
|
1138
|
+
"stateMutability": "view"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
"type": "function",
|
|
1142
|
+
"name": "pendingOwner",
|
|
1143
|
+
"inputs": [],
|
|
1144
|
+
"outputs": [
|
|
1145
|
+
{
|
|
1146
|
+
"name": "",
|
|
1147
|
+
"type": "address",
|
|
1148
|
+
"internalType": "address"
|
|
1149
|
+
}
|
|
1150
|
+
],
|
|
1151
|
+
"stateMutability": "view"
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
"type": "function",
|
|
1155
|
+
"name": "rebalanceTokenCount",
|
|
1156
|
+
"inputs": [],
|
|
1157
|
+
"outputs": [
|
|
1158
|
+
{
|
|
1159
|
+
"name": "",
|
|
1160
|
+
"type": "uint256",
|
|
1161
|
+
"internalType": "uint256"
|
|
1162
|
+
}
|
|
1163
|
+
],
|
|
1164
|
+
"stateMutability": "view"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"type": "function",
|
|
1168
|
+
"name": "rebalanceTokenWhitelist",
|
|
1169
|
+
"inputs": [
|
|
1170
|
+
{
|
|
1171
|
+
"name": "",
|
|
1172
|
+
"type": "address",
|
|
1173
|
+
"internalType": "address"
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
"outputs": [
|
|
1177
|
+
{
|
|
1178
|
+
"name": "",
|
|
1179
|
+
"type": "bool",
|
|
1180
|
+
"internalType": "bool"
|
|
1181
|
+
}
|
|
1182
|
+
],
|
|
1183
|
+
"stateMutability": "view"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
"type": "function",
|
|
1187
|
+
"name": "removeBot",
|
|
1188
|
+
"inputs": [
|
|
1189
|
+
{
|
|
1190
|
+
"name": "bot",
|
|
1191
|
+
"type": "address",
|
|
1192
|
+
"internalType": "address"
|
|
1193
|
+
}
|
|
1194
|
+
],
|
|
1195
|
+
"outputs": [],
|
|
1196
|
+
"stateMutability": "nonpayable"
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
"type": "function",
|
|
1200
|
+
"name": "removeBotDestination",
|
|
1201
|
+
"inputs": [
|
|
1202
|
+
{
|
|
1203
|
+
"name": "bot",
|
|
1204
|
+
"type": "address",
|
|
1205
|
+
"internalType": "address"
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
"name": "destination",
|
|
1209
|
+
"type": "address",
|
|
1210
|
+
"internalType": "address"
|
|
1211
|
+
}
|
|
1212
|
+
],
|
|
1213
|
+
"outputs": [],
|
|
1214
|
+
"stateMutability": "nonpayable"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
"type": "function",
|
|
1218
|
+
"name": "removeGlobalBlacklist",
|
|
1219
|
+
"inputs": [
|
|
1220
|
+
{
|
|
1221
|
+
"name": "destination",
|
|
1222
|
+
"type": "address",
|
|
1223
|
+
"internalType": "address"
|
|
1224
|
+
}
|
|
1225
|
+
],
|
|
1226
|
+
"outputs": [],
|
|
1227
|
+
"stateMutability": "nonpayable"
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
"type": "function",
|
|
1231
|
+
"name": "removeGlobalDestination",
|
|
1232
|
+
"inputs": [
|
|
1233
|
+
{
|
|
1234
|
+
"name": "destination",
|
|
1235
|
+
"type": "address",
|
|
1236
|
+
"internalType": "address"
|
|
1237
|
+
}
|
|
1238
|
+
],
|
|
1239
|
+
"outputs": [],
|
|
1240
|
+
"stateMutability": "nonpayable"
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
"type": "function",
|
|
1244
|
+
"name": "removeProtocol",
|
|
1245
|
+
"inputs": [
|
|
1246
|
+
{
|
|
1247
|
+
"name": "protocol",
|
|
1248
|
+
"type": "address",
|
|
1249
|
+
"internalType": "address"
|
|
1250
|
+
}
|
|
1251
|
+
],
|
|
1252
|
+
"outputs": [],
|
|
1253
|
+
"stateMutability": "nonpayable"
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
"type": "function",
|
|
1257
|
+
"name": "removeRebalanceTokens",
|
|
1258
|
+
"inputs": [
|
|
1259
|
+
{
|
|
1260
|
+
"name": "tokens",
|
|
1261
|
+
"type": "address[]",
|
|
1262
|
+
"internalType": "address[]"
|
|
1263
|
+
}
|
|
1264
|
+
],
|
|
1265
|
+
"outputs": [],
|
|
1266
|
+
"stateMutability": "nonpayable"
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
"type": "function",
|
|
1270
|
+
"name": "renounceOwnership",
|
|
1271
|
+
"inputs": [],
|
|
1272
|
+
"outputs": [],
|
|
1273
|
+
"stateMutability": "nonpayable"
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
"type": "function",
|
|
1277
|
+
"name": "setOperator",
|
|
1278
|
+
"inputs": [
|
|
1279
|
+
{
|
|
1280
|
+
"name": "_operator",
|
|
1281
|
+
"type": "address",
|
|
1282
|
+
"internalType": "address"
|
|
1283
|
+
}
|
|
1284
|
+
],
|
|
1285
|
+
"outputs": [],
|
|
1286
|
+
"stateMutability": "nonpayable"
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
"type": "function",
|
|
1290
|
+
"name": "setOperatorCeilings",
|
|
1291
|
+
"inputs": [
|
|
1292
|
+
{
|
|
1293
|
+
"name": "ceilings",
|
|
1294
|
+
"type": "tuple",
|
|
1295
|
+
"internalType": "struct AxonVault.OperatorCeilings",
|
|
1296
|
+
"components": [
|
|
1297
|
+
{
|
|
1298
|
+
"name": "maxPerTxAmount",
|
|
1299
|
+
"type": "uint256",
|
|
1300
|
+
"internalType": "uint256"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
"name": "maxBotDailyLimit",
|
|
1304
|
+
"type": "uint256",
|
|
1305
|
+
"internalType": "uint256"
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
"name": "maxOperatorBots",
|
|
1309
|
+
"type": "uint256",
|
|
1310
|
+
"internalType": "uint256"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
"name": "vaultDailyAggregate",
|
|
1314
|
+
"type": "uint256",
|
|
1315
|
+
"internalType": "uint256"
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
"name": "minAiTriggerFloor",
|
|
1319
|
+
"type": "uint256",
|
|
1320
|
+
"internalType": "uint256"
|
|
1321
|
+
}
|
|
1322
|
+
]
|
|
1323
|
+
}
|
|
1324
|
+
],
|
|
1325
|
+
"outputs": [],
|
|
1326
|
+
"stateMutability": "nonpayable"
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
"type": "function",
|
|
1330
|
+
"name": "transferOwnership",
|
|
1331
|
+
"inputs": [
|
|
1332
|
+
{
|
|
1333
|
+
"name": "newOwner",
|
|
1334
|
+
"type": "address",
|
|
1335
|
+
"internalType": "address"
|
|
1336
|
+
}
|
|
1337
|
+
],
|
|
1338
|
+
"outputs": [],
|
|
1339
|
+
"stateMutability": "nonpayable"
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
"type": "function",
|
|
1343
|
+
"name": "unpause",
|
|
1344
|
+
"inputs": [],
|
|
1345
|
+
"outputs": [],
|
|
1346
|
+
"stateMutability": "nonpayable"
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
"type": "function",
|
|
1350
|
+
"name": "updateBotConfig",
|
|
1351
|
+
"inputs": [
|
|
1352
|
+
{
|
|
1353
|
+
"name": "bot",
|
|
1354
|
+
"type": "address",
|
|
1355
|
+
"internalType": "address"
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
"name": "params",
|
|
1359
|
+
"type": "tuple",
|
|
1360
|
+
"internalType": "struct AxonVault.BotConfigParams",
|
|
1361
|
+
"components": [
|
|
1362
|
+
{
|
|
1363
|
+
"name": "maxPerTxAmount",
|
|
1364
|
+
"type": "uint256",
|
|
1365
|
+
"internalType": "uint256"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
"name": "maxRebalanceAmount",
|
|
1369
|
+
"type": "uint256",
|
|
1370
|
+
"internalType": "uint256"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
"name": "spendingLimits",
|
|
1374
|
+
"type": "tuple[]",
|
|
1375
|
+
"internalType": "struct AxonVault.SpendingLimit[]",
|
|
1376
|
+
"components": [
|
|
1377
|
+
{
|
|
1378
|
+
"name": "amount",
|
|
1379
|
+
"type": "uint256",
|
|
1380
|
+
"internalType": "uint256"
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
"name": "maxCount",
|
|
1384
|
+
"type": "uint256",
|
|
1385
|
+
"internalType": "uint256"
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
"name": "windowSeconds",
|
|
1389
|
+
"type": "uint256",
|
|
1390
|
+
"internalType": "uint256"
|
|
1391
|
+
}
|
|
1392
|
+
]
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
"name": "aiTriggerThreshold",
|
|
1396
|
+
"type": "uint256",
|
|
1397
|
+
"internalType": "uint256"
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
"name": "requireAiVerification",
|
|
1401
|
+
"type": "bool",
|
|
1402
|
+
"internalType": "bool"
|
|
1403
|
+
}
|
|
1404
|
+
]
|
|
1405
|
+
}
|
|
1406
|
+
],
|
|
1407
|
+
"outputs": [],
|
|
1408
|
+
"stateMutability": "nonpayable"
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
"type": "function",
|
|
1412
|
+
"name": "usedIntents",
|
|
1413
|
+
"inputs": [
|
|
1414
|
+
{
|
|
1415
|
+
"name": "",
|
|
1416
|
+
"type": "bytes32",
|
|
1417
|
+
"internalType": "bytes32"
|
|
1418
|
+
}
|
|
1419
|
+
],
|
|
1420
|
+
"outputs": [
|
|
1421
|
+
{
|
|
1422
|
+
"name": "",
|
|
1423
|
+
"type": "bool",
|
|
1424
|
+
"internalType": "bool"
|
|
1425
|
+
}
|
|
1426
|
+
],
|
|
1427
|
+
"stateMutability": "view"
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
"type": "function",
|
|
1431
|
+
"name": "withdraw",
|
|
1432
|
+
"inputs": [
|
|
1433
|
+
{
|
|
1434
|
+
"name": "token",
|
|
1435
|
+
"type": "address",
|
|
1436
|
+
"internalType": "address"
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
"name": "amount",
|
|
1440
|
+
"type": "uint256",
|
|
1441
|
+
"internalType": "uint256"
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
"name": "to",
|
|
1445
|
+
"type": "address",
|
|
1446
|
+
"internalType": "address"
|
|
1447
|
+
}
|
|
1448
|
+
],
|
|
1449
|
+
"outputs": [],
|
|
1450
|
+
"stateMutability": "nonpayable"
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
"type": "event",
|
|
1454
|
+
"name": "BotAdded",
|
|
1455
|
+
"inputs": [
|
|
1456
|
+
{
|
|
1457
|
+
"name": "bot",
|
|
1458
|
+
"type": "address",
|
|
1459
|
+
"indexed": true,
|
|
1460
|
+
"internalType": "address"
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
"name": "addedBy",
|
|
1464
|
+
"type": "address",
|
|
1465
|
+
"indexed": true,
|
|
1466
|
+
"internalType": "address"
|
|
1467
|
+
}
|
|
1468
|
+
],
|
|
1469
|
+
"anonymous": false
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
"type": "event",
|
|
1473
|
+
"name": "BotConfigUpdated",
|
|
1474
|
+
"inputs": [
|
|
1475
|
+
{
|
|
1476
|
+
"name": "bot",
|
|
1477
|
+
"type": "address",
|
|
1478
|
+
"indexed": true,
|
|
1479
|
+
"internalType": "address"
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
"name": "updatedBy",
|
|
1483
|
+
"type": "address",
|
|
1484
|
+
"indexed": true,
|
|
1485
|
+
"internalType": "address"
|
|
1486
|
+
}
|
|
1487
|
+
],
|
|
1488
|
+
"anonymous": false
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
"type": "event",
|
|
1492
|
+
"name": "BotDestinationAdded",
|
|
1493
|
+
"inputs": [
|
|
1494
|
+
{
|
|
1495
|
+
"name": "bot",
|
|
1496
|
+
"type": "address",
|
|
1497
|
+
"indexed": true,
|
|
1498
|
+
"internalType": "address"
|
|
1499
|
+
},
|
|
1500
|
+
{
|
|
1501
|
+
"name": "destination",
|
|
1502
|
+
"type": "address",
|
|
1503
|
+
"indexed": true,
|
|
1504
|
+
"internalType": "address"
|
|
1505
|
+
}
|
|
1506
|
+
],
|
|
1507
|
+
"anonymous": false
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
"type": "event",
|
|
1511
|
+
"name": "BotDestinationRemoved",
|
|
1512
|
+
"inputs": [
|
|
1513
|
+
{
|
|
1514
|
+
"name": "bot",
|
|
1515
|
+
"type": "address",
|
|
1516
|
+
"indexed": true,
|
|
1517
|
+
"internalType": "address"
|
|
1518
|
+
},
|
|
1519
|
+
{
|
|
1520
|
+
"name": "destination",
|
|
1521
|
+
"type": "address",
|
|
1522
|
+
"indexed": true,
|
|
1523
|
+
"internalType": "address"
|
|
1524
|
+
}
|
|
1525
|
+
],
|
|
1526
|
+
"anonymous": false
|
|
1527
|
+
},
|
|
1528
|
+
{
|
|
1529
|
+
"type": "event",
|
|
1530
|
+
"name": "BotRemoved",
|
|
1531
|
+
"inputs": [
|
|
1532
|
+
{
|
|
1533
|
+
"name": "bot",
|
|
1534
|
+
"type": "address",
|
|
1535
|
+
"indexed": true,
|
|
1536
|
+
"internalType": "address"
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
"name": "removedBy",
|
|
1540
|
+
"type": "address",
|
|
1541
|
+
"indexed": true,
|
|
1542
|
+
"internalType": "address"
|
|
1543
|
+
}
|
|
1544
|
+
],
|
|
1545
|
+
"anonymous": false
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
"type": "event",
|
|
1549
|
+
"name": "Deposited",
|
|
1550
|
+
"inputs": [
|
|
1551
|
+
{
|
|
1552
|
+
"name": "from",
|
|
1553
|
+
"type": "address",
|
|
1554
|
+
"indexed": true,
|
|
1555
|
+
"internalType": "address"
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
"name": "token",
|
|
1559
|
+
"type": "address",
|
|
1560
|
+
"indexed": true,
|
|
1561
|
+
"internalType": "address"
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
"name": "amount",
|
|
1565
|
+
"type": "uint256",
|
|
1566
|
+
"indexed": false,
|
|
1567
|
+
"internalType": "uint256"
|
|
1568
|
+
},
|
|
1569
|
+
{
|
|
1570
|
+
"name": "ref",
|
|
1571
|
+
"type": "bytes32",
|
|
1572
|
+
"indexed": false,
|
|
1573
|
+
"internalType": "bytes32"
|
|
1574
|
+
}
|
|
1575
|
+
],
|
|
1576
|
+
"anonymous": false
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
"type": "event",
|
|
1580
|
+
"name": "EIP712DomainChanged",
|
|
1581
|
+
"inputs": [],
|
|
1582
|
+
"anonymous": false
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
"type": "event",
|
|
1586
|
+
"name": "GlobalBlacklistAdded",
|
|
1587
|
+
"inputs": [
|
|
1588
|
+
{
|
|
1589
|
+
"name": "destination",
|
|
1590
|
+
"type": "address",
|
|
1591
|
+
"indexed": true,
|
|
1592
|
+
"internalType": "address"
|
|
1593
|
+
}
|
|
1594
|
+
],
|
|
1595
|
+
"anonymous": false
|
|
1596
|
+
},
|
|
1597
|
+
{
|
|
1598
|
+
"type": "event",
|
|
1599
|
+
"name": "GlobalBlacklistRemoved",
|
|
1600
|
+
"inputs": [
|
|
1601
|
+
{
|
|
1602
|
+
"name": "destination",
|
|
1603
|
+
"type": "address",
|
|
1604
|
+
"indexed": true,
|
|
1605
|
+
"internalType": "address"
|
|
1606
|
+
}
|
|
1607
|
+
],
|
|
1608
|
+
"anonymous": false
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
"type": "event",
|
|
1612
|
+
"name": "GlobalDestinationAdded",
|
|
1613
|
+
"inputs": [
|
|
1614
|
+
{
|
|
1615
|
+
"name": "destination",
|
|
1616
|
+
"type": "address",
|
|
1617
|
+
"indexed": true,
|
|
1618
|
+
"internalType": "address"
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
"anonymous": false
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
"type": "event",
|
|
1625
|
+
"name": "GlobalDestinationRemoved",
|
|
1626
|
+
"inputs": [
|
|
1627
|
+
{
|
|
1628
|
+
"name": "destination",
|
|
1629
|
+
"type": "address",
|
|
1630
|
+
"indexed": true,
|
|
1631
|
+
"internalType": "address"
|
|
1632
|
+
}
|
|
1633
|
+
],
|
|
1634
|
+
"anonymous": false
|
|
1635
|
+
},
|
|
1636
|
+
{
|
|
1637
|
+
"type": "event",
|
|
1638
|
+
"name": "OperatorCeilingsUpdated",
|
|
1639
|
+
"inputs": [
|
|
1640
|
+
{
|
|
1641
|
+
"name": "ceilings",
|
|
1642
|
+
"type": "tuple",
|
|
1643
|
+
"indexed": false,
|
|
1644
|
+
"internalType": "struct AxonVault.OperatorCeilings",
|
|
1645
|
+
"components": [
|
|
1646
|
+
{
|
|
1647
|
+
"name": "maxPerTxAmount",
|
|
1648
|
+
"type": "uint256",
|
|
1649
|
+
"internalType": "uint256"
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
"name": "maxBotDailyLimit",
|
|
1653
|
+
"type": "uint256",
|
|
1654
|
+
"internalType": "uint256"
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
"name": "maxOperatorBots",
|
|
1658
|
+
"type": "uint256",
|
|
1659
|
+
"internalType": "uint256"
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
"name": "vaultDailyAggregate",
|
|
1663
|
+
"type": "uint256",
|
|
1664
|
+
"internalType": "uint256"
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
"name": "minAiTriggerFloor",
|
|
1668
|
+
"type": "uint256",
|
|
1669
|
+
"internalType": "uint256"
|
|
1670
|
+
}
|
|
1671
|
+
]
|
|
1672
|
+
}
|
|
1673
|
+
],
|
|
1674
|
+
"anonymous": false
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
"type": "event",
|
|
1678
|
+
"name": "OperatorSet",
|
|
1679
|
+
"inputs": [
|
|
1680
|
+
{
|
|
1681
|
+
"name": "oldOperator",
|
|
1682
|
+
"type": "address",
|
|
1683
|
+
"indexed": true,
|
|
1684
|
+
"internalType": "address"
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
"name": "newOperator",
|
|
1688
|
+
"type": "address",
|
|
1689
|
+
"indexed": true,
|
|
1690
|
+
"internalType": "address"
|
|
1691
|
+
}
|
|
1692
|
+
],
|
|
1693
|
+
"anonymous": false
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
"type": "event",
|
|
1697
|
+
"name": "OwnershipTransferStarted",
|
|
1698
|
+
"inputs": [
|
|
1699
|
+
{
|
|
1700
|
+
"name": "previousOwner",
|
|
1701
|
+
"type": "address",
|
|
1702
|
+
"indexed": true,
|
|
1703
|
+
"internalType": "address"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
"name": "newOwner",
|
|
1707
|
+
"type": "address",
|
|
1708
|
+
"indexed": true,
|
|
1709
|
+
"internalType": "address"
|
|
1710
|
+
}
|
|
1711
|
+
],
|
|
1712
|
+
"anonymous": false
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
"type": "event",
|
|
1716
|
+
"name": "OwnershipTransferred",
|
|
1717
|
+
"inputs": [
|
|
1718
|
+
{
|
|
1719
|
+
"name": "previousOwner",
|
|
1720
|
+
"type": "address",
|
|
1721
|
+
"indexed": true,
|
|
1722
|
+
"internalType": "address"
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
"name": "newOwner",
|
|
1726
|
+
"type": "address",
|
|
1727
|
+
"indexed": true,
|
|
1728
|
+
"internalType": "address"
|
|
1729
|
+
}
|
|
1730
|
+
],
|
|
1731
|
+
"anonymous": false
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
"type": "event",
|
|
1735
|
+
"name": "Paused",
|
|
1736
|
+
"inputs": [
|
|
1737
|
+
{
|
|
1738
|
+
"name": "account",
|
|
1739
|
+
"type": "address",
|
|
1740
|
+
"indexed": false,
|
|
1741
|
+
"internalType": "address"
|
|
1742
|
+
}
|
|
1743
|
+
],
|
|
1744
|
+
"anonymous": false
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
"type": "event",
|
|
1748
|
+
"name": "PaymentExecuted",
|
|
1749
|
+
"inputs": [
|
|
1750
|
+
{
|
|
1751
|
+
"name": "bot",
|
|
1752
|
+
"type": "address",
|
|
1753
|
+
"indexed": true,
|
|
1754
|
+
"internalType": "address"
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
"name": "to",
|
|
1758
|
+
"type": "address",
|
|
1759
|
+
"indexed": true,
|
|
1760
|
+
"internalType": "address"
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
"name": "token",
|
|
1764
|
+
"type": "address",
|
|
1765
|
+
"indexed": true,
|
|
1766
|
+
"internalType": "address"
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
"name": "amount",
|
|
1770
|
+
"type": "uint256",
|
|
1771
|
+
"indexed": false,
|
|
1772
|
+
"internalType": "uint256"
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
"name": "ref",
|
|
1776
|
+
"type": "bytes32",
|
|
1777
|
+
"indexed": false,
|
|
1778
|
+
"internalType": "bytes32"
|
|
1779
|
+
}
|
|
1780
|
+
],
|
|
1781
|
+
"anonymous": false
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
"type": "event",
|
|
1785
|
+
"name": "ProtocolAdded",
|
|
1786
|
+
"inputs": [
|
|
1787
|
+
{
|
|
1788
|
+
"name": "protocol",
|
|
1789
|
+
"type": "address",
|
|
1790
|
+
"indexed": true,
|
|
1791
|
+
"internalType": "address"
|
|
1792
|
+
}
|
|
1793
|
+
],
|
|
1794
|
+
"anonymous": false
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
"type": "event",
|
|
1798
|
+
"name": "ProtocolExecuted",
|
|
1799
|
+
"inputs": [
|
|
1800
|
+
{
|
|
1801
|
+
"name": "bot",
|
|
1802
|
+
"type": "address",
|
|
1803
|
+
"indexed": true,
|
|
1804
|
+
"internalType": "address"
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
"name": "protocol",
|
|
1808
|
+
"type": "address",
|
|
1809
|
+
"indexed": true,
|
|
1810
|
+
"internalType": "address"
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
"name": "token",
|
|
1814
|
+
"type": "address",
|
|
1815
|
+
"indexed": false,
|
|
1816
|
+
"internalType": "address"
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
"name": "amount",
|
|
1820
|
+
"type": "uint256",
|
|
1821
|
+
"indexed": false,
|
|
1822
|
+
"internalType": "uint256"
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
"name": "ref",
|
|
1826
|
+
"type": "bytes32",
|
|
1827
|
+
"indexed": false,
|
|
1828
|
+
"internalType": "bytes32"
|
|
1829
|
+
}
|
|
1830
|
+
],
|
|
1831
|
+
"anonymous": false
|
|
1832
|
+
},
|
|
1833
|
+
{
|
|
1834
|
+
"type": "event",
|
|
1835
|
+
"name": "ProtocolRemoved",
|
|
1836
|
+
"inputs": [
|
|
1837
|
+
{
|
|
1838
|
+
"name": "protocol",
|
|
1839
|
+
"type": "address",
|
|
1840
|
+
"indexed": true,
|
|
1841
|
+
"internalType": "address"
|
|
1842
|
+
}
|
|
1843
|
+
],
|
|
1844
|
+
"anonymous": false
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
"type": "event",
|
|
1848
|
+
"name": "RebalanceTokenAdded",
|
|
1849
|
+
"inputs": [
|
|
1850
|
+
{
|
|
1851
|
+
"name": "token",
|
|
1852
|
+
"type": "address",
|
|
1853
|
+
"indexed": true,
|
|
1854
|
+
"internalType": "address"
|
|
1855
|
+
}
|
|
1856
|
+
],
|
|
1857
|
+
"anonymous": false
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
"type": "event",
|
|
1861
|
+
"name": "RebalanceTokenRemoved",
|
|
1862
|
+
"inputs": [
|
|
1863
|
+
{
|
|
1864
|
+
"name": "token",
|
|
1865
|
+
"type": "address",
|
|
1866
|
+
"indexed": true,
|
|
1867
|
+
"internalType": "address"
|
|
1868
|
+
}
|
|
1869
|
+
],
|
|
1870
|
+
"anonymous": false
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
"type": "event",
|
|
1874
|
+
"name": "SwapExecuted",
|
|
1875
|
+
"inputs": [
|
|
1876
|
+
{
|
|
1877
|
+
"name": "bot",
|
|
1878
|
+
"type": "address",
|
|
1879
|
+
"indexed": true,
|
|
1880
|
+
"internalType": "address"
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
"name": "fromToken",
|
|
1884
|
+
"type": "address",
|
|
1885
|
+
"indexed": false,
|
|
1886
|
+
"internalType": "address"
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
"name": "toToken",
|
|
1890
|
+
"type": "address",
|
|
1891
|
+
"indexed": false,
|
|
1892
|
+
"internalType": "address"
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
"name": "fromAmount",
|
|
1896
|
+
"type": "uint256",
|
|
1897
|
+
"indexed": false,
|
|
1898
|
+
"internalType": "uint256"
|
|
1899
|
+
},
|
|
1900
|
+
{
|
|
1901
|
+
"name": "toAmount",
|
|
1902
|
+
"type": "uint256",
|
|
1903
|
+
"indexed": false,
|
|
1904
|
+
"internalType": "uint256"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
"name": "ref",
|
|
1908
|
+
"type": "bytes32",
|
|
1909
|
+
"indexed": false,
|
|
1910
|
+
"internalType": "bytes32"
|
|
1911
|
+
}
|
|
1912
|
+
],
|
|
1913
|
+
"anonymous": false
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
"type": "event",
|
|
1917
|
+
"name": "SwapPaymentExecuted",
|
|
1918
|
+
"inputs": [
|
|
1919
|
+
{
|
|
1920
|
+
"name": "bot",
|
|
1921
|
+
"type": "address",
|
|
1922
|
+
"indexed": true,
|
|
1923
|
+
"internalType": "address"
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
"name": "to",
|
|
1927
|
+
"type": "address",
|
|
1928
|
+
"indexed": true,
|
|
1929
|
+
"internalType": "address"
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
"name": "fromToken",
|
|
1933
|
+
"type": "address",
|
|
1934
|
+
"indexed": false,
|
|
1935
|
+
"internalType": "address"
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
"name": "toToken",
|
|
1939
|
+
"type": "address",
|
|
1940
|
+
"indexed": false,
|
|
1941
|
+
"internalType": "address"
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
"name": "fromAmount",
|
|
1945
|
+
"type": "uint256",
|
|
1946
|
+
"indexed": false,
|
|
1947
|
+
"internalType": "uint256"
|
|
1948
|
+
},
|
|
1949
|
+
{
|
|
1950
|
+
"name": "toAmount",
|
|
1951
|
+
"type": "uint256",
|
|
1952
|
+
"indexed": false,
|
|
1953
|
+
"internalType": "uint256"
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
"name": "ref",
|
|
1957
|
+
"type": "bytes32",
|
|
1958
|
+
"indexed": false,
|
|
1959
|
+
"internalType": "bytes32"
|
|
1960
|
+
}
|
|
1961
|
+
],
|
|
1962
|
+
"anonymous": false
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
"type": "event",
|
|
1966
|
+
"name": "Unpaused",
|
|
1967
|
+
"inputs": [
|
|
1968
|
+
{
|
|
1969
|
+
"name": "account",
|
|
1970
|
+
"type": "address",
|
|
1971
|
+
"indexed": false,
|
|
1972
|
+
"internalType": "address"
|
|
1973
|
+
}
|
|
1974
|
+
],
|
|
1975
|
+
"anonymous": false
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
"type": "event",
|
|
1979
|
+
"name": "Withdrawn",
|
|
1980
|
+
"inputs": [
|
|
1981
|
+
{
|
|
1982
|
+
"name": "token",
|
|
1983
|
+
"type": "address",
|
|
1984
|
+
"indexed": true,
|
|
1985
|
+
"internalType": "address"
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
"name": "amount",
|
|
1989
|
+
"type": "uint256",
|
|
1990
|
+
"indexed": false,
|
|
1991
|
+
"internalType": "uint256"
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
"name": "to",
|
|
1995
|
+
"type": "address",
|
|
1996
|
+
"indexed": true,
|
|
1997
|
+
"internalType": "address"
|
|
1998
|
+
}
|
|
1999
|
+
],
|
|
2000
|
+
"anonymous": false
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
"type": "error",
|
|
2004
|
+
"name": "AlreadyApprovedProtocol",
|
|
2005
|
+
"inputs": []
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
"type": "error",
|
|
2009
|
+
"name": "AmountMismatch",
|
|
2010
|
+
"inputs": []
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
"type": "error",
|
|
2014
|
+
"name": "BotAlreadyExists",
|
|
2015
|
+
"inputs": []
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
"type": "error",
|
|
2019
|
+
"name": "BotDoesNotExist",
|
|
2020
|
+
"inputs": []
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
"type": "error",
|
|
2024
|
+
"name": "BotNotActive",
|
|
2025
|
+
"inputs": []
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
"type": "error",
|
|
2029
|
+
"name": "CalldataHashMismatch",
|
|
2030
|
+
"inputs": []
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
"type": "error",
|
|
2034
|
+
"name": "DeadlineExpired",
|
|
2035
|
+
"inputs": []
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
"type": "error",
|
|
2039
|
+
"name": "DestinationBlacklisted",
|
|
2040
|
+
"inputs": []
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
"type": "error",
|
|
2044
|
+
"name": "DestinationNotWhitelisted",
|
|
2045
|
+
"inputs": []
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
"type": "error",
|
|
2049
|
+
"name": "ECDSAInvalidSignature",
|
|
2050
|
+
"inputs": []
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
"type": "error",
|
|
2054
|
+
"name": "ECDSAInvalidSignatureLength",
|
|
2055
|
+
"inputs": [
|
|
2056
|
+
{
|
|
2057
|
+
"name": "length",
|
|
2058
|
+
"type": "uint256",
|
|
2059
|
+
"internalType": "uint256"
|
|
2060
|
+
}
|
|
2061
|
+
]
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
"type": "error",
|
|
2065
|
+
"name": "ECDSAInvalidSignatureS",
|
|
2066
|
+
"inputs": [
|
|
2067
|
+
{
|
|
2068
|
+
"name": "s",
|
|
2069
|
+
"type": "bytes32",
|
|
2070
|
+
"internalType": "bytes32"
|
|
2071
|
+
}
|
|
2072
|
+
]
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
"type": "error",
|
|
2076
|
+
"name": "EnforcedPause",
|
|
2077
|
+
"inputs": []
|
|
2078
|
+
},
|
|
2079
|
+
{
|
|
2080
|
+
"type": "error",
|
|
2081
|
+
"name": "ExceedsOperatorCeiling",
|
|
2082
|
+
"inputs": []
|
|
2083
|
+
},
|
|
2084
|
+
{
|
|
2085
|
+
"type": "error",
|
|
2086
|
+
"name": "ExpectedPause",
|
|
2087
|
+
"inputs": []
|
|
2088
|
+
},
|
|
2089
|
+
{
|
|
2090
|
+
"type": "error",
|
|
2091
|
+
"name": "InsufficientBalance",
|
|
2092
|
+
"inputs": []
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
"type": "error",
|
|
2096
|
+
"name": "IntentAlreadyUsed",
|
|
2097
|
+
"inputs": []
|
|
2098
|
+
},
|
|
2099
|
+
{
|
|
2100
|
+
"type": "error",
|
|
2101
|
+
"name": "InvalidShortString",
|
|
2102
|
+
"inputs": []
|
|
2103
|
+
},
|
|
2104
|
+
{
|
|
2105
|
+
"type": "error",
|
|
2106
|
+
"name": "InvalidSignature",
|
|
2107
|
+
"inputs": []
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
"type": "error",
|
|
2111
|
+
"name": "MaxPerTxExceeded",
|
|
2112
|
+
"inputs": []
|
|
2113
|
+
},
|
|
2114
|
+
{
|
|
2115
|
+
"type": "error",
|
|
2116
|
+
"name": "MaxRebalanceAmountExceeded",
|
|
2117
|
+
"inputs": []
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
"type": "error",
|
|
2121
|
+
"name": "NativeTransferFailed",
|
|
2122
|
+
"inputs": []
|
|
2123
|
+
},
|
|
2124
|
+
{
|
|
2125
|
+
"type": "error",
|
|
2126
|
+
"name": "NotAuthorized",
|
|
2127
|
+
"inputs": []
|
|
2128
|
+
},
|
|
2129
|
+
{
|
|
2130
|
+
"type": "error",
|
|
2131
|
+
"name": "NotAuthorizedRelayer",
|
|
2132
|
+
"inputs": []
|
|
2133
|
+
},
|
|
2134
|
+
{
|
|
2135
|
+
"type": "error",
|
|
2136
|
+
"name": "OperatorBotLimitReached",
|
|
2137
|
+
"inputs": []
|
|
2138
|
+
},
|
|
2139
|
+
{
|
|
2140
|
+
"type": "error",
|
|
2141
|
+
"name": "OperatorCannotBeOwner",
|
|
2142
|
+
"inputs": []
|
|
2143
|
+
},
|
|
2144
|
+
{
|
|
2145
|
+
"type": "error",
|
|
2146
|
+
"name": "OracleNotConfigured",
|
|
2147
|
+
"inputs": []
|
|
2148
|
+
},
|
|
2149
|
+
{
|
|
2150
|
+
"type": "error",
|
|
2151
|
+
"name": "OracleUnavailable",
|
|
2152
|
+
"inputs": []
|
|
2153
|
+
},
|
|
2154
|
+
{
|
|
2155
|
+
"type": "error",
|
|
2156
|
+
"name": "OwnableInvalidOwner",
|
|
2157
|
+
"inputs": [
|
|
2158
|
+
{
|
|
2159
|
+
"name": "owner",
|
|
2160
|
+
"type": "address",
|
|
2161
|
+
"internalType": "address"
|
|
2162
|
+
}
|
|
2163
|
+
]
|
|
2164
|
+
},
|
|
2165
|
+
{
|
|
2166
|
+
"type": "error",
|
|
2167
|
+
"name": "OwnableUnauthorizedAccount",
|
|
2168
|
+
"inputs": [
|
|
2169
|
+
{
|
|
2170
|
+
"name": "account",
|
|
2171
|
+
"type": "address",
|
|
2172
|
+
"internalType": "address"
|
|
2173
|
+
}
|
|
2174
|
+
]
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
"type": "error",
|
|
2178
|
+
"name": "OwnerCannotBeBot",
|
|
2179
|
+
"inputs": []
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
"type": "error",
|
|
2183
|
+
"name": "PaymentToZeroAddress",
|
|
2184
|
+
"inputs": []
|
|
2185
|
+
},
|
|
2186
|
+
{
|
|
2187
|
+
"type": "error",
|
|
2188
|
+
"name": "ProtocolCallFailed",
|
|
2189
|
+
"inputs": []
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
"type": "error",
|
|
2193
|
+
"name": "ProtocolNotApproved",
|
|
2194
|
+
"inputs": []
|
|
2195
|
+
},
|
|
2196
|
+
{
|
|
2197
|
+
"type": "error",
|
|
2198
|
+
"name": "ProtocolNotInList",
|
|
2199
|
+
"inputs": []
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
"type": "error",
|
|
2203
|
+
"name": "RebalanceTokenNotAllowed",
|
|
2204
|
+
"inputs": []
|
|
2205
|
+
},
|
|
2206
|
+
{
|
|
2207
|
+
"type": "error",
|
|
2208
|
+
"name": "ReentrancyGuardReentrantCall",
|
|
2209
|
+
"inputs": []
|
|
2210
|
+
},
|
|
2211
|
+
{
|
|
2212
|
+
"type": "error",
|
|
2213
|
+
"name": "RouterNotApproved",
|
|
2214
|
+
"inputs": []
|
|
2215
|
+
},
|
|
2216
|
+
{
|
|
2217
|
+
"type": "error",
|
|
2218
|
+
"name": "SafeERC20FailedOperation",
|
|
2219
|
+
"inputs": [
|
|
2220
|
+
{
|
|
2221
|
+
"name": "token",
|
|
2222
|
+
"type": "address",
|
|
2223
|
+
"internalType": "address"
|
|
2224
|
+
}
|
|
2225
|
+
]
|
|
2226
|
+
},
|
|
2227
|
+
{
|
|
2228
|
+
"type": "error",
|
|
2229
|
+
"name": "SameTokenSwap",
|
|
2230
|
+
"inputs": []
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
"type": "error",
|
|
2234
|
+
"name": "SelfPayment",
|
|
2235
|
+
"inputs": []
|
|
2236
|
+
},
|
|
2237
|
+
{
|
|
2238
|
+
"type": "error",
|
|
2239
|
+
"name": "StringTooLong",
|
|
2240
|
+
"inputs": [
|
|
2241
|
+
{
|
|
2242
|
+
"name": "str",
|
|
2243
|
+
"type": "string",
|
|
2244
|
+
"internalType": "string"
|
|
2245
|
+
}
|
|
2246
|
+
]
|
|
2247
|
+
},
|
|
2248
|
+
{
|
|
2249
|
+
"type": "error",
|
|
2250
|
+
"name": "SwapFailed",
|
|
2251
|
+
"inputs": []
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
"type": "error",
|
|
2255
|
+
"name": "SwapOutputInsufficient",
|
|
2256
|
+
"inputs": []
|
|
2257
|
+
},
|
|
2258
|
+
{
|
|
2259
|
+
"type": "error",
|
|
2260
|
+
"name": "TooManySpendingLimits",
|
|
2261
|
+
"inputs": []
|
|
2262
|
+
},
|
|
2263
|
+
{
|
|
2264
|
+
"type": "error",
|
|
2265
|
+
"name": "UnexpectedETH",
|
|
2266
|
+
"inputs": []
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
"type": "error",
|
|
2270
|
+
"name": "ZeroAddress",
|
|
2271
|
+
"inputs": []
|
|
2272
|
+
},
|
|
2273
|
+
{
|
|
2274
|
+
"type": "error",
|
|
2275
|
+
"name": "ZeroAmount",
|
|
2276
|
+
"inputs": []
|
|
2277
|
+
}
|
|
2278
|
+
];
|
|
2279
|
+
|
|
2280
|
+
// src/abis/AxonVaultFactory.ts
|
|
2281
|
+
var AxonVaultFactoryAbi = [
|
|
2282
|
+
{
|
|
2283
|
+
"type": "constructor",
|
|
2284
|
+
"inputs": [
|
|
2285
|
+
{
|
|
2286
|
+
"name": "_axonRegistry",
|
|
2287
|
+
"type": "address",
|
|
2288
|
+
"internalType": "address"
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
"name": "factoryOwner",
|
|
2292
|
+
"type": "address",
|
|
2293
|
+
"internalType": "address"
|
|
2294
|
+
}
|
|
2295
|
+
],
|
|
2296
|
+
"stateMutability": "nonpayable"
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
"type": "function",
|
|
2300
|
+
"name": "acceptOwnership",
|
|
2301
|
+
"inputs": [],
|
|
2302
|
+
"outputs": [],
|
|
2303
|
+
"stateMutability": "nonpayable"
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
"type": "function",
|
|
2307
|
+
"name": "allVaults",
|
|
2308
|
+
"inputs": [
|
|
2309
|
+
{
|
|
2310
|
+
"name": "",
|
|
2311
|
+
"type": "uint256",
|
|
2312
|
+
"internalType": "uint256"
|
|
2313
|
+
}
|
|
2314
|
+
],
|
|
2315
|
+
"outputs": [
|
|
2316
|
+
{
|
|
2317
|
+
"name": "",
|
|
2318
|
+
"type": "address",
|
|
2319
|
+
"internalType": "address"
|
|
2320
|
+
}
|
|
2321
|
+
],
|
|
2322
|
+
"stateMutability": "view"
|
|
2323
|
+
},
|
|
2324
|
+
{
|
|
2325
|
+
"type": "function",
|
|
2326
|
+
"name": "axonRegistry",
|
|
2327
|
+
"inputs": [],
|
|
2328
|
+
"outputs": [
|
|
2329
|
+
{
|
|
2330
|
+
"name": "",
|
|
2331
|
+
"type": "address",
|
|
2332
|
+
"internalType": "address"
|
|
2333
|
+
}
|
|
2334
|
+
],
|
|
2335
|
+
"stateMutability": "view"
|
|
2336
|
+
},
|
|
2337
|
+
{
|
|
2338
|
+
"type": "function",
|
|
2339
|
+
"name": "deployVault",
|
|
2340
|
+
"inputs": [],
|
|
2341
|
+
"outputs": [
|
|
2342
|
+
{
|
|
2343
|
+
"name": "vault",
|
|
2344
|
+
"type": "address",
|
|
2345
|
+
"internalType": "address"
|
|
2346
|
+
}
|
|
2347
|
+
],
|
|
2348
|
+
"stateMutability": "nonpayable"
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
"type": "function",
|
|
2352
|
+
"name": "owner",
|
|
2353
|
+
"inputs": [],
|
|
2354
|
+
"outputs": [
|
|
2355
|
+
{
|
|
2356
|
+
"name": "",
|
|
2357
|
+
"type": "address",
|
|
2358
|
+
"internalType": "address"
|
|
2359
|
+
}
|
|
2360
|
+
],
|
|
2361
|
+
"stateMutability": "view"
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
"type": "function",
|
|
2365
|
+
"name": "ownerVaultCount",
|
|
2366
|
+
"inputs": [
|
|
2367
|
+
{
|
|
2368
|
+
"name": "owner",
|
|
2369
|
+
"type": "address",
|
|
2370
|
+
"internalType": "address"
|
|
2371
|
+
}
|
|
2372
|
+
],
|
|
2373
|
+
"outputs": [
|
|
2374
|
+
{
|
|
2375
|
+
"name": "",
|
|
2376
|
+
"type": "uint256",
|
|
2377
|
+
"internalType": "uint256"
|
|
2378
|
+
}
|
|
2379
|
+
],
|
|
2380
|
+
"stateMutability": "view"
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
"type": "function",
|
|
2384
|
+
"name": "ownerVaults",
|
|
2385
|
+
"inputs": [
|
|
2386
|
+
{
|
|
2387
|
+
"name": "",
|
|
2388
|
+
"type": "address",
|
|
2389
|
+
"internalType": "address"
|
|
2390
|
+
},
|
|
2391
|
+
{
|
|
2392
|
+
"name": "",
|
|
2393
|
+
"type": "uint256",
|
|
2394
|
+
"internalType": "uint256"
|
|
2395
|
+
}
|
|
2396
|
+
],
|
|
2397
|
+
"outputs": [
|
|
2398
|
+
{
|
|
2399
|
+
"name": "",
|
|
2400
|
+
"type": "address",
|
|
2401
|
+
"internalType": "address"
|
|
2402
|
+
}
|
|
2403
|
+
],
|
|
2404
|
+
"stateMutability": "view"
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
"type": "function",
|
|
2408
|
+
"name": "pendingOwner",
|
|
2409
|
+
"inputs": [],
|
|
2410
|
+
"outputs": [
|
|
2411
|
+
{
|
|
2412
|
+
"name": "",
|
|
2413
|
+
"type": "address",
|
|
2414
|
+
"internalType": "address"
|
|
2415
|
+
}
|
|
2416
|
+
],
|
|
2417
|
+
"stateMutability": "view"
|
|
2418
|
+
},
|
|
2419
|
+
{
|
|
2420
|
+
"type": "function",
|
|
2421
|
+
"name": "renounceOwnership",
|
|
2422
|
+
"inputs": [],
|
|
2423
|
+
"outputs": [],
|
|
2424
|
+
"stateMutability": "nonpayable"
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
"type": "function",
|
|
2428
|
+
"name": "transferOwnership",
|
|
2429
|
+
"inputs": [
|
|
2430
|
+
{
|
|
2431
|
+
"name": "newOwner",
|
|
2432
|
+
"type": "address",
|
|
2433
|
+
"internalType": "address"
|
|
2434
|
+
}
|
|
2435
|
+
],
|
|
2436
|
+
"outputs": [],
|
|
2437
|
+
"stateMutability": "nonpayable"
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
"type": "function",
|
|
2441
|
+
"name": "vaultCount",
|
|
2442
|
+
"inputs": [],
|
|
2443
|
+
"outputs": [
|
|
2444
|
+
{
|
|
2445
|
+
"name": "",
|
|
2446
|
+
"type": "uint256",
|
|
2447
|
+
"internalType": "uint256"
|
|
2448
|
+
}
|
|
2449
|
+
],
|
|
2450
|
+
"stateMutability": "view"
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
"type": "event",
|
|
2454
|
+
"name": "OwnershipTransferStarted",
|
|
2455
|
+
"inputs": [
|
|
2456
|
+
{
|
|
2457
|
+
"name": "previousOwner",
|
|
2458
|
+
"type": "address",
|
|
2459
|
+
"indexed": true,
|
|
2460
|
+
"internalType": "address"
|
|
2461
|
+
},
|
|
2462
|
+
{
|
|
2463
|
+
"name": "newOwner",
|
|
2464
|
+
"type": "address",
|
|
2465
|
+
"indexed": true,
|
|
2466
|
+
"internalType": "address"
|
|
2467
|
+
}
|
|
2468
|
+
],
|
|
2469
|
+
"anonymous": false
|
|
2470
|
+
},
|
|
2471
|
+
{
|
|
2472
|
+
"type": "event",
|
|
2473
|
+
"name": "OwnershipTransferred",
|
|
2474
|
+
"inputs": [
|
|
2475
|
+
{
|
|
2476
|
+
"name": "previousOwner",
|
|
2477
|
+
"type": "address",
|
|
2478
|
+
"indexed": true,
|
|
2479
|
+
"internalType": "address"
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
"name": "newOwner",
|
|
2483
|
+
"type": "address",
|
|
2484
|
+
"indexed": true,
|
|
2485
|
+
"internalType": "address"
|
|
2486
|
+
}
|
|
2487
|
+
],
|
|
2488
|
+
"anonymous": false
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"type": "event",
|
|
2492
|
+
"name": "VaultDeployed",
|
|
2493
|
+
"inputs": [
|
|
2494
|
+
{
|
|
2495
|
+
"name": "owner",
|
|
2496
|
+
"type": "address",
|
|
2497
|
+
"indexed": true,
|
|
2498
|
+
"internalType": "address"
|
|
2499
|
+
},
|
|
2500
|
+
{
|
|
2501
|
+
"name": "vault",
|
|
2502
|
+
"type": "address",
|
|
2503
|
+
"indexed": true,
|
|
2504
|
+
"internalType": "address"
|
|
2505
|
+
},
|
|
2506
|
+
{
|
|
2507
|
+
"name": "version",
|
|
2508
|
+
"type": "uint16",
|
|
2509
|
+
"indexed": false,
|
|
2510
|
+
"internalType": "uint16"
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
"name": "axonRegistry",
|
|
2514
|
+
"type": "address",
|
|
2515
|
+
"indexed": false,
|
|
2516
|
+
"internalType": "address"
|
|
2517
|
+
}
|
|
2518
|
+
],
|
|
2519
|
+
"anonymous": false
|
|
2520
|
+
},
|
|
2521
|
+
{
|
|
2522
|
+
"type": "error",
|
|
2523
|
+
"name": "OwnableInvalidOwner",
|
|
2524
|
+
"inputs": [
|
|
2525
|
+
{
|
|
2526
|
+
"name": "owner",
|
|
2527
|
+
"type": "address",
|
|
2528
|
+
"internalType": "address"
|
|
2529
|
+
}
|
|
2530
|
+
]
|
|
2531
|
+
},
|
|
2532
|
+
{
|
|
2533
|
+
"type": "error",
|
|
2534
|
+
"name": "OwnableUnauthorizedAccount",
|
|
2535
|
+
"inputs": [
|
|
2536
|
+
{
|
|
2537
|
+
"name": "account",
|
|
2538
|
+
"type": "address",
|
|
2539
|
+
"internalType": "address"
|
|
2540
|
+
}
|
|
2541
|
+
]
|
|
2542
|
+
},
|
|
2543
|
+
{
|
|
2544
|
+
"type": "error",
|
|
2545
|
+
"name": "ZeroAddress",
|
|
2546
|
+
"inputs": []
|
|
2547
|
+
}
|
|
2548
|
+
];
|
|
2549
|
+
|
|
2550
|
+
// src/vault.ts
|
|
2551
|
+
function getChain(chainId) {
|
|
2552
|
+
switch (chainId) {
|
|
2553
|
+
case 8453:
|
|
2554
|
+
return chains.base;
|
|
2555
|
+
case 84532:
|
|
2556
|
+
return chains.baseSepolia;
|
|
2557
|
+
case 42161:
|
|
2558
|
+
return chains.arbitrum;
|
|
2559
|
+
case 421614:
|
|
2560
|
+
return chains.arbitrumSepolia;
|
|
2561
|
+
default:
|
|
2562
|
+
throw new Error(
|
|
2563
|
+
`Unsupported chainId: ${chainId}. Supported: 8453 (Base), 84532 (Base Sepolia), 42161 (Arbitrum), 421614 (Arbitrum Sepolia)`
|
|
2564
|
+
);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
function createAxonPublicClient(chainId, rpcUrl) {
|
|
2568
|
+
return viem.createPublicClient({
|
|
2569
|
+
chain: getChain(chainId),
|
|
2570
|
+
transport: viem.http(rpcUrl)
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
function createAxonWalletClient(privateKey, chainId) {
|
|
2574
|
+
const account = accounts.privateKeyToAccount(privateKey);
|
|
2575
|
+
return viem.createWalletClient({
|
|
2576
|
+
account,
|
|
2577
|
+
chain: getChain(chainId),
|
|
2578
|
+
transport: viem.http()
|
|
2579
|
+
// signing is local — transport is unused but required by viem
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2582
|
+
async function getBotConfig(publicClient, vaultAddress, botAddress) {
|
|
2583
|
+
const result = await publicClient.readContract({
|
|
2584
|
+
address: vaultAddress,
|
|
2585
|
+
abi: AxonVaultAbi,
|
|
2586
|
+
functionName: "getBotConfig",
|
|
2587
|
+
args: [botAddress]
|
|
2588
|
+
});
|
|
2589
|
+
return {
|
|
2590
|
+
isActive: result.isActive,
|
|
2591
|
+
registeredAt: result.registeredAt,
|
|
2592
|
+
maxPerTxAmount: result.maxPerTxAmount,
|
|
2593
|
+
maxRebalanceAmount: result.maxRebalanceAmount,
|
|
2594
|
+
spendingLimits: result.spendingLimits.map((sl) => ({
|
|
2595
|
+
amount: sl.amount,
|
|
2596
|
+
maxCount: sl.maxCount,
|
|
2597
|
+
windowSeconds: sl.windowSeconds
|
|
2598
|
+
})),
|
|
2599
|
+
aiTriggerThreshold: result.aiTriggerThreshold,
|
|
2600
|
+
requireAiVerification: result.requireAiVerification
|
|
2601
|
+
};
|
|
2602
|
+
}
|
|
2603
|
+
async function isBotActive(publicClient, vaultAddress, botAddress) {
|
|
2604
|
+
return publicClient.readContract({
|
|
2605
|
+
address: vaultAddress,
|
|
2606
|
+
abi: AxonVaultAbi,
|
|
2607
|
+
functionName: "isBotActive",
|
|
2608
|
+
args: [botAddress]
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
async function getOperatorCeilings(publicClient, vaultAddress) {
|
|
2612
|
+
const result = await publicClient.readContract({
|
|
2613
|
+
address: vaultAddress,
|
|
2614
|
+
abi: AxonVaultAbi,
|
|
2615
|
+
functionName: "operatorCeilings"
|
|
2616
|
+
});
|
|
2617
|
+
const [maxPerTxAmount, maxBotDailyLimit, maxOperatorBots, vaultDailyAggregate, minAiTriggerFloor] = result;
|
|
2618
|
+
return {
|
|
2619
|
+
maxPerTxAmount,
|
|
2620
|
+
maxBotDailyLimit,
|
|
2621
|
+
maxOperatorBots,
|
|
2622
|
+
vaultDailyAggregate,
|
|
2623
|
+
minAiTriggerFloor
|
|
2624
|
+
};
|
|
2625
|
+
}
|
|
2626
|
+
async function operatorMaxDrainPerDay(publicClient, vaultAddress) {
|
|
2627
|
+
return publicClient.readContract({
|
|
2628
|
+
address: vaultAddress,
|
|
2629
|
+
abi: AxonVaultAbi,
|
|
2630
|
+
functionName: "operatorMaxDrainPerDay"
|
|
2631
|
+
});
|
|
2632
|
+
}
|
|
2633
|
+
async function isVaultPaused(publicClient, vaultAddress) {
|
|
2634
|
+
return publicClient.readContract({
|
|
2635
|
+
address: vaultAddress,
|
|
2636
|
+
abi: AxonVaultAbi,
|
|
2637
|
+
functionName: "paused"
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
async function getDomainSeparator(publicClient, vaultAddress) {
|
|
2641
|
+
return publicClient.readContract({
|
|
2642
|
+
address: vaultAddress,
|
|
2643
|
+
abi: AxonVaultAbi,
|
|
2644
|
+
functionName: "DOMAIN_SEPARATOR"
|
|
2645
|
+
});
|
|
2646
|
+
}
|
|
2647
|
+
async function getVaultVersion(publicClient, vaultAddress) {
|
|
2648
|
+
const version = await publicClient.readContract({
|
|
2649
|
+
address: vaultAddress,
|
|
2650
|
+
abi: AxonVaultAbi,
|
|
2651
|
+
functionName: "VERSION"
|
|
2652
|
+
});
|
|
2653
|
+
return Number(version);
|
|
2654
|
+
}
|
|
2655
|
+
async function getVaultOwner(publicClient, vaultAddress) {
|
|
2656
|
+
return publicClient.readContract({
|
|
2657
|
+
address: vaultAddress,
|
|
2658
|
+
abi: AxonVaultAbi,
|
|
2659
|
+
functionName: "owner"
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
async function getVaultOperator(publicClient, vaultAddress) {
|
|
2663
|
+
return publicClient.readContract({
|
|
2664
|
+
address: vaultAddress,
|
|
2665
|
+
abi: AxonVaultAbi,
|
|
2666
|
+
functionName: "operator"
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
async function isDestinationAllowed(publicClient, vaultAddress, botAddress, destination) {
|
|
2670
|
+
const isBlacklisted = await publicClient.readContract({
|
|
2671
|
+
address: vaultAddress,
|
|
2672
|
+
abi: AxonVaultAbi,
|
|
2673
|
+
functionName: "globalDestinationBlacklist",
|
|
2674
|
+
args: [destination]
|
|
2675
|
+
});
|
|
2676
|
+
if (isBlacklisted) {
|
|
2677
|
+
return { allowed: false, reason: "Destination is on the global blacklist" };
|
|
2678
|
+
}
|
|
2679
|
+
const globalCount = await publicClient.readContract({
|
|
2680
|
+
address: vaultAddress,
|
|
2681
|
+
abi: AxonVaultAbi,
|
|
2682
|
+
functionName: "globalDestinationCount"
|
|
2683
|
+
});
|
|
2684
|
+
if (globalCount > 0n) {
|
|
2685
|
+
const isGlobalWhitelisted = await publicClient.readContract({
|
|
2686
|
+
address: vaultAddress,
|
|
2687
|
+
abi: AxonVaultAbi,
|
|
2688
|
+
functionName: "globalDestinationWhitelist",
|
|
2689
|
+
args: [destination]
|
|
2690
|
+
});
|
|
2691
|
+
if (!isGlobalWhitelisted) {
|
|
2692
|
+
return { allowed: false, reason: "Destination is not on the global whitelist" };
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
const botCount = await publicClient.readContract({
|
|
2696
|
+
address: vaultAddress,
|
|
2697
|
+
abi: AxonVaultAbi,
|
|
2698
|
+
functionName: "botDestinationCount",
|
|
2699
|
+
args: [botAddress]
|
|
2700
|
+
});
|
|
2701
|
+
if (botCount > 0n) {
|
|
2702
|
+
const isBotWhitelisted = await publicClient.readContract({
|
|
2703
|
+
address: vaultAddress,
|
|
2704
|
+
abi: AxonVaultAbi,
|
|
2705
|
+
functionName: "botDestinationWhitelist",
|
|
2706
|
+
args: [botAddress, destination]
|
|
2707
|
+
});
|
|
2708
|
+
if (!isBotWhitelisted) {
|
|
2709
|
+
return { allowed: false, reason: "Destination is not on the bot whitelist" };
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
return { allowed: true };
|
|
2713
|
+
}
|
|
2714
|
+
async function getRebalanceTokenCount(publicClient, vaultAddress) {
|
|
2715
|
+
const count = await publicClient.readContract({
|
|
2716
|
+
address: vaultAddress,
|
|
2717
|
+
abi: AxonVaultAbi,
|
|
2718
|
+
functionName: "rebalanceTokenCount"
|
|
2719
|
+
});
|
|
2720
|
+
return Number(count);
|
|
2721
|
+
}
|
|
2722
|
+
async function isRebalanceTokenWhitelisted(publicClient, vaultAddress, token) {
|
|
2723
|
+
return publicClient.readContract({
|
|
2724
|
+
address: vaultAddress,
|
|
2725
|
+
abi: AxonVaultAbi,
|
|
2726
|
+
functionName: "rebalanceTokenWhitelist",
|
|
2727
|
+
args: [token]
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
async function deployVault(walletClient, publicClient, factoryAddress) {
|
|
2731
|
+
if (!walletClient.account) {
|
|
2732
|
+
throw new Error("walletClient has no account attached");
|
|
2733
|
+
}
|
|
2734
|
+
const hash = await walletClient.writeContract({
|
|
2735
|
+
address: factoryAddress,
|
|
2736
|
+
abi: AxonVaultFactoryAbi,
|
|
2737
|
+
functionName: "deployVault",
|
|
2738
|
+
args: [],
|
|
2739
|
+
account: walletClient.account,
|
|
2740
|
+
chain: walletClient.chain ?? null
|
|
2741
|
+
});
|
|
2742
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
2743
|
+
for (const log of receipt.logs) {
|
|
2744
|
+
try {
|
|
2745
|
+
if (log.topics.length >= 3 && log.topics[2]) {
|
|
2746
|
+
const vaultAddress = `0x${log.topics[2].slice(26)}`;
|
|
2747
|
+
return vaultAddress;
|
|
2748
|
+
}
|
|
2749
|
+
} catch {
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
throw new Error("VaultDeployed event not found in transaction receipt");
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
// src/tokens.ts
|
|
2756
|
+
var Token = /* @__PURE__ */ ((Token2) => {
|
|
2757
|
+
Token2["USDC"] = "USDC";
|
|
2758
|
+
Token2["USDT"] = "USDT";
|
|
2759
|
+
Token2["DAI"] = "DAI";
|
|
2760
|
+
Token2["WETH"] = "WETH";
|
|
2761
|
+
Token2["WBTC"] = "WBTC";
|
|
2762
|
+
Token2["cbBTC"] = "cbBTC";
|
|
2763
|
+
Token2["cbETH"] = "cbETH";
|
|
2764
|
+
Token2["wstETH"] = "wstETH";
|
|
2765
|
+
Token2["rETH"] = "rETH";
|
|
2766
|
+
Token2["LINK"] = "LINK";
|
|
2767
|
+
Token2["UNI"] = "UNI";
|
|
2768
|
+
Token2["AAVE"] = "AAVE";
|
|
2769
|
+
Token2["COMP"] = "COMP";
|
|
2770
|
+
Token2["CRV"] = "CRV";
|
|
2771
|
+
Token2["SNX"] = "SNX";
|
|
2772
|
+
Token2["ARB"] = "ARB";
|
|
2773
|
+
Token2["AERO"] = "AERO";
|
|
2774
|
+
Token2["GMX"] = "GMX";
|
|
2775
|
+
return Token2;
|
|
2776
|
+
})(Token || {});
|
|
2777
|
+
var KNOWN_TOKENS = {
|
|
2778
|
+
// ── Core stables + wrapped ──────────────────────────────
|
|
2779
|
+
USDC: {
|
|
2780
|
+
symbol: "USDC",
|
|
2781
|
+
name: "USD Coin",
|
|
2782
|
+
decimals: 6,
|
|
2783
|
+
addresses: {
|
|
2784
|
+
8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
2785
|
+
84532: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
2786
|
+
42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
2787
|
+
421614: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"
|
|
2788
|
+
}
|
|
2789
|
+
},
|
|
2790
|
+
USDT: {
|
|
2791
|
+
symbol: "USDT",
|
|
2792
|
+
name: "Tether USD",
|
|
2793
|
+
decimals: 6,
|
|
2794
|
+
addresses: {
|
|
2795
|
+
8453: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
|
|
2796
|
+
84532: "0x323e78f944A9a1FcF3a10efcC5319DBb0bB6e673",
|
|
2797
|
+
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
2798
|
+
}
|
|
2799
|
+
},
|
|
2800
|
+
DAI: {
|
|
2801
|
+
symbol: "DAI",
|
|
2802
|
+
name: "Dai Stablecoin",
|
|
2803
|
+
decimals: 18,
|
|
2804
|
+
addresses: {
|
|
2805
|
+
8453: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
|
|
2806
|
+
84532: "0x819ffecd4e64f193e959944bcd57eedc7755e17a",
|
|
2807
|
+
42161: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"
|
|
2808
|
+
}
|
|
2809
|
+
},
|
|
2810
|
+
WETH: {
|
|
2811
|
+
symbol: "WETH",
|
|
2812
|
+
name: "Wrapped Ether",
|
|
2813
|
+
decimals: 18,
|
|
2814
|
+
addresses: {
|
|
2815
|
+
8453: "0x4200000000000000000000000000000000000006",
|
|
2816
|
+
84532: "0x4200000000000000000000000000000000000006",
|
|
2817
|
+
42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
2818
|
+
421614: "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73"
|
|
2819
|
+
}
|
|
2820
|
+
},
|
|
2821
|
+
WBTC: {
|
|
2822
|
+
symbol: "WBTC",
|
|
2823
|
+
name: "Wrapped BTC",
|
|
2824
|
+
decimals: 8,
|
|
2825
|
+
addresses: {
|
|
2826
|
+
8453: "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c",
|
|
2827
|
+
42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
|
|
2828
|
+
}
|
|
2829
|
+
},
|
|
2830
|
+
cbBTC: {
|
|
2831
|
+
symbol: "cbBTC",
|
|
2832
|
+
name: "Coinbase Wrapped BTC",
|
|
2833
|
+
decimals: 8,
|
|
2834
|
+
addresses: {
|
|
2835
|
+
8453: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
|
|
2836
|
+
42161: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf"
|
|
2837
|
+
}
|
|
2838
|
+
},
|
|
2839
|
+
// ── Liquid staking ──────────────────────────────────────
|
|
2840
|
+
cbETH: {
|
|
2841
|
+
symbol: "cbETH",
|
|
2842
|
+
name: "Coinbase Staked ETH",
|
|
2843
|
+
decimals: 18,
|
|
2844
|
+
addresses: {
|
|
2845
|
+
8453: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
|
|
2846
|
+
42161: "0x1DEBd73E752bEaF79865Fd6446b0c970EaE7732f"
|
|
2847
|
+
}
|
|
2848
|
+
},
|
|
2849
|
+
wstETH: {
|
|
2850
|
+
symbol: "wstETH",
|
|
2851
|
+
name: "Lido Wrapped stETH",
|
|
2852
|
+
decimals: 18,
|
|
2853
|
+
addresses: {
|
|
2854
|
+
8453: "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
|
|
2855
|
+
42161: "0x5979D7b546E38E414F7E9822514be443A4800529"
|
|
2856
|
+
}
|
|
2857
|
+
},
|
|
2858
|
+
rETH: {
|
|
2859
|
+
symbol: "rETH",
|
|
2860
|
+
name: "Rocket Pool ETH",
|
|
2861
|
+
decimals: 18,
|
|
2862
|
+
addresses: {
|
|
2863
|
+
42161: "0xEC70Dcb4A1EFa46b8F2D97C310C9c4790ba5ffA8"
|
|
2864
|
+
}
|
|
2865
|
+
},
|
|
2866
|
+
// ── DeFi blue-chips ─────────────────────────────────────
|
|
2867
|
+
LINK: {
|
|
2868
|
+
symbol: "LINK",
|
|
2869
|
+
name: "Chainlink",
|
|
2870
|
+
decimals: 18,
|
|
2871
|
+
addresses: {
|
|
2872
|
+
8453: "0x88Fb150BDc53A65fe94Dea0c9BA0a6dAf8C6e196",
|
|
2873
|
+
84532: "0xE4aB69C077896252FAFBD49EFD26B5D171A32410",
|
|
2874
|
+
42161: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4"
|
|
2875
|
+
}
|
|
2876
|
+
},
|
|
2877
|
+
UNI: {
|
|
2878
|
+
symbol: "UNI",
|
|
2879
|
+
name: "Uniswap",
|
|
2880
|
+
decimals: 18,
|
|
2881
|
+
addresses: {
|
|
2882
|
+
8453: "0xc3De830EA07524a0761646a6a4e4be0e114a3C83",
|
|
2883
|
+
42161: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0"
|
|
2884
|
+
}
|
|
2885
|
+
},
|
|
2886
|
+
AAVE: {
|
|
2887
|
+
symbol: "AAVE",
|
|
2888
|
+
name: "Aave",
|
|
2889
|
+
decimals: 18,
|
|
2890
|
+
addresses: {
|
|
2891
|
+
8453: "0x63706e401c06ac8513145b7687A14804d17f814b",
|
|
2892
|
+
42161: "0xba5DdD1f9d7F570dc94a51479a000E3BCE967196"
|
|
2893
|
+
}
|
|
2894
|
+
},
|
|
2895
|
+
COMP: {
|
|
2896
|
+
symbol: "COMP",
|
|
2897
|
+
name: "Compound",
|
|
2898
|
+
decimals: 18,
|
|
2899
|
+
addresses: {
|
|
2900
|
+
8453: "0x9e1028F5F1D5eDE59748FFceE5532509976840E0",
|
|
2901
|
+
42161: "0x354A6dA3fcde098F8389cad84b0182725c6C91dE"
|
|
2902
|
+
}
|
|
2903
|
+
},
|
|
2904
|
+
CRV: {
|
|
2905
|
+
symbol: "CRV",
|
|
2906
|
+
name: "Curve DAO",
|
|
2907
|
+
decimals: 18,
|
|
2908
|
+
addresses: {
|
|
2909
|
+
8453: "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415",
|
|
2910
|
+
42161: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978"
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
SNX: {
|
|
2914
|
+
symbol: "SNX",
|
|
2915
|
+
name: "Synthetix",
|
|
2916
|
+
decimals: 18,
|
|
2917
|
+
addresses: {
|
|
2918
|
+
8453: "0x22e6966B799c4D5B13BE962E1D117b56327FDa66"
|
|
2919
|
+
}
|
|
2920
|
+
},
|
|
2921
|
+
// ── Chain-native governance ─────────────────────────────
|
|
2922
|
+
ARB: {
|
|
2923
|
+
symbol: "ARB",
|
|
2924
|
+
name: "Arbitrum",
|
|
2925
|
+
decimals: 18,
|
|
2926
|
+
addresses: {
|
|
2927
|
+
42161: "0x912CE59144191C1204E64559FE8253a0e49E6548"
|
|
2928
|
+
}
|
|
2929
|
+
},
|
|
2930
|
+
AERO: {
|
|
2931
|
+
symbol: "AERO",
|
|
2932
|
+
name: "Aerodrome",
|
|
2933
|
+
decimals: 18,
|
|
2934
|
+
addresses: {
|
|
2935
|
+
8453: "0x940181a94A35A4569E4529A3CDfB74e38FD98631"
|
|
2936
|
+
}
|
|
2937
|
+
},
|
|
2938
|
+
GMX: {
|
|
2939
|
+
symbol: "GMX",
|
|
2940
|
+
name: "GMX",
|
|
2941
|
+
decimals: 18,
|
|
2942
|
+
addresses: {
|
|
2943
|
+
42161: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a"
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
};
|
|
2947
|
+
var addressToSymbol = /* @__PURE__ */ new Map();
|
|
2948
|
+
for (const token of Object.values(KNOWN_TOKENS)) {
|
|
2949
|
+
for (const addr of Object.values(token.addresses)) {
|
|
2950
|
+
addressToSymbol.set(addr.toLowerCase(), token.symbol);
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
function getKnownTokensForChain(chainId) {
|
|
2954
|
+
const result = [];
|
|
2955
|
+
for (const token of Object.values(KNOWN_TOKENS)) {
|
|
2956
|
+
const addr = token.addresses[chainId];
|
|
2957
|
+
if (addr) {
|
|
2958
|
+
result.push({ ...token, address: addr });
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
return result;
|
|
2962
|
+
}
|
|
2963
|
+
function getTokenSymbolByAddress(address) {
|
|
2964
|
+
return addressToSymbol.get(address.toLowerCase()) ?? null;
|
|
2965
|
+
}
|
|
2966
|
+
function resolveToken(token, chainId) {
|
|
2967
|
+
if (typeof token === "string" && token.startsWith("0x")) {
|
|
2968
|
+
if (token === "0x0000000000000000000000000000000000000000") {
|
|
2969
|
+
throw new Error("Token address cannot be the zero address");
|
|
2970
|
+
}
|
|
2971
|
+
return token;
|
|
2972
|
+
}
|
|
2973
|
+
const entry = KNOWN_TOKENS[token];
|
|
2974
|
+
if (!entry) {
|
|
2975
|
+
throw new Error(`Unknown token symbol: ${token}`);
|
|
2976
|
+
}
|
|
2977
|
+
const addr = entry.addresses[chainId];
|
|
2978
|
+
if (!addr) {
|
|
2979
|
+
throw new Error(`Token ${token} is not available on chain ${chainId}`);
|
|
2980
|
+
}
|
|
2981
|
+
return addr;
|
|
2982
|
+
}
|
|
2983
|
+
function resolveTokenDecimals(token, chainId) {
|
|
2984
|
+
if (typeof token === "string" && token.startsWith("0x")) {
|
|
2985
|
+
const symbol = getTokenSymbolByAddress(token);
|
|
2986
|
+
if (!symbol) {
|
|
2987
|
+
throw new Error(
|
|
2988
|
+
`Unknown token address ${token} \u2014 cannot determine decimals. Use a bigint amount instead, or pass a known token symbol.`
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
const entry2 = KNOWN_TOKENS[symbol];
|
|
2992
|
+
return entry2.decimals;
|
|
2993
|
+
}
|
|
2994
|
+
const entry = KNOWN_TOKENS[token];
|
|
2995
|
+
if (!entry) {
|
|
2996
|
+
throw new Error(
|
|
2997
|
+
`Unknown token symbol "${token}" \u2014 cannot determine decimals. Use a bigint amount instead, or use a known symbol (${Object.keys(KNOWN_TOKENS).join(", ")}).`
|
|
2998
|
+
);
|
|
2999
|
+
}
|
|
3000
|
+
return entry.decimals;
|
|
3001
|
+
}
|
|
3002
|
+
function parseAmount(amount, token, chainId) {
|
|
3003
|
+
if (typeof amount === "bigint") {
|
|
3004
|
+
return amount;
|
|
3005
|
+
}
|
|
3006
|
+
const decimals = resolveTokenDecimals(token);
|
|
3007
|
+
const str = typeof amount === "number" ? amount.toString() : amount;
|
|
3008
|
+
const dotIndex = str.indexOf(".");
|
|
3009
|
+
if (dotIndex !== -1) {
|
|
3010
|
+
const decimalPlaces = str.length - dotIndex - 1;
|
|
3011
|
+
if (decimalPlaces > decimals) {
|
|
3012
|
+
throw new Error(
|
|
3013
|
+
`Amount "${str}" has ${decimalPlaces} decimal places, but ${typeof token === "string" && token.startsWith("0x") ? "this token" : token} only supports ${decimals}. Truncate or round your amount.`
|
|
3014
|
+
);
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
return viem.parseUnits(str, decimals);
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
// src/utils.ts
|
|
3021
|
+
function generateUuid() {
|
|
3022
|
+
const bytes = new Uint8Array(16);
|
|
3023
|
+
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
3024
|
+
crypto.getRandomValues(bytes);
|
|
3025
|
+
} else {
|
|
3026
|
+
const { randomBytes } = __require("crypto");
|
|
3027
|
+
const buf = randomBytes(16);
|
|
3028
|
+
for (let i = 0; i < 16; i++) bytes[i] = buf[i] ?? 0;
|
|
3029
|
+
}
|
|
3030
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
3031
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
3032
|
+
const hex = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
3033
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
// src/x402.ts
|
|
3037
|
+
function parsePaymentRequired(headerValue) {
|
|
3038
|
+
let decoded;
|
|
3039
|
+
try {
|
|
3040
|
+
decoded = atob(headerValue);
|
|
3041
|
+
} catch {
|
|
3042
|
+
decoded = headerValue;
|
|
3043
|
+
}
|
|
3044
|
+
const parsed = JSON.parse(decoded);
|
|
3045
|
+
if (!parsed.accepts || !Array.isArray(parsed.accepts) || parsed.accepts.length === 0) {
|
|
3046
|
+
throw new Error("x402: no payment options in PAYMENT-REQUIRED header");
|
|
3047
|
+
}
|
|
3048
|
+
if (!parsed.resource) {
|
|
3049
|
+
throw new Error("x402: missing resource in PAYMENT-REQUIRED header");
|
|
3050
|
+
}
|
|
3051
|
+
return parsed;
|
|
3052
|
+
}
|
|
3053
|
+
function parseChainId(network) {
|
|
3054
|
+
const parts = network.split(":");
|
|
3055
|
+
if (parts.length !== 2 || parts[0] !== "eip155") {
|
|
3056
|
+
throw new Error(`x402: unsupported network format "${network}" (expected "eip155:<chainId>")`);
|
|
3057
|
+
}
|
|
3058
|
+
const chainId = parseInt(parts[1], 10);
|
|
3059
|
+
if (isNaN(chainId)) {
|
|
3060
|
+
throw new Error(`x402: invalid chain ID in network "${network}"`);
|
|
3061
|
+
}
|
|
3062
|
+
return chainId;
|
|
3063
|
+
}
|
|
3064
|
+
function findMatchingOption(accepts, chainId) {
|
|
3065
|
+
const matchingOptions = [];
|
|
3066
|
+
for (const option of accepts) {
|
|
3067
|
+
try {
|
|
3068
|
+
const optionChainId = parseChainId(option.network);
|
|
3069
|
+
if (optionChainId === chainId) {
|
|
3070
|
+
matchingOptions.push(option);
|
|
3071
|
+
}
|
|
3072
|
+
} catch {
|
|
3073
|
+
continue;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
if (matchingOptions.length === 0) return null;
|
|
3077
|
+
const usdcAddress = USDC[chainId]?.toLowerCase();
|
|
3078
|
+
if (usdcAddress) {
|
|
3079
|
+
const usdcOption = matchingOptions.find((opt) => opt.asset.toLowerCase() === usdcAddress);
|
|
3080
|
+
if (usdcOption) return usdcOption;
|
|
3081
|
+
}
|
|
3082
|
+
return matchingOptions[0] ?? null;
|
|
3083
|
+
}
|
|
3084
|
+
function extractX402Metadata(parsed, selectedOption) {
|
|
3085
|
+
const metadata = {};
|
|
3086
|
+
if (parsed.x402Version !== void 0) {
|
|
3087
|
+
metadata.x402_version = String(parsed.x402Version);
|
|
3088
|
+
}
|
|
3089
|
+
if (selectedOption.scheme) {
|
|
3090
|
+
metadata.x402_scheme = selectedOption.scheme;
|
|
3091
|
+
}
|
|
3092
|
+
if (parsed.resource.mimeType) {
|
|
3093
|
+
metadata.x402_mime_type = parsed.resource.mimeType;
|
|
3094
|
+
}
|
|
3095
|
+
if (selectedOption.payTo) {
|
|
3096
|
+
metadata.x402_merchant = selectedOption.payTo;
|
|
3097
|
+
}
|
|
3098
|
+
if (parsed.resource.description) {
|
|
3099
|
+
metadata.x402_resource_description = parsed.resource.description;
|
|
3100
|
+
}
|
|
3101
|
+
return {
|
|
3102
|
+
resourceUrl: parsed.resource.url,
|
|
3103
|
+
memo: parsed.resource.description ?? null,
|
|
3104
|
+
recipientLabel: selectedOption.payTo ? `${selectedOption.payTo.slice(0, 6)}...${selectedOption.payTo.slice(-4)}` : null,
|
|
3105
|
+
metadata
|
|
3106
|
+
};
|
|
3107
|
+
}
|
|
3108
|
+
function formatPaymentSignature(payload) {
|
|
3109
|
+
const json = JSON.stringify(payload);
|
|
3110
|
+
return btoa(json);
|
|
3111
|
+
}
|
|
3112
|
+
var USDC_EIP712_DOMAIN = {
|
|
3113
|
+
// Base mainnet
|
|
3114
|
+
8453: { name: "USD Coin", version: "2" },
|
|
3115
|
+
// Base Sepolia
|
|
3116
|
+
84532: { name: "USDC", version: "2" },
|
|
3117
|
+
// Arbitrum One
|
|
3118
|
+
42161: { name: "USD Coin", version: "2" },
|
|
3119
|
+
// Arbitrum Sepolia (same as mainnet convention)
|
|
3120
|
+
421614: { name: "USDC", version: "2" }
|
|
3121
|
+
};
|
|
3122
|
+
var TRANSFER_WITH_AUTHORIZATION_TYPES = {
|
|
3123
|
+
TransferWithAuthorization: [
|
|
3124
|
+
{ name: "from", type: "address" },
|
|
3125
|
+
{ name: "to", type: "address" },
|
|
3126
|
+
{ name: "value", type: "uint256" },
|
|
3127
|
+
{ name: "validAfter", type: "uint256" },
|
|
3128
|
+
{ name: "validBefore", type: "uint256" },
|
|
3129
|
+
{ name: "nonce", type: "bytes32" }
|
|
3130
|
+
]
|
|
3131
|
+
};
|
|
3132
|
+
function randomNonce() {
|
|
3133
|
+
const bytes = new Uint8Array(32);
|
|
3134
|
+
crypto.getRandomValues(bytes);
|
|
3135
|
+
return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
3136
|
+
}
|
|
3137
|
+
async function signTransferWithAuthorization(privateKey, chainId, auth) {
|
|
3138
|
+
const domainConfig = USDC_EIP712_DOMAIN[chainId];
|
|
3139
|
+
if (!domainConfig) {
|
|
3140
|
+
throw new Error(`EIP-3009 not configured for chain ${chainId}`);
|
|
3141
|
+
}
|
|
3142
|
+
const usdcAddress = USDC[chainId];
|
|
3143
|
+
if (!usdcAddress) {
|
|
3144
|
+
throw new Error(`USDC address not known for chain ${chainId}`);
|
|
3145
|
+
}
|
|
3146
|
+
const account = accounts.privateKeyToAccount(privateKey);
|
|
3147
|
+
return account.signTypedData({
|
|
3148
|
+
domain: {
|
|
3149
|
+
name: domainConfig.name,
|
|
3150
|
+
version: domainConfig.version,
|
|
3151
|
+
chainId,
|
|
3152
|
+
verifyingContract: usdcAddress
|
|
3153
|
+
},
|
|
3154
|
+
types: TRANSFER_WITH_AUTHORIZATION_TYPES,
|
|
3155
|
+
primaryType: "TransferWithAuthorization",
|
|
3156
|
+
message: {
|
|
3157
|
+
from: auth.from,
|
|
3158
|
+
to: auth.to,
|
|
3159
|
+
value: auth.value,
|
|
3160
|
+
validAfter: auth.validAfter,
|
|
3161
|
+
validBefore: auth.validBefore,
|
|
3162
|
+
nonce: auth.nonce
|
|
3163
|
+
}
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
3167
|
+
var X402_PROXY_ADDRESS = "0x4020CD856C882D5fb903D99CE35316A085Bb0001";
|
|
3168
|
+
var WITNESS_TYPE_STRING = "TransferDetails witness)TokenPermissions(address token,uint256 amount)TransferDetails(address to,uint256 requestedAmount)";
|
|
3169
|
+
var PERMIT_WITNESS_TRANSFER_FROM_TYPES = {
|
|
3170
|
+
PermitWitnessTransferFrom: [
|
|
3171
|
+
{ name: "permitted", type: "TokenPermissions" },
|
|
3172
|
+
{ name: "spender", type: "address" },
|
|
3173
|
+
{ name: "nonce", type: "uint256" },
|
|
3174
|
+
{ name: "deadline", type: "uint256" },
|
|
3175
|
+
{ name: "witness", type: "TransferDetails" }
|
|
3176
|
+
],
|
|
3177
|
+
TokenPermissions: [
|
|
3178
|
+
{ name: "token", type: "address" },
|
|
3179
|
+
{ name: "amount", type: "uint256" }
|
|
3180
|
+
],
|
|
3181
|
+
TransferDetails: [
|
|
3182
|
+
{ name: "to", type: "address" },
|
|
3183
|
+
{ name: "requestedAmount", type: "uint256" }
|
|
3184
|
+
]
|
|
3185
|
+
};
|
|
3186
|
+
function randomPermit2Nonce() {
|
|
3187
|
+
const bytes = new Uint8Array(32);
|
|
3188
|
+
crypto.getRandomValues(bytes);
|
|
3189
|
+
let n = 0n;
|
|
3190
|
+
for (const b of bytes) {
|
|
3191
|
+
n = n << 8n | BigInt(b);
|
|
3192
|
+
}
|
|
3193
|
+
return n;
|
|
3194
|
+
}
|
|
3195
|
+
async function signPermit2WitnessTransfer(privateKey, chainId, permit) {
|
|
3196
|
+
const account = accounts.privateKeyToAccount(privateKey);
|
|
3197
|
+
return account.signTypedData({
|
|
3198
|
+
domain: {
|
|
3199
|
+
name: "Permit2",
|
|
3200
|
+
chainId,
|
|
3201
|
+
verifyingContract: PERMIT2_ADDRESS
|
|
3202
|
+
},
|
|
3203
|
+
types: PERMIT_WITNESS_TRANSFER_FROM_TYPES,
|
|
3204
|
+
primaryType: "PermitWitnessTransferFrom",
|
|
3205
|
+
message: {
|
|
3206
|
+
permitted: {
|
|
3207
|
+
token: permit.token,
|
|
3208
|
+
amount: permit.amount
|
|
3209
|
+
},
|
|
3210
|
+
spender: permit.spender,
|
|
3211
|
+
nonce: permit.nonce,
|
|
3212
|
+
deadline: permit.deadline,
|
|
3213
|
+
witness: {
|
|
3214
|
+
to: permit.witnessTo,
|
|
3215
|
+
requestedAmount: permit.witnessRequestedAmount
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
});
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
// src/client.ts
|
|
3222
|
+
var AxonClient = class {
|
|
3223
|
+
constructor(config) {
|
|
3224
|
+
// ============================================================================
|
|
3225
|
+
// x402 — HTTP 402 Payment Required
|
|
3226
|
+
// ============================================================================
|
|
3227
|
+
/**
|
|
3228
|
+
* x402 utilities for handling HTTP 402 Payment Required responses.
|
|
3229
|
+
*
|
|
3230
|
+
* The x402 flow:
|
|
3231
|
+
* 1. Bot hits an API that returns HTTP 402 + PAYMENT-REQUIRED header
|
|
3232
|
+
* 2. SDK parses the header, finds a matching payment option
|
|
3233
|
+
* 3. SDK funds the bot's EOA from the vault (full Axon pipeline applies)
|
|
3234
|
+
* 4. Bot signs an EIP-3009 or Permit2 authorization
|
|
3235
|
+
* 5. SDK returns a PAYMENT-SIGNATURE header for the bot to retry with
|
|
3236
|
+
*
|
|
3237
|
+
* @example
|
|
3238
|
+
* ```ts
|
|
3239
|
+
* const response = await fetch('https://api.example.com/data');
|
|
3240
|
+
* if (response.status === 402) {
|
|
3241
|
+
* const result = await client.x402.handlePaymentRequired(response.headers);
|
|
3242
|
+
* const data = await fetch('https://api.example.com/data', {
|
|
3243
|
+
* headers: { 'PAYMENT-SIGNATURE': result.paymentSignature },
|
|
3244
|
+
* });
|
|
3245
|
+
* }
|
|
3246
|
+
* ```
|
|
3247
|
+
*/
|
|
3248
|
+
this.x402 = {
|
|
3249
|
+
/**
|
|
3250
|
+
* Fund the bot's EOA from the vault for x402 settlement.
|
|
3251
|
+
*
|
|
3252
|
+
* This is a regular Axon payment (to = bot's own address) that goes through
|
|
3253
|
+
* the full pipeline: policy engine, AI scan, human review if needed.
|
|
3254
|
+
*
|
|
3255
|
+
* @param amount - Amount in token base units
|
|
3256
|
+
* @param token - Token address (defaults to USDC on this chain)
|
|
3257
|
+
* @param metadata - Optional metadata for the payment record
|
|
3258
|
+
*/
|
|
3259
|
+
fund: async (amount, token, metadata) => {
|
|
3260
|
+
const tokenAddress = token ?? USDC[this.chainId];
|
|
3261
|
+
if (!tokenAddress) {
|
|
3262
|
+
throw new Error(`No default USDC address for chain ${this.chainId}`);
|
|
3263
|
+
}
|
|
3264
|
+
return this.pay({
|
|
3265
|
+
to: this.botAddress,
|
|
3266
|
+
token: tokenAddress,
|
|
3267
|
+
amount,
|
|
3268
|
+
x402Funding: true,
|
|
3269
|
+
...metadata
|
|
3270
|
+
});
|
|
3271
|
+
},
|
|
3272
|
+
/**
|
|
3273
|
+
* Handle a full x402 flow: parse header, fund bot, sign authorization, return header.
|
|
3274
|
+
*
|
|
3275
|
+
* Supports both EIP-3009 (USDC) and Permit2 (any ERC-20) settlement.
|
|
3276
|
+
* The bot's EOA is funded from the vault first (full Axon pipeline applies).
|
|
3277
|
+
*
|
|
3278
|
+
* @param headers - Response headers from the 402 response (must contain PAYMENT-REQUIRED)
|
|
3279
|
+
* @param maxTimeoutMs - Maximum time to wait for pending_review resolution (default: 120s)
|
|
3280
|
+
* @param pollIntervalMs - Polling interval for pending_review (default: 5s)
|
|
3281
|
+
* @returns Payment signature header value + funding details
|
|
3282
|
+
*/
|
|
3283
|
+
handlePaymentRequired: async (headers, maxTimeoutMs = 12e4, pollIntervalMs = 5e3) => {
|
|
3284
|
+
const headerValue = headers instanceof Headers ? headers.get("payment-required") ?? headers.get("PAYMENT-REQUIRED") : headers["payment-required"] ?? headers["PAYMENT-REQUIRED"];
|
|
3285
|
+
if (!headerValue) {
|
|
3286
|
+
throw new Error("x402: no PAYMENT-REQUIRED header found");
|
|
3287
|
+
}
|
|
3288
|
+
const parsed = parsePaymentRequired(headerValue);
|
|
3289
|
+
const option = findMatchingOption(parsed.accepts, this.chainId);
|
|
3290
|
+
if (!option) {
|
|
3291
|
+
throw new Error(
|
|
3292
|
+
`x402: no payment option matches chain ${this.chainId}. Available: ${parsed.accepts.map((a) => a.network).join(", ")}`
|
|
3293
|
+
);
|
|
3294
|
+
}
|
|
3295
|
+
const x402Meta = extractX402Metadata(parsed, option);
|
|
3296
|
+
const amount = BigInt(option.amount);
|
|
3297
|
+
const tokenAddress = option.asset;
|
|
3298
|
+
const payInput = {
|
|
3299
|
+
to: this.botAddress,
|
|
3300
|
+
token: tokenAddress,
|
|
3301
|
+
amount,
|
|
3302
|
+
x402Funding: true,
|
|
3303
|
+
resourceUrl: x402Meta.resourceUrl,
|
|
3304
|
+
metadata: x402Meta.metadata
|
|
3305
|
+
};
|
|
3306
|
+
if (x402Meta.memo) payInput.memo = x402Meta.memo;
|
|
3307
|
+
if (x402Meta.recipientLabel) payInput.recipientLabel = x402Meta.recipientLabel;
|
|
3308
|
+
let fundingResult = await this.pay(payInput);
|
|
3309
|
+
if (fundingResult.status === "pending_review") {
|
|
3310
|
+
const deadline = Date.now() + maxTimeoutMs;
|
|
3311
|
+
while (fundingResult.status === "pending_review" && Date.now() < deadline) {
|
|
3312
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
3313
|
+
fundingResult = await this.poll(fundingResult.requestId);
|
|
3314
|
+
}
|
|
3315
|
+
if (fundingResult.status === "pending_review") {
|
|
3316
|
+
throw new Error(`x402: funding timed out after ${maxTimeoutMs}ms (still pending_review)`);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
if (fundingResult.status === "rejected") {
|
|
3320
|
+
throw new Error(`x402: funding rejected \u2014 ${fundingResult.reason ?? "unknown reason"}`);
|
|
3321
|
+
}
|
|
3322
|
+
const botPrivateKey = this.botPrivateKey;
|
|
3323
|
+
const payTo = option.payTo;
|
|
3324
|
+
const usdcAddress = USDC[this.chainId]?.toLowerCase();
|
|
3325
|
+
const isUsdc = tokenAddress.toLowerCase() === usdcAddress;
|
|
3326
|
+
let signaturePayload;
|
|
3327
|
+
if (isUsdc && USDC_EIP712_DOMAIN[this.chainId]) {
|
|
3328
|
+
const nonce = randomNonce();
|
|
3329
|
+
const validAfter = 0n;
|
|
3330
|
+
const validBefore = BigInt(Math.floor(Date.now() / 1e3) + 300);
|
|
3331
|
+
const sig = await signTransferWithAuthorization(botPrivateKey, this.chainId, {
|
|
3332
|
+
from: this.botAddress,
|
|
3333
|
+
to: payTo,
|
|
3334
|
+
value: amount,
|
|
3335
|
+
validAfter,
|
|
3336
|
+
validBefore,
|
|
3337
|
+
nonce
|
|
3338
|
+
});
|
|
3339
|
+
signaturePayload = {
|
|
3340
|
+
scheme: "exact",
|
|
3341
|
+
signature: sig,
|
|
3342
|
+
authorization: {
|
|
3343
|
+
from: this.botAddress,
|
|
3344
|
+
to: payTo,
|
|
3345
|
+
value: amount.toString(),
|
|
3346
|
+
validAfter: validAfter.toString(),
|
|
3347
|
+
validBefore: validBefore.toString(),
|
|
3348
|
+
nonce
|
|
3349
|
+
}
|
|
3350
|
+
};
|
|
3351
|
+
} else {
|
|
3352
|
+
const nonce = randomPermit2Nonce();
|
|
3353
|
+
const deadline = BigInt(Math.floor(Date.now() / 1e3) + 300);
|
|
3354
|
+
const sig = await signPermit2WitnessTransfer(botPrivateKey, this.chainId, {
|
|
3355
|
+
token: tokenAddress,
|
|
3356
|
+
amount,
|
|
3357
|
+
spender: X402_PROXY_ADDRESS,
|
|
3358
|
+
nonce,
|
|
3359
|
+
deadline,
|
|
3360
|
+
witnessTo: payTo,
|
|
3361
|
+
witnessRequestedAmount: amount
|
|
3362
|
+
});
|
|
3363
|
+
signaturePayload = {
|
|
3364
|
+
scheme: "permit2",
|
|
3365
|
+
signature: sig,
|
|
3366
|
+
permit: {
|
|
3367
|
+
permitted: { token: tokenAddress, amount: amount.toString() },
|
|
3368
|
+
spender: X402_PROXY_ADDRESS,
|
|
3369
|
+
nonce: nonce.toString(),
|
|
3370
|
+
deadline: deadline.toString()
|
|
3371
|
+
},
|
|
3372
|
+
witness: {
|
|
3373
|
+
to: payTo,
|
|
3374
|
+
requestedAmount: amount.toString()
|
|
3375
|
+
}
|
|
3376
|
+
};
|
|
3377
|
+
}
|
|
3378
|
+
const paymentSignature = formatPaymentSignature(signaturePayload);
|
|
3379
|
+
const handleResult = {
|
|
3380
|
+
paymentSignature,
|
|
3381
|
+
selectedOption: option,
|
|
3382
|
+
fundingResult: {
|
|
3383
|
+
requestId: fundingResult.requestId,
|
|
3384
|
+
status: fundingResult.status
|
|
3385
|
+
}
|
|
3386
|
+
};
|
|
3387
|
+
if (fundingResult.txHash) {
|
|
3388
|
+
handleResult.fundingResult.txHash = fundingResult.txHash;
|
|
3389
|
+
}
|
|
3390
|
+
return handleResult;
|
|
3391
|
+
}
|
|
3392
|
+
};
|
|
3393
|
+
this.vaultAddress = config.vaultAddress;
|
|
3394
|
+
this.chainId = config.chainId;
|
|
3395
|
+
this.relayerUrl = config.relayerUrl ?? "https://relay.axonfi.xyz";
|
|
3396
|
+
if (!config.botPrivateKey) {
|
|
3397
|
+
throw new Error("botPrivateKey is required in AxonClientConfig");
|
|
3398
|
+
}
|
|
3399
|
+
this.botPrivateKey = config.botPrivateKey;
|
|
3400
|
+
this.walletClient = createAxonWalletClient(config.botPrivateKey, config.chainId);
|
|
3401
|
+
}
|
|
3402
|
+
// ============================================================================
|
|
3403
|
+
// Bot address
|
|
3404
|
+
// ============================================================================
|
|
3405
|
+
/** Returns the bot's address derived from the configured private key. */
|
|
3406
|
+
get botAddress() {
|
|
3407
|
+
const account = this.walletClient.account;
|
|
3408
|
+
if (!account) throw new Error("No account on walletClient");
|
|
3409
|
+
return account.address;
|
|
3410
|
+
}
|
|
3411
|
+
// ============================================================================
|
|
3412
|
+
// pay()
|
|
3413
|
+
// ============================================================================
|
|
3414
|
+
/**
|
|
3415
|
+
* Create, sign, and submit a payment intent to the Axon relayer.
|
|
3416
|
+
*
|
|
3417
|
+
* Three possible outcomes (all included in PaymentResult.status):
|
|
3418
|
+
* - `"approved"`: fast path — txHash available immediately
|
|
3419
|
+
* - `"pending_review"`: AI scan or human review in progress — poll for status
|
|
3420
|
+
* - `"rejected"`: payment was rejected — reason field explains why
|
|
3421
|
+
*/
|
|
3422
|
+
async pay(input) {
|
|
3423
|
+
const intent = this._buildPaymentIntent(input);
|
|
3424
|
+
const signature = await signPayment(this.walletClient, this.vaultAddress, this.chainId, intent);
|
|
3425
|
+
return this._submitPayment(intent, signature, input);
|
|
3426
|
+
}
|
|
3427
|
+
// ============================================================================
|
|
3428
|
+
// execute()
|
|
3429
|
+
// ============================================================================
|
|
3430
|
+
/**
|
|
3431
|
+
* Sign and submit a DeFi protocol execution to the Axon relayer.
|
|
3432
|
+
*
|
|
3433
|
+
* The vault approves `token` to `protocol`, calls it with `callData`,
|
|
3434
|
+
* then revokes the approval. Tokens stay in the vault or go to the protocol
|
|
3435
|
+
* as specified by the calldata.
|
|
3436
|
+
*/
|
|
3437
|
+
async execute(input) {
|
|
3438
|
+
const intent = this._buildExecuteIntent(input);
|
|
3439
|
+
const signature = await signExecuteIntent(this.walletClient, this.vaultAddress, this.chainId, intent);
|
|
3440
|
+
return this._submitExecute(intent, signature, input);
|
|
3441
|
+
}
|
|
3442
|
+
// ============================================================================
|
|
3443
|
+
// swap()
|
|
3444
|
+
// ============================================================================
|
|
3445
|
+
/**
|
|
3446
|
+
* Sign and submit an in-vault token swap to the Axon relayer.
|
|
3447
|
+
*
|
|
3448
|
+
* Swaps tokens within the vault (no external recipient). Useful for
|
|
3449
|
+
* rebalancing vault holdings.
|
|
3450
|
+
*/
|
|
3451
|
+
async swap(input) {
|
|
3452
|
+
const intent = this._buildSwapIntent(input);
|
|
3453
|
+
const signature = await signSwapIntent(this.walletClient, this.vaultAddress, this.chainId, intent);
|
|
3454
|
+
return this._submitSwap(intent, signature, input);
|
|
3455
|
+
}
|
|
3456
|
+
// ============================================================================
|
|
3457
|
+
// getBalance() — via relayer
|
|
3458
|
+
// ============================================================================
|
|
3459
|
+
/** Read the vault's ERC-20 balance for a given token (via relayer). */
|
|
3460
|
+
async getBalance(token) {
|
|
3461
|
+
const path = RELAYER_API.vaultBalance(this.vaultAddress, token, this.chainId);
|
|
3462
|
+
const data = await this._get(path);
|
|
3463
|
+
return BigInt(data.balance);
|
|
3464
|
+
}
|
|
3465
|
+
// ============================================================================
|
|
3466
|
+
// getBalances() — via relayer
|
|
3467
|
+
// ============================================================================
|
|
3468
|
+
/**
|
|
3469
|
+
* Read the vault's ERC-20 balances for multiple tokens in a single call (via relayer).
|
|
3470
|
+
* Returns a record mapping token address → balance.
|
|
3471
|
+
*/
|
|
3472
|
+
async getBalances(tokens) {
|
|
3473
|
+
const path = RELAYER_API.vaultBalances(this.vaultAddress, this.chainId);
|
|
3474
|
+
const url = `${this.relayerUrl}${path}?chainId=${this.chainId}&tokens=${tokens.join(",")}`;
|
|
3475
|
+
const response = await fetch(url, {
|
|
3476
|
+
method: "GET",
|
|
3477
|
+
headers: { "Content-Type": "application/json" }
|
|
3478
|
+
});
|
|
3479
|
+
if (!response.ok) {
|
|
3480
|
+
const body = await response.text();
|
|
3481
|
+
throw new Error(`Relayer request failed [${response.status}]: ${body}`);
|
|
3482
|
+
}
|
|
3483
|
+
const data = await response.json();
|
|
3484
|
+
const result = {};
|
|
3485
|
+
for (const [addr, val] of Object.entries(data.balances)) {
|
|
3486
|
+
result[addr] = BigInt(val);
|
|
3487
|
+
}
|
|
3488
|
+
return result;
|
|
3489
|
+
}
|
|
3490
|
+
// ============================================================================
|
|
3491
|
+
// isActive() — via relayer
|
|
3492
|
+
// ============================================================================
|
|
3493
|
+
/** Returns whether this bot is registered and active in the vault (via relayer). */
|
|
3494
|
+
async isActive() {
|
|
3495
|
+
const path = RELAYER_API.botStatus(this.vaultAddress, this.botAddress, this.chainId);
|
|
3496
|
+
const data = await this._get(path);
|
|
3497
|
+
return data.isActive;
|
|
3498
|
+
}
|
|
3499
|
+
// ============================================================================
|
|
3500
|
+
// isPaused() — via relayer
|
|
3501
|
+
// ============================================================================
|
|
3502
|
+
/** Returns whether the vault is currently paused (via relayer). */
|
|
3503
|
+
async isPaused() {
|
|
3504
|
+
const path = RELAYER_API.vaultInfo(this.vaultAddress, this.chainId);
|
|
3505
|
+
const data = await this._get(path);
|
|
3506
|
+
return data.paused;
|
|
3507
|
+
}
|
|
3508
|
+
// ============================================================================
|
|
3509
|
+
// getVaultInfo() — via relayer
|
|
3510
|
+
// ============================================================================
|
|
3511
|
+
/** Returns high-level vault info (owner, operator, paused, version) via relayer. */
|
|
3512
|
+
async getVaultInfo() {
|
|
3513
|
+
const path = RELAYER_API.vaultInfo(this.vaultAddress, this.chainId);
|
|
3514
|
+
return this._get(path);
|
|
3515
|
+
}
|
|
3516
|
+
// ============================================================================
|
|
3517
|
+
// canPayTo() — via relayer
|
|
3518
|
+
// ============================================================================
|
|
3519
|
+
/**
|
|
3520
|
+
* Check whether this bot can pay to a given destination address (via relayer).
|
|
3521
|
+
* Checks blacklist → global whitelist → bot whitelist, matching on-chain logic.
|
|
3522
|
+
*/
|
|
3523
|
+
async canPayTo(destination) {
|
|
3524
|
+
const path = RELAYER_API.destinationCheck(this.vaultAddress, this.botAddress, destination, this.chainId);
|
|
3525
|
+
return this._get(path);
|
|
3526
|
+
}
|
|
3527
|
+
// ============================================================================
|
|
3528
|
+
// isProtocolApproved() — via relayer
|
|
3529
|
+
// ============================================================================
|
|
3530
|
+
/** Returns whether a protocol address is approved for executeProtocol() calls (via relayer). */
|
|
3531
|
+
async isProtocolApproved(protocol) {
|
|
3532
|
+
const path = RELAYER_API.protocolCheck(this.vaultAddress, protocol, this.chainId);
|
|
3533
|
+
const data = await this._get(path);
|
|
3534
|
+
return data.approved;
|
|
3535
|
+
}
|
|
3536
|
+
// ============================================================================
|
|
3537
|
+
// getRebalanceTokens() — via relayer
|
|
3538
|
+
// ============================================================================
|
|
3539
|
+
/**
|
|
3540
|
+
* Returns the effective rebalance token whitelist for this vault.
|
|
3541
|
+
*
|
|
3542
|
+
* If the owner set tokens on-chain, those override entirely.
|
|
3543
|
+
* If no on-chain whitelist, returns relayer defaults (USDC, WETH, USDT).
|
|
3544
|
+
* Use this before calling swap() to check which output tokens are allowed.
|
|
3545
|
+
*/
|
|
3546
|
+
async getRebalanceTokens() {
|
|
3547
|
+
const path = RELAYER_API.rebalanceTokens(this.vaultAddress, this.chainId);
|
|
3548
|
+
return this._get(path);
|
|
3549
|
+
}
|
|
3550
|
+
// ============================================================================
|
|
3551
|
+
// isRebalanceTokenAllowed() — via relayer
|
|
3552
|
+
// ============================================================================
|
|
3553
|
+
/** Check if a specific token is allowed for rebalancing (executeSwap output) on this vault. */
|
|
3554
|
+
async isRebalanceTokenAllowed(token) {
|
|
3555
|
+
const path = RELAYER_API.rebalanceTokenCheck(this.vaultAddress, token, this.chainId);
|
|
3556
|
+
return this._get(path);
|
|
3557
|
+
}
|
|
3558
|
+
// ============================================================================
|
|
3559
|
+
// TOS (Terms of Service)
|
|
3560
|
+
// ============================================================================
|
|
3561
|
+
/** Check if a wallet has accepted the current TOS version. */
|
|
3562
|
+
async getTosStatus(wallet) {
|
|
3563
|
+
return this._get(RELAYER_API.tosStatus(wallet));
|
|
3564
|
+
}
|
|
3565
|
+
/**
|
|
3566
|
+
* Sign and submit TOS acceptance. Uses the owner's wallet (not the bot key).
|
|
3567
|
+
*
|
|
3568
|
+
* @param signer - Object with a `signMessage` method (e.g. a viem WalletClient
|
|
3569
|
+
* or ethers Signer). This should be the vault owner's wallet, not the bot key.
|
|
3570
|
+
* @param wallet - The owner's wallet address (must match the signer).
|
|
3571
|
+
*/
|
|
3572
|
+
async acceptTos(signer, wallet) {
|
|
3573
|
+
const { tosVersion } = await this.getTosStatus(wallet);
|
|
3574
|
+
const timestamp = Math.floor(Date.now() / 1e3);
|
|
3575
|
+
const message = `I accept the Axon Terms of Service (${tosVersion}).
|
|
3576
|
+
Wallet: ${wallet}
|
|
3577
|
+
Timestamp: ${timestamp}`;
|
|
3578
|
+
const signature = await signer.signMessage({ message });
|
|
3579
|
+
const url = `${this.relayerUrl}${RELAYER_API.TOS_ACCEPT}`;
|
|
3580
|
+
const response = await fetch(url, {
|
|
3581
|
+
method: "POST",
|
|
3582
|
+
headers: { "Content-Type": "application/json" },
|
|
3583
|
+
body: JSON.stringify({ wallet, signature, tosVersion, timestamp })
|
|
3584
|
+
});
|
|
3585
|
+
if (!response.ok) {
|
|
3586
|
+
const body = await response.text();
|
|
3587
|
+
throw new Error(`TOS acceptance failed [${response.status}]: ${body}`);
|
|
3588
|
+
}
|
|
3589
|
+
return response.json();
|
|
3590
|
+
}
|
|
3591
|
+
// ============================================================================
|
|
3592
|
+
// poll() / pollExecute() / pollSwap()
|
|
3593
|
+
// ============================================================================
|
|
3594
|
+
/**
|
|
3595
|
+
* Poll the relayer for the status of an async payment.
|
|
3596
|
+
*
|
|
3597
|
+
* Use this when pay() returns `status: "pending_review"`. Poll until
|
|
3598
|
+
* status is `"approved"` or `"rejected"`.
|
|
3599
|
+
*
|
|
3600
|
+
* Recommended polling interval: 5–10 seconds.
|
|
3601
|
+
*/
|
|
3602
|
+
async poll(requestId) {
|
|
3603
|
+
return this._get(RELAYER_API.payment(requestId));
|
|
3604
|
+
}
|
|
3605
|
+
/** Poll the relayer for the status of an async protocol execution. */
|
|
3606
|
+
async pollExecute(requestId) {
|
|
3607
|
+
return this._get(RELAYER_API.execute(requestId));
|
|
3608
|
+
}
|
|
3609
|
+
/** Poll the relayer for the status of an async swap. */
|
|
3610
|
+
async pollSwap(requestId) {
|
|
3611
|
+
return this._get(RELAYER_API.swap(requestId));
|
|
3612
|
+
}
|
|
3613
|
+
// ============================================================================
|
|
3614
|
+
// signPayment() — low-level access
|
|
3615
|
+
// ============================================================================
|
|
3616
|
+
/**
|
|
3617
|
+
* Sign a PaymentIntent directly without submitting to the relayer.
|
|
3618
|
+
*
|
|
3619
|
+
* Use this if you want to build the intent yourself and pass the signature
|
|
3620
|
+
* to another system (e.g. a custom relayer integration).
|
|
3621
|
+
*/
|
|
3622
|
+
async signPayment(intent) {
|
|
3623
|
+
return signPayment(this.walletClient, this.vaultAddress, this.chainId, intent);
|
|
3624
|
+
}
|
|
3625
|
+
// ============================================================================
|
|
3626
|
+
// Internal helpers
|
|
3627
|
+
// ============================================================================
|
|
3628
|
+
async _get(path) {
|
|
3629
|
+
const url = `${this.relayerUrl}${path}`;
|
|
3630
|
+
const response = await fetch(url, {
|
|
3631
|
+
method: "GET",
|
|
3632
|
+
headers: { "Content-Type": "application/json" }
|
|
3633
|
+
});
|
|
3634
|
+
if (!response.ok) {
|
|
3635
|
+
const body = await response.text();
|
|
3636
|
+
throw new Error(`Relayer request failed [${response.status}]: ${body}`);
|
|
3637
|
+
}
|
|
3638
|
+
return response.json();
|
|
3639
|
+
}
|
|
3640
|
+
_defaultDeadline() {
|
|
3641
|
+
return BigInt(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE_SECONDS);
|
|
3642
|
+
}
|
|
3643
|
+
_resolveRef(memo, ref) {
|
|
3644
|
+
if (ref) return ref;
|
|
3645
|
+
if (memo) return encodeRef(memo);
|
|
3646
|
+
return "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
3647
|
+
}
|
|
3648
|
+
_buildPaymentIntent(input) {
|
|
3649
|
+
if (input.to === "0x0000000000000000000000000000000000000000") {
|
|
3650
|
+
throw new Error("Payment recipient cannot be the zero address");
|
|
3651
|
+
}
|
|
3652
|
+
return {
|
|
3653
|
+
bot: this.botAddress,
|
|
3654
|
+
to: input.to,
|
|
3655
|
+
token: resolveToken(input.token, this.chainId),
|
|
3656
|
+
amount: parseAmount(input.amount, input.token, this.chainId),
|
|
3657
|
+
deadline: input.deadline ?? this._defaultDeadline(),
|
|
3658
|
+
ref: this._resolveRef(input.memo, input.ref)
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3661
|
+
_buildExecuteIntent(input) {
|
|
3662
|
+
return {
|
|
3663
|
+
bot: this.botAddress,
|
|
3664
|
+
protocol: input.protocol,
|
|
3665
|
+
calldataHash: viem.keccak256(input.callData),
|
|
3666
|
+
token: resolveToken(input.token, this.chainId),
|
|
3667
|
+
amount: parseAmount(input.amount, input.token, this.chainId),
|
|
3668
|
+
deadline: input.deadline ?? this._defaultDeadline(),
|
|
3669
|
+
ref: this._resolveRef(input.memo, input.ref)
|
|
3670
|
+
};
|
|
3671
|
+
}
|
|
3672
|
+
_buildSwapIntent(input) {
|
|
3673
|
+
return {
|
|
3674
|
+
bot: this.botAddress,
|
|
3675
|
+
toToken: resolveToken(input.toToken, this.chainId),
|
|
3676
|
+
minToAmount: parseAmount(input.minToAmount, input.toToken, this.chainId),
|
|
3677
|
+
deadline: input.deadline ?? this._defaultDeadline(),
|
|
3678
|
+
ref: this._resolveRef(input.memo, input.ref)
|
|
3679
|
+
};
|
|
3680
|
+
}
|
|
3681
|
+
async _submitPayment(intent, signature, input) {
|
|
3682
|
+
const idempotencyKey = input.idempotencyKey ?? generateUuid();
|
|
3683
|
+
const body = {
|
|
3684
|
+
// Routing
|
|
3685
|
+
chainId: this.chainId,
|
|
3686
|
+
vaultAddress: this.vaultAddress,
|
|
3687
|
+
// Flat intent fields (matches relayer DTO)
|
|
3688
|
+
bot: intent.bot,
|
|
3689
|
+
to: intent.to,
|
|
3690
|
+
token: intent.token,
|
|
3691
|
+
amount: intent.amount.toString(),
|
|
3692
|
+
deadline: intent.deadline.toString(),
|
|
3693
|
+
ref: intent.ref,
|
|
3694
|
+
signature,
|
|
3695
|
+
// Off-chain metadata
|
|
3696
|
+
idempotencyKey,
|
|
3697
|
+
...input.memo !== void 0 && { memo: input.memo },
|
|
3698
|
+
...input.resourceUrl !== void 0 && { resourceUrl: input.resourceUrl },
|
|
3699
|
+
...input.invoiceId !== void 0 && { invoiceId: input.invoiceId },
|
|
3700
|
+
...input.orderId !== void 0 && { orderId: input.orderId },
|
|
3701
|
+
...input.recipientLabel !== void 0 && { recipientLabel: input.recipientLabel },
|
|
3702
|
+
...input.metadata !== void 0 && { metadata: input.metadata },
|
|
3703
|
+
...input.x402Funding !== void 0 && { x402Funding: input.x402Funding }
|
|
3704
|
+
};
|
|
3705
|
+
return this._post(RELAYER_API.PAYMENTS, idempotencyKey, body);
|
|
3706
|
+
}
|
|
3707
|
+
async _submitExecute(intent, signature, input) {
|
|
3708
|
+
const idempotencyKey = input.idempotencyKey ?? generateUuid();
|
|
3709
|
+
const fromToken = input.fromToken !== void 0 ? resolveToken(input.fromToken, this.chainId) : void 0;
|
|
3710
|
+
const maxFromAmount = input.maxFromAmount !== void 0 ? parseAmount(input.maxFromAmount, input.fromToken ?? input.token, this.chainId) : void 0;
|
|
3711
|
+
const body = {
|
|
3712
|
+
chainId: this.chainId,
|
|
3713
|
+
vaultAddress: this.vaultAddress,
|
|
3714
|
+
// Flat intent fields
|
|
3715
|
+
bot: intent.bot,
|
|
3716
|
+
protocol: intent.protocol,
|
|
3717
|
+
calldataHash: intent.calldataHash,
|
|
3718
|
+
token: intent.token,
|
|
3719
|
+
amount: intent.amount.toString(),
|
|
3720
|
+
deadline: intent.deadline.toString(),
|
|
3721
|
+
ref: intent.ref,
|
|
3722
|
+
signature,
|
|
3723
|
+
// Protocol calldata
|
|
3724
|
+
callData: input.callData,
|
|
3725
|
+
// Optional pre-swap
|
|
3726
|
+
...fromToken !== void 0 && { fromToken },
|
|
3727
|
+
...maxFromAmount !== void 0 && { maxFromAmount: maxFromAmount.toString() },
|
|
3728
|
+
// Off-chain metadata
|
|
3729
|
+
idempotencyKey,
|
|
3730
|
+
...input.memo !== void 0 && { memo: input.memo },
|
|
3731
|
+
...input.protocolName !== void 0 && { protocolName: input.protocolName },
|
|
3732
|
+
...input.metadata !== void 0 && { metadata: input.metadata }
|
|
3733
|
+
};
|
|
3734
|
+
return this._post(RELAYER_API.EXECUTE, idempotencyKey, body);
|
|
3735
|
+
}
|
|
3736
|
+
async _submitSwap(intent, signature, input) {
|
|
3737
|
+
const idempotencyKey = input.idempotencyKey ?? generateUuid();
|
|
3738
|
+
const fromToken = input.fromToken !== void 0 ? resolveToken(input.fromToken, this.chainId) : void 0;
|
|
3739
|
+
const maxFromAmount = input.maxFromAmount !== void 0 ? parseAmount(input.maxFromAmount, input.fromToken ?? input.toToken, this.chainId) : void 0;
|
|
3740
|
+
const body = {
|
|
3741
|
+
chainId: this.chainId,
|
|
3742
|
+
vaultAddress: this.vaultAddress,
|
|
3743
|
+
// Flat intent fields
|
|
3744
|
+
bot: intent.bot,
|
|
3745
|
+
toToken: intent.toToken,
|
|
3746
|
+
minToAmount: intent.minToAmount.toString(),
|
|
3747
|
+
deadline: intent.deadline.toString(),
|
|
3748
|
+
ref: intent.ref,
|
|
3749
|
+
signature,
|
|
3750
|
+
// Optional source token
|
|
3751
|
+
...fromToken !== void 0 && { fromToken },
|
|
3752
|
+
...maxFromAmount !== void 0 && { maxFromAmount: maxFromAmount.toString() },
|
|
3753
|
+
// Off-chain metadata
|
|
3754
|
+
idempotencyKey,
|
|
3755
|
+
...input.memo !== void 0 && { memo: input.memo }
|
|
3756
|
+
};
|
|
3757
|
+
return this._post(RELAYER_API.SWAP, idempotencyKey, body);
|
|
3758
|
+
}
|
|
3759
|
+
async _post(path, idempotencyKey, body) {
|
|
3760
|
+
const url = `${this.relayerUrl}${path}`;
|
|
3761
|
+
const response = await fetch(url, {
|
|
3762
|
+
method: "POST",
|
|
3763
|
+
headers: {
|
|
3764
|
+
"Content-Type": "application/json",
|
|
3765
|
+
"Idempotency-Key": idempotencyKey
|
|
3766
|
+
},
|
|
3767
|
+
body: JSON.stringify(body)
|
|
3768
|
+
});
|
|
3769
|
+
if (!response.ok) {
|
|
3770
|
+
const responseBody = await response.text();
|
|
3771
|
+
throw new Error(`Relayer request failed [${response.status}]: ${responseBody}`);
|
|
3772
|
+
}
|
|
3773
|
+
return response.json();
|
|
3774
|
+
}
|
|
3775
|
+
};
|
|
3776
|
+
var SCRYPT_N = 262144;
|
|
3777
|
+
var SCRYPT_R = 8;
|
|
3778
|
+
var SCRYPT_P = 1;
|
|
3779
|
+
var SCRYPT_DKLEN = 32;
|
|
3780
|
+
function getRandomBytes(length) {
|
|
3781
|
+
const bytes = new Uint8Array(length);
|
|
3782
|
+
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
3783
|
+
crypto.getRandomValues(bytes);
|
|
3784
|
+
} else {
|
|
3785
|
+
const { randomBytes } = __require("crypto");
|
|
3786
|
+
const buf = randomBytes(length);
|
|
3787
|
+
for (let i = 0; i < length; i++) bytes[i] = buf[i] ?? 0;
|
|
3788
|
+
}
|
|
3789
|
+
return bytes;
|
|
3790
|
+
}
|
|
3791
|
+
function hexToBytes(hex) {
|
|
3792
|
+
const clean = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
3793
|
+
const bytes = new Uint8Array(clean.length / 2);
|
|
3794
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
3795
|
+
bytes[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
|
|
3796
|
+
}
|
|
3797
|
+
return bytes;
|
|
3798
|
+
}
|
|
3799
|
+
function bytesToHex(bytes) {
|
|
3800
|
+
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
3801
|
+
}
|
|
3802
|
+
async function encryptKeystore(privateKey, passphrase) {
|
|
3803
|
+
if (!passphrase) throw new Error("Passphrase must not be empty");
|
|
3804
|
+
const keyBytes = hexToBytes(privateKey);
|
|
3805
|
+
const account = accounts.privateKeyToAccount(privateKey);
|
|
3806
|
+
const address = account.address.slice(2).toLowerCase();
|
|
3807
|
+
const salt = getRandomBytes(32);
|
|
3808
|
+
const iv = getRandomBytes(16);
|
|
3809
|
+
const derivedKey = await scrypt.scryptAsync(new TextEncoder().encode(passphrase), salt, {
|
|
3810
|
+
N: SCRYPT_N,
|
|
3811
|
+
r: SCRYPT_R,
|
|
3812
|
+
p: SCRYPT_P,
|
|
3813
|
+
dkLen: SCRYPT_DKLEN
|
|
3814
|
+
});
|
|
3815
|
+
const encryptionKey = derivedKey.slice(0, 16);
|
|
3816
|
+
const cipher = aes.ctr(encryptionKey, iv);
|
|
3817
|
+
const ciphertext = cipher.encrypt(keyBytes);
|
|
3818
|
+
const macInput = new Uint8Array(16 + ciphertext.length);
|
|
3819
|
+
macInput.set(derivedKey.slice(16, 32), 0);
|
|
3820
|
+
macInput.set(ciphertext, 16);
|
|
3821
|
+
const mac = sha3.keccak_256(macInput);
|
|
3822
|
+
return {
|
|
3823
|
+
version: 3,
|
|
3824
|
+
id: generateUuid(),
|
|
3825
|
+
address,
|
|
3826
|
+
crypto: {
|
|
3827
|
+
ciphertext: bytesToHex(ciphertext),
|
|
3828
|
+
cipherparams: { iv: bytesToHex(iv) },
|
|
3829
|
+
cipher: "aes-128-ctr",
|
|
3830
|
+
kdf: "scrypt",
|
|
3831
|
+
kdfparams: {
|
|
3832
|
+
dklen: SCRYPT_DKLEN,
|
|
3833
|
+
salt: bytesToHex(salt),
|
|
3834
|
+
n: SCRYPT_N,
|
|
3835
|
+
r: SCRYPT_R,
|
|
3836
|
+
p: SCRYPT_P
|
|
3837
|
+
},
|
|
3838
|
+
mac: bytesToHex(mac)
|
|
3839
|
+
}
|
|
3840
|
+
};
|
|
3841
|
+
}
|
|
3842
|
+
async function decryptKeystore(keystore, passphrase) {
|
|
3843
|
+
let ks;
|
|
3844
|
+
if (typeof keystore === "string") {
|
|
3845
|
+
try {
|
|
3846
|
+
ks = JSON.parse(keystore);
|
|
3847
|
+
} catch {
|
|
3848
|
+
throw new Error("Invalid keystore: could not parse JSON");
|
|
3849
|
+
}
|
|
3850
|
+
} else {
|
|
3851
|
+
ks = keystore;
|
|
3852
|
+
}
|
|
3853
|
+
if (ks.version !== 3) throw new Error(`Unsupported keystore version: ${ks.version}`);
|
|
3854
|
+
if (!ks.crypto) throw new Error("Invalid keystore: missing crypto field");
|
|
3855
|
+
if (ks.crypto.kdf !== "scrypt") throw new Error(`Unsupported KDF: ${ks.crypto.kdf}`);
|
|
3856
|
+
if (ks.crypto.cipher !== "aes-128-ctr") throw new Error(`Unsupported cipher: ${ks.crypto.cipher}`);
|
|
3857
|
+
const { kdfparams, ciphertext: ctHex, cipherparams, mac: expectedMacHex } = ks.crypto;
|
|
3858
|
+
const salt = hexToBytes(kdfparams.salt);
|
|
3859
|
+
const derivedKey = await scrypt.scryptAsync(new TextEncoder().encode(passphrase), salt, {
|
|
3860
|
+
N: kdfparams.n,
|
|
3861
|
+
r: kdfparams.r,
|
|
3862
|
+
p: kdfparams.p,
|
|
3863
|
+
dkLen: kdfparams.dklen
|
|
3864
|
+
});
|
|
3865
|
+
const ciphertextBytes = hexToBytes(ctHex);
|
|
3866
|
+
const macInput = new Uint8Array(16 + ciphertextBytes.length);
|
|
3867
|
+
macInput.set(derivedKey.slice(16, 32), 0);
|
|
3868
|
+
macInput.set(ciphertextBytes, 16);
|
|
3869
|
+
const computedMac = bytesToHex(sha3.keccak_256(macInput));
|
|
3870
|
+
if (computedMac !== expectedMacHex) {
|
|
3871
|
+
throw new Error("Wrong passphrase: MAC mismatch");
|
|
3872
|
+
}
|
|
3873
|
+
const iv = hexToBytes(cipherparams.iv);
|
|
3874
|
+
const encryptionKey = derivedKey.slice(0, 16);
|
|
3875
|
+
const cipher = aes.ctr(encryptionKey, iv);
|
|
3876
|
+
const plaintext = cipher.decrypt(ciphertextBytes);
|
|
3877
|
+
return `0x${bytesToHex(plaintext)}`;
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
// src/abis/AxonRegistry.ts
|
|
3881
|
+
var AxonRegistryAbi = [
|
|
3882
|
+
{
|
|
3883
|
+
"type": "constructor",
|
|
3884
|
+
"inputs": [
|
|
3885
|
+
{
|
|
3886
|
+
"name": "initialOwner",
|
|
3887
|
+
"type": "address",
|
|
3888
|
+
"internalType": "address"
|
|
3889
|
+
}
|
|
3890
|
+
],
|
|
3891
|
+
"stateMutability": "nonpayable"
|
|
3892
|
+
},
|
|
3893
|
+
{
|
|
3894
|
+
"type": "function",
|
|
3895
|
+
"name": "acceptOwnership",
|
|
3896
|
+
"inputs": [],
|
|
3897
|
+
"outputs": [],
|
|
3898
|
+
"stateMutability": "nonpayable"
|
|
3899
|
+
},
|
|
3900
|
+
{
|
|
3901
|
+
"type": "function",
|
|
3902
|
+
"name": "addRelayer",
|
|
3903
|
+
"inputs": [
|
|
3904
|
+
{
|
|
3905
|
+
"name": "relayer",
|
|
3906
|
+
"type": "address",
|
|
3907
|
+
"internalType": "address"
|
|
3908
|
+
}
|
|
3909
|
+
],
|
|
3910
|
+
"outputs": [],
|
|
3911
|
+
"stateMutability": "nonpayable"
|
|
3912
|
+
},
|
|
3913
|
+
{
|
|
3914
|
+
"type": "function",
|
|
3915
|
+
"name": "addSwapRouter",
|
|
3916
|
+
"inputs": [
|
|
3917
|
+
{
|
|
3918
|
+
"name": "router",
|
|
3919
|
+
"type": "address",
|
|
3920
|
+
"internalType": "address"
|
|
3921
|
+
}
|
|
3922
|
+
],
|
|
3923
|
+
"outputs": [],
|
|
3924
|
+
"stateMutability": "nonpayable"
|
|
3925
|
+
},
|
|
3926
|
+
{
|
|
3927
|
+
"type": "function",
|
|
3928
|
+
"name": "isApprovedSwapRouter",
|
|
3929
|
+
"inputs": [
|
|
3930
|
+
{
|
|
3931
|
+
"name": "router",
|
|
3932
|
+
"type": "address",
|
|
3933
|
+
"internalType": "address"
|
|
3934
|
+
}
|
|
3935
|
+
],
|
|
3936
|
+
"outputs": [
|
|
3937
|
+
{
|
|
3938
|
+
"name": "",
|
|
3939
|
+
"type": "bool",
|
|
3940
|
+
"internalType": "bool"
|
|
3941
|
+
}
|
|
3942
|
+
],
|
|
3943
|
+
"stateMutability": "view"
|
|
3944
|
+
},
|
|
3945
|
+
{
|
|
3946
|
+
"type": "function",
|
|
3947
|
+
"name": "isAuthorized",
|
|
3948
|
+
"inputs": [
|
|
3949
|
+
{
|
|
3950
|
+
"name": "relayer",
|
|
3951
|
+
"type": "address",
|
|
3952
|
+
"internalType": "address"
|
|
3953
|
+
}
|
|
3954
|
+
],
|
|
3955
|
+
"outputs": [
|
|
3956
|
+
{
|
|
3957
|
+
"name": "",
|
|
3958
|
+
"type": "bool",
|
|
3959
|
+
"internalType": "bool"
|
|
3960
|
+
}
|
|
3961
|
+
],
|
|
3962
|
+
"stateMutability": "view"
|
|
3963
|
+
},
|
|
3964
|
+
{
|
|
3965
|
+
"type": "function",
|
|
3966
|
+
"name": "owner",
|
|
3967
|
+
"inputs": [],
|
|
3968
|
+
"outputs": [
|
|
3969
|
+
{
|
|
3970
|
+
"name": "",
|
|
3971
|
+
"type": "address",
|
|
3972
|
+
"internalType": "address"
|
|
3973
|
+
}
|
|
3974
|
+
],
|
|
3975
|
+
"stateMutability": "view"
|
|
3976
|
+
},
|
|
3977
|
+
{
|
|
3978
|
+
"type": "function",
|
|
3979
|
+
"name": "pendingOwner",
|
|
3980
|
+
"inputs": [],
|
|
3981
|
+
"outputs": [
|
|
3982
|
+
{
|
|
3983
|
+
"name": "",
|
|
3984
|
+
"type": "address",
|
|
3985
|
+
"internalType": "address"
|
|
3986
|
+
}
|
|
3987
|
+
],
|
|
3988
|
+
"stateMutability": "view"
|
|
3989
|
+
},
|
|
3990
|
+
{
|
|
3991
|
+
"type": "function",
|
|
3992
|
+
"name": "removeRelayer",
|
|
3993
|
+
"inputs": [
|
|
3994
|
+
{
|
|
3995
|
+
"name": "relayer",
|
|
3996
|
+
"type": "address",
|
|
3997
|
+
"internalType": "address"
|
|
3998
|
+
}
|
|
3999
|
+
],
|
|
4000
|
+
"outputs": [],
|
|
4001
|
+
"stateMutability": "nonpayable"
|
|
4002
|
+
},
|
|
4003
|
+
{
|
|
4004
|
+
"type": "function",
|
|
4005
|
+
"name": "removeSwapRouter",
|
|
4006
|
+
"inputs": [
|
|
4007
|
+
{
|
|
4008
|
+
"name": "router",
|
|
4009
|
+
"type": "address",
|
|
4010
|
+
"internalType": "address"
|
|
4011
|
+
}
|
|
4012
|
+
],
|
|
4013
|
+
"outputs": [],
|
|
4014
|
+
"stateMutability": "nonpayable"
|
|
4015
|
+
},
|
|
4016
|
+
{
|
|
4017
|
+
"type": "function",
|
|
4018
|
+
"name": "renounceOwnership",
|
|
4019
|
+
"inputs": [],
|
|
4020
|
+
"outputs": [],
|
|
4021
|
+
"stateMutability": "nonpayable"
|
|
4022
|
+
},
|
|
4023
|
+
{
|
|
4024
|
+
"type": "function",
|
|
4025
|
+
"name": "setOracleConfig",
|
|
4026
|
+
"inputs": [
|
|
4027
|
+
{
|
|
4028
|
+
"name": "uniV3Factory",
|
|
4029
|
+
"type": "address",
|
|
4030
|
+
"internalType": "address"
|
|
4031
|
+
},
|
|
4032
|
+
{
|
|
4033
|
+
"name": "usdc",
|
|
4034
|
+
"type": "address",
|
|
4035
|
+
"internalType": "address"
|
|
4036
|
+
},
|
|
4037
|
+
{
|
|
4038
|
+
"name": "weth",
|
|
4039
|
+
"type": "address",
|
|
4040
|
+
"internalType": "address"
|
|
4041
|
+
}
|
|
4042
|
+
],
|
|
4043
|
+
"outputs": [],
|
|
4044
|
+
"stateMutability": "nonpayable"
|
|
4045
|
+
},
|
|
4046
|
+
{
|
|
4047
|
+
"type": "function",
|
|
4048
|
+
"name": "transferOwnership",
|
|
4049
|
+
"inputs": [
|
|
4050
|
+
{
|
|
4051
|
+
"name": "newOwner",
|
|
4052
|
+
"type": "address",
|
|
4053
|
+
"internalType": "address"
|
|
4054
|
+
}
|
|
4055
|
+
],
|
|
4056
|
+
"outputs": [],
|
|
4057
|
+
"stateMutability": "nonpayable"
|
|
4058
|
+
},
|
|
4059
|
+
{
|
|
4060
|
+
"type": "function",
|
|
4061
|
+
"name": "uniswapV3Factory",
|
|
4062
|
+
"inputs": [],
|
|
4063
|
+
"outputs": [
|
|
4064
|
+
{
|
|
4065
|
+
"name": "",
|
|
4066
|
+
"type": "address",
|
|
4067
|
+
"internalType": "address"
|
|
4068
|
+
}
|
|
4069
|
+
],
|
|
4070
|
+
"stateMutability": "view"
|
|
4071
|
+
},
|
|
4072
|
+
{
|
|
4073
|
+
"type": "function",
|
|
4074
|
+
"name": "usdcAddress",
|
|
4075
|
+
"inputs": [],
|
|
4076
|
+
"outputs": [
|
|
4077
|
+
{
|
|
4078
|
+
"name": "",
|
|
4079
|
+
"type": "address",
|
|
4080
|
+
"internalType": "address"
|
|
4081
|
+
}
|
|
4082
|
+
],
|
|
4083
|
+
"stateMutability": "view"
|
|
4084
|
+
},
|
|
4085
|
+
{
|
|
4086
|
+
"type": "function",
|
|
4087
|
+
"name": "wethAddress",
|
|
4088
|
+
"inputs": [],
|
|
4089
|
+
"outputs": [
|
|
4090
|
+
{
|
|
4091
|
+
"name": "",
|
|
4092
|
+
"type": "address",
|
|
4093
|
+
"internalType": "address"
|
|
4094
|
+
}
|
|
4095
|
+
],
|
|
4096
|
+
"stateMutability": "view"
|
|
4097
|
+
},
|
|
4098
|
+
{
|
|
4099
|
+
"type": "event",
|
|
4100
|
+
"name": "OracleConfigUpdated",
|
|
4101
|
+
"inputs": [
|
|
4102
|
+
{
|
|
4103
|
+
"name": "uniswapV3Factory",
|
|
4104
|
+
"type": "address",
|
|
4105
|
+
"indexed": false,
|
|
4106
|
+
"internalType": "address"
|
|
4107
|
+
},
|
|
4108
|
+
{
|
|
4109
|
+
"name": "usdc",
|
|
4110
|
+
"type": "address",
|
|
4111
|
+
"indexed": false,
|
|
4112
|
+
"internalType": "address"
|
|
4113
|
+
},
|
|
4114
|
+
{
|
|
4115
|
+
"name": "weth",
|
|
4116
|
+
"type": "address",
|
|
4117
|
+
"indexed": false,
|
|
4118
|
+
"internalType": "address"
|
|
4119
|
+
}
|
|
4120
|
+
],
|
|
4121
|
+
"anonymous": false
|
|
4122
|
+
},
|
|
4123
|
+
{
|
|
4124
|
+
"type": "event",
|
|
4125
|
+
"name": "OwnershipTransferStarted",
|
|
4126
|
+
"inputs": [
|
|
4127
|
+
{
|
|
4128
|
+
"name": "previousOwner",
|
|
4129
|
+
"type": "address",
|
|
4130
|
+
"indexed": true,
|
|
4131
|
+
"internalType": "address"
|
|
4132
|
+
},
|
|
4133
|
+
{
|
|
4134
|
+
"name": "newOwner",
|
|
4135
|
+
"type": "address",
|
|
4136
|
+
"indexed": true,
|
|
4137
|
+
"internalType": "address"
|
|
4138
|
+
}
|
|
4139
|
+
],
|
|
4140
|
+
"anonymous": false
|
|
4141
|
+
},
|
|
4142
|
+
{
|
|
4143
|
+
"type": "event",
|
|
4144
|
+
"name": "OwnershipTransferred",
|
|
4145
|
+
"inputs": [
|
|
4146
|
+
{
|
|
4147
|
+
"name": "previousOwner",
|
|
4148
|
+
"type": "address",
|
|
4149
|
+
"indexed": true,
|
|
4150
|
+
"internalType": "address"
|
|
4151
|
+
},
|
|
4152
|
+
{
|
|
4153
|
+
"name": "newOwner",
|
|
4154
|
+
"type": "address",
|
|
4155
|
+
"indexed": true,
|
|
4156
|
+
"internalType": "address"
|
|
4157
|
+
}
|
|
4158
|
+
],
|
|
4159
|
+
"anonymous": false
|
|
4160
|
+
},
|
|
4161
|
+
{
|
|
4162
|
+
"type": "event",
|
|
4163
|
+
"name": "RelayerAdded",
|
|
4164
|
+
"inputs": [
|
|
4165
|
+
{
|
|
4166
|
+
"name": "relayer",
|
|
4167
|
+
"type": "address",
|
|
4168
|
+
"indexed": true,
|
|
4169
|
+
"internalType": "address"
|
|
4170
|
+
}
|
|
4171
|
+
],
|
|
4172
|
+
"anonymous": false
|
|
4173
|
+
},
|
|
4174
|
+
{
|
|
4175
|
+
"type": "event",
|
|
4176
|
+
"name": "RelayerRemoved",
|
|
4177
|
+
"inputs": [
|
|
4178
|
+
{
|
|
4179
|
+
"name": "relayer",
|
|
4180
|
+
"type": "address",
|
|
4181
|
+
"indexed": true,
|
|
4182
|
+
"internalType": "address"
|
|
4183
|
+
}
|
|
4184
|
+
],
|
|
4185
|
+
"anonymous": false
|
|
4186
|
+
},
|
|
4187
|
+
{
|
|
4188
|
+
"type": "event",
|
|
4189
|
+
"name": "SwapRouterAdded",
|
|
4190
|
+
"inputs": [
|
|
4191
|
+
{
|
|
4192
|
+
"name": "router",
|
|
4193
|
+
"type": "address",
|
|
4194
|
+
"indexed": true,
|
|
4195
|
+
"internalType": "address"
|
|
4196
|
+
}
|
|
4197
|
+
],
|
|
4198
|
+
"anonymous": false
|
|
4199
|
+
},
|
|
4200
|
+
{
|
|
4201
|
+
"type": "event",
|
|
4202
|
+
"name": "SwapRouterRemoved",
|
|
4203
|
+
"inputs": [
|
|
4204
|
+
{
|
|
4205
|
+
"name": "router",
|
|
4206
|
+
"type": "address",
|
|
4207
|
+
"indexed": true,
|
|
4208
|
+
"internalType": "address"
|
|
4209
|
+
}
|
|
4210
|
+
],
|
|
4211
|
+
"anonymous": false
|
|
4212
|
+
},
|
|
4213
|
+
{
|
|
4214
|
+
"type": "error",
|
|
4215
|
+
"name": "AlreadyApproved",
|
|
4216
|
+
"inputs": []
|
|
4217
|
+
},
|
|
4218
|
+
{
|
|
4219
|
+
"type": "error",
|
|
4220
|
+
"name": "AlreadyAuthorized",
|
|
4221
|
+
"inputs": []
|
|
4222
|
+
},
|
|
4223
|
+
{
|
|
4224
|
+
"type": "error",
|
|
4225
|
+
"name": "NotApproved",
|
|
4226
|
+
"inputs": []
|
|
4227
|
+
},
|
|
4228
|
+
{
|
|
4229
|
+
"type": "error",
|
|
4230
|
+
"name": "NotAuthorized",
|
|
4231
|
+
"inputs": []
|
|
4232
|
+
},
|
|
4233
|
+
{
|
|
4234
|
+
"type": "error",
|
|
4235
|
+
"name": "OwnableInvalidOwner",
|
|
4236
|
+
"inputs": [
|
|
4237
|
+
{
|
|
4238
|
+
"name": "owner",
|
|
4239
|
+
"type": "address",
|
|
4240
|
+
"internalType": "address"
|
|
4241
|
+
}
|
|
4242
|
+
]
|
|
4243
|
+
},
|
|
4244
|
+
{
|
|
4245
|
+
"type": "error",
|
|
4246
|
+
"name": "OwnableUnauthorizedAccount",
|
|
4247
|
+
"inputs": [
|
|
4248
|
+
{
|
|
4249
|
+
"name": "account",
|
|
4250
|
+
"type": "address",
|
|
4251
|
+
"internalType": "address"
|
|
4252
|
+
}
|
|
4253
|
+
]
|
|
4254
|
+
},
|
|
4255
|
+
{
|
|
4256
|
+
"type": "error",
|
|
4257
|
+
"name": "ZeroAddress",
|
|
4258
|
+
"inputs": []
|
|
4259
|
+
}
|
|
4260
|
+
];
|
|
4261
|
+
|
|
4262
|
+
exports.AxonClient = AxonClient;
|
|
4263
|
+
exports.AxonRegistryAbi = AxonRegistryAbi;
|
|
4264
|
+
exports.AxonVaultAbi = AxonVaultAbi;
|
|
4265
|
+
exports.AxonVaultFactoryAbi = AxonVaultFactoryAbi;
|
|
4266
|
+
exports.CHAIN_NAMES = CHAIN_NAMES;
|
|
4267
|
+
exports.Chain = Chain;
|
|
4268
|
+
exports.DEFAULT_DEADLINE_SECONDS = DEFAULT_DEADLINE_SECONDS;
|
|
4269
|
+
exports.EIP712_DOMAIN_NAME = EIP712_DOMAIN_NAME;
|
|
4270
|
+
exports.EIP712_DOMAIN_VERSION = EIP712_DOMAIN_VERSION;
|
|
4271
|
+
exports.EXECUTE_INTENT_TYPEHASH = EXECUTE_INTENT_TYPEHASH;
|
|
4272
|
+
exports.EXPLORER_ADDR = EXPLORER_ADDR;
|
|
4273
|
+
exports.EXPLORER_TX = EXPLORER_TX;
|
|
4274
|
+
exports.KNOWN_TOKENS = KNOWN_TOKENS;
|
|
4275
|
+
exports.NATIVE_ETH = NATIVE_ETH;
|
|
4276
|
+
exports.PAYMENT_INTENT_TYPEHASH = PAYMENT_INTENT_TYPEHASH;
|
|
4277
|
+
exports.PERMIT2_ADDRESS = PERMIT2_ADDRESS;
|
|
4278
|
+
exports.PaymentErrorCode = PaymentErrorCode;
|
|
4279
|
+
exports.RELAYER_API = RELAYER_API;
|
|
4280
|
+
exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS;
|
|
4281
|
+
exports.SWAP_INTENT_TYPEHASH = SWAP_INTENT_TYPEHASH;
|
|
4282
|
+
exports.Token = Token;
|
|
4283
|
+
exports.USDC = USDC;
|
|
4284
|
+
exports.USDC_EIP712_DOMAIN = USDC_EIP712_DOMAIN;
|
|
4285
|
+
exports.WINDOW = WINDOW;
|
|
4286
|
+
exports.WITNESS_TYPE_STRING = WITNESS_TYPE_STRING;
|
|
4287
|
+
exports.X402_PROXY_ADDRESS = X402_PROXY_ADDRESS;
|
|
4288
|
+
exports.createAxonPublicClient = createAxonPublicClient;
|
|
4289
|
+
exports.createAxonWalletClient = createAxonWalletClient;
|
|
4290
|
+
exports.decryptKeystore = decryptKeystore;
|
|
4291
|
+
exports.deployVault = deployVault;
|
|
4292
|
+
exports.encodeRef = encodeRef;
|
|
4293
|
+
exports.encryptKeystore = encryptKeystore;
|
|
4294
|
+
exports.extractX402Metadata = extractX402Metadata;
|
|
4295
|
+
exports.findMatchingOption = findMatchingOption;
|
|
4296
|
+
exports.formatPaymentSignature = formatPaymentSignature;
|
|
4297
|
+
exports.getBotConfig = getBotConfig;
|
|
4298
|
+
exports.getChain = getChain;
|
|
4299
|
+
exports.getDomainSeparator = getDomainSeparator;
|
|
4300
|
+
exports.getKnownTokensForChain = getKnownTokensForChain;
|
|
4301
|
+
exports.getOperatorCeilings = getOperatorCeilings;
|
|
4302
|
+
exports.getRebalanceTokenCount = getRebalanceTokenCount;
|
|
4303
|
+
exports.getTokenSymbolByAddress = getTokenSymbolByAddress;
|
|
4304
|
+
exports.getVaultOperator = getVaultOperator;
|
|
4305
|
+
exports.getVaultOwner = getVaultOwner;
|
|
4306
|
+
exports.getVaultVersion = getVaultVersion;
|
|
4307
|
+
exports.isBotActive = isBotActive;
|
|
4308
|
+
exports.isDestinationAllowed = isDestinationAllowed;
|
|
4309
|
+
exports.isRebalanceTokenWhitelisted = isRebalanceTokenWhitelisted;
|
|
4310
|
+
exports.isVaultPaused = isVaultPaused;
|
|
4311
|
+
exports.operatorMaxDrainPerDay = operatorMaxDrainPerDay;
|
|
4312
|
+
exports.parseAmount = parseAmount;
|
|
4313
|
+
exports.parseChainId = parseChainId;
|
|
4314
|
+
exports.parsePaymentRequired = parsePaymentRequired;
|
|
4315
|
+
exports.randomNonce = randomNonce;
|
|
4316
|
+
exports.randomPermit2Nonce = randomPermit2Nonce;
|
|
4317
|
+
exports.resolveToken = resolveToken;
|
|
4318
|
+
exports.resolveTokenDecimals = resolveTokenDecimals;
|
|
4319
|
+
exports.signExecuteIntent = signExecuteIntent;
|
|
4320
|
+
exports.signPayment = signPayment;
|
|
4321
|
+
exports.signPermit2WitnessTransfer = signPermit2WitnessTransfer;
|
|
4322
|
+
exports.signSwapIntent = signSwapIntent;
|
|
4323
|
+
exports.signTransferWithAuthorization = signTransferWithAuthorization;
|
|
4324
|
+
//# sourceMappingURL=index.cjs.map
|
|
4325
|
+
//# sourceMappingURL=index.cjs.map
|