-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathlayout.ts
More file actions
30 lines (27 loc) · 826 Bytes
/
layout.ts
File metadata and controls
30 lines (27 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { struct } from '@solana/buffer-layout';
import { CreateEvent, TradeEvent, CompleteEvent } from './types';
import { stringLayout, pubKey, uint64, boolean } from '../../core/layout';
export const CREATE_EVENT_LAYOUT = struct<CreateEvent>([
stringLayout('name'),
stringLayout('symbol'),
stringLayout('uri'),
pubKey('mint'),
pubKey('bondingCurve'),
pubKey('user'),
]);
export const TRADE_EVENT_LAYOUT = struct<TradeEvent>([
pubKey('mint'),
uint64('solAmount'),
uint64('tokenAmount'),
boolean('isBuy'),
pubKey('user'),
uint64('timestamp'),
uint64('virtualSolReserves'),
uint64('virtualTokenReserves'),
]);
export const COMPLETE_EVENT_LAYOUT = struct<CompleteEvent>([
pubKey('user'),
pubKey('mint'),
pubKey('bondingCurve'),
uint64('timestamp'),
]);