four_meme_sdk/
types.rs

1use alloy::primitives::{Address, U256};
2use serde::{Deserialize, Serialize};
3
4use crate::IFourMeme;
5
6
7
8#[derive(Clone)]
9pub enum FourMemeEvent {
10    TokenPurchase(IFourMeme::TokenPurchase),
11    TokenSale(IFourMeme::TokenSale),
12    TokenCreate(IFourMeme::TokenCreate),
13}
14 
15
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct BuyParams {
19    pub token: Address,
20    pub amount: U256,
21    pub max_funds: U256,
22    pub to: Option<Address>,
23}
24
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct BuyAmapParams {
28    pub token: Address,
29    pub funds: U256,
30    pub min_amount: U256,
31    pub to: Option<Address>,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct SellAmapParams {
36    pub token: Address,
37    pub amount: U256,
38    pub min_funds: Option<U256>,
39    pub origin: Option<U256>,
40    pub from: Option<Address>,
41    pub fee_rate: Option<U256>,
42    pub fee_recipient: Option<Address>,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct SellParams {
47    pub origin: u32,
48    pub token: Address,
49    pub from: Address,               // Must equal tx.origin
50    pub amount_tokens: U256,         // Amount of tokens to sell
51    pub min_funds_out: U256,
52    pub fee_rate_bp: u32,
53    pub fee_recipient: Address,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct CreateTokenParams {
58    pub name: String,
59    pub short_name: String,
60    pub description: String,
61    pub img_url: String,
62    pub total_supply: Option<U256>,
63    pub raised_amount: Option<U256>,
64    pub sale_rate: Option<f64>,
65    pub pre_sale: Option<U256>,
66    pub label: Option<String>,
67}
68
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct TokenInfo {
72    pub token: Address,
73    pub owner: Address,
74    pub token_manager: Address,      // Specific TM address for V1/V2
75    pub is_bonded: bool,
76    pub total_supply: U256,
77    pub reserve: U256,
78    pub price: U256,                 // Specific fields depend on helper ABI
79}
80
81
82
83
84
85#[derive(Debug, Serialize)]
86pub struct CreateTokenApiParams {
87    pub access_token: String,
88    pub name: String,
89    pub short_name: String,
90    pub desc: String,
91    pub total_supply: U256,
92    pub raised_amount: U256,
93    pub sale_rate: f64,
94    pub signature: String,
95    pub user_address: String,
96    pub network: String,
97    pub img_url: String,
98    pub pre_sale: U256,
99    pub label: Option<String>,
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(rename_all = "camelCase")]
104pub struct CreateMemeResponse {
105    pub code: i64,
106    pub msg: String,
107    pub data: Option<CreateMemeResponseData>,
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(rename_all = "camelCase")]
112pub struct CreateMemeResponseData {
113    pub token_id: u64,
114    pub total_amount: U256,
115    pub sale_amount: U256,
116    pub template: u32,
117    pub launch_time: i64,
118    pub server_time: i64,
119    pub create_arg: String, 
120    pub signature: String,
121    pub bamount: String,
122    pub tamount: String,
123    // ... other fields
124}
125
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(rename_all = "camelCase")]
129pub struct GetTokenInfoByIdResponse {
130    pub code: i64,
131    pub msg: String,
132    pub data: GetTokenInfoByIdResponseData,
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(rename_all = "camelCase")]
137pub struct GetTokenInfoByIdResponseData {
138    pub id: u64,
139    pub address: String,
140    pub image: String,
141    pub name: String,
142    pub short_name: String,
143    pub symbol: String,
144    pub descr: String,
145    pub total_amount: String,
146    pub sale_amount: String,
147    pub b0: String,
148    pub t0: String,
149    pub launch_time: i64,
150    pub min_buy: String,
151    pub max_buy: String,
152    pub user_id: i64,
153    pub user_address: Address,
154    pub user_name: String,
155    pub user_avatar: String,
156    pub status: String,
157    pub show_status: String,
158    pub token_price: TokenPrice,
159    pub oscar_status: String,
160    pub progress_tag: bool,
161    pub cto_tag: bool,
162    pub version: String,
163    pub click_fun_check: bool,
164    pub reserve_amount: String,
165    pub raised_amount: String,
166    pub network_code: String,
167    pub label: String,
168    pub create_date: String,
169    pub modify_date: String,
170    pub is_rush: bool,
171    pub dex_type: String,
172    pub last_id: u64,
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(rename_all = "camelCase")]
177pub struct TokenPrice {
178    pub price: String,
179    pub max_price: String,
180    pub increase: String,
181    pub amount: String,
182    pub market_cap: String,
183    pub trading: String,
184    pub day_increase: String,
185    pub day_trading: String,
186    pub raised_amount: String,
187    pub progress: String,
188    pub liquidity: String,
189    pub trading_usd: String,
190    pub create_date: String,
191    pub modify_date: String,
192    pub bamount: String,
193    pub tamount: String,
194}