-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdfinance_backend.did.js
More file actions
147 lines (147 loc) · 5.34 KB
/
dfinance_backend.did.js
File metadata and controls
147 lines (147 loc) · 5.34 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
export const idlFactory = ({ IDL }) => {
const Result = IDL.Variant({ 'Ok' : IDL.Null, 'Err' : IDL.Text });
const Result_1 = IDL.Variant({ 'Ok' : IDL.Text, 'Err' : IDL.Text });
const Result_2 = IDL.Variant({ 'Ok' : IDL.Nat, 'Err' : IDL.Text });
const UserState = IDL.Record({
'adjusted_balance' : IDL.Nat,
'last_liquidity_index' : IDL.Nat,
});
const UserReserveData = IDL.Record({
'supply_rate' : IDL.Nat,
'asset_price_when_supplied' : IDL.Nat,
'principal_stable_debt' : IDL.Nat64,
'asset_borrow' : IDL.Nat,
'last_update_timestamp' : IDL.Nat64,
'is_collateral' : IDL.Bool,
'asset_price_when_borrowed' : IDL.Nat,
'liquidity_index' : IDL.Nat,
'faucet_limit' : IDL.Nat,
'variable_borrow_index' : IDL.Nat,
'reserve' : IDL.Text,
'asset_supply' : IDL.Nat,
'state' : UserState,
'faucet_usage' : IDL.Nat,
'borrow_rate' : IDL.Nat,
'is_using_as_collateral_or_borrow' : IDL.Bool,
'is_borrowed' : IDL.Bool,
});
const UserData = IDL.Record({
'ltv' : IDL.Opt(IDL.Nat),
'available_borrow' : IDL.Opt(IDL.Nat),
'net_apy' : IDL.Opt(IDL.Nat),
'reserves' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, UserReserveData))),
'health_factor' : IDL.Opt(IDL.Nat),
'total_collateral' : IDL.Opt(IDL.Nat),
'total_debt' : IDL.Opt(IDL.Nat),
'user_id' : IDL.Opt(IDL.Text),
'liquidation_threshold' : IDL.Opt(IDL.Nat),
'max_ltv' : IDL.Opt(IDL.Nat),
'net_worth' : IDL.Opt(IDL.Nat),
});
const Result_3 = IDL.Variant({ 'Ok' : IDL.Principal, 'Err' : IDL.Text });
const CachedPrice = IDL.Record({ 'price' : IDL.Nat });
const PriceCache = IDL.Record({
'cache' : IDL.Vec(IDL.Tuple(IDL.Text, CachedPrice)),
});
const Result_4 = IDL.Variant({ 'Ok' : PriceCache, 'Err' : IDL.Text });
const Result_5 = IDL.Variant({
'Ok' : IDL.Tuple(IDL.Nat, IDL.Nat64),
'Err' : IDL.Text,
});
const ReserveConfiguration = IDL.Record({
'ltv' : IDL.Nat,
'liquidation_protocol_fee' : IDL.Nat,
'active' : IDL.Bool,
'supply_cap' : IDL.Nat,
'borrow_cap' : IDL.Nat,
'reserve_factor' : IDL.Nat,
'borrowing_enabled' : IDL.Bool,
'frozen' : IDL.Bool,
'liquidation_bonus' : IDL.Nat,
'liquidation_threshold' : IDL.Nat,
'paused' : IDL.Bool,
});
const ReserveData = IDL.Record({
'id' : IDL.Nat16,
'asset_name' : IDL.Opt(IDL.Text),
'userlist' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Bool))),
'asset_borrow' : IDL.Nat,
'can_be_collateral' : IDL.Opt(IDL.Bool),
'debt_token_canister' : IDL.Opt(IDL.Text),
'last_update_timestamp' : IDL.Nat64,
'liquidity_index' : IDL.Nat,
'd_token_canister' : IDL.Opt(IDL.Text),
'asset_supply' : IDL.Nat,
'current_liquidity_rate' : IDL.Nat,
'borrow_rate' : IDL.Nat,
'configuration' : ReserveConfiguration,
'accure_to_platform' : IDL.Nat,
'debt_index' : IDL.Nat,
'total_borrowed' : IDL.Nat,
'total_supply' : IDL.Nat,
});
const Result_6 = IDL.Variant({ 'Ok' : ReserveData, 'Err' : IDL.Text });
const Result_7 = IDL.Variant({ 'Ok' : UserData, 'Err' : IDL.Text });
const Result_8 = IDL.Variant({ 'Ok' : IDL.Nat, 'Err' : IDL.Text });
const Result_9 = IDL.Variant({
'Ok' : IDL.Tuple(IDL.Nat, IDL.Nat),
'Err' : IDL.Text,
});
return IDL.Service({
'borrow' : IDL.Func([IDL.Text, IDL.Nat64], [Result], []),
'check_user' : IDL.Func([IDL.Text], [Result_1], []),
'create_multiple_canisters' : IDL.Func([], [IDL.Vec(IDL.Principal)], []),
'faucet' : IDL.Func([IDL.Text, IDL.Nat], [Result_2], []),
'get_all_assets' : IDL.Func([], [IDL.Vec(IDL.Text)], ['query']),
'get_all_users' : IDL.Func(
[],
[IDL.Vec(IDL.Tuple(IDL.Principal, UserData))],
['query'],
),
'get_asset_principal' : IDL.Func([IDL.Text], [Result_3], ['query']),
'get_balance' : IDL.Func(
[IDL.Principal, IDL.Principal],
[IDL.Nat],
['query'],
),
'get_cached_exchange_rate' : IDL.Func([IDL.Text], [Result_4], ['query']),
'get_exchange_rates' : IDL.Func(
[IDL.Text, IDL.Opt(IDL.Text), IDL.Nat],
[Result_5],
[],
),
'get_reserve_data' : IDL.Func([IDL.Text], [Result_6], ['query']),
'get_user_data' : IDL.Func([IDL.Text], [Result_7], ['query']),
'initialize_reserve' : IDL.Func([], [], []),
'liquidation_call' : IDL.Func(
[IDL.Text, IDL.Text, IDL.Nat64, IDL.Text],
[Result],
[],
),
'login' : IDL.Func([], [Result], []),
'queary_reserve_price' : IDL.Func([], [IDL.Vec(PriceCache)], ['query']),
'repay' : IDL.Func([IDL.Text, IDL.Nat, IDL.Opt(IDL.Text)], [Result], []),
'reset_faucet_usage' : IDL.Func([IDL.Text], [Result], []),
'supply' : IDL.Func([IDL.Text, IDL.Nat64, IDL.Bool], [Result], []),
'toggle_collateral' : IDL.Func([IDL.Text, IDL.Nat, IDL.Nat], [], []),
'update_balance' : IDL.Func(
[IDL.Principal, IDL.Principal, IDL.Nat],
[Result_2],
[],
),
'update_reserves_price' : IDL.Func([], [], []),
'user_normalized_debt' : IDL.Func([UserReserveData], [Result_8], ['query']),
'user_normalized_supply' : IDL.Func(
[UserReserveData],
[Result_8],
['query'],
),
'user_position' : IDL.Func([IDL.Text], [Result_9], ['query']),
'withdraw' : IDL.Func(
[IDL.Text, IDL.Nat, IDL.Opt(IDL.Text), IDL.Bool],
[Result],
[],
),
});
};
export const init = ({ IDL }) => { return []; };