outsmart 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +568 -0
- package/dist/cli.d.ts +44 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1251 -0
- package/dist/cli.js.map +1 -0
- package/dist/dex/byreal-clmm.d.ts +16 -0
- package/dist/dex/byreal-clmm.d.ts.map +1 -0
- package/dist/dex/byreal-clmm.js +39 -0
- package/dist/dex/byreal-clmm.js.map +1 -0
- package/dist/dex/dflow.d.ts +27 -0
- package/dist/dex/dflow.d.ts.map +1 -0
- package/dist/dex/dflow.js +200 -0
- package/dist/dex/dflow.js.map +1 -0
- package/dist/dex/fusion-amm.d.ts +44 -0
- package/dist/dex/fusion-amm.d.ts.map +1 -0
- package/dist/dex/fusion-amm.js +546 -0
- package/dist/dex/fusion-amm.js.map +1 -0
- package/dist/dex/futarchy-amm.d.ts +32 -0
- package/dist/dex/futarchy-amm.d.ts.map +1 -0
- package/dist/dex/futarchy-amm.js +443 -0
- package/dist/dex/futarchy-amm.js.map +1 -0
- package/dist/dex/futarchy-idl.d.ts +2568 -0
- package/dist/dex/futarchy-idl.d.ts.map +1 -0
- package/dist/dex/futarchy-idl.js +2570 -0
- package/dist/dex/futarchy-idl.js.map +1 -0
- package/dist/dex/futarchy-launchpad.d.ts +68 -0
- package/dist/dex/futarchy-launchpad.d.ts.map +1 -0
- package/dist/dex/futarchy-launchpad.js +377 -0
- package/dist/dex/futarchy-launchpad.js.map +1 -0
- package/dist/dex/index.d.ts +88 -0
- package/dist/dex/index.d.ts.map +1 -0
- package/dist/dex/index.js +159 -0
- package/dist/dex/index.js.map +1 -0
- package/dist/dex/jupiter-ultra.d.ts +27 -0
- package/dist/dex/jupiter-ultra.d.ts.map +1 -0
- package/dist/dex/jupiter-ultra.js +369 -0
- package/dist/dex/jupiter-ultra.js.map +1 -0
- package/dist/dex/meteora-damm-v1.d.ts +36 -0
- package/dist/dex/meteora-damm-v1.d.ts.map +1 -0
- package/dist/dex/meteora-damm-v1.js +314 -0
- package/dist/dex/meteora-damm-v1.js.map +1 -0
- package/dist/dex/meteora-damm-v2.d.ts +103 -0
- package/dist/dex/meteora-damm-v2.d.ts.map +1 -0
- package/dist/dex/meteora-damm-v2.js +1146 -0
- package/dist/dex/meteora-damm-v2.js.map +1 -0
- package/dist/dex/meteora-dbc.d.ts +38 -0
- package/dist/dex/meteora-dbc.d.ts.map +1 -0
- package/dist/dex/meteora-dbc.js +374 -0
- package/dist/dex/meteora-dbc.js.map +1 -0
- package/dist/dex/meteora-dlmm.d.ts +79 -0
- package/dist/dex/meteora-dlmm.d.ts.map +1 -0
- package/dist/dex/meteora-dlmm.js +735 -0
- package/dist/dex/meteora-dlmm.js.map +1 -0
- package/dist/dex/orca.d.ts +31 -0
- package/dist/dex/orca.d.ts.map +1 -0
- package/dist/dex/orca.js +536 -0
- package/dist/dex/orca.js.map +1 -0
- package/dist/dex/pancakeswap-clmm.d.ts +16 -0
- package/dist/dex/pancakeswap-clmm.d.ts.map +1 -0
- package/dist/dex/pancakeswap-clmm.js +39 -0
- package/dist/dex/pancakeswap-clmm.js.map +1 -0
- package/dist/dex/pumpfun-amm.d.ts +46 -0
- package/dist/dex/pumpfun-amm.d.ts.map +1 -0
- package/dist/dex/pumpfun-amm.js +692 -0
- package/dist/dex/pumpfun-amm.js.map +1 -0
- package/dist/dex/pumpfun.d.ts +41 -0
- package/dist/dex/pumpfun.d.ts.map +1 -0
- package/dist/dex/pumpfun.js +555 -0
- package/dist/dex/pumpfun.js.map +1 -0
- package/dist/dex/raydium-amm-v4.d.ts +11 -0
- package/dist/dex/raydium-amm-v4.d.ts.map +1 -0
- package/dist/dex/raydium-amm-v4.js +649 -0
- package/dist/dex/raydium-amm-v4.js.map +1 -0
- package/dist/dex/raydium-clmm.d.ts +12 -0
- package/dist/dex/raydium-clmm.d.ts.map +1 -0
- package/dist/dex/raydium-clmm.js +675 -0
- package/dist/dex/raydium-clmm.js.map +1 -0
- package/dist/dex/raydium-cpmm.d.ts +10 -0
- package/dist/dex/raydium-cpmm.d.ts.map +1 -0
- package/dist/dex/raydium-cpmm.js +613 -0
- package/dist/dex/raydium-cpmm.js.map +1 -0
- package/dist/dex/raydium-launchlab.d.ts +12 -0
- package/dist/dex/raydium-launchlab.d.ts.map +1 -0
- package/dist/dex/raydium-launchlab.js +530 -0
- package/dist/dex/raydium-launchlab.js.map +1 -0
- package/dist/dex/shared/clmm-base.d.ts +58 -0
- package/dist/dex/shared/clmm-base.d.ts.map +1 -0
- package/dist/dex/shared/clmm-base.js +891 -0
- package/dist/dex/shared/clmm-base.js.map +1 -0
- package/dist/dex/types.d.ts +601 -0
- package/dist/dex/types.d.ts.map +1 -0
- package/dist/dex/types.js +137 -0
- package/dist/dex/types.js.map +1 -0
- package/dist/dexscreener/index.d.ts +2 -0
- package/dist/dexscreener/index.d.ts.map +1 -0
- package/dist/dexscreener/index.js +18 -0
- package/dist/dexscreener/index.js.map +1 -0
- package/dist/dexscreener/info.d.ts +22 -0
- package/dist/dexscreener/info.d.ts.map +1 -0
- package/dist/dexscreener/info.js +104 -0
- package/dist/dexscreener/info.js.map +1 -0
- package/dist/helpers/check_balance.d.ts +10 -0
- package/dist/helpers/check_balance.d.ts.map +1 -0
- package/dist/helpers/check_balance.js +34 -0
- package/dist/helpers/check_balance.js.map +1 -0
- package/dist/helpers/config.d.ts +51 -0
- package/dist/helpers/config.d.ts.map +1 -0
- package/dist/helpers/config.js +118 -0
- package/dist/helpers/config.js.map +1 -0
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +29 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/logger.d.ts +27 -0
- package/dist/helpers/logger.d.ts.map +1 -0
- package/dist/helpers/logger.js +39 -0
- package/dist/helpers/logger.js.map +1 -0
- package/dist/helpers/token-2022.d.ts +32 -0
- package/dist/helpers/token-2022.d.ts.map +1 -0
- package/dist/helpers/token-2022.js +48 -0
- package/dist/helpers/token-2022.js.map +1 -0
- package/dist/helpers/unwrap_sol.d.ts +2 -0
- package/dist/helpers/unwrap_sol.d.ts.map +1 -0
- package/dist/helpers/unwrap_sol.js +67 -0
- package/dist/helpers/unwrap_sol.js.map +1 -0
- package/dist/helpers/util.d.ts +698 -0
- package/dist/helpers/util.d.ts.map +1 -0
- package/dist/helpers/util.js +181 -0
- package/dist/helpers/util.js.map +1 -0
- package/dist/helpers/utils.d.ts +10 -0
- package/dist/helpers/utils.d.ts.map +1 -0
- package/dist/helpers/utils.js +97 -0
- package/dist/helpers/utils.js.map +1 -0
- package/dist/helpers/wrap_sol.d.ts +3 -0
- package/dist/helpers/wrap_sol.d.ts.map +1 -0
- package/dist/helpers/wrap_sol.js +88 -0
- package/dist/helpers/wrap_sol.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/transactions/bloXroute_tips_tx_executor.d.ts +4 -0
- package/dist/transactions/bloXroute_tips_tx_executor.d.ts.map +1 -0
- package/dist/transactions/bloXroute_tips_tx_executor.js +70 -0
- package/dist/transactions/bloXroute_tips_tx_executor.js.map +1 -0
- package/dist/transactions/index.d.ts +6 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/index.js +30 -0
- package/dist/transactions/index.js.map +1 -0
- package/dist/transactions/jito_tips_tx_executor.d.ts +15 -0
- package/dist/transactions/jito_tips_tx_executor.d.ts.map +1 -0
- package/dist/transactions/jito_tips_tx_executor.js +99 -0
- package/dist/transactions/jito_tips_tx_executor.js.map +1 -0
- package/dist/transactions/landing/index.d.ts +30 -0
- package/dist/transactions/landing/index.d.ts.map +1 -0
- package/dist/transactions/landing/index.js +60 -0
- package/dist/transactions/landing/index.js.map +1 -0
- package/dist/transactions/landing/nonce-manager.d.ts +116 -0
- package/dist/transactions/landing/nonce-manager.d.ts.map +1 -0
- package/dist/transactions/landing/nonce-manager.js +393 -0
- package/dist/transactions/landing/nonce-manager.js.map +1 -0
- package/dist/transactions/landing/orchestrator.d.ts +104 -0
- package/dist/transactions/landing/orchestrator.d.ts.map +1 -0
- package/dist/transactions/landing/orchestrator.js +329 -0
- package/dist/transactions/landing/orchestrator.js.map +1 -0
- package/dist/transactions/landing/providers/astralane.d.ts +12 -0
- package/dist/transactions/landing/providers/astralane.d.ts.map +1 -0
- package/dist/transactions/landing/providers/astralane.js +132 -0
- package/dist/transactions/landing/providers/astralane.js.map +1 -0
- package/dist/transactions/landing/providers/blockrazor.d.ts +11 -0
- package/dist/transactions/landing/providers/blockrazor.d.ts.map +1 -0
- package/dist/transactions/landing/providers/blockrazor.js +134 -0
- package/dist/transactions/landing/providers/blockrazor.js.map +1 -0
- package/dist/transactions/landing/providers/bloxroute.d.ts +12 -0
- package/dist/transactions/landing/providers/bloxroute.d.ts.map +1 -0
- package/dist/transactions/landing/providers/bloxroute.js +102 -0
- package/dist/transactions/landing/providers/bloxroute.js.map +1 -0
- package/dist/transactions/landing/providers/flashblock.d.ts +10 -0
- package/dist/transactions/landing/providers/flashblock.d.ts.map +1 -0
- package/dist/transactions/landing/providers/flashblock.js +102 -0
- package/dist/transactions/landing/providers/flashblock.js.map +1 -0
- package/dist/transactions/landing/providers/helius-sender.d.ts +11 -0
- package/dist/transactions/landing/providers/helius-sender.d.ts.map +1 -0
- package/dist/transactions/landing/providers/helius-sender.js +101 -0
- package/dist/transactions/landing/providers/helius-sender.js.map +1 -0
- package/dist/transactions/landing/providers/jito.d.ts +16 -0
- package/dist/transactions/landing/providers/jito.d.ts.map +1 -0
- package/dist/transactions/landing/providers/jito.js +110 -0
- package/dist/transactions/landing/providers/jito.js.map +1 -0
- package/dist/transactions/landing/providers/nextblock.d.ts +11 -0
- package/dist/transactions/landing/providers/nextblock.d.ts.map +1 -0
- package/dist/transactions/landing/providers/nextblock.js +109 -0
- package/dist/transactions/landing/providers/nextblock.js.map +1 -0
- package/dist/transactions/landing/providers/node1.d.ts +11 -0
- package/dist/transactions/landing/providers/node1.d.ts.map +1 -0
- package/dist/transactions/landing/providers/node1.js +101 -0
- package/dist/transactions/landing/providers/node1.js.map +1 -0
- package/dist/transactions/landing/providers/nozomi.d.ts +11 -0
- package/dist/transactions/landing/providers/nozomi.d.ts.map +1 -0
- package/dist/transactions/landing/providers/nozomi.js +124 -0
- package/dist/transactions/landing/providers/nozomi.js.map +1 -0
- package/dist/transactions/landing/providers/soyas.d.ts +16 -0
- package/dist/transactions/landing/providers/soyas.d.ts.map +1 -0
- package/dist/transactions/landing/providers/soyas.js +192 -0
- package/dist/transactions/landing/providers/soyas.js.map +1 -0
- package/dist/transactions/landing/providers/stellium.d.ts +11 -0
- package/dist/transactions/landing/providers/stellium.d.ts.map +1 -0
- package/dist/transactions/landing/providers/stellium.js +102 -0
- package/dist/transactions/landing/providers/stellium.js.map +1 -0
- package/dist/transactions/landing/providers/zero-slot.d.ts +10 -0
- package/dist/transactions/landing/providers/zero-slot.d.ts.map +1 -0
- package/dist/transactions/landing/providers/zero-slot.js +92 -0
- package/dist/transactions/landing/providers/zero-slot.js.map +1 -0
- package/dist/transactions/landing/tip-accounts.d.ts +22 -0
- package/dist/transactions/landing/tip-accounts.d.ts.map +1 -0
- package/dist/transactions/landing/tip-accounts.js +140 -0
- package/dist/transactions/landing/tip-accounts.js.map +1 -0
- package/dist/transactions/landing/types.d.ts +98 -0
- package/dist/transactions/landing/types.d.ts.map +1 -0
- package/dist/transactions/landing/types.js +30 -0
- package/dist/transactions/landing/types.js.map +1 -0
- package/dist/transactions/nozomi/tx-submission.d.ts +14 -0
- package/dist/transactions/nozomi/tx-submission.d.ts.map +1 -0
- package/dist/transactions/nozomi/tx-submission.js +107 -0
- package/dist/transactions/nozomi/tx-submission.js.map +1 -0
- package/dist/transactions/send-rpc.d.ts +54 -0
- package/dist/transactions/send-rpc.d.ts.map +1 -0
- package/dist/transactions/send-rpc.js +126 -0
- package/dist/transactions/send-rpc.js.map +1 -0
- package/dist/transactions/simple_tx_executor.d.ts +10 -0
- package/dist/transactions/simple_tx_executor.d.ts.map +1 -0
- package/dist/transactions/simple_tx_executor.js +33 -0
- package/dist/transactions/simple_tx_executor.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Futarchy AMM — IDexAdapter Implementation
|
|
4
|
+
*
|
|
5
|
+
* Anchor-based DEX using the Futarchy protocol's on-chain AMM.
|
|
6
|
+
* Pools are "DAOs" that embed an AMM with spot/futarchy pool states.
|
|
7
|
+
*
|
|
8
|
+
* Flow:
|
|
9
|
+
* 1. Create Anchor provider + FutarchyAmmSDK
|
|
10
|
+
* 2. Fetch DAO account to get pool state (reserves, mints)
|
|
11
|
+
* 3. Build spotSwap instructions via the SDK
|
|
12
|
+
* 4. Submit via landing layer
|
|
13
|
+
*
|
|
14
|
+
* No sell in source module — only buy/snipe are supported.
|
|
15
|
+
* getPrice reads spot pool reserves from the DAO account.
|
|
16
|
+
*
|
|
17
|
+
* Source: 100x-algo-bots/trading-modules/futarchy-amm/
|
|
18
|
+
*
|
|
19
|
+
* Capabilities: canBuy, canSnipe, canGetPrice
|
|
20
|
+
* Requires: @coral-xyz/anchor
|
|
21
|
+
*/
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.FutarchyAmmAdapter = void 0;
|
|
27
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
28
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
29
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
30
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
31
|
+
const config_1 = require("../helpers/config");
|
|
32
|
+
const landing_1 = require("../transactions/landing");
|
|
33
|
+
const send_rpc_1 = require("../transactions/send-rpc");
|
|
34
|
+
const futarchy_idl_1 = require("./futarchy-idl");
|
|
35
|
+
const types_1 = require("./types");
|
|
36
|
+
const index_1 = require("./index");
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Constants
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
const FUTARCHY_PROGRAM_ID = new web3_js_1.PublicKey("FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq");
|
|
41
|
+
const WSOL_MINT_PK = new web3_js_1.PublicKey(types_1.WSOL_MINT);
|
|
42
|
+
const USDC_MINT_PK = new web3_js_1.PublicKey(types_1.USDC_MINT);
|
|
43
|
+
/** PRICE_SCALE from Rust: 1_000_000_000_000 (1e12) */
|
|
44
|
+
const PRICE_SCALE = 1_000_000_000_000;
|
|
45
|
+
/** Full Futarchy IDL (v0.6.0) — cast for Anchor 0.29 compatibility */
|
|
46
|
+
const FUTARCHY_IDL = futarchy_idl_1.IDL;
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Internal SDK (embedded — matches source FutarchyAmmSDK)
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
class FutarchyAmmSDK {
|
|
51
|
+
program;
|
|
52
|
+
connection;
|
|
53
|
+
constructor(provider) {
|
|
54
|
+
this.connection = provider.connection;
|
|
55
|
+
// Anchor 0.29 constructor: (idl, programId, provider)
|
|
56
|
+
this.program = new anchor_1.Program(FUTARCHY_IDL, FUTARCHY_PROGRAM_ID, provider);
|
|
57
|
+
}
|
|
58
|
+
async getDao(dao) {
|
|
59
|
+
return this.program.account.dao.fetch(dao);
|
|
60
|
+
}
|
|
61
|
+
async createSpotSwapInstructions(dao, baseMint, quoteMint, swapType, inputAmount, minOutputAmount = BigInt(0), trader) {
|
|
62
|
+
const userBaseAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(baseMint, trader, true);
|
|
63
|
+
const userQuoteAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(quoteMint, trader, true);
|
|
64
|
+
const ammBaseVault = (0, spl_token_1.getAssociatedTokenAddressSync)(baseMint, dao, true);
|
|
65
|
+
const ammQuoteVault = (0, spl_token_1.getAssociatedTokenAddressSync)(quoteMint, dao, true);
|
|
66
|
+
const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], this.program.programId);
|
|
67
|
+
const swapIx = await this.program.methods
|
|
68
|
+
.spotSwap({
|
|
69
|
+
swapType: swapType === "buy" ? { buy: {} } : { sell: {} },
|
|
70
|
+
inputAmount: new bn_js_1.default(inputAmount.toString()),
|
|
71
|
+
minOutputAmount: new bn_js_1.default(minOutputAmount.toString()),
|
|
72
|
+
})
|
|
73
|
+
.accounts({
|
|
74
|
+
dao,
|
|
75
|
+
userBaseAccount,
|
|
76
|
+
userQuoteAccount,
|
|
77
|
+
ammBaseVault,
|
|
78
|
+
ammQuoteVault,
|
|
79
|
+
user: trader,
|
|
80
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
81
|
+
eventAuthority,
|
|
82
|
+
program: this.program.programId,
|
|
83
|
+
})
|
|
84
|
+
.instruction();
|
|
85
|
+
const createBaseAtaIx = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(trader, userBaseAccount, trader, baseMint);
|
|
86
|
+
const createQuoteAtaIx = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(trader, userQuoteAccount, trader, quoteMint);
|
|
87
|
+
return [createBaseAtaIx, createQuoteAtaIx, swapIx];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// Helpers
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
/**
|
|
94
|
+
* Extract the spot pool from a DAO's AMM state.
|
|
95
|
+
* Handles both Spot and Futarchy state variants.
|
|
96
|
+
*/
|
|
97
|
+
function extractSpotPool(ammState) {
|
|
98
|
+
// Anchor enums: { spot: { spot: Pool } } or { futarchy: { spot, pass, fail } }
|
|
99
|
+
if (ammState.spot) {
|
|
100
|
+
return ammState.spot.spot;
|
|
101
|
+
}
|
|
102
|
+
if (ammState.futarchy) {
|
|
103
|
+
return ammState.futarchy.spot;
|
|
104
|
+
}
|
|
105
|
+
// Capital-case variants (Anchor representation)
|
|
106
|
+
if (ammState.Spot) {
|
|
107
|
+
return ammState.Spot.spot;
|
|
108
|
+
}
|
|
109
|
+
if (ammState.Futarchy) {
|
|
110
|
+
return ammState.Futarchy.spot;
|
|
111
|
+
}
|
|
112
|
+
throw new Error(`Invalid pool state: ${JSON.stringify(ammState)}`);
|
|
113
|
+
}
|
|
114
|
+
/** Convert SOL-denominated amount to quote token lamports based on quote mint */
|
|
115
|
+
function computeInputAmount(amountSol, quoteMint) {
|
|
116
|
+
if (quoteMint.equals(WSOL_MINT_PK)) {
|
|
117
|
+
return BigInt(Math.floor(amountSol * web3_js_1.LAMPORTS_PER_SOL));
|
|
118
|
+
}
|
|
119
|
+
if (quoteMint.equals(USDC_MINT_PK)) {
|
|
120
|
+
return BigInt(Math.floor(amountSol * 1_000_000)); // 6 decimals
|
|
121
|
+
}
|
|
122
|
+
return BigInt(Math.floor(amountSol * 1_000_000_000));
|
|
123
|
+
}
|
|
124
|
+
function createProvider() {
|
|
125
|
+
const connection = (0, config_1.getConnection)();
|
|
126
|
+
const wallet = (0, config_1.getWallet)();
|
|
127
|
+
return new anchor_1.AnchorProvider(connection, wallet, {
|
|
128
|
+
commitment: "confirmed",
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// Adapter
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
class FutarchyAmmAdapter {
|
|
135
|
+
name = "futarchy-amm";
|
|
136
|
+
protocol = "futarchy";
|
|
137
|
+
capabilities = (0, types_1.defaultCapabilities)({
|
|
138
|
+
canBuy: true,
|
|
139
|
+
canSell: true,
|
|
140
|
+
canSnipe: true,
|
|
141
|
+
canGetPrice: true,
|
|
142
|
+
});
|
|
143
|
+
// ----- Core: buy -----
|
|
144
|
+
async buy(params) {
|
|
145
|
+
const tokenMint = (0, types_1.requireTokenMint)(params, this.name);
|
|
146
|
+
const { amountSol, quoteMint: quoteMintParam, poolAddress, opts } = params;
|
|
147
|
+
const connection = (0, config_1.getConnection)();
|
|
148
|
+
const wallet = (0, config_1.getWallet)();
|
|
149
|
+
if (!poolAddress) {
|
|
150
|
+
throw new Error("futarchy-amm buy() requires poolAddress (DAO address). " +
|
|
151
|
+
"Futarchy DAOs cannot be auto-discovered by mint alone.");
|
|
152
|
+
}
|
|
153
|
+
const dao = new web3_js_1.PublicKey(poolAddress);
|
|
154
|
+
const baseMint = new web3_js_1.PublicKey(tokenMint);
|
|
155
|
+
const provider = createProvider();
|
|
156
|
+
const sdk = new FutarchyAmmSDK(provider);
|
|
157
|
+
// Fetch DAO to auto-detect quote mint
|
|
158
|
+
const daoAccount = await sdk.getDao(dao);
|
|
159
|
+
if (!daoAccount) {
|
|
160
|
+
throw new Error(`DAO not found: ${dao.toBase58()}`);
|
|
161
|
+
}
|
|
162
|
+
// Auto-detect quote mint from DAO account (override user param if not set)
|
|
163
|
+
const quoteMintStr = quoteMintParam ?? daoAccount.quoteMint.toBase58();
|
|
164
|
+
const quoteMint = new web3_js_1.PublicKey(quoteMintStr);
|
|
165
|
+
// Calculate input amount based on quote mint decimals
|
|
166
|
+
const inputAmount = computeInputAmount(amountSol, quoteMint);
|
|
167
|
+
// Slippage — use minOutputAmount=0 for now (source does the same)
|
|
168
|
+
const minOutputAmount = BigInt(0);
|
|
169
|
+
// Build swap instructions
|
|
170
|
+
const swapIxs = await sdk.createSpotSwapInstructions(dao, baseMint, quoteMint, "buy", inputAmount, minOutputAmount, wallet.publicKey);
|
|
171
|
+
// Handle WSOL wrapping
|
|
172
|
+
const quoteAta = await (0, spl_token_1.getAssociatedTokenAddress)(quoteMint, wallet.publicKey, false, spl_token_1.TOKEN_PROGRAM_ID);
|
|
173
|
+
const computeLimit = opts?.computeUnitLimit ?? types_1.DEFAULT_COMPUTE_UNIT_LIMIT;
|
|
174
|
+
const priorityFee = opts?.priorityFeeMicroLamports ?? types_1.DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS;
|
|
175
|
+
let ixs;
|
|
176
|
+
if (quoteMint.equals(WSOL_MINT_PK)) {
|
|
177
|
+
const wsolLamports = Math.floor(amountSol * web3_js_1.LAMPORTS_PER_SOL);
|
|
178
|
+
ixs = [
|
|
179
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: computeLimit }),
|
|
180
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }),
|
|
181
|
+
web3_js_1.SystemProgram.transfer({
|
|
182
|
+
fromPubkey: wallet.publicKey,
|
|
183
|
+
toPubkey: quoteAta,
|
|
184
|
+
lamports: wsolLamports,
|
|
185
|
+
}),
|
|
186
|
+
(0, spl_token_1.createSyncNativeInstruction)(quoteAta, spl_token_1.TOKEN_PROGRAM_ID),
|
|
187
|
+
...swapIxs,
|
|
188
|
+
(0, spl_token_1.createCloseAccountInstruction)(quoteAta, wallet.publicKey, wallet.publicKey, [], spl_token_1.TOKEN_PROGRAM_ID),
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
ixs = [
|
|
193
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: computeLimit }),
|
|
194
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }),
|
|
195
|
+
...swapIxs,
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
// Submit via RPC send+confirm
|
|
199
|
+
const result = await (0, send_rpc_1.sendAndConfirmVtx)(connection, ixs, wallet, {
|
|
200
|
+
addressLookupTables: opts?.addressLookupTables,
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
txSignature: result.txSignature,
|
|
204
|
+
confirmed: result.confirmed,
|
|
205
|
+
amountIn: amountSol,
|
|
206
|
+
amountInToken: quoteMintStr,
|
|
207
|
+
dex: this.name,
|
|
208
|
+
poolAddress,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// ----- Core: sell -----
|
|
212
|
+
async sell(params) {
|
|
213
|
+
const tokenMint = (0, types_1.requireTokenMint)(params, this.name);
|
|
214
|
+
const { percentage, quoteMint: quoteMintParam, poolAddress, opts } = params;
|
|
215
|
+
const connection = (0, config_1.getConnection)();
|
|
216
|
+
const wallet = (0, config_1.getWallet)();
|
|
217
|
+
if (!poolAddress) {
|
|
218
|
+
throw new Error("futarchy-amm sell() requires poolAddress (DAO address). " +
|
|
219
|
+
"Futarchy DAOs cannot be auto-discovered by mint alone.");
|
|
220
|
+
}
|
|
221
|
+
const dao = new web3_js_1.PublicKey(poolAddress);
|
|
222
|
+
const baseMint = new web3_js_1.PublicKey(tokenMint);
|
|
223
|
+
const provider = createProvider();
|
|
224
|
+
const sdk = new FutarchyAmmSDK(provider);
|
|
225
|
+
// Auto-detect quote mint from DAO account
|
|
226
|
+
const daoAccount = await sdk.getDao(dao);
|
|
227
|
+
if (!daoAccount) {
|
|
228
|
+
throw new Error(`DAO not found: ${dao.toBase58()}`);
|
|
229
|
+
}
|
|
230
|
+
const quoteMintStr = quoteMintParam ?? daoAccount.quoteMint.toBase58();
|
|
231
|
+
const quoteMint = new web3_js_1.PublicKey(quoteMintStr);
|
|
232
|
+
// Get token balance (Futarchy uses standard SPL tokens)
|
|
233
|
+
const ata = await (0, spl_token_1.getAssociatedTokenAddress)(baseMint, wallet.publicKey, false, spl_token_1.TOKEN_PROGRAM_ID);
|
|
234
|
+
const tokenAccount = await (0, spl_token_1.getAccount)(connection, ata, "confirmed", spl_token_1.TOKEN_PROGRAM_ID);
|
|
235
|
+
const balance = tokenAccount.amount;
|
|
236
|
+
// Calculate sell amount based on percentage
|
|
237
|
+
const sellAmount = BigInt(Math.floor((Number(balance) * percentage) / 100));
|
|
238
|
+
if (sellAmount === 0n) {
|
|
239
|
+
throw new Error(`No balance to sell for ${tokenMint}`);
|
|
240
|
+
}
|
|
241
|
+
// Build swap instructions — "sell" direction (base → quote)
|
|
242
|
+
const swapIxs = await sdk.createSpotSwapInstructions(dao, baseMint, quoteMint, "sell", sellAmount, BigInt(0), wallet.publicKey);
|
|
243
|
+
const computeLimit = opts?.computeUnitLimit ?? types_1.DEFAULT_COMPUTE_UNIT_LIMIT;
|
|
244
|
+
const priorityFee = opts?.priorityFeeMicroLamports ?? types_1.DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS;
|
|
245
|
+
let ixs;
|
|
246
|
+
// Handle WSOL output wrapping (receive SOL → need WSOL ATA creation + close)
|
|
247
|
+
if (quoteMint.equals(WSOL_MINT_PK)) {
|
|
248
|
+
const quoteAta = await (0, spl_token_1.getAssociatedTokenAddress)(quoteMint, wallet.publicKey, false, spl_token_1.TOKEN_PROGRAM_ID);
|
|
249
|
+
ixs = [
|
|
250
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: computeLimit }),
|
|
251
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }),
|
|
252
|
+
(0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(wallet.publicKey, quoteAta, wallet.publicKey, quoteMint),
|
|
253
|
+
...swapIxs,
|
|
254
|
+
(0, spl_token_1.createCloseAccountInstruction)(quoteAta, wallet.publicKey, wallet.publicKey, [], spl_token_1.TOKEN_PROGRAM_ID),
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
ixs = [
|
|
259
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: computeLimit }),
|
|
260
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }),
|
|
261
|
+
...swapIxs,
|
|
262
|
+
];
|
|
263
|
+
}
|
|
264
|
+
// Submit via RPC send+confirm
|
|
265
|
+
const result = await (0, send_rpc_1.sendAndConfirmVtx)(connection, ixs, wallet, {
|
|
266
|
+
addressLookupTables: opts?.addressLookupTables,
|
|
267
|
+
});
|
|
268
|
+
// Human-readable sell amount
|
|
269
|
+
let tokenDecimals = 9;
|
|
270
|
+
try {
|
|
271
|
+
const mintData = await connection.getTokenSupply(baseMint);
|
|
272
|
+
tokenDecimals = mintData.value.decimals;
|
|
273
|
+
}
|
|
274
|
+
catch { /* fallback to 9 */ }
|
|
275
|
+
const humanAmount = Number(sellAmount) / Math.pow(10, tokenDecimals);
|
|
276
|
+
return {
|
|
277
|
+
txSignature: result.txSignature,
|
|
278
|
+
confirmed: result.confirmed,
|
|
279
|
+
amountIn: humanAmount,
|
|
280
|
+
amountInToken: tokenMint,
|
|
281
|
+
dex: this.name,
|
|
282
|
+
poolAddress,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
// ----- Snipe -----
|
|
286
|
+
async snipe(params) {
|
|
287
|
+
const { tokenMint, amountSol, poolAddress, quoteMint: quoteMintParam, tipSol, opts } = params;
|
|
288
|
+
const connection = (0, config_1.getConnection)();
|
|
289
|
+
const wallet = (0, config_1.getWallet)();
|
|
290
|
+
const dao = new web3_js_1.PublicKey(poolAddress);
|
|
291
|
+
const baseMint = new web3_js_1.PublicKey(tokenMint);
|
|
292
|
+
const provider = createProvider();
|
|
293
|
+
const sdk = new FutarchyAmmSDK(provider);
|
|
294
|
+
// Auto-detect quote mint from DAO account
|
|
295
|
+
const daoAccount = await sdk.getDao(dao);
|
|
296
|
+
if (!daoAccount) {
|
|
297
|
+
throw new Error(`DAO not found: ${dao.toBase58()}`);
|
|
298
|
+
}
|
|
299
|
+
const quoteMintStr = quoteMintParam ?? daoAccount.quoteMint.toBase58();
|
|
300
|
+
const quoteMint = new web3_js_1.PublicKey(quoteMintStr);
|
|
301
|
+
const inputAmount = computeInputAmount(amountSol, quoteMint);
|
|
302
|
+
// Snipe: minOutput = 0 for maximum fill
|
|
303
|
+
const swapIxs = await sdk.createSpotSwapInstructions(dao, baseMint, quoteMint, "buy", inputAmount, BigInt(0), wallet.publicKey);
|
|
304
|
+
const quoteAta = await (0, spl_token_1.getAssociatedTokenAddress)(quoteMint, wallet.publicKey, false, spl_token_1.TOKEN_PROGRAM_ID);
|
|
305
|
+
const computeLimit = opts?.computeUnitLimit ?? types_1.DEFAULT_COMPUTE_UNIT_LIMIT;
|
|
306
|
+
const priorityFee = opts?.priorityFeeMicroLamports ?? 20_000_000; // high for snipe
|
|
307
|
+
let ixs;
|
|
308
|
+
if (quoteMint.equals(WSOL_MINT_PK)) {
|
|
309
|
+
const wsolLamports = Math.floor(amountSol * web3_js_1.LAMPORTS_PER_SOL);
|
|
310
|
+
ixs = [
|
|
311
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: computeLimit }),
|
|
312
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }),
|
|
313
|
+
web3_js_1.SystemProgram.transfer({
|
|
314
|
+
fromPubkey: wallet.publicKey,
|
|
315
|
+
toPubkey: quoteAta,
|
|
316
|
+
lamports: wsolLamports,
|
|
317
|
+
}),
|
|
318
|
+
(0, spl_token_1.createSyncNativeInstruction)(quoteAta, spl_token_1.TOKEN_PROGRAM_ID),
|
|
319
|
+
...swapIxs,
|
|
320
|
+
(0, spl_token_1.createCloseAccountInstruction)(quoteAta, wallet.publicKey, wallet.publicKey, [], spl_token_1.TOKEN_PROGRAM_ID),
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
ixs = [
|
|
325
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: computeLimit }),
|
|
326
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }),
|
|
327
|
+
...swapIxs,
|
|
328
|
+
];
|
|
329
|
+
}
|
|
330
|
+
const blockhash = await connection.getLatestBlockhash();
|
|
331
|
+
const results = await (0, landing_1.landTransaction)(ixs, wallet, blockhash, {
|
|
332
|
+
dex: this.name,
|
|
333
|
+
operation: "snipe",
|
|
334
|
+
tipSol,
|
|
335
|
+
addressLookupTables: opts?.addressLookupTables,
|
|
336
|
+
});
|
|
337
|
+
const accepted = results.find((r) => r.accepted);
|
|
338
|
+
return {
|
|
339
|
+
txSignature: accepted?.signature ?? "",
|
|
340
|
+
confirmed: !!accepted?.accepted,
|
|
341
|
+
amountIn: amountSol,
|
|
342
|
+
amountInToken: quoteMintStr,
|
|
343
|
+
dex: this.name,
|
|
344
|
+
poolAddress,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
// ----- buildSwapIxs (for orchestrator / nonce integration) -----
|
|
348
|
+
async buildSwapIxs(params) {
|
|
349
|
+
const tokenMint = (0, types_1.requireTokenMint)(params, this.name);
|
|
350
|
+
if ("percentage" in params) {
|
|
351
|
+
throw new types_1.UnsupportedOperationError(this.name, "buildSwapIxs(sell)");
|
|
352
|
+
}
|
|
353
|
+
const buyParams = params;
|
|
354
|
+
const wallet = (0, config_1.getWallet)();
|
|
355
|
+
if (!buyParams.poolAddress) {
|
|
356
|
+
throw new Error("futarchy-amm buildSwapIxs() requires poolAddress (DAO address)");
|
|
357
|
+
}
|
|
358
|
+
const dao = new web3_js_1.PublicKey(buyParams.poolAddress);
|
|
359
|
+
const baseMint = new web3_js_1.PublicKey(tokenMint);
|
|
360
|
+
const provider = createProvider();
|
|
361
|
+
const sdk = new FutarchyAmmSDK(provider);
|
|
362
|
+
// Auto-detect quote mint from DAO account
|
|
363
|
+
const daoAccount = await sdk.getDao(dao);
|
|
364
|
+
if (!daoAccount) {
|
|
365
|
+
throw new Error(`DAO not found: ${dao.toBase58()}`);
|
|
366
|
+
}
|
|
367
|
+
const quoteMintStr = buyParams.quoteMint ?? daoAccount.quoteMint.toBase58();
|
|
368
|
+
const quoteMint = new web3_js_1.PublicKey(quoteMintStr);
|
|
369
|
+
const inputAmount = computeInputAmount(buyParams.amountSol, quoteMint);
|
|
370
|
+
const swapIxs = await sdk.createSpotSwapInstructions(dao, baseMint, quoteMint, "buy", inputAmount, BigInt(0), wallet.publicKey);
|
|
371
|
+
// If WSOL, add wrap/unwrap instructions around swap
|
|
372
|
+
if (quoteMint.equals(WSOL_MINT_PK)) {
|
|
373
|
+
const quoteAta = await (0, spl_token_1.getAssociatedTokenAddress)(quoteMint, wallet.publicKey, false, spl_token_1.TOKEN_PROGRAM_ID);
|
|
374
|
+
const wsolLamports = Math.floor(buyParams.amountSol * web3_js_1.LAMPORTS_PER_SOL);
|
|
375
|
+
return {
|
|
376
|
+
instructions: [
|
|
377
|
+
web3_js_1.SystemProgram.transfer({
|
|
378
|
+
fromPubkey: wallet.publicKey,
|
|
379
|
+
toPubkey: quoteAta,
|
|
380
|
+
lamports: wsolLamports,
|
|
381
|
+
}),
|
|
382
|
+
(0, spl_token_1.createSyncNativeInstruction)(quoteAta, spl_token_1.TOKEN_PROGRAM_ID),
|
|
383
|
+
...swapIxs,
|
|
384
|
+
(0, spl_token_1.createCloseAccountInstruction)(quoteAta, wallet.publicKey, wallet.publicKey, [], spl_token_1.TOKEN_PROGRAM_ID),
|
|
385
|
+
],
|
|
386
|
+
signers: [],
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
instructions: swapIxs,
|
|
391
|
+
signers: [],
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
// ----- getPrice -----
|
|
395
|
+
async getPrice(poolAddress) {
|
|
396
|
+
const connection = (0, config_1.getConnection)();
|
|
397
|
+
const dao = new web3_js_1.PublicKey(poolAddress);
|
|
398
|
+
const provider = createProvider();
|
|
399
|
+
const sdk = new FutarchyAmmSDK(provider);
|
|
400
|
+
const daoAccount = await sdk.getDao(dao);
|
|
401
|
+
if (!daoAccount) {
|
|
402
|
+
throw new Error(`DAO not found: ${dao.toBase58()}`);
|
|
403
|
+
}
|
|
404
|
+
const amm = daoAccount.amm;
|
|
405
|
+
const spotPool = extractSpotPool(amm.state);
|
|
406
|
+
if (!spotPool) {
|
|
407
|
+
throw new Error(`Spot pool not found in DAO ${dao.toBase58()}`);
|
|
408
|
+
}
|
|
409
|
+
const quoteReserves = Number(spotPool.quoteReserves);
|
|
410
|
+
const baseReserves = Number(spotPool.baseReserves);
|
|
411
|
+
if (baseReserves === 0) {
|
|
412
|
+
throw new Error(`Base reserves are zero for DAO ${dao.toBase58()}`);
|
|
413
|
+
}
|
|
414
|
+
// Calculate price: (quote_reserves * PRICE_SCALE) / base_reserves
|
|
415
|
+
const price = (quoteReserves * PRICE_SCALE) / baseReserves;
|
|
416
|
+
// Get mint decimals for UI price conversion
|
|
417
|
+
const baseMint = new web3_js_1.PublicKey(amm.baseMint);
|
|
418
|
+
const quoteMint = new web3_js_1.PublicKey(amm.quoteMint);
|
|
419
|
+
const baseMintInfo = await (0, spl_token_1.getMint)(connection, baseMint);
|
|
420
|
+
const quoteMintInfo = await (0, spl_token_1.getMint)(connection, quoteMint);
|
|
421
|
+
const baseDecimals = baseMintInfo.decimals;
|
|
422
|
+
const quoteDecimals = quoteMintInfo.decimals;
|
|
423
|
+
// Convert to UI price: ui_price = (price * (10**(base_decimals - quote_decimals))) / PRICE_SCALE
|
|
424
|
+
const decimalsDiff = baseDecimals - quoteDecimals;
|
|
425
|
+
const decimalsMultiplier = Math.pow(10, decimalsDiff);
|
|
426
|
+
const uiPrice = (price * decimalsMultiplier) / PRICE_SCALE;
|
|
427
|
+
const realPrice = uiPrice;
|
|
428
|
+
return {
|
|
429
|
+
price: realPrice,
|
|
430
|
+
baseMint: baseMint.toBase58(),
|
|
431
|
+
quoteMint: quoteMint.toBase58(),
|
|
432
|
+
source: "on-chain",
|
|
433
|
+
poolAddress,
|
|
434
|
+
timestamp: Date.now(),
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
exports.FutarchyAmmAdapter = FutarchyAmmAdapter;
|
|
439
|
+
// ---------------------------------------------------------------------------
|
|
440
|
+
// Auto-register
|
|
441
|
+
// ---------------------------------------------------------------------------
|
|
442
|
+
(0, index_1.registerAdapter)(new FutarchyAmmAdapter());
|
|
443
|
+
//# sourceMappingURL=futarchy-amm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"futarchy-amm.js","sourceRoot":"","sources":["../../src/dex/futarchy-amm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,6CAOyB;AACzB,8CAAiE;AACjE,kDAAuB;AACvB,iDAS2B;AAE3B,8CAA6D;AAE7D,qDAA0D;AAC1D,uDAA6D;AAC7D,iDAAyD;AAEzD,mCAkBiB;AAEjB,mCAA0C;AAE1C,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,mBAAmB,GAAG,IAAI,mBAAS,CACvC,8CAA8C,CAC/C,CAAC;AAEF,MAAM,YAAY,GAAG,IAAI,mBAAS,CAAC,iBAAS,CAAC,CAAC;AAC9C,MAAM,YAAY,GAAG,IAAI,mBAAS,CAAC,iBAAS,CAAC,CAAC;AAE9C,sDAAsD;AACtD,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC,sEAAsE;AACtE,MAAM,YAAY,GAAG,kBAAkC,CAAC;AAExD,8EAA8E;AAC9E,0DAA0D;AAC1D,8EAA8E;AAE9E,MAAM,cAAc;IACF,OAAO,CAAe;IACtB,UAAU,CAAa;IAEvC,YAAY,QAAwB;QAClC,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACtC,sDAAsD;QACtD,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAO,CACxB,YAAY,EACZ,mBAAmB,EACnB,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAc;QACzB,OAAQ,IAAI,CAAC,OAAO,CAAC,OAAe,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,0BAA0B,CAC9B,GAAc,EACd,QAAmB,E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