github.com/stafiprotocol/go-substrate-rpc-client@v1.4.7/client/stafi_model.go (about) 1 package client 2 3 import ( 4 scale "github.com/itering/scale.go" 5 "github.com/itering/substrate-api-rpc/rpc" 6 "github.com/shopspring/decimal" 7 "github.com/stafiprotocol/go-substrate-rpc-client/signature" 8 "github.com/stafiprotocol/go-substrate-rpc-client/types" 9 ) 10 11 type EraUpdated struct { 12 Symbol RSymbol 13 OldEra uint32 14 NewEra uint32 15 } 16 17 type Transfer struct { 18 From types.AccountID 19 To types.AccountID 20 Symbol RSymbol 21 Value types.U128 22 } 23 24 // /// liquidity withdraw unbond 25 // LiquidityWithdrawUnBond(AccountId, AccountId, Balance), 26 type LiquidityWithdrawUnbond struct { 27 From types.AccountID 28 To types.AccountID 29 Value types.U128 30 } 31 32 type Minted struct { 33 To types.AccountID 34 Symbol RSymbol 35 Value types.U128 36 } 37 38 type Burned struct { 39 From types.AccountID 40 Symbol RSymbol 41 Value types.U128 42 } 43 44 // LiquidityUnBond(AccountId, RSymbol, Vec<u8>, u128, u128, u128, Vec<u8>), 45 // RawEvent::LiquidityUnBond(who, symbol, pool, value, left_value, balance, recipient) 46 type Unbond struct { 47 From types.AccountID 48 Symbol RSymbol 49 Pool types.Bytes 50 Value types.U128 51 LeftValue types.U128 52 Balance types.U128 53 Recipient types.Bytes 54 } 55 56 // Swap: (account, symbol, input amount, output amount, fee amount, input is fis, fis balance, rtoken balance) 57 // Swap(AccountId, RSymbol, u128, u128, u128, bool, u128, u128), 58 type RdexSwap struct { 59 From types.AccountID 60 Symbol RSymbol 61 InputAmount types.U128 62 OutputAmount types.U128 63 FeeAmount types.U128 64 InputIsFis bool 65 FisBalance types.U128 66 RTokenBalance types.U128 67 } 68 69 // AddLiquidity: (account, symbol, fis amount, rToken amount, new total unit, add lp unit, fis balance, rtoken balance) 70 // AddLiquidity(AccountId, RSymbol, u128, u128, u128, u128, u128, u128), 71 type RdexAddLiquidity struct { 72 From types.AccountID 73 Symbol RSymbol 74 FisAmount types.U128 75 RTokenAmount types.U128 76 NewTotalUnit types.U128 77 AddUnit types.U128 78 FisBalance types.U128 79 RTokenBalance types.U128 80 } 81 82 // RemoveLiquidity: (account, symbol, rm unit, swap unit, rm fis amount, rm rToken amount, input is fis, fis balance, rtoken balance) 83 // RemoveLiquidity(AccountId, RSymbol, u128, u128, u128, u128, bool, u128, u128), 84 type RdexRemoveLiquidity struct { 85 From types.AccountID 86 Symbol RSymbol 87 RemoveUnit types.U128 88 SwapUnit types.U128 89 RemoveFisAmount types.U128 90 RemoveRTokenAmount types.U128 91 InputIsFis bool 92 FisBalance types.U128 93 RTokenBalance types.U128 94 } 95 96 // RawEvent::LiquidityUnBond(who, controller, value, left_value, balance) 97 type RFisUnbond struct { 98 From types.AccountID 99 Pool types.Bytes 100 Value types.U128 101 LeftValue types.U128 102 Balance types.U128 103 } 104 105 // /// symbol, old_bonding_duration, new_bonding_duration 106 // BondingDurationUpdated(RSymbol, u32, u32), 107 type BondingDuration struct { 108 Symbol RSymbol 109 OldDuration types.U32 110 NewDuration types.U32 111 } 112 113 // / \[era_index, validator_payout, remainder\] 114 // EraPayout(EraIndex, Balance, Balance), 115 type EraPayout struct { 116 EraIndex types.U32 117 Balance types.U128 118 Balance2 types.U128 119 } 120 121 // RateSet(RSymbol, RateType) 122 type RateSet struct { 123 Symbol RSymbol 124 Rate types.U64 125 } 126 127 type MultiEventFlow struct { 128 EventId string 129 Symbol RSymbol 130 EventData interface{} 131 Block uint64 132 Index uint32 133 Threshold uint16 134 SubAccounts []types.Bytes 135 Key *signature.KeyringPair 136 Others []types.AccountID 137 OpaqueCalls []*MultiOpaqueCall 138 PaymentInfo *rpc.PaymentQueryInfo 139 NewMulCallHashs map[string]bool 140 MulExeCallHashs map[string]bool 141 } 142 143 type EventNewMultisig struct { 144 Who, ID types.AccountID 145 CallHash types.Hash 146 CallHashStr string 147 TimePoint *OptionTimePoint 148 Approvals []types.AccountID 149 } 150 151 type Multisig struct { 152 When types.TimePoint 153 Deposit types.U128 154 Depositor types.AccountID 155 Approvals []types.AccountID 156 } 157 158 type EventMultisigExecuted struct { 159 Who, ID types.AccountID 160 TimePoint types.TimePoint 161 CallHash types.Hash 162 CallHashStr string 163 Result bool 164 } 165 166 type MultiCallParam struct { 167 TimePoint *OptionTimePoint 168 Opaque []byte 169 Extrinsic string 170 CallHash string 171 } 172 173 type Receive struct { 174 Recipient []byte 175 Value types.UCompact 176 } 177 178 type Era struct { 179 Type string `json:"type"` 180 Value uint32 `json:"value"` 181 } 182 183 type ChainEvent struct { 184 ModuleId string `json:"module_id" ` 185 EventId string `json:"event_id" ` 186 EventIndex int `json:"event_idx"` 187 ExtrinsicIndex int `json:"extrinsic_idx"` 188 Params []scale.EventParam `json:"params"` 189 } 190 191 type MultiOpaqueCall struct { 192 Extrinsic string 193 Opaque []byte 194 CallHash string 195 TimePoint *OptionTimePoint 196 } 197 198 type TransInfoSingle struct { 199 Block uint64 200 Index uint32 201 DestSymbol RSymbol 202 Info TransInfo 203 } 204 205 type TransInfoList struct { 206 Block uint64 207 DestSymbol RSymbol 208 List []TransInfo 209 } 210 211 type TransInfoKey struct { 212 Symbol RSymbol 213 Block uint64 214 } 215 216 type TransInfo struct { 217 Account types.AccountID 218 Receiver []byte 219 Value types.U128 220 IsDeal bool `json:"is_deal"` 221 } 222 223 type TransResultWithBlock struct { 224 Symbol RSymbol 225 Block uint64 226 } 227 228 type TransResultWithIndex struct { 229 Symbol RSymbol 230 Block uint64 231 Index uint32 232 } 233 234 type GetLatestDealBLockParam struct { 235 Symbol RSymbol 236 Block chan uint64 237 } 238 239 type GetSignaturesParam struct { 240 Symbol RSymbol 241 Block uint64 242 ProposalId []byte 243 Signatures chan []types.Bytes 244 } 245 246 type GetSignaturesKey struct { 247 Block uint64 248 ProposalId types.Bytes 249 } 250 251 type SubmitSignatureParams struct { 252 Symbol RSymbol 253 Block types.U64 254 ProposalId types.Bytes 255 Signature types.Bytes 256 } 257 258 type MintRewardAct struct { 259 Begin types.U32 260 End types.U32 261 Cycle types.U32 262 RewardRate types.U128 263 TotalReward types.U128 264 LeftAmount types.U128 265 UserLimit types.U128 266 LockedBlocks types.U32 267 TotalRtokenAmount types.U128 268 TotalNativeTokenAmount types.U128 269 } 270 271 type EvtExecuteBondAndSwap struct { 272 AccountId types.AccountID 273 Symbol RSymbol 274 BondId types.Hash 275 Amount types.U128 276 DestRecipient types.Bytes 277 DestId types.U8 278 } 279 280 type ChainExtrinsic struct { 281 ID uint `gorm:"primary_key"` 282 ExtrinsicIndex string `json:"extrinsic_index" sql:"default: null;size:100"` 283 BlockNum int `json:"block_num" ` 284 BlockTimestamp int `json:"block_timestamp"` 285 ExtrinsicLength string `json:"extrinsic_length"` 286 VersionInfo string `json:"version_info"` 287 CallCode string `json:"call_code"` 288 CallModuleFunction string `json:"call_module_function" sql:"size:100"` 289 CallModule string `json:"call_module" sql:"size:100"` 290 Params interface{} `json:"params" sql:"type:MEDIUMTEXT;" ` 291 AccountId string `json:"account_id"` 292 Signature string `json:"signature"` 293 Nonce int `json:"nonce"` 294 Era string `json:"era"` 295 ExtrinsicHash string `json:"extrinsic_hash" sql:"default: null" ` 296 IsSigned bool `json:"is_signed"` 297 Success bool `json:"success"` 298 Fee decimal.Decimal `json:"fee" sql:"type:decimal(30,0);"` 299 BatchIndex int `json:"-" gorm:"-"` 300 }