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
use eosio::*; use std::collections::VecDeque; /// <https://github.com/EOSIO/eosio.contracts/blob/c046863a65d7e98424312ee8009f0acb493e6231/contracts/eosio.system/include/eosio.system/eosio.system.hpp#L216-L227> #[derive(Read, Write, NumBytes, Debug, Clone)] pub struct RexPool { pub version: u8, /// total amount of CORE_SYMBOL in open rex_loans pub total_lent: Asset, /// total amount of CORE_SYMBOL available to be lent (connector) pub total_unlent: Asset, /// fees received in exchange for lent (connector) pub total_rent: Asset, /// total amount of CORE_SYMBOL that have been lent (total_unlent + /// total_lent) pub total_lendable: Asset, /// total number of REX shares allocated to contributors to total_lendable pub total_rex: Asset, /// the amount of CORE_SYMBOL to be transferred from namebids to REX pool pub namebid_proceeds: Asset, /// increments with each new loan pub loan_num: u64, } impl Table for RexPool { type Row = Self; const NAME: TableName = TableName::new(n!("rexpool")); fn primary_key(_row: &Self::Row) -> u64 { 0 } } /// <https://github.com/EOSIO/eosio.contracts/blob/c046863a65d7e98424312ee8009f0acb493e6231/contracts/eosio.system/include/eosio.system/eosio.system.hpp#L231-L237> #[derive(Table, Read, Write, NumBytes, Debug, Clone)] #[eosio(table_name = "rexfund")] pub struct RexFund { pub version: u8, /// owner of the rex fund #[eosio(primary_key)] pub owner: AccountName, /// balance of the fund. pub balance: Asset, } /// <https://github.com/EOSIO/eosio.contracts/blob/c046863a65d7e98424312ee8009f0acb493e6231/contracts/eosio.system/include/eosio.system/eosio.system.hpp#L241-L250> #[derive(Table, Read, Write, NumBytes, Debug, Clone)] #[eosio(table_name = "rexbal")] pub struct RexBalance { pub version: u8, /// owner of the rex fund #[eosio(primary_key)] pub owner: AccountName, /// the amount of CORE_SYMBOL currently included in owner's vote pub vote_stake: Asset, /// the amount of REX owned by owner pub rex_balance: Asset, /// matured REX available for selling pub matured_rex: i64, /// REX daily maturity buckets pub rex_maturities: VecDeque<(TimePointSec, i64)>, } /// <https://github.com/EOSIO/eosio.contracts/blob/c046863a65d7e98424312ee8009f0acb493e6231/contracts/eosio.system/include/eosio.system/eosio.system.hpp#L254-L267> #[derive(Read, Write, NumBytes, Debug, Clone)] pub struct RexLoan { pub version: u8, pub from: AccountName, pub receiver: AccountName, pub payment: Asset, pub balance: Asset, pub total_staked: Asset, pub loan_num: u64, pub expiration: TimePoint, } /// <https://github.com/EOSIO/eosio.contracts/blob/c046863a65d7e98424312ee8009f0acb493e6231/contracts/eosio.system/include/eosio.system/eosio.system.hpp#L279-L291> #[derive(Read, Write, NumBytes, Debug, Clone)] pub struct RexOrder { pub version: u8, pub owner: AccountName, pub rex_requested: Asset, pub proceeds: Asset, pub stake_change: Asset, pub order_time: TimePoint, pub is_open: bool, } /// <https://github.com/EOSIO/eosio.contracts/blob/c046863a65d7e98424312ee8009f0acb493e6231/contracts/eosio.system/include/eosio.system/eosio.system.hpp#L296-L300> pub struct RexOrderOutcome { pub success: bool, pub proceeds: Asset, pub stake_change: Asset, } /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L10-L22> #[eosio::action] pub fn deposit(owner: AccountName, amount: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L24-L37> #[eosio::action] pub fn withdraw(owner: AccountName, amount: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L39-L54> #[eosio::action] pub fn buyrex(from: AccountName, amount: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L56-L94> #[eosio::action] pub fn unstaketorex( owner: AccountName, receiver: AccountName, from_net: Asset, from_cpu: Asset, ) { } /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L96-L144> #[eosio::action] pub fn sellrex(from: AccountName, rex: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L146-L153> #[eosio::action] pub fn cnclrexorder(owner: AccountName) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L155-L162> #[eosio::action] pub fn rentcpu( from: AccountName, receiver: AccountName, loan_payment: Asset, loan_fund: Asset, ) { } /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L164-L171> #[eosio::action] pub fn rentnet( from: AccountName, receiver: AccountName, loan_payment: Asset, loan_fund: Asset, ) { } /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L173-L179> #[eosio::action] pub fn fundcpuloan(from: AccountName, loan_num: u64, payment: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L181-L187> #[eosio::action] pub fn fundnetloan(from: AccountName, loan_num: u64, payment: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L189-L195> #[eosio::action] pub fn defcpuloan(from: AccountName, loan_num: u64, amount: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L197-L203> #[eosio::action] pub fn defnetloan(from: AccountName, loan_num: u64, amount: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L205-L229> #[eosio::action] pub fn updaterex(owner: AccountName) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L231-L241> #[eosio::action] pub fn setrex(balance: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L243-L248> #[eosio::action] pub fn rexexec(user: AccountName, max: u16) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L250-L259> #[eosio::action] pub fn consolidate(owner: AccountName) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L261-L293> #[eosio::action] pub fn mvtosavings(owner: AccountName, rex: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L295-L316> #[eosio::action] pub fn mvfrsavings(owner: AccountName, rex: Asset) {} /// <https://github.com/EOSIO/eosio.contracts/blob/v1.9.0-rc3/contracts/eosio.system/src/rex.cpp#L318-L353> #[eosio::action] pub fn closerex(owner: AccountName) {}