-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathswap.did
More file actions
218 lines (218 loc) · 6.49 KB
/
swap.did
File metadata and controls
218 lines (218 loc) · 6.49 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
type BlockInfo = record { height : nat32; hash : text };
type CoinBalance = record { id : text; value : nat };
type DonateIntention = record {
out_rune : CoinBalance;
out_sats : nat64;
nonce : nat64;
input : Utxo;
};
type ExchangeError = variant {
InvalidSignPsbtArgs : text;
FundsLimitExceeded;
UtxoMismatch;
InvalidNumeric;
Overflow;
Paused;
InvalidInput;
PoolAddressNotFound;
PriceImpactLimitExceeded;
RuneIndexerError : text;
PoolStateExpired : nat64;
InvalidSignature;
SwapPaused;
TooSmallFunds;
LiquidityLocked;
OnetimePool;
InvalidRuneId;
InvalidPool;
InvalidPsbt : text;
PoolAlreadyExists;
InvalidTxid;
InvalidLiquidity;
BlockSyncing;
EmptyPool;
InvalidLockMessage;
FetchBitcoinCanisterError;
LpNotFound;
NoConfirmedUtxos;
ChainKeyError;
FetchRuneIndexerError;
InvalidState : text;
InsufficientFunds;
};
type ExecuteTxArgs = record {
zero_confirmed_tx_queue_length : nat32;
txid : text;
intention_set : IntentionSet;
intention_index : nat32;
psbt_hex : text;
};
type ExtractFeeOffer = record {
output : CoinBalance;
nonce : nat64;
input : Utxo;
};
type GetMinimalTxValueArgs = record {
zero_confirmed_tx_queue_length : nat32;
pool_address : text;
};
type GetPoolInfoArgs = record { pool_address : text };
type InputCoin = record { coin : CoinBalance; from : text };
type Intention = record {
input_coins : vec InputCoin;
output_coins : vec OutputCoin;
action : text;
exchange_id : text;
pool_utxo_spent : vec text;
action_params : text;
nonce : nat64;
pool_address : text;
pool_utxo_received : vec Utxo;
};
type IntentionSet = record {
tx_fee_in_sats : nat64;
initiator_address : text;
intentions : vec Intention;
};
type Liquidity = record {
total_share : nat;
user_share : nat;
locked_revenue : nat64;
user_incomes : nat64;
locked_revenue_claimed : nat64;
lock_until : nat32;
};
type LiquidityOffer = record {
output : CoinBalance;
inputs : opt Utxo;
nonce : nat64;
};
type NewBlockInfo = record {
block_hash : text;
confirmed_txids : vec text;
block_timestamp : nat64;
block_height : nat32;
};
type OutputCoin = record { to : text; coin : CoinBalance };
type PoolBasic = record { name : text; address : text };
type PoolInfo = record {
key : text;
name : text;
btc_reserved : nat64;
key_derivation_path : vec blob;
coin_reserved : vec CoinBalance;
attributes : text;
address : text;
nonce : nat64;
utxos : vec Utxo;
};
type PoolState = record {
k : nat;
id : opt text;
lp : vec record { text; nat };
lp_earnings : vec record { text; nat64 };
utxo : opt Utxo;
total_rune_donation : nat;
incomes : nat64;
locked_lp_revenue : vec record { text; nat64 };
claimed : vec record { text; nat64 };
total_btc_donation : nat64;
nonce : nat64;
lp_locks : vec record { text; nat32 };
};
type PoolTemplate = variant { NFTStrategy; Satsman; Standard };
type PreClaimOutput = record {
nonce : nat64;
claim_sats : nat64;
input : Utxo;
};
type Result = variant { Ok : record { nat64; nat64 }; Err : text };
type Result_1 = variant { Ok : text; Err : ExchangeError };
type Result_10 = variant { Ok : PreClaimOutput; Err : ExchangeError };
type Result_11 = variant { Ok : ExtractFeeOffer; Err : ExchangeError };
type Result_12 = variant { Ok : SwapOffer; Err : ExchangeError };
type Result_13 = variant { Ok : WithdrawalOffer; Err : ExchangeError };
type Result_14 = variant { Ok : vec BlockInfo; Err : text };
type Result_15 = variant { Ok : PoolInfo; Err : ExchangeError };
type Result_16 = variant { Ok : vec TxRecordInfo; Err : text };
type Result_2 = variant { Ok; Err : ExchangeError };
type Result_3 = variant { Ok : text; Err : text };
type Result_4 = variant {
Ok : vec record { text; Liquidity };
Err : ExchangeError;
};
type Result_5 = variant { Ok : Liquidity; Err : ExchangeError };
type Result_6 = variant {
Ok : opt record { opt PoolState; PoolState };
Err : text;
};
type Result_7 = variant { Ok; Err : text };
type Result_8 = variant { Ok : LiquidityOffer; Err : ExchangeError };
type Result_9 = variant { Ok : DonateIntention; Err : ExchangeError };
type RollbackTxArgs = record { txid : text };
type SwapOffer = record {
output : CoinBalance;
nonce : nat64;
price_impact : nat32;
input : Utxo;
};
type TxRecord = record { pools : vec text };
type TxRecordInfo = record {
records : vec text;
txid : text;
confirmed : bool;
};
type Utxo = record {
coins : vec CoinBalance;
sats : nat64;
txid : text;
vout : nat32;
};
type WithdrawalOffer = record {
nonce : nat64;
input : Utxo;
user_outputs : vec CoinBalance;
};
service : {
add_pool_creator_principal : (principal) -> ();
blocks_tx_records_count : () -> (Result) query;
create : (text) -> (Result_1);
create_with_template : (text, PoolTemplate) -> (Result_1);
donate_rich_protocol_revenue : () -> (Result_2);
escape_hatch : (text, text, nat64) -> (Result_3);
execute_tx : (ExecuteTxArgs) -> (Result_3);
get_all_lp : (text) -> (Result_4) query;
get_block : (nat32) -> (opt NewBlockInfo) query;
get_execute_log : (text) -> (text) query;
get_fee_collector : () -> (text) query;
get_lp : (text, text) -> (Result_5) query;
get_max_block : () -> (opt NewBlockInfo) query;
get_minimal_tx_value : (GetMinimalTxValueArgs) -> (nat64) query;
get_pool_info : (GetPoolInfoArgs) -> (opt PoolInfo) query;
get_pool_list : () -> (vec PoolBasic) query;
get_pool_state_chain : (text, text) -> (Result_6) query;
get_tx_affected : (text) -> (opt TxRecord) query;
list_pools : (opt text, nat64) -> (vec PoolInfo) query;
lock_lp : (text, text, text) -> (Result_2);
new_block : (NewBlockInfo) -> (Result_7);
pause : () -> ();
pause_swap : (text) -> (Result_2);
pre_add_liquidity : (text, CoinBalance) -> (Result_8) query;
pre_bi_donate : (text, nat64, CoinBalance) -> (Result_9) query;
pre_claim_revenue : (text, text) -> (Result_10) query;
pre_donate : (text, nat64) -> (Result_9) query;
pre_extract_fee : (text) -> (Result_11) query;
pre_self_donate : () -> (Result_9) query;
pre_swap : (text, CoinBalance) -> (Result_12) query;
pre_withdraw_liquidity : (text, text, nat) -> (Result_13) query;
query_blocks : () -> (Result_14) query;
query_pool : (text) -> (Result_15) query;
query_tx_records : () -> (Result_16) query;
recover : () -> ();
remove_pool : (text) -> (Result_2);
resume_swap : (text) -> (Result_2);
rollback_tx : (RollbackTxArgs) -> (Result_7);
set_donation_amount : (text, nat64, nat) -> (Result_2);
set_orchestrator : (principal) -> ();
sync_with_btc : (text, nat64) -> (Result_1);
}