@exponent-labs/exponent-sdk 0.0.3
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 +16 -0
- package/build/addressLookupTableUtil.d.ts +12 -0
- package/build/addressLookupTableUtil.js +32 -0
- package/build/addressLookupTableUtil.js.map +1 -0
- package/build/environment.d.ts +10 -0
- package/build/environment.js +13 -0
- package/build/environment.js.map +1 -0
- package/build/events.d.ts +339 -0
- package/build/events.js +231 -0
- package/build/events.js.map +1 -0
- package/build/flavors.d.ts +24 -0
- package/build/flavors.js +713 -0
- package/build/flavors.js.map +1 -0
- package/build/index.d.ts +11 -0
- package/build/index.js +45 -0
- package/build/index.js.map +1 -0
- package/build/lpPosition.d.ts +35 -0
- package/build/lpPosition.js +103 -0
- package/build/lpPosition.js.map +1 -0
- package/build/market.d.ts +567 -0
- package/build/market.js +1445 -0
- package/build/market.js.map +1 -0
- package/build/syPosition.d.ts +6 -0
- package/build/syPosition.js +115 -0
- package/build/syPosition.js.map +1 -0
- package/build/tokenUtil.d.ts +3 -0
- package/build/tokenUtil.js +23 -0
- package/build/tokenUtil.js.map +1 -0
- package/build/utils/altUtil.d.ts +8 -0
- package/build/utils/altUtil.js +35 -0
- package/build/utils/altUtil.js.map +1 -0
- package/build/utils/binSolver.d.ts +1 -0
- package/build/utils/binSolver.js +45 -0
- package/build/utils/binSolver.js.map +1 -0
- package/build/utils/binSolver.test.d.ts +1 -0
- package/build/utils/binSolver.test.js +15 -0
- package/build/utils/binSolver.test.js.map +1 -0
- package/build/utils/index.d.ts +6 -0
- package/build/utils/index.js +31 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/ix.d.ts +6 -0
- package/build/utils/ix.js +3 -0
- package/build/utils/ix.js.map +1 -0
- package/build/vault.d.ts +289 -0
- package/build/vault.js +615 -0
- package/build/vault.js.map +1 -0
- package/build/ytPosition.d.ts +86 -0
- package/build/ytPosition.js +231 -0
- package/build/ytPosition.js.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +42 -0
- package/src/addressLookupTableUtil.ts +34 -0
- package/src/environment.ts +19 -0
- package/src/events.ts +595 -0
- package/src/flavors.ts +773 -0
- package/src/index.ts +11 -0
- package/src/lpPosition.ts +129 -0
- package/src/market.ts +2338 -0
- package/src/syPosition.ts +151 -0
- package/src/tokenUtil.ts +20 -0
- package/src/utils/altUtil.ts +47 -0
- package/src/utils/binSolver.test.ts +15 -0
- package/src/utils/binSolver.ts +44 -0
- package/src/utils/index.ts +32 -0
- package/src/utils/ix.ts +7 -0
- package/src/vault.ts +999 -0
- package/src/ytPosition.ts +313 -0
- package/tsconfig.json +38 -0
package/src/events.ts
ADDED
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import { BorshCoder, web3, BN } from "@coral-xyz/anchor"
|
|
2
|
+
import { ExponentCore, IDL } from "@exponent-labs/exponent-idl"
|
|
3
|
+
import { AnchorizedPNum } from "@exponent-labs/exponent-types"
|
|
4
|
+
import bs58 from "bs58"
|
|
5
|
+
|
|
6
|
+
export class EventDecoder {
|
|
7
|
+
private coder: BorshCoder
|
|
8
|
+
private eventDecoder: EventDecoder
|
|
9
|
+
programId: web3.PublicKey
|
|
10
|
+
private static eventIxTag = new BN("1d9acb512ea545e4", 16)
|
|
11
|
+
private discriminators: Map<string, string>
|
|
12
|
+
|
|
13
|
+
constructor(idl: ExponentCore = IDL as ExponentCore) {
|
|
14
|
+
this.programId = new web3.PublicKey(idl.address)
|
|
15
|
+
this.coder = new BorshCoder(idl)
|
|
16
|
+
this.discriminators = new Map<string, string>(
|
|
17
|
+
(idl.events ?? []).map((ev): [string, string] => [Buffer.from(ev.discriminator).toString("hex"), ev.name]),
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
parseAsTransactionCpiData(log: string): string | null {
|
|
22
|
+
let encodedLog: Buffer
|
|
23
|
+
try {
|
|
24
|
+
encodedLog = bs58.decode(log)
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
const disc = encodedLog.slice(0, 8)
|
|
29
|
+
if (disc.equals(Uint8Array.from(EventDecoder.eventIxTag.toBuffer("le", 8)))) {
|
|
30
|
+
return Buffer.from(Uint8Array.from(encodedLog.slice(8))).toString("base64")
|
|
31
|
+
} else {
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
decode(log: string): GenericEvent | null {
|
|
37
|
+
const cpiData = this.parseAsTransactionCpiData(log)
|
|
38
|
+
if (!cpiData) {
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const event = this.coder.events.decode(cpiData)
|
|
44
|
+
return {
|
|
45
|
+
name: event.name,
|
|
46
|
+
data: event,
|
|
47
|
+
}
|
|
48
|
+
} catch (e) {
|
|
49
|
+
console.error(`Failed to decode event:`, e)
|
|
50
|
+
return null
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
parseCpiEvents(transactionResponse: web3.VersionedTransactionResponse | web3.TransactionResponse): CategorizedEvents {
|
|
55
|
+
const events: GenericEvent[] = []
|
|
56
|
+
const inner: web3.CompiledInnerInstruction[] = transactionResponse?.meta?.innerInstructions ?? []
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < inner.length; i++) {
|
|
59
|
+
for (let j = 0; j < inner[i].instructions.length; j++) {
|
|
60
|
+
const ix = inner[i].instructions[j]
|
|
61
|
+
|
|
62
|
+
const programPubkey = transactionResponse?.transaction.message.staticAccountKeys[ix.programIdIndex]
|
|
63
|
+
|
|
64
|
+
if (programPubkey === undefined || !programPubkey.equals(this.programId)) {
|
|
65
|
+
continue
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const event = this.decode(ix.data)
|
|
69
|
+
if (event) {
|
|
70
|
+
events.push(event.data)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return categorizeEvents(events)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
parseHeliusWebsocketCpiEvents(
|
|
79
|
+
transactionResponse: web3.VersionedTransactionResponse | web3.TransactionResponse,
|
|
80
|
+
): CategorizedEvents {
|
|
81
|
+
const events: GenericEvent[] = []
|
|
82
|
+
const inner: web3.CompiledInnerInstruction[] = transactionResponse?.meta?.innerInstructions ?? []
|
|
83
|
+
|
|
84
|
+
for (let i = 0; i < inner.length; i++) {
|
|
85
|
+
for (let j = 0; j < inner[i].instructions.length; j++) {
|
|
86
|
+
const ix = inner[i].instructions[j]
|
|
87
|
+
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
const programPubkey = new web3.PublicKey(ix.programId)
|
|
90
|
+
|
|
91
|
+
if (programPubkey === undefined || !programPubkey.equals(this.programId)) {
|
|
92
|
+
continue
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const event = this.decode(ix.data)
|
|
96
|
+
if (event) {
|
|
97
|
+
events.push(event.data)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return categorizeEvents(events)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface GenericEvent {
|
|
107
|
+
name: string
|
|
108
|
+
data: any
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function categorizeEvents(events: GenericEvent[]): CategorizedEvents {
|
|
112
|
+
const tradePtEvents: TradePtEvent[] = []
|
|
113
|
+
const stripEvents: StripEvent[] = []
|
|
114
|
+
const mergeEvents: MergeEvent[] = []
|
|
115
|
+
const depositYtEvents: DepositYtEvent[] = []
|
|
116
|
+
const withdrawYtEvents: WithdrawYtEvent[] = []
|
|
117
|
+
const collectInterestEvents: CollectInterestEvent[] = []
|
|
118
|
+
const collectEmissionEvents: CollectEmissionEvent[] = []
|
|
119
|
+
const stageYieldEvents: StageYieldEvent[] = []
|
|
120
|
+
const initializeYieldPositionEvents: InitializeYieldPositionEvent[] = []
|
|
121
|
+
const withdrawLpEvents: WithdrawLpEvent[] = []
|
|
122
|
+
const withdrawLiquidityEvents: WithdrawLiquidityEvent[] = []
|
|
123
|
+
const sellYtEvents: SellYtEvent[] = []
|
|
124
|
+
const marketCollectEmissionEvents: MarketCollectEmissionEvent[] = []
|
|
125
|
+
const initLpPositionEvents: InitLpPositionEvent[] = []
|
|
126
|
+
const depositLpEvents: DepositLpEvent[] = []
|
|
127
|
+
const depositLiquidityEvents: DepositLiquidityEvent[] = []
|
|
128
|
+
const claimFarmEmissionsEvents: ClaimFarmEmissionsEvent[] = []
|
|
129
|
+
const buyYtEvents: BuyYtEvent[] = []
|
|
130
|
+
const wrapperBuyYtEvents: WrapperBuyYtEvent[] = []
|
|
131
|
+
const wrapperSellYtEvents: WrapperSellYtEvent[] = []
|
|
132
|
+
const sellPtEvents: SellPtEvent[] = []
|
|
133
|
+
const buyPtEvents: BuyPtEvent[] = []
|
|
134
|
+
const wrapperProvideLiquidityEvents: WrapperProvideLiquidityEvent[] = []
|
|
135
|
+
const wrapperCollectInterestEvents: WrapperCollectInterestEvent[] = []
|
|
136
|
+
const wrapperWithdrawLiquidityEvents: WrapperWithdrawLiquidityEvent[] = []
|
|
137
|
+
const wrapperWithdrawLiquidityClassicEvents: WrapperWithdrawLiquidityClassicEvent[] = []
|
|
138
|
+
|
|
139
|
+
for (const ev of events) {
|
|
140
|
+
switch (ev.name) {
|
|
141
|
+
case "TradePtEvent":
|
|
142
|
+
tradePtEvents.push(ev.data as TradePtEvent)
|
|
143
|
+
break
|
|
144
|
+
case "StripEvent":
|
|
145
|
+
stripEvents.push(ev.data as StripEvent)
|
|
146
|
+
break
|
|
147
|
+
case "MergeEvent":
|
|
148
|
+
mergeEvents.push(ev.data as MergeEvent)
|
|
149
|
+
break
|
|
150
|
+
case "DepositYtEvent":
|
|
151
|
+
depositYtEvents.push(ev.data as DepositYtEvent)
|
|
152
|
+
break
|
|
153
|
+
case "WithdrawYtEvent":
|
|
154
|
+
withdrawYtEvents.push(ev.data as WithdrawYtEvent)
|
|
155
|
+
break
|
|
156
|
+
case "CollectInterestEvent":
|
|
157
|
+
collectInterestEvents.push(ev.data as CollectInterestEvent)
|
|
158
|
+
break
|
|
159
|
+
case "CollectEmissionEvent":
|
|
160
|
+
collectEmissionEvents.push(ev.data as CollectEmissionEvent)
|
|
161
|
+
break
|
|
162
|
+
case "StageYieldEvent":
|
|
163
|
+
stageYieldEvents.push(ev.data as StageYieldEvent)
|
|
164
|
+
break
|
|
165
|
+
case "InitializeYieldPositionEvent":
|
|
166
|
+
initializeYieldPositionEvents.push(ev.data as InitializeYieldPositionEvent)
|
|
167
|
+
break
|
|
168
|
+
case "WithdrawLpEvent":
|
|
169
|
+
withdrawLpEvents.push(ev.data as WithdrawLpEvent)
|
|
170
|
+
break
|
|
171
|
+
case "WithdrawLiquidityEvent":
|
|
172
|
+
withdrawLiquidityEvents.push(ev.data as WithdrawLiquidityEvent)
|
|
173
|
+
break
|
|
174
|
+
case "SellYtEvent":
|
|
175
|
+
sellYtEvents.push(ev.data as SellYtEvent)
|
|
176
|
+
break
|
|
177
|
+
case "MarketCollectEmissionEvent":
|
|
178
|
+
marketCollectEmissionEvents.push(ev.data as MarketCollectEmissionEvent)
|
|
179
|
+
break
|
|
180
|
+
case "InitLpPositionEvent":
|
|
181
|
+
initLpPositionEvents.push(ev.data as InitLpPositionEvent)
|
|
182
|
+
break
|
|
183
|
+
case "DepositLpEvent":
|
|
184
|
+
depositLpEvents.push(ev.data as DepositLpEvent)
|
|
185
|
+
break
|
|
186
|
+
case "DepositLiquidityEvent":
|
|
187
|
+
depositLiquidityEvents.push(ev.data as DepositLiquidityEvent)
|
|
188
|
+
break
|
|
189
|
+
case "ClaimFarmEmissionsEvent":
|
|
190
|
+
claimFarmEmissionsEvents.push(ev.data as ClaimFarmEmissionsEvent)
|
|
191
|
+
break
|
|
192
|
+
case "BuyYtEvent":
|
|
193
|
+
buyYtEvents.push(ev.data as BuyYtEvent)
|
|
194
|
+
break
|
|
195
|
+
case "WrapperBuyYtEvent":
|
|
196
|
+
wrapperBuyYtEvents.push(ev.data as WrapperBuyYtEvent)
|
|
197
|
+
break
|
|
198
|
+
case "WrapperSellYtEvent":
|
|
199
|
+
wrapperSellYtEvents.push(ev.data as WrapperSellYtEvent)
|
|
200
|
+
break
|
|
201
|
+
case "SellPtEvent":
|
|
202
|
+
sellPtEvents.push(ev.data as SellPtEvent)
|
|
203
|
+
break
|
|
204
|
+
case "BuyPtEvent":
|
|
205
|
+
buyPtEvents.push(ev.data as BuyPtEvent)
|
|
206
|
+
break
|
|
207
|
+
case "WrapperProvideLiquidityEvent":
|
|
208
|
+
wrapperProvideLiquidityEvents.push(ev.data as WrapperProvideLiquidityEvent)
|
|
209
|
+
break
|
|
210
|
+
case "WrapperCollectInterestEvent":
|
|
211
|
+
wrapperCollectInterestEvents.push(ev.data as WrapperCollectInterestEvent)
|
|
212
|
+
break
|
|
213
|
+
case "WrapperWithdrawLiquidityEvent":
|
|
214
|
+
wrapperWithdrawLiquidityEvents.push(ev.data as WrapperWithdrawLiquidityEvent)
|
|
215
|
+
break
|
|
216
|
+
case "WrapperWithdrawLiquidityClassicEvent":
|
|
217
|
+
wrapperWithdrawLiquidityClassicEvents.push(ev.data as WrapperWithdrawLiquidityClassicEvent)
|
|
218
|
+
break
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
tradePtEvents,
|
|
224
|
+
stripEvents,
|
|
225
|
+
mergeEvents,
|
|
226
|
+
depositYtEvents,
|
|
227
|
+
withdrawYtEvents,
|
|
228
|
+
collectInterestEvents,
|
|
229
|
+
collectEmissionEvents,
|
|
230
|
+
stageYieldEvents,
|
|
231
|
+
initializeYieldPositionEvents,
|
|
232
|
+
withdrawLpEvents,
|
|
233
|
+
withdrawLiquidityEvents,
|
|
234
|
+
sellYtEvents,
|
|
235
|
+
marketCollectEmissionEvents,
|
|
236
|
+
initLpPositionEvents,
|
|
237
|
+
depositLpEvents,
|
|
238
|
+
depositLiquidityEvents,
|
|
239
|
+
claimFarmEmissionsEvents,
|
|
240
|
+
buyYtEvents,
|
|
241
|
+
wrapperBuyYtEvents,
|
|
242
|
+
wrapperSellYtEvents,
|
|
243
|
+
sellPtEvents,
|
|
244
|
+
buyPtEvents,
|
|
245
|
+
wrapperProvideLiquidityEvents,
|
|
246
|
+
wrapperCollectInterestEvents,
|
|
247
|
+
wrapperWithdrawLiquidityEvents,
|
|
248
|
+
wrapperWithdrawLiquidityClassicEvents,
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface CategorizedEvents {
|
|
253
|
+
tradePtEvents: TradePtEvent[]
|
|
254
|
+
stripEvents: StripEvent[]
|
|
255
|
+
mergeEvents: MergeEvent[]
|
|
256
|
+
depositYtEvents: DepositYtEvent[]
|
|
257
|
+
withdrawYtEvents: WithdrawYtEvent[]
|
|
258
|
+
collectInterestEvents: CollectInterestEvent[]
|
|
259
|
+
collectEmissionEvents: CollectEmissionEvent[]
|
|
260
|
+
stageYieldEvents: StageYieldEvent[]
|
|
261
|
+
initializeYieldPositionEvents: InitializeYieldPositionEvent[]
|
|
262
|
+
withdrawLpEvents: WithdrawLpEvent[]
|
|
263
|
+
withdrawLiquidityEvents: WithdrawLiquidityEvent[]
|
|
264
|
+
sellYtEvents: SellYtEvent[]
|
|
265
|
+
marketCollectEmissionEvents: MarketCollectEmissionEvent[]
|
|
266
|
+
initLpPositionEvents: InitLpPositionEvent[]
|
|
267
|
+
depositLpEvents: DepositLpEvent[]
|
|
268
|
+
depositLiquidityEvents: DepositLiquidityEvent[]
|
|
269
|
+
claimFarmEmissionsEvents: ClaimFarmEmissionsEvent[]
|
|
270
|
+
buyYtEvents: BuyYtEvent[]
|
|
271
|
+
wrapperBuyYtEvents: WrapperBuyYtEvent[]
|
|
272
|
+
wrapperSellYtEvents: WrapperSellYtEvent[]
|
|
273
|
+
sellPtEvents: SellPtEvent[]
|
|
274
|
+
buyPtEvents: BuyPtEvent[]
|
|
275
|
+
wrapperProvideLiquidityEvents: WrapperProvideLiquidityEvent[]
|
|
276
|
+
wrapperCollectInterestEvents: WrapperCollectInterestEvent[]
|
|
277
|
+
wrapperWithdrawLiquidityEvents: WrapperWithdrawLiquidityEvent[]
|
|
278
|
+
wrapperWithdrawLiquidityClassicEvents: WrapperWithdrawLiquidityClassicEvent[]
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface TradePtEvent {
|
|
282
|
+
trader: web3.PublicKey
|
|
283
|
+
market: web3.PublicKey
|
|
284
|
+
token_sy_trader: web3.PublicKey
|
|
285
|
+
token_pt_trader: web3.PublicKey
|
|
286
|
+
token_sy_escrow: web3.PublicKey
|
|
287
|
+
token_pt_escrow: web3.PublicKey
|
|
288
|
+
net_trader_pt: BN
|
|
289
|
+
net_trader_sy: BN
|
|
290
|
+
fee_sy: BN
|
|
291
|
+
sy_exchange_rate: AnchorizedPNum
|
|
292
|
+
timestamp: BN
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface StripEvent {
|
|
296
|
+
depositor: web3.PublicKey
|
|
297
|
+
vault: web3.PublicKey
|
|
298
|
+
authority: web3.PublicKey
|
|
299
|
+
sy_src: web3.PublicKey
|
|
300
|
+
escrow_sy: web3.PublicKey
|
|
301
|
+
yt_dst: web3.PublicKey
|
|
302
|
+
pt_dst: web3.PublicKey
|
|
303
|
+
mint_yt: web3.PublicKey
|
|
304
|
+
mint_pt: web3.PublicKey
|
|
305
|
+
yield_position: web3.PublicKey
|
|
306
|
+
amount_sy_in: BN
|
|
307
|
+
amount_py_out: BN
|
|
308
|
+
sy_exchange_rate: AnchorizedPNum
|
|
309
|
+
total_sy_in_escrow: BN
|
|
310
|
+
pt_supply: BN
|
|
311
|
+
yt_balance: BN
|
|
312
|
+
all_time_high_sy_exchange_rate: AnchorizedPNum
|
|
313
|
+
sy_for_pt: BN
|
|
314
|
+
unix_timestamp: BN
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export interface MergeEvent {
|
|
318
|
+
owner: web3.PublicKey
|
|
319
|
+
vault: web3.PublicKey
|
|
320
|
+
sy_dst: web3.PublicKey
|
|
321
|
+
escrow_sy: web3.PublicKey
|
|
322
|
+
yt_src: web3.PublicKey
|
|
323
|
+
pt_src: web3.PublicKey
|
|
324
|
+
mint_yt: web3.PublicKey
|
|
325
|
+
mint_pt: web3.PublicKey
|
|
326
|
+
yield_position: web3.PublicKey
|
|
327
|
+
amount_py_in: BN
|
|
328
|
+
amount_sy_out: BN
|
|
329
|
+
sy_exchange_rate: AnchorizedPNum
|
|
330
|
+
pt_redemption_rate: AnchorizedPNum
|
|
331
|
+
total_sy_in_escrow: BN
|
|
332
|
+
pt_supply: BN
|
|
333
|
+
yt_balance: BN
|
|
334
|
+
sy_for_pt: BN
|
|
335
|
+
is_vault_active: boolean
|
|
336
|
+
unix_timestamp: BN
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface DepositYtEvent {
|
|
340
|
+
depositor: web3.PublicKey
|
|
341
|
+
vault: web3.PublicKey
|
|
342
|
+
user_yield_position: web3.PublicKey
|
|
343
|
+
vault_yield_position: web3.PublicKey
|
|
344
|
+
yt_src: web3.PublicKey
|
|
345
|
+
escrow_yt: web3.PublicKey
|
|
346
|
+
amount: BN
|
|
347
|
+
sy_exchange_rate: AnchorizedPNum
|
|
348
|
+
user_yt_balance_after: BN
|
|
349
|
+
vault_yt_balance_after: BN
|
|
350
|
+
user_staged_yield: BN
|
|
351
|
+
unix_timestamp: BN
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface WithdrawYtEvent {
|
|
355
|
+
owner: web3.PublicKey
|
|
356
|
+
vault: web3.PublicKey
|
|
357
|
+
user_yield_position: web3.PublicKey
|
|
358
|
+
vault_yield_position: web3.PublicKey
|
|
359
|
+
yt_dst: web3.PublicKey
|
|
360
|
+
escrow_yt: web3.PublicKey
|
|
361
|
+
amount: BN
|
|
362
|
+
sy_exchange_rate: AnchorizedPNum
|
|
363
|
+
user_yt_balance_after: BN
|
|
364
|
+
vault_yt_balance_after: BN
|
|
365
|
+
user_staged_yield: BN
|
|
366
|
+
unix_timestamp: BN
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface CollectInterestEvent {
|
|
370
|
+
user: web3.PublicKey
|
|
371
|
+
vault: web3.PublicKey
|
|
372
|
+
user_yield_position: web3.PublicKey
|
|
373
|
+
amount_to_user: BN
|
|
374
|
+
amount_to_treasury: BN
|
|
375
|
+
unix_timestamp: BN
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface CollectEmissionEvent {
|
|
379
|
+
user: web3.PublicKey
|
|
380
|
+
vault: web3.PublicKey
|
|
381
|
+
position: web3.PublicKey
|
|
382
|
+
emission_index: number
|
|
383
|
+
amount_to_user: BN
|
|
384
|
+
amount_to_treasury: BN
|
|
385
|
+
unix_timestamp: BN
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface StageYieldEvent {
|
|
389
|
+
payer: web3.PublicKey
|
|
390
|
+
vault: web3.PublicKey
|
|
391
|
+
user_yield_position: web3.PublicKey
|
|
392
|
+
vault_yield_position: web3.PublicKey
|
|
393
|
+
sy_exchange_rate: AnchorizedPNum
|
|
394
|
+
user_yt_balance: BN
|
|
395
|
+
user_staged_yield: BN
|
|
396
|
+
user_staged_emissions: BN[]
|
|
397
|
+
unix_timestamp: BN
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface InitializeYieldPositionEvent {
|
|
401
|
+
owner: web3.PublicKey
|
|
402
|
+
vault: web3.PublicKey
|
|
403
|
+
yield_position: web3.PublicKey
|
|
404
|
+
unix_timestamp: BN
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface WithdrawLpEvent {
|
|
408
|
+
owner: web3.PublicKey
|
|
409
|
+
market: web3.PublicKey
|
|
410
|
+
lp_position: web3.PublicKey
|
|
411
|
+
mint_lp: web3.PublicKey
|
|
412
|
+
token_lp_dst: web3.PublicKey
|
|
413
|
+
token_lp_escrow: web3.PublicKey
|
|
414
|
+
amount: BN
|
|
415
|
+
new_lp_balance: BN
|
|
416
|
+
unix_timestamp: BN
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface WithdrawLiquidityEvent {
|
|
420
|
+
withdrawer: web3.PublicKey
|
|
421
|
+
market: web3.PublicKey
|
|
422
|
+
token_pt_dst: web3.PublicKey
|
|
423
|
+
token_sy_dst: web3.PublicKey
|
|
424
|
+
token_pt_escrow: web3.PublicKey
|
|
425
|
+
token_sy_escrow: web3.PublicKey
|
|
426
|
+
token_lp_src: web3.PublicKey
|
|
427
|
+
mint_lp: web3.PublicKey
|
|
428
|
+
lp_in: BN
|
|
429
|
+
pt_out: BN
|
|
430
|
+
sy_out: BN
|
|
431
|
+
new_lp_supply: BN
|
|
432
|
+
timestamp: BN
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface SellYtEvent {
|
|
436
|
+
trader: web3.PublicKey
|
|
437
|
+
market: web3.PublicKey
|
|
438
|
+
token_yt_trader: web3.PublicKey
|
|
439
|
+
token_pt_trader: web3.PublicKey
|
|
440
|
+
token_sy_trader: web3.PublicKey
|
|
441
|
+
token_sy_escrow: web3.PublicKey
|
|
442
|
+
token_pt_escrow: web3.PublicKey
|
|
443
|
+
amount_yt_in: BN
|
|
444
|
+
amount_sy_received_from_merge: BN
|
|
445
|
+
amount_sy_spent_buying_pt: BN
|
|
446
|
+
amount_sy_out: BN
|
|
447
|
+
pt_borrowed_and_repaid: BN
|
|
448
|
+
timestamp: BN
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export interface MarketCollectEmissionEvent {
|
|
452
|
+
owner: web3.PublicKey
|
|
453
|
+
market: web3.PublicKey
|
|
454
|
+
lp_position: web3.PublicKey
|
|
455
|
+
token_emission_escrow: web3.PublicKey
|
|
456
|
+
token_emission_dst: web3.PublicKey
|
|
457
|
+
emission_index: number
|
|
458
|
+
amount_collected: BN
|
|
459
|
+
timestamp: BN
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface InitLpPositionEvent {
|
|
463
|
+
fee_payer: web3.PublicKey
|
|
464
|
+
owner: web3.PublicKey
|
|
465
|
+
market: web3.PublicKey
|
|
466
|
+
lp_position: web3.PublicKey
|
|
467
|
+
num_emission_trackers: number
|
|
468
|
+
num_farm_emissions: number
|
|
469
|
+
timestamp: BN
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export interface DepositLpEvent {
|
|
473
|
+
owner: web3.PublicKey
|
|
474
|
+
market: web3.PublicKey
|
|
475
|
+
lp_position: web3.PublicKey
|
|
476
|
+
token_lp_src: web3.PublicKey
|
|
477
|
+
token_lp_escrow: web3.PublicKey
|
|
478
|
+
mint_lp: web3.PublicKey
|
|
479
|
+
amount: BN
|
|
480
|
+
new_lp_balance: BN
|
|
481
|
+
timestamp: BN
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export interface DepositLiquidityEvent {
|
|
485
|
+
depositor: web3.PublicKey
|
|
486
|
+
market: web3.PublicKey
|
|
487
|
+
token_pt_src: web3.PublicKey
|
|
488
|
+
token_sy_src: web3.PublicKey
|
|
489
|
+
token_pt_escrow: web3.PublicKey
|
|
490
|
+
token_sy_escrow: web3.PublicKey
|
|
491
|
+
token_lp_dst: web3.PublicKey
|
|
492
|
+
mint_lp: web3.PublicKey
|
|
493
|
+
pt_intent: BN
|
|
494
|
+
sy_intent: BN
|
|
495
|
+
pt_in: BN
|
|
496
|
+
sy_in: BN
|
|
497
|
+
lp_out: BN
|
|
498
|
+
new_lp_supply: BN
|
|
499
|
+
timestamp: BN
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export interface ClaimFarmEmissionsEvent {
|
|
503
|
+
owner: web3.PublicKey
|
|
504
|
+
market: web3.PublicKey
|
|
505
|
+
lp_position: web3.PublicKey
|
|
506
|
+
token_dst: web3.PublicKey
|
|
507
|
+
mint: web3.PublicKey
|
|
508
|
+
token_farm: web3.PublicKey
|
|
509
|
+
farm_index: number
|
|
510
|
+
amount_claimed: BN
|
|
511
|
+
remaining_staged: BN
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export interface BuyYtEvent {
|
|
515
|
+
trader: web3.PublicKey
|
|
516
|
+
market: web3.PublicKey
|
|
517
|
+
token_sy_trader: web3.PublicKey
|
|
518
|
+
token_yt_trader: web3.PublicKey
|
|
519
|
+
token_pt_trader: web3.PublicKey
|
|
520
|
+
token_sy_escrow: web3.PublicKey
|
|
521
|
+
token_pt_escrow: web3.PublicKey
|
|
522
|
+
max_sy_in: BN
|
|
523
|
+
yt_out: BN
|
|
524
|
+
sy_exchange_rate: AnchorizedPNum
|
|
525
|
+
sy_to_strip: BN
|
|
526
|
+
sy_borrowed: BN
|
|
527
|
+
pt_out: BN
|
|
528
|
+
sy_repaid: BN
|
|
529
|
+
timestamp: BN
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface WrapperBuyYtEvent {
|
|
533
|
+
market: web3.PublicKey
|
|
534
|
+
buyer: web3.PublicKey
|
|
535
|
+
yt_out_amount: BN
|
|
536
|
+
base_in_amount: BN
|
|
537
|
+
unix_timestamp: BN
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export interface WrapperSellYtEvent {
|
|
541
|
+
seller: web3.PublicKey
|
|
542
|
+
market: web3.PublicKey
|
|
543
|
+
yt_in_amount: BN
|
|
544
|
+
base_out_amount: BN
|
|
545
|
+
unix_timestamp: BN
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export interface SellPtEvent {
|
|
549
|
+
market: web3.PublicKey
|
|
550
|
+
seller: web3.PublicKey
|
|
551
|
+
pt_amount_in: BN
|
|
552
|
+
base_amount_out: BN
|
|
553
|
+
unix_timestamp: BN
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export interface BuyPtEvent {
|
|
557
|
+
market: web3.PublicKey
|
|
558
|
+
buyer: web3.PublicKey
|
|
559
|
+
base_amount_in: BN
|
|
560
|
+
pt_amount_out: BN
|
|
561
|
+
unix_timestamp: BN
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export interface WrapperProvideLiquidityEvent {
|
|
565
|
+
user_address: web3.PublicKey
|
|
566
|
+
market_address: web3.PublicKey
|
|
567
|
+
amount_base_in: BN
|
|
568
|
+
amount_lp_out: BN
|
|
569
|
+
amount_yt_out: BN
|
|
570
|
+
lp_price: number
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
export interface WrapperCollectInterestEvent {
|
|
574
|
+
depositor: web3.PublicKey
|
|
575
|
+
vault: web3.PublicKey
|
|
576
|
+
amount_base_collected: BN
|
|
577
|
+
unix_timestamp: BN
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export interface WrapperWithdrawLiquidityEvent {
|
|
581
|
+
user_address: web3.PublicKey
|
|
582
|
+
market_address: web3.PublicKey
|
|
583
|
+
amount_base_out: BN
|
|
584
|
+
amount_lp_in: BN
|
|
585
|
+
lp_price: number
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface WrapperWithdrawLiquidityClassicEvent {
|
|
589
|
+
user_address: web3.PublicKey
|
|
590
|
+
market_address: web3.PublicKey
|
|
591
|
+
amount_base_out: BN
|
|
592
|
+
amount_lp_in: BN
|
|
593
|
+
amount_pt_out: BN
|
|
594
|
+
lp_price: number
|
|
595
|
+
}
|