hookr-sdk 0.2.0 → 1.0.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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/MIGRATING.md +89 -0
- package/README.md +283 -96
- package/dist/core/abi.d.ts +10930 -0
- package/dist/core/abi.js +455 -0
- package/dist/core/advisories.d.ts +184 -0
- package/dist/core/advisories.js +291 -0
- package/dist/core/client.d.ts +55 -0
- package/dist/core/client.js +107 -0
- package/dist/core/generated.d.ts +14295 -0
- package/dist/core/generated.js +1058 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +17 -0
- package/dist/core/launch.d.ts +200 -0
- package/dist/core/launch.js +427 -0
- package/dist/core/pair.d.ts +64 -0
- package/dist/core/pair.js +136 -0
- package/dist/core/params.d.ts +415 -0
- package/dist/core/params.js +1235 -0
- package/dist/core/policies.d.ts +136 -0
- package/dist/core/policies.js +125 -0
- package/dist/core/proofs.d.ts +25 -0
- package/dist/core/proofs.js +118 -0
- package/dist/core/quotes.d.ts +185 -0
- package/dist/core/quotes.js +550 -0
- package/dist/core/referrals.d.ts +32 -0
- package/dist/core/referrals.js +36 -0
- package/dist/core/registry.d.ts +357 -0
- package/dist/core/registry.js +378 -0
- package/dist/core/rules.d.ts +675 -0
- package/dist/core/rules.js +1049 -0
- package/dist/core/schema.d.ts +358 -0
- package/dist/core/schema.js +105 -0
- package/dist/core/stocks.generated.d.ts +11 -0
- package/dist/core/stocks.generated.js +1228 -0
- package/dist/core/vault.d.ts +59 -0
- package/dist/core/vault.js +112 -0
- package/dist/core/wallet.d.ts +142 -0
- package/dist/core/wallet.js +304 -0
- package/dist/deployments.d.ts +8 -0
- package/dist/deployments.js +26 -0
- package/dist/index.d.ts +6 -15
- package/dist/index.js +6 -15
- package/dist/releases.d.ts +172 -0
- package/dist/releases.js +268 -0
- package/package.json +46 -10
- package/provenance.json +31 -0
- package/dist/abi.d.ts +0 -6404
- package/dist/abi.js +0 -8300
- package/dist/chain.d.ts +0 -87
- package/dist/chain.js +0 -86
- package/dist/claims.d.ts +0 -32
- package/dist/claims.js +0 -31
- package/dist/fees.d.ts +0 -59
- package/dist/fees.js +0 -142
- package/dist/links.d.ts +0 -48
- package/dist/links.js +0 -93
- package/dist/market.d.ts +0 -264
- package/dist/market.js +0 -310
- package/dist/reads.d.ts +0 -127
- package/dist/reads.js +0 -207
- package/dist/rules.d.ts +0 -84
- package/dist/rules.js +0 -296
- package/dist/swap.d.ts +0 -96
- package/dist/swap.js +0 -134
package/dist/core/abi.js
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { parseAbi } from "viem";
|
|
2
|
+
import { ARTIFACT_ABIS } from "./generated.js";
|
|
3
|
+
export const CORE_STRUCTS = [
|
|
4
|
+
"struct PoolKey { address currency0; address currency1; uint24 fee; int24 tickSpacing; address hooks; }",
|
|
5
|
+
"struct Caps { uint24 maxLpFeePips; uint24 maxQuoteTakePips; uint16 maxSubjectTakeBps; }",
|
|
6
|
+
"struct PoolConfig { address subject; address quote; address rules; address advisory; address liquidityOwner; uint24 baseLpFeePips; Caps caps; uint32 rulesGasLimit; uint32 advisoryGasLimit; uint8 advisoryPhases; bool advisoryFailOpen; bytes32 policyId; }",
|
|
7
|
+
"struct RulesConfig { uint40 guardEndBlock; uint24 maxFeePips; uint24 snipeTaxPips; uint24 snipeFloorPips; uint16 snipeDecaySeconds; uint16 dynamicFeeSens; uint16 burnBps; uint16 lpBps; uint16 potBps; uint16 royaltyBps; uint16 protocolShareBps; uint32 potEveryNBuys; uint128 maxBuyQuoteAmount; uint128 potMinBuyQuote; address royaltyTo; address integrator; }",
|
|
8
|
+
"struct Swap { PoolKey key; bool zeroForOne; int128 amountSpecified; uint128 amountBound; uint160 sqrtPriceLimitX96; address recipient; uint256 deadline; }",
|
|
9
|
+
"struct Token { address existing; string name; string symbol; uint256 supply; bytes32 salt; }",
|
|
10
|
+
"struct RecaptureConfig { bool on; uint16 traderBps; uint16 lpBps; uint32 period; uint16 maxPrizeBps; uint16 potReleaseBps; uint128 minBuyQuote; uint32 releaseBlocks; }",
|
|
11
|
+
"struct Member { address quote; int24 tickSpacing; uint160 sqrtPriceX96; int24 tickLower; int24 tickUpper; uint128 liquidity; uint128 amount0Max; uint128 amount1Max; PoolConfig config; RulesConfig rules; RecaptureConfig recapture; }",
|
|
12
|
+
"struct Position { PoolKey key; int24 tickLower; int24 tickUpper; uint128 liquidity; }",
|
|
13
|
+
"struct CoreReceipt { bytes32 id; bytes32 policyHash; address payer; address beneficiary; address inputCurrency; address outputCurrency; uint256 inputAmount; uint256 outputAmount; uint256 actualQuote; uint256 quoteFee; uint256 quoteRefund; uint256 subjectBurn; uint24 lpFeePips; }",
|
|
14
|
+
];
|
|
15
|
+
export const launcherAbi = parseAbi([
|
|
16
|
+
...CORE_STRUCTS,
|
|
17
|
+
"function launch(Token token,address rootAddress,Member[] members,uint256 deadline) payable returns(bytes32 familyId,address subject)",
|
|
18
|
+
"function launchAdvised(Token token,address rootAddress,Member[] members,bytes[] advisoryConfigs,uint256 deadline) payable returns(bytes32 familyId,address subject)",
|
|
19
|
+
"struct DevBuy { uint8 member; uint128 quoteIn; uint128 minSubjectOut; uint32 lockBlocks; }",
|
|
20
|
+
"function launchWithBuy(Token token,address rootAddress,Member[] members,bytes[] advisoryConfigs,DevBuy buy,uint256 deadline) payable returns(bytes32 familyId,address subject,uint256 subjectOut)",
|
|
21
|
+
// r31: the Multi-pool launch with each member's knobs, up to one dev buy per member, a retained cap and an opening
|
|
22
|
+
// check.
|
|
23
|
+
"struct MemberKnobs { uint16 subjectWeightBps; uint16 dynamicFeeLiquidityDivisor; uint64 lockEndBlock; uint16 windowSeconds; uint16 resetSeconds; uint16 carryBps; uint24 moveTicks; uint8 snipeCurve; }",
|
|
24
|
+
"struct OpeningCheck { uint16 toleranceBps; PoolKey[] references; }",
|
|
25
|
+
"struct LaunchParams { Token token; address root; Member[] members; MemberKnobs[] knobs; bytes[] advisoryConfigs; DevBuy[] buys; uint16 maxRetainedBps; OpeningCheck opening; uint256 deadline; string tagline; string logoURI; }",
|
|
26
|
+
"function launchFamily(LaunchParams p) payable returns(bytes32 familyId,address subject,uint256 subjectOut)",
|
|
27
|
+
"event FamilyWeights(bytes32 indexed familyId,uint16[8] weightsBps)",
|
|
28
|
+
"event FamilyRetained(bytes32 indexed familyId,uint256 retained,uint256 cap)",
|
|
29
|
+
"event FamilyOpeningChecked(bytes32 indexed familyId,uint16 toleranceBps,bytes32 referencesHash)",
|
|
30
|
+
"event LaunchFeePaid(bytes32 indexed familyId,address indexed target,uint256 fee)",
|
|
31
|
+
"error InvalidFamily()",
|
|
32
|
+
"error InvalidFunding()",
|
|
33
|
+
"error InvalidRetainedCap(uint256 maxRetainedBps)",
|
|
34
|
+
"error RetainedAboveCap(uint256 held,uint256 cap)",
|
|
35
|
+
"error InvalidWeights()",
|
|
36
|
+
"error WeightMismatch(uint8 member,uint256 budget,uint256 expected)",
|
|
37
|
+
"error InvalidDivisor(uint8 member,uint256 divisor)",
|
|
38
|
+
"error InvalidLockEnd(uint8 member,uint256 lockEndBlock)",
|
|
39
|
+
"error OpeningToleranceOutOfRange(uint16 toleranceBps)",
|
|
40
|
+
"error OpeningReferenceMismatch(uint8 member)",
|
|
41
|
+
"error OpeningReferenceUninitialized(uint8 member)",
|
|
42
|
+
"error OpeningOutsideTolerance(uint8 member,uint256 converted,uint256 low,uint256 high)",
|
|
43
|
+
"function launchBuyPool() view returns(bytes32)",
|
|
44
|
+
"event DevBuyExecuted(bytes32 indexed familyId,bytes32 indexed poolId,address indexed buyer,uint8 member,uint256 quoteIn,uint256 subjectOut,uint160 sqrtPriceX96,uint160 sqrtPriceAfterX96,uint256 lockedUntil)",
|
|
45
|
+
"error InvalidDevBuy()",
|
|
46
|
+
"error DevBuyAboveCap(uint256 held,uint256 cap)",
|
|
47
|
+
"error DevBuySlippage(uint256 subjectOut,uint256 minSubjectOut)",
|
|
48
|
+
"error DevBuyPartialFill(uint256 paid,uint256 quoteIn)",
|
|
49
|
+
"function releaseId() pure returns(uint256)",
|
|
50
|
+
"function DYNAMIC_FEE_LIQUIDITY_DIVISOR() view returns(uint256)",
|
|
51
|
+
"function withdraw(bytes32 familyId,uint8 member,uint128 liquidity,uint256 min0,uint256 min1,address recipient,uint256 deadline) returns(uint256 amount0,uint256 amount1)",
|
|
52
|
+
"function withdrawWithClaims(bytes32 familyId,uint8 member,uint128 liquidity,uint256 min0,uint256 min1,address recipient,uint8 claims,uint256 deadline) returns(uint256 amount0,uint256 amount1)",
|
|
53
|
+
"function transferFamily(bytes32 familyId,address newOwner,uint16 claims)",
|
|
54
|
+
"function acceptFamily(bytes32 familyId)",
|
|
55
|
+
"function pendingFamilyOwner(bytes32 familyId) view returns(address pendingOwner,uint16 claims)",
|
|
56
|
+
"function principalLockedUntil(bytes32 familyId) view returns(uint256)",
|
|
57
|
+
"function memberKey(address subject,address quote,int24 tickSpacing,address rootAddress) view returns(PoolKey key,bool available)",
|
|
58
|
+
"function redeem(address currency,uint256 amount,address recipient)",
|
|
59
|
+
"function sweep(address currency,address recipient) returns(uint256 amount)",
|
|
60
|
+
"function position(bytes32 familyId,uint8 member) view returns(Position)",
|
|
61
|
+
"function predictToken(address creator,Token token) view returns(address)",
|
|
62
|
+
"function addLiquidity(bytes32 familyId,uint8 member,uint128 liquidity,uint128 max0,uint128 max1,uint256 deadline) payable returns(uint256 amount0,uint256 amount1)",
|
|
63
|
+
"event LiquidityAdded(bytes32 indexed familyId,uint8 member,uint128 liquidity,uint256 amount0,uint256 amount1)",
|
|
64
|
+
"event LPFeesCollected(bytes32 indexed familyId,uint8 member,bytes32 indexed poolId,address indexed owner,address recipient,uint256 amount0,uint256 amount1)",
|
|
65
|
+
"function familyOwner(bytes32) view returns(address)",
|
|
66
|
+
"event FamilyLaunched(bytes32 indexed familyId,address indexed owner,address indexed subject,address root)",
|
|
67
|
+
"event MemberLaunched(bytes32 indexed familyId,uint8 member,bytes32 indexed poolId,address quote,uint128 liquidity)",
|
|
68
|
+
"event FamilyTransferStarted(bytes32 indexed familyId,address indexed owner,address indexed pendingOwner,uint16 claims)",
|
|
69
|
+
"event FamilyTransferred(bytes32 indexed familyId,address indexed owner)",
|
|
70
|
+
"event LiquidityRemoved(bytes32 indexed familyId,uint8 member,uint128 liquidity,uint256 amount0,uint256 amount1)",
|
|
71
|
+
]);
|
|
72
|
+
/**
|
|
73
|
+
* IHookrLaunchFee (r31): the launch fee every launch's native value carries, served by HookrLauncher's fallback from its
|
|
74
|
+
* linked library HookrLaunchChecks (so outside the launcher's ABI), with the registry owner's propose and accept and
|
|
75
|
+
* the owner's or guardian's clear.
|
|
76
|
+
*/
|
|
77
|
+
export const launchFeeAbi = parseAbi([
|
|
78
|
+
"function launchFee() view returns(uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)",
|
|
79
|
+
"function proposeLaunchFee(uint96 fee,address treasury)",
|
|
80
|
+
"function acceptLaunchFee()",
|
|
81
|
+
"function clearLaunchFee()",
|
|
82
|
+
]);
|
|
83
|
+
export const routerAbi = parseAbi([
|
|
84
|
+
...CORE_STRUCTS,
|
|
85
|
+
"function swap(Swap params,address engagement,uint256[] campaigns) payable returns(uint256 amountIn,uint256 amountOut)",
|
|
86
|
+
"event SwapExecuted(bytes32 indexed poolId,address indexed payer,address indexed recipient,uint256 amountIn,uint256 amountOut)",
|
|
87
|
+
"function swapFor(Swap params,address payer,uint256 outputFee,address feeRecipient,address engagement,uint256[] campaigns) returns(uint256 amountIn,uint256 amountOut)",
|
|
88
|
+
// A swap for `payer` vouched by the root's admitted GATE (r31; HookrFamilyRouter is the release's gate). `data` goes to
|
|
89
|
+
// the gate only.
|
|
90
|
+
"function swapGated(Swap params,address payer,address gate,bytes data,address engagement,uint256[] campaigns) payable returns(uint256 amountIn,uint256 amountOut)",
|
|
91
|
+
"function sweep(address currency,address to) returns(uint256 amount)",
|
|
92
|
+
"function forwarder() view returns(address)",
|
|
93
|
+
"function forwarderCodeHash() view returns(bytes32)",
|
|
94
|
+
"function releaseId() pure returns(uint256)",
|
|
95
|
+
]);
|
|
96
|
+
export const quoterAbi = parseAbi([
|
|
97
|
+
...CORE_STRUCTS,
|
|
98
|
+
"function quote(Swap params,address payer) returns(CoreReceipt receipt)",
|
|
99
|
+
// `quote` with the payer's arb recapture claim and the simulation's gas (a cost, not a gas limit).
|
|
100
|
+
"function quoteDetailed(Swap params,address payer) returns(CoreReceipt receipt,uint256 traderClaim,uint256 gasEstimate)",
|
|
101
|
+
// Uniswap IV4Quoter's single-pool shape for aggregators: `msg.sender` is the payer and the recipient, and hookData
|
|
102
|
+
// must be empty.
|
|
103
|
+
"struct QuoteExactSingleParams { PoolKey poolKey; bool zeroForOne; uint128 exactAmount; bytes hookData; }",
|
|
104
|
+
"function quoteExactInputSingle(QuoteExactSingleParams params) returns(uint256 amountOut,uint256 gasEstimate)",
|
|
105
|
+
"function quoteExactOutputSingle(QuoteExactSingleParams params) returns(uint256 amountIn,uint256 gasEstimate)",
|
|
106
|
+
// The committed simulation; only the quoter itself can call it, inside its own unlock.
|
|
107
|
+
"struct Request { Swap params; address payer; }",
|
|
108
|
+
"function simulate(Request request) returns(CoreReceipt receipt)",
|
|
109
|
+
"error InvalidQuote()",
|
|
110
|
+
"error InvalidHookData()",
|
|
111
|
+
"error NotEnoughLiquidity(bytes32 poolId)",
|
|
112
|
+
"error QuoteDetail(CoreReceipt receipt,uint256 traderClaim)",
|
|
113
|
+
"function releaseId() pure returns(uint256)",
|
|
114
|
+
]);
|
|
115
|
+
/** PoolManager's IPoolManager.SwapParams, as HookrRoot.quoteLeg takes it. */
|
|
116
|
+
export const SWAP_PARAMS_STRUCT = "struct SwapParams { bool zeroForOne; int256 amountSpecified; uint160 sqrtPriceLimitX96; }";
|
|
117
|
+
/**
|
|
118
|
+
* HookrRoot.quoteLeg (selector 0xba835629): the LP fee, quote take and recipient the pool's advisory asks of the
|
|
119
|
+
* caller's recapture leg, refusing where the leg would be refused. Only the pool's lane executor may ask, and only a
|
|
120
|
+
* staticcall inside the frame right before the leg sees the leg's state; an eth_call is an estimate. `amount0` and
|
|
121
|
+
* `amount1` are the pool's own swap delta; both zero skip the after phase (`afterSkipped`), and `afterPreSwap` flags
|
|
122
|
+
* an after phase asked on the state before the swap.
|
|
123
|
+
*/
|
|
124
|
+
const QUOTE_LEG = "function quoteLeg(PoolKey key,SwapParams params,int128 amount0,int128 amount1) returns(uint24 lpFeePips,uint24 takePips,address recipient,bool fullPath,bool afterSkipped,bool afterPreSwap)";
|
|
125
|
+
export const rootAbi = parseAbi([
|
|
126
|
+
...CORE_STRUCTS,
|
|
127
|
+
SWAP_PARAMS_STRUCT,
|
|
128
|
+
QUOTE_LEG,
|
|
129
|
+
"function poolConfig(bytes32 id) view returns(PoolConfig)",
|
|
130
|
+
"function policyHash(bytes32 id) view returns(bytes32)",
|
|
131
|
+
"function curatedRouter() view returns(address)",
|
|
132
|
+
"function releaseId() pure returns(uint256)",
|
|
133
|
+
"event PoolOpened(bytes32 indexed id,address indexed launcher,bytes32 indexed policyHash,address rules,address advisory)",
|
|
134
|
+
]);
|
|
135
|
+
/**
|
|
136
|
+
* The recapture lane surface HookrRoot answers (IHookrLaneRoot): laneOf and the lane module through its fallback,
|
|
137
|
+
* quoteLeg as its own function, and the lane events. The mechanism is an arb recapture; the event names keep the
|
|
138
|
+
* contracts' identifiers.
|
|
139
|
+
*/
|
|
140
|
+
export const laneRootAbi = parseAbi([
|
|
141
|
+
...CORE_STRUCTS,
|
|
142
|
+
SWAP_PARAMS_STRUCT,
|
|
143
|
+
QUOTE_LEG,
|
|
144
|
+
"function laneOf(bytes32 id) view returns(address executor,bytes32 codeHash,uint16 partnerBps,bytes32 family,bool on,uint32 gasCap,uint256 gasFloor)",
|
|
145
|
+
"function laneModule() view returns(address module,bytes32 codeHash)",
|
|
146
|
+
"event PoolLane(bytes32 indexed id,address indexed executor,bytes32 codeHash,uint16 partnerBps,bytes32 family)",
|
|
147
|
+
"event CorrectionSucceeded(bytes32 indexed id,uint8 indexed phase,address indexed trader,uint256 reportedProfit,uint256 pushed,address currency)",
|
|
148
|
+
"event CorrectionFailed(bytes32 indexed id,uint8 indexed phase,address indexed trader,bytes4 reason)",
|
|
149
|
+
"event LaneCodeChanged(bytes32 indexed id,uint8 indexed phase)",
|
|
150
|
+
]);
|
|
151
|
+
/**
|
|
152
|
+
* IHookrLaneExecutor: the call a lane makes, selector 0x488301cd, in both phases of a lane pool's swap (before the
|
|
153
|
+
* swap is quoted and after it settles). `rebateRecipient` is the swap's authenticated payer in the after phase, zero
|
|
154
|
+
* in the before phase and for an unauthenticated swap. An executor on the three-argument ABI of r19 to r21
|
|
155
|
+
* (`uint256 swappedQuote` third, 0x481c5bd1) fails every frame. Since r30 (`docs/security/audits/r30.md`; r29's view,
|
|
156
|
+
* 0x0c1cd60a, had no direction) the root asks `checkV3PoolsMev(subject, quote, swapper, zeroForOne)` (0x9e97c424) by
|
|
157
|
+
* staticcall with at most 200,000 gas right after the before-phase call, `zeroForOne` being the swap's own direction on
|
|
158
|
+
* the lane pool in its key's order, and refuses the swap (`MevCallbackRefused`) only on a clean true.
|
|
159
|
+
*/
|
|
160
|
+
export const laneExecutorAbi = parseAbi([
|
|
161
|
+
...CORE_STRUCTS,
|
|
162
|
+
"function executeArbitrage(PoolKey triggeringPool,address rebateRecipient) returns(uint256 realizedProfitQuote)",
|
|
163
|
+
"function checkV3PoolsMev(address subject,address quote,address swapper,bool zeroForOne) view returns(bool)",
|
|
164
|
+
]);
|
|
165
|
+
/**
|
|
166
|
+
* An arb recapture leg on a dynamic fee pool carries the pool's dynamic fee state (since r27,
|
|
167
|
+
* `docs/security/audits/r27.md`): after the leg's swap the root's afterSwap DELEGATECALLs its lane module's
|
|
168
|
+
* `updateLegDynamicFee()` (selector 0xfb86cbca; only while the PoolManager is the caller, so it is refused for anyone
|
|
169
|
+
* else the root's fallback forwards it for), which calls the Rules' `carryLeg(context, simulation, quoteAmount)`
|
|
170
|
+
* (IHookrLaneRules, selector 0xff341722, root only, answered from HookrRules' fallback before the recapture module, so
|
|
171
|
+
* it is in neither the HookrRules nor the HookrRecapture ABI). Both are fail-open, charge and credit nothing and emit
|
|
172
|
+
* nothing: the Rules step the reference and move the anchor as for an ordinary swap from the leg's start to its end
|
|
173
|
+
* that paid `quoteAmount` of the quote, so the next trader is priced from where the leg left the price. A leg's own LP
|
|
174
|
+
* fee, take and swap are unchanged. Nothing outside the root calls either; they are here for decoders and review.
|
|
175
|
+
*/
|
|
176
|
+
export const LANE_CARRY_STRUCTS = [
|
|
177
|
+
"struct SwapContext { bytes32 id; address sender; address payer; address beneficiary; address subject; address quote; bool authenticated; bool isBuy; bool exactInput; bool zeroForOne; int256 amountSpecified; uint160 sqrtPriceLimitX96; uint24 baseLpFeePips; }",
|
|
178
|
+
"struct SwapSimulation { uint160 sqrtPriceBeforeX96; int24 tickBefore; uint160 sqrtPriceAfterX96; int24 tickAfter; }",
|
|
179
|
+
];
|
|
180
|
+
export const laneRulesAbi = parseAbi([
|
|
181
|
+
...LANE_CARRY_STRUCTS,
|
|
182
|
+
"function carryLeg(SwapContext context,SwapSimulation simulation,uint256 quoteAmount)",
|
|
183
|
+
]);
|
|
184
|
+
export const laneModuleAbi = parseAbi(["function updateLegDynamicFee()"]);
|
|
185
|
+
/**
|
|
186
|
+
* HookrRecapture, reached through HookrRules' fallback: the pool's recapture config and its bounds, the pending LP
|
|
187
|
+
* share, and settleLeg (selector 0x4f735c09, root only), which credits a recapture leg's advisory take to its
|
|
188
|
+
* recipient and emits FeesAllocated(id, quote, 0, 0, 0, recipient, take). The release counts L2 blocks
|
|
189
|
+
* (ArbSys.arbBlockNumber) and at most RECAPTURE_L2_PER_SECOND of them per second of block time. settleRecapture
|
|
190
|
+
* (selector 0xe2ee7083, root only) splits one arb recapture's push: RECAPTURE_PROTOCOL_BPS (2,500, 25%) of
|
|
191
|
+
* `reportedProfit`, the profit the root reads back from the push at the pool's frozen partner share, to the protocol,
|
|
192
|
+
* at most the push, on every pool alike and never shared with an integrator (`recaptureSplit` in rules.ts). prizeBound
|
|
193
|
+
* is the King of the Pool prize ceiling on a share, which a pool with an integrator takes on the share the protocol
|
|
194
|
+
* keeps; prizeBoundFor (r26) takes the integrator's rate and computes that kept share as the bind does.
|
|
195
|
+
* protocolShareFloor (r26) is the effective floor a bind checks: the larger of the Rules' minProtocolShareBps and the
|
|
196
|
+
* treasury's governed floor.
|
|
197
|
+
* minimumFee (r25) is the Hookr minimum a pool froze at bind, for every pool; since r31 only a Hookr token's pool with
|
|
198
|
+
* no arb recapture and no rule that earns Hookr a share binds a nonzero one, so no arb recapture leg pays a top-up.
|
|
199
|
+
* RecaptureSplit (r31) carries `reportedProfit` last: the profit the executor's push reports at the pool's frozen
|
|
200
|
+
* partner share, which the split is computed from, not proof of payment.
|
|
201
|
+
*/
|
|
202
|
+
export const recaptureAbi = parseAbi([
|
|
203
|
+
...CORE_STRUCTS,
|
|
204
|
+
"function settleLeg(bytes32 id,address recipient,uint256 amount) returns(uint256)",
|
|
205
|
+
"function settleRecapture(PoolKey key,address currency,address trader,uint256 amount,uint256 traderBasis,uint256 reportedProfit) returns(uint256)",
|
|
206
|
+
"function RECAPTURE_PROTOCOL_BPS() view returns(uint16)",
|
|
207
|
+
"function prizeBound(uint16 lpBps,uint16 burnBps,uint16 protocolShareBps) pure returns(uint256)",
|
|
208
|
+
"function prizeBoundFor(uint16 lpBps,uint16 burnBps,uint16 protocolShareBps,uint16 integratorBps) pure returns(uint256)",
|
|
209
|
+
"function protocolShareFloor() view returns(uint16)",
|
|
210
|
+
"function recaptureDefaults() pure returns(RecaptureConfig rc,uint16 potBps)",
|
|
211
|
+
"function recaptureConfig(bytes32 id) view returns(RecaptureConfig rc,uint16 potBps,uint16 protocolShareBps)",
|
|
212
|
+
"function recaptureMode(bytes32 id) view returns(uint256)",
|
|
213
|
+
"function pendingDonation(bytes32 id) view returns(uint256 due0,uint256 due1,uint256 fresh0,uint256 fresh1,uint256 freshBlock)",
|
|
214
|
+
"function MIN_RELEASE_BLOCKS() view returns(uint32)",
|
|
215
|
+
"function DEFAULT_RELEASE_BLOCKS() view returns(uint32)",
|
|
216
|
+
"function MAX_RELEASE_BLOCKS() view returns(uint32)",
|
|
217
|
+
"function minimumFee(bytes32 id) view returns(uint16)",
|
|
218
|
+
"event RecaptureSplit(bytes32 indexed id,address indexed trader,uint256 traderAmount,uint256 lp,uint256 pot,uint256 protocol,address currency,uint256 reportedProfit)",
|
|
219
|
+
"event LpShareDonated(bytes32 indexed id,uint256 amount0,uint256 amount1)",
|
|
220
|
+
"event FeesAllocated(bytes32 indexed id,address indexed quote,uint256 protocol,uint256 royalty,uint256 refund,address advisoryRecipient,uint256 advisoryFee)",
|
|
221
|
+
]);
|
|
222
|
+
export const registryAbi = parseAbi([
|
|
223
|
+
"function isRoot(address root) view returns(bool)",
|
|
224
|
+
"function rootOpen(address root) view returns(bool)",
|
|
225
|
+
"function isQuote(address asset) view returns(bool)",
|
|
226
|
+
"function quoteAssets() view returns(address[])",
|
|
227
|
+
"function newMarketsPaused() view returns(bool)",
|
|
228
|
+
"function queue(bytes32 kind,bytes arguments) returns(bytes32 operation)",
|
|
229
|
+
"function operationHash(bytes32 kind,bytes arguments) view returns(bytes32)",
|
|
230
|
+
"function readyAt(bytes32 operation) view returns(uint48)",
|
|
231
|
+
"function expiresAt(bytes32 operation) view returns(uint48)",
|
|
232
|
+
"function delay() view returns(uint48)",
|
|
233
|
+
"function isLauncher(address account) view returns(bool)",
|
|
234
|
+
"function isRootFactory(address factory) view returns(bool)",
|
|
235
|
+
"function rootFactoryOf(address root) view returns(address)",
|
|
236
|
+
"function rootFactoryCodeHash(address factory) view returns(bytes32)",
|
|
237
|
+
"function rootStatus(address root) view returns(address advisory,bool verified)",
|
|
238
|
+
"function isRevokedAdmission(address scope,address implementation) view returns(bool)",
|
|
239
|
+
"function revokeFactoryAdmissions(address factory,address[] implementations)",
|
|
240
|
+
"function releaseId() pure returns(uint256)",
|
|
241
|
+
"event OperationQueued(bytes32 indexed operation,bytes32 indexed kind,bytes arguments,uint48 readyAt,uint48 expiresAt)",
|
|
242
|
+
"event RootRegistered(address indexed root)",
|
|
243
|
+
"event RootFactorySet(address indexed factory,bytes32 codeHash,bool active)",
|
|
244
|
+
"event FactoryRootRegistered(address indexed factory,address indexed root)",
|
|
245
|
+
"event AdmissionRevoked(address indexed scope,address indexed implementation,address indexed by)",
|
|
246
|
+
]);
|
|
247
|
+
export const managerAbi = parseAbi([
|
|
248
|
+
"event Initialize(bytes32 indexed id,address indexed currency0,address indexed currency1,uint24 fee,int24 tickSpacing,address hooks,uint160 sqrtPriceX96,int24 tick)",
|
|
249
|
+
"event ModifyLiquidity(bytes32 indexed id,address indexed sender,int24 tickLower,int24 tickUpper,int256 liquidityDelta,bytes32 salt)",
|
|
250
|
+
"event Swap(bytes32 indexed id,address indexed sender,int128 amount0,int128 amount1,uint160 sqrtPriceX96,uint128 liquidity,int24 tick,uint24 fee)",
|
|
251
|
+
"event Donate(bytes32 indexed id,address indexed sender,uint256 amount0,uint256 amount1)",
|
|
252
|
+
"event ProtocolFeeUpdated(bytes32 indexed id,uint24 protocolFee)",
|
|
253
|
+
"function extsload(bytes32 startSlot,uint256 nSlots) view returns(bytes32[])",
|
|
254
|
+
]);
|
|
255
|
+
export const positionManagerAbi = parseAbi([
|
|
256
|
+
"event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)",
|
|
257
|
+
"function ownerOf(uint256) view returns(address)",
|
|
258
|
+
]);
|
|
259
|
+
export const rulesAbi = parseAbi([
|
|
260
|
+
...CORE_STRUCTS,
|
|
261
|
+
"function protocolRecipient() view returns(address)",
|
|
262
|
+
"function trustedRoot() view returns(address)",
|
|
263
|
+
"function protocolFeePaid(address payer,address quote) view returns(uint256 amount)",
|
|
264
|
+
"function removalLockedUntil(bytes32 id) view returns(uint256 untilBlock)",
|
|
265
|
+
"function claim(address currency) returns(uint256)",
|
|
266
|
+
"function claimTo(address currency,address to) returns(uint256)",
|
|
267
|
+
"function claimAsClaims(address currency,address to) returns(uint256 amount)",
|
|
268
|
+
"function claimable(address currency,address beneficiary) view returns(uint256)",
|
|
269
|
+
"function config(bytes32 id) view returns(RulesConfig)",
|
|
270
|
+
"function integration(bytes32 id) view returns(address integrator,uint16 integratorBps)",
|
|
271
|
+
"function feeOnlyFrom(bytes32 id) view returns(uint256)",
|
|
272
|
+
"function minProtocolShareBps() view returns(uint16)",
|
|
273
|
+
"function configSchemaHash() pure returns(bytes32)",
|
|
274
|
+
"function rootSimulates() view returns(bool)",
|
|
275
|
+
"function poolHasDynamicFee(bytes32 id) view returns(bool)",
|
|
276
|
+
"function dynamicFeeParameters() pure returns(uint256 window,uint256 reset,uint256 carryBps,uint256 moveTicks)",
|
|
277
|
+
"function referenceState(bytes32 id) view returns(uint256 minLiquidity,int24 referenceTick,int24 anchorTick,uint40 movedAt,uint40 referenceAt,int24 movedTick)",
|
|
278
|
+
"function releaseId() pure returns(uint256)",
|
|
279
|
+
"event RulesBound(bytes32 indexed id,address indexed root,bytes32 configHash,bytes config)",
|
|
280
|
+
"event FeesAllocated(bytes32 indexed id,address indexed quote,uint256 protocol,uint256 royalty,uint256 refund,address advisoryRecipient,uint256 advisoryFee)",
|
|
281
|
+
"event Claimed(address indexed quote,address indexed beneficiary,address indexed to,uint256 amount)",
|
|
282
|
+
"event IntegratorPaid(bytes32 indexed id,address indexed quote,address indexed integrator,uint256 amount)",
|
|
283
|
+
"error UnknownIntegrator(address integrator)",
|
|
284
|
+
]);
|
|
285
|
+
/**
|
|
286
|
+
* HookrTreasury: protocol collection and, since r23, the fee terms every Rules paying it reads once when it binds a
|
|
287
|
+
* pool (`feeTerms(integrator, recapture, id)`, r25): the governed rule-share floor (0 to 5,000 bps), the integrator
|
|
288
|
+
* list (1 to 5,000 bps of Hookr's rule-fee share each, 5,000 pre-filled) and the Hookr minimum (r25): a rate for
|
|
289
|
+
* pools without arb recapture and one for pools with it (0 to 10,000 pips, 1,000 at deployment) and a per-integrator
|
|
290
|
+
* override (0 to 10,000, or NO_MIN_FEE_OVERRIDE to remove it) that reaches only the pool ids the integrator approved
|
|
291
|
+
* with its own `approveMinFeePool`. Owner only, except approveMinFeePool; every change waits TERMS_DELAY (30 minutes)
|
|
292
|
+
* after its proposal and lapses TERMS_GRACE (14 days) after maturing; removeIntegrator is immediate and also removes
|
|
293
|
+
* the integrator's override. Since r26 the pending views report a proposal only until it lapses; acceptIntegrator
|
|
294
|
+
* re-checks the proposal's refusals (the zero address, the treasury, the PoolManager, an admitted source) and
|
|
295
|
+
* admitSource refuses a listed or pending integrator; removeIntegrator emits the cancellation of each proposal it
|
|
296
|
+
* voids, and a change of owner emits the floor's and both rates' cancellations and FeeTermsProposalsVoided(epoch) for
|
|
297
|
+
* the per-account proposals it voids.
|
|
298
|
+
*/
|
|
299
|
+
export const treasuryAbi = parseAbi([
|
|
300
|
+
"event ProtocolCollected(address indexed source,address indexed currency,address indexed to,uint256 amount)",
|
|
301
|
+
"event ProtocolForwarded(address indexed currency,address indexed target,uint256 amount)",
|
|
302
|
+
"event ProtocolForwardDeferred(address indexed currency,address indexed target,uint256 amount)",
|
|
303
|
+
"function collect(address source,address currency) returns(uint256)",
|
|
304
|
+
"function collectTo(address source,address currency) returns(uint256)",
|
|
305
|
+
"function collectAsClaims(address source,address currency) returns(uint256)",
|
|
306
|
+
"function forwardBalance(address currency) returns(uint256,bool)",
|
|
307
|
+
"function target() view returns(address)",
|
|
308
|
+
"function sourceCodeHash(address source) view returns(bytes32)",
|
|
309
|
+
"function releaseId() pure returns(uint256)",
|
|
310
|
+
"function TERMS_DELAY() view returns(uint256)",
|
|
311
|
+
"function TERMS_GRACE() view returns(uint256)",
|
|
312
|
+
"function MAX_RULE_SHARE_FLOOR_BPS() view returns(uint16)",
|
|
313
|
+
"function MAX_INTEGRATOR_BPS() view returns(uint16)",
|
|
314
|
+
"function DEFAULT_INTEGRATOR_BPS() view returns(uint16)",
|
|
315
|
+
"function MAX_MIN_FEE_PIPS() view returns(uint16)",
|
|
316
|
+
"function DEFAULT_MIN_FEE_PIPS() view returns(uint16)",
|
|
317
|
+
"function NO_MIN_FEE_OVERRIDE() view returns(uint16)",
|
|
318
|
+
"function feeTerms(address integrator,bool recapture,bytes32 id) view returns(uint16 ruleShareFloorBps,uint16 integratorBps,uint16 minFeePips)",
|
|
319
|
+
"function minFeePips(bool recapture) view returns(uint16)",
|
|
320
|
+
"function pendingMinFee(bool recapture) view returns(uint16 pips,uint256 readyAt)",
|
|
321
|
+
"function integratorMinFee(address account) view returns(uint16 pips,uint16 pendingPips,uint256 readyAt)",
|
|
322
|
+
"function minFeePoolApproved(address account,bytes32 id) view returns(bool)",
|
|
323
|
+
"function approveMinFeePool(bytes32 id,bool approved)",
|
|
324
|
+
"function proposeMinFee(bool recapture,uint16 pips)",
|
|
325
|
+
"function cancelMinFee(bool recapture)",
|
|
326
|
+
"function acceptMinFee(bool recapture)",
|
|
327
|
+
"function proposeIntegratorMinFee(address account,uint16 pips)",
|
|
328
|
+
"function cancelIntegratorMinFee(address account)",
|
|
329
|
+
"function acceptIntegratorMinFee(address account)",
|
|
330
|
+
"function ruleShareFloorBps() view returns(uint16)",
|
|
331
|
+
"function pendingRuleShareFloor() view returns(uint16 floorBps,uint256 readyAt)",
|
|
332
|
+
"function integrator(address account) view returns(uint16 rateBps,uint16 pendingRateBps,uint256 readyAt)",
|
|
333
|
+
"function proposeRuleShareFloor(uint16 floorBps)",
|
|
334
|
+
"function cancelRuleShareFloor()",
|
|
335
|
+
"function acceptRuleShareFloor()",
|
|
336
|
+
"function proposeIntegrator(address account,uint16 rateBps)",
|
|
337
|
+
"function cancelIntegrator(address account)",
|
|
338
|
+
"function acceptIntegrator(address account)",
|
|
339
|
+
"function removeIntegrator(address account)",
|
|
340
|
+
"event RuleShareFloorProposed(uint16 current,uint16 proposed,uint256 readyAt)",
|
|
341
|
+
"event RuleShareFloorProposalCancelled(uint16 proposed)",
|
|
342
|
+
"event RuleShareFloorSet(uint16 previous,uint16 current)",
|
|
343
|
+
"event IntegratorProposed(address indexed account,uint16 current,uint16 proposed,uint256 readyAt)",
|
|
344
|
+
"event IntegratorProposalCancelled(address indexed account,uint16 proposed)",
|
|
345
|
+
"event IntegratorSet(address indexed account,uint16 previous,uint16 current)",
|
|
346
|
+
"event IntegratorRemoved(address indexed account,uint16 previous)",
|
|
347
|
+
"event MinFeeProposed(bool indexed recapture,uint16 current,uint16 proposed,uint256 readyAt)",
|
|
348
|
+
"event MinFeeProposalCancelled(bool indexed recapture,uint16 proposed)",
|
|
349
|
+
"event MinFeeSet(bool indexed recapture,uint16 previous,uint16 current)",
|
|
350
|
+
"event IntegratorMinFeeProposed(address indexed account,uint16 current,uint16 proposed,uint256 readyAt)",
|
|
351
|
+
"event IntegratorMinFeeProposalCancelled(address indexed account,uint16 proposed)",
|
|
352
|
+
"event IntegratorMinFeeSet(address indexed account,uint16 previous,uint16 current)",
|
|
353
|
+
"event MinFeePoolApproved(address indexed account,bytes32 indexed id,bool approved)",
|
|
354
|
+
"event FeeTermsProposalsVoided(uint64 indexed epoch)",
|
|
355
|
+
]);
|
|
356
|
+
/** HookrForwarder: the gasless swap-intent relay the router pins (read surface only; the SDK signs nothing). */
|
|
357
|
+
export const forwarderAbi = parseAbi([
|
|
358
|
+
"function router() view returns(address)",
|
|
359
|
+
"function registry() view returns(address)",
|
|
360
|
+
"function permit2() view returns(address)",
|
|
361
|
+
"function isNonceUsed(address owner,uint256 intentNonce) view returns(bool)",
|
|
362
|
+
"function releaseId() pure returns(uint256)",
|
|
363
|
+
"event IntentExecuted(bytes32 indexed intentHash,address indexed owner,address indexed relayer,bytes32 poolId,uint256 amountIn,uint256 amountOut,uint256 relayerFee,bool feeFromInput)",
|
|
364
|
+
]);
|
|
365
|
+
export const PROGRAM_STRUCTS = [
|
|
366
|
+
"struct Terms { uint8 mode; bool globalBux; uint64 start; uint64 end; uint128 pointBudget; uint128 walletPointCap; uint128 pointNumerator; uint128 pointDenominator; uint128 dailyPointBudget; address rewardToken; uint128 cashBudget; uint128 walletCashCap; uint128 cashNumerator; uint128 cashDenominator; uint128 dailyCashBudget; address attestor; address reviewer; uint64 reviewDelay; bytes32 sourcePolicyHash; string name; string metadataURI; uint8 pointDecimals; address referralRegistry; uint256 baseProgramId; }",
|
|
367
|
+
"struct Scope { address root; bytes32 poolId; bytes32 configHash; address quoteAsset; uint128 numerator; uint128 denominator; uint128 subjectNumerator; uint128 subjectDenominator; }",
|
|
368
|
+
"struct Milestone { uint128 pointsRequired; uint32 maxAwards; }",
|
|
369
|
+
"struct NFTMetadata { string name; string symbol; string baseURI; bool transferable; }",
|
|
370
|
+
"struct Receipt { uint256 chainId; address root; bytes32 poolId; bytes32 configHash; address quoteAsset; address participant; uint256 quoteVolume; bytes32 executionId; uint64 executedAt; uint8 flowType; }",
|
|
371
|
+
];
|
|
372
|
+
export const programsAbi = parseAbi([
|
|
373
|
+
...PROGRAM_STRUCTS,
|
|
374
|
+
"struct Program { Terms terms; address creator; bytes32 termsHash; address collection; uint256 pointsIssued; uint256 cashAllocated; uint256 cashPaid; uint256 cashRefunded; uint256 nextTokenId; uint32 openDays; bool buxApproved; bool buxReleased; bool cancelled; bool immediateCashReleased; }",
|
|
375
|
+
"struct Epoch { bytes32 merkleRoot; bytes32 coverageHash; bytes32 evidenceHash; uint256 totalWeight; uint256 claimedWeight; uint256 pointsAllocated; uint256 cashAllocated; uint64 finalizeAfter; uint64 version; bool challenged; bool finalized; bool closed; bool remainderReleased; }",
|
|
376
|
+
"function referrals() view returns(address)",
|
|
377
|
+
"function trustedRouter() view returns(address)",
|
|
378
|
+
"function poolManager() view returns(address)",
|
|
379
|
+
"function releaseId() pure returns(uint256)",
|
|
380
|
+
"function program(uint256 id) view returns(Program)",
|
|
381
|
+
"function scopes(uint256 id) view returns(Scope[])",
|
|
382
|
+
"function milestones(uint256 id) view returns(Milestone[])",
|
|
383
|
+
"function epoch(uint256 id,uint256 day) view returns(Epoch)",
|
|
384
|
+
"function points(uint256 id,address participant) view returns(uint256)",
|
|
385
|
+
"function buxBalance(address participant) view returns(uint256)",
|
|
386
|
+
"function claimableCash(uint256 id,address participant) view returns(uint256)",
|
|
387
|
+
"function reservedNFT(uint256 id,address participant,uint256 milestone) view returns(uint256)",
|
|
388
|
+
"function deliveredNFT(uint256 id,address participant) view returns(uint256)",
|
|
389
|
+
"function referralProgramKey(uint256 id) view returns(bytes32)",
|
|
390
|
+
"function dayClaimed(uint256 id,uint256 day,address participant) view returns(bool)",
|
|
391
|
+
"function createProgram(Terms terms,Scope[] scopes,Milestone[] milestones,NFTMetadata metadata) returns(uint256)",
|
|
392
|
+
"event ProgramCreated(uint256 indexed id,address indexed creator,bytes32 indexed termsHash,bool globalBux,bytes termsData,bytes scopesData,bytes milestonesData,bytes metadataData)",
|
|
393
|
+
"event ExecutionAccepted(bytes32 indexed executionId,address indexed participant,bytes receiptData)",
|
|
394
|
+
"function claimReferralDay(uint256 id,uint256 day,address payer,address referrer,uint64 firstActivityBlock,uint128 weight,bytes32[] proof)",
|
|
395
|
+
"event ReferralDayClaimed(uint256 indexed id,uint256 indexed day,address indexed payer,address referrer,uint128 weight,uint256 pointsAward)",
|
|
396
|
+
"event DailyActivityAccepted(uint256 indexed id,uint256 indexed day,bytes32 indexed executionId,address participant)",
|
|
397
|
+
"event BuxProgramApproved(uint256 indexed id,uint256 reserved)",
|
|
398
|
+
"event EpochChallenged(uint256 indexed id,uint256 indexed day,bytes32 reasonHash)",
|
|
399
|
+
"event EpochFinalized(uint256 indexed id,uint256 indexed day,uint64 version)",
|
|
400
|
+
"event DayClaimed(uint256 indexed id,uint256 indexed day,address indexed beneficiary,uint128 weight,uint256 pointsAward,uint256 cashAward)",
|
|
401
|
+
"event CashClaimed(uint256 indexed id,address indexed beneficiary,address indexed to,uint256 amount)",
|
|
402
|
+
"event MilestoneReserved(uint256 indexed id,address indexed beneficiary,uint256 indexed milestone,uint256 tokenId)",
|
|
403
|
+
"event NFTDelivered(uint256 indexed id,address indexed beneficiary,uint256 indexed milestone,address to)",
|
|
404
|
+
"function claimCash(uint256 id,address beneficiary,address to,uint256 amount)",
|
|
405
|
+
"function claimNFT(uint256 id,address beneficiary,uint256 milestone,address to) returns(bool)",
|
|
406
|
+
"function finalizeDay(uint256 id,uint256 day)",
|
|
407
|
+
"function challengeDay(uint256 id,uint256 day,bytes32 reasonHash)",
|
|
408
|
+
"event ActivityCredited(uint256 indexed id,address indexed participant,uint256 weight,uint256 pointsAward,uint256 cashAward)",
|
|
409
|
+
"event EpochProposed(uint256 indexed id,uint256 indexed day,uint64 version,bytes32 merkleRoot,uint256 totalWeight,bytes32 coverageHash,bytes32 evidenceHash,uint64 finalizeAfter)",
|
|
410
|
+
"function proposeDay(uint256 id,uint256 day,bytes32 merkleRoot,uint256 totalWeight,bytes32 coverageHash,bytes32 evidenceHash)",
|
|
411
|
+
"function claimDay(uint256 id,uint256 day,address beneficiary,uint128 weight,bytes32[] proof)",
|
|
412
|
+
]);
|
|
413
|
+
export const referralsAbi = parseAbi([
|
|
414
|
+
"event ReferralCodeRegistered(bytes32 indexed codeHash,address indexed referrer)",
|
|
415
|
+
"event ReferralBound(bytes32 indexed programKey,address indexed payer,address indexed referrer,bytes32 codeHash,uint64 eligibleFromBlock)",
|
|
416
|
+
"function registerCode(bytes32 codeHash)",
|
|
417
|
+
"function register(bytes32 programKey,address referrer,bytes32 codeHash)",
|
|
418
|
+
"function registerSigned(address payer,address referrer,bytes32 programKey,bytes32 codeHash,uint256 nonce,uint256 deadline,bytes signature)",
|
|
419
|
+
"function binding(bytes32 programKey,address payer) view returns(address referrer,uint64 eligibleFromBlock,bytes32 codeHash)",
|
|
420
|
+
"function codeOwner(bytes32 codeHash) view returns(address)",
|
|
421
|
+
"function contractBlockNumber() view returns(uint256)",
|
|
422
|
+
"function nonces(address payer) view returns(uint256)",
|
|
423
|
+
"function releaseId() pure returns(uint256)",
|
|
424
|
+
]);
|
|
425
|
+
export const COMMISSION_STRUCTS = [
|
|
426
|
+
"struct CommissionTerms { address root; address rules; bytes32 poolId; bytes32 configHash; address currency; uint8 feeSource; uint64 start; uint64 end; uint16 referrerBps; uint16 cashbackBps; uint128 dailyBudget; uint128 walletFeeCap; address attestor; address reviewer; uint64 reviewDelay; bytes32 sourcePolicyHash; }",
|
|
427
|
+
];
|
|
428
|
+
export const commissionsAbi = parseAbi([
|
|
429
|
+
...COMMISSION_STRUCTS,
|
|
430
|
+
"struct Campaign { CommissionTerms terms; address creator; bytes32 termsHash; bytes32 programKey; }",
|
|
431
|
+
"struct Epoch { bytes32 merkleRoot; bytes32 coverageHash; bytes32 collectionsHash; uint256 totalFees; uint256 claimedFees; uint256 allocated; uint64 finalizeAfter; uint64 version; bool challenged; bool finalized; bool released; }",
|
|
432
|
+
"function referrals() view returns(address)",
|
|
433
|
+
"function campaign(uint256 id) view returns(Campaign)",
|
|
434
|
+
"function attestor() view returns(address)",
|
|
435
|
+
"function releaseId() pure returns(uint256)",
|
|
436
|
+
"function epoch(uint256 id,uint256 day) view returns(Epoch)",
|
|
437
|
+
"function claimable(address currency,address beneficiary) view returns(uint256)",
|
|
438
|
+
"function createCampaign(CommissionTerms t) payable returns(uint256 id)",
|
|
439
|
+
"event CampaignCreated(uint256 indexed id,address indexed creator,bytes32 indexed programKey,bytes32 termsHash,bytes termsData)",
|
|
440
|
+
"event EpochProposed(uint256 indexed id,uint256 indexed day,uint64 version,bytes32 root,uint256 totalFees,bytes32 coverageHash,bytes32 collectionsHash,uint64 finalizeAfter)",
|
|
441
|
+
"event EpochChallenged(uint256 indexed id,uint256 indexed day,bytes32 reasonHash)",
|
|
442
|
+
"event EpochFinalized(uint256 indexed id,uint256 indexed day,uint64 version)",
|
|
443
|
+
"event CommissionCredited(uint256 indexed id,uint256 indexed day,address indexed payer,address referrer,uint128 eligibleFees,uint256 commission,uint256 cashback)",
|
|
444
|
+
"event Claimed(address indexed currency,address indexed beneficiary,address indexed to,uint256 amount)",
|
|
445
|
+
"function proposeDay(uint256 id,uint256 day,bytes32 root,uint256 totalFees,bytes32 coverageHash,bytes32 collectionsHash)",
|
|
446
|
+
"function finalizeDay(uint256 id,uint256 day)",
|
|
447
|
+
"function creditDay(uint256 id,uint256 day,address payer,address referrer,uint64 firstActivityBlock,uint128 eligibleFees,bytes32[] proof)",
|
|
448
|
+
"function claim(address currency,address beneficiary,address to,uint256 amount)",
|
|
449
|
+
]);
|
|
450
|
+
/** Later-stage contracts: full ABIs generated from the release artifacts (scripts/sync-artifacts.ts). */
|
|
451
|
+
export const rootFactoryAbi = ARTIFACT_ABIS.HookrRootFactory;
|
|
452
|
+
export const pairRootAbi = ARTIFACT_ABIS.HookrPairRoot;
|
|
453
|
+
export const feeAdvisoryAbi = ARTIFACT_ABIS.HookrFeeAdvisory;
|
|
454
|
+
export const sessionAdvisoryAbi = ARTIFACT_ABIS.HookrSessionAdvisory;
|
|
455
|
+
export const liquidityVaultAbi = ARTIFACT_ABIS.HookrLiquidityVault;
|