hdao

package
v0.0.0-...-5d50b2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() gorose.IOrm

func Query_cdcs

func Query_cdcs(start int, limit int, state int, ownerAddress string) (*[]CdcTable, error)

state=-1 refers to all state ownerAddress="" refers to all owner

func Query_supply

func Query_supply(startblocknum int, endblocknum int) (*[]StableTokenSupplyHistoryTable, error)

Types

type CDCOperation

type CDCOperation struct {
	Account    string
	Contract   string
	Wallet_api *HXWalletApi
	Asset      string
	Precision  int
}

func NewCDCOperation

func NewCDCOperation(account string, contract string, wallet_api *HXWalletApi) (*CDCOperation, error)

create a new CDC

func (*CDCOperation) Add_collateral

func (cdcOperation *CDCOperation) Add_collateral(cdc_id string, collateralAmount float64) (string, error)

func (*CDCOperation) Change_admin

func (cdcOperation *CDCOperation) Change_admin(addr string) (string, error)

func (*CDCOperation) Close_cdc

func (cdcOperation *CDCOperation) Close_cdc(cdc_id string) (string, error)

func (*CDCOperation) Close_contract

func (cdcOperation *CDCOperation) Close_contract() (string, error)

func (*CDCOperation) Generate_stable_coin

func (cdcOperation *CDCOperation) Generate_stable_coin(cdc_id string, stableCoinAmount float64) (string, error)

func (*CDCOperation) Get_Info

func (cdcOperation *CDCOperation) Get_Info() (string, error)

offline apis

func (*CDCOperation) Get_cdc

func (cdcOperation *CDCOperation) Get_cdc(cdc_id string) (string, error)

func (*CDCOperation) Get_liquidable_info

func (cdcOperation *CDCOperation) Get_liquidable_info(cdc_id string) (string, error)

func (*CDCOperation) Global_liquidate

func (cdcOperation *CDCOperation) Global_liquidate() (string, error)

func (*CDCOperation) Init_config

func (cdcOperation *CDCOperation) Init_config(collateralAsset string, collateralizationRatio float64, annualStabilityFee float64, liquidationRatio float64, liquidationPenalty float64, liquidationDiscount float64, priceFeederAddr string, stableCoinAddr string, proxyAddr string) (string, error)

func (*CDCOperation) Liquidate

func (cdcOperation *CDCOperation) Liquidate(cdc_id string, stableCoinAmount float64, collateralAmount float64) (string, error)

func (*CDCOperation) Open_cdc

func (cdcOperation *CDCOperation) Open_cdc(collateralAmount float64, stableCoinAmount float64) (string, error)

func (*CDCOperation) Pay_back

func (cdcOperation *CDCOperation) Pay_back(cdc_id string, stableCoinAmount float64) (string, error)

func (*CDCOperation) Set_annual_stability_fee

func (cdcOperation *CDCOperation) Set_annual_stability_fee(annual_stability_fee float64) (string, error)

func (*CDCOperation) Set_liquidation_discount

func (cdcOperation *CDCOperation) Set_liquidation_discount(discount float64) (string, error)

func (*CDCOperation) Set_liquidation_penalty

func (cdcOperation *CDCOperation) Set_liquidation_penalty(penalty float64) (string, error)

func (*CDCOperation) Set_liquidation_ratio

func (cdcOperation *CDCOperation) Set_liquidation_ratio(ratio float64) (string, error)

func (*CDCOperation) Set_price_feeder_addr

func (cdcOperation *CDCOperation) Set_price_feeder_addr(addr string) (string, error)

func (*CDCOperation) Take_back_collateral_by_cdc

func (cdcOperation *CDCOperation) Take_back_collateral_by_cdc(cdc_id string) (string, error)

func (*CDCOperation) Take_back_collateral_by_token

func (cdcOperation *CDCOperation) Take_back_collateral_by_token(cdc_id string) (string, error)

func (*CDCOperation) Transfer_cdc

func (cdcOperation *CDCOperation) Transfer_cdc(cdc_id string, addr string) (string, error)

func (*CDCOperation) Withdraw_collateral

func (cdcOperation *CDCOperation) Withdraw_collateral(cdc_id string, amount float64) (string, error)

type CdcChainTable

type CdcChainTable struct {
	Chain_id                    string `gorose:"chain_id"`
	Cdc_contract_address        string `gorose:"cdc_contract_address"`
	Contract_register_block_num int    `gorose:"contract_register_block_num"`
	End_block_num               int    `gorose:"end_block_num"`
	End_block_id                string `gorose:"end_block_id"`
}

func (*CdcChainTable) TableName

func (u *CdcChainTable) TableName() string

type CdcEventTable

type CdcEventTable struct {
	Event_id int    `gorose:"event_id"`
	Tx_id    string `gorose:"tx_id"`
	// contains filtered or unexported fields
}

//

func (*CdcEventTable) TableName

func (u *CdcEventTable) TableName() string

type CdcTable

type CdcTable struct {
	CdcId string `gorose:"cdcId"`
	State int    `gorose:"state"`
	//StabilityFee      int64  `gorose:"stabilityFee"`
	CollateralAmount  int64  `gorose:"collateralAmount"`
	StableTokenAmount int64  `gorose:"stableTokenAmount"`
	Owner             string `gorose:"owner"`
	Liquidator        string `gorose:"liquidator"`
	Block_number      int    `gorose:"block_number"`
	Last_event_id     string `gorose:"last_event_id"`
}

//////////

func Query_cdc_by_address

func Query_cdc_by_address(ownerAddress string) (CdcTable, error)

func Query_cdc_by_id

func Query_cdc_by_id(cdcId string) (CdcTable, error)

func (*CdcTable) TableName

func (u *CdcTable) TableName() string

type EventAddCollateralTable

type EventAddCollateralTable struct {
	Event_id     string `gorose:"event_id"`
	CdcId        string `gorose:"cdcId"`
	AddAmount    int64  `gorose:"addAmount"`
	Block_number int    `gorose:"block_number"`
}

func (*EventAddCollateralTable) TableName

func (u *EventAddCollateralTable) TableName() string

type EventCloseCdcTable

type EventCloseCdcTable struct {
	Event_id          string `gorose:"event_id"`
	CdcId             string `gorose:"cdcId"`
	Owner             string `gorose:"owner"`
	SecSinceEpoch     int    `gorose:"secSinceEpoch"`
	StabilityFee      int64  `gorose:"stabilityFee"`
	CollateralAmount  int64  `gorose:"collateralAmount"`
	StableTokenAmount int64  `gorose:"stableTokenAmount"`
	Block_number      int    `gorose:"block_number"`
}

func (*EventCloseCdcTable) TableName

func (u *EventCloseCdcTable) TableName() string

type EventExpandLoanTable

type EventExpandLoanTable struct {
	Event_id         string `gorose:"event_id"`
	CdcId            string `gorose:"cdcId"`
	From_address     string `gorose:"from_address"`
	RepayFee         int64  `gorose:"repayFee"`
	ExpandLoanAmount int64  `gorose:"expandLoanAmount"`
	RealGotAmount    int64  `gorose:"realGotAmount"`
	Block_number     int    `gorose:"block_number"`
}

func (*EventExpandLoanTable) TableName

func (u *EventExpandLoanTable) TableName() string

type EventLiquidateTable

type EventLiquidateTable struct {
	Event_id                string `gorose:"event_id"`
	CdcId                   string `gorose:"cdcId"`
	Owner                   string `gorose:"owner"`
	SecSinceEpoch           int    `gorose:"secSinceEpoch"`
	CollateralAmount        int64  `gorose:"collateralAmount"`
	StableTokenAmount       int64  `gorose:"stableTokenAmount"`
	CurPrice                string `gorose:"curPrice"`
	IsBadDebt               bool   `gorose:"isBadDebt"`
	Liquidator              string `gorose:"liquidator"`
	AuctionPrice            string `gorose:"auctionPrice"`
	ReturnAmount            int64  `gorose:"returnAmount"`
	PenaltyAmount           int64  `gorose:"penaltyAmount"`
	IsNeedLiquidation       bool   `gorose:"isNeedLiquidation"`
	StabilityFee            int64  `gorose:"stabilityFee"`
	RepayStableTokenAmount  int64  `gorose:"repayStableTokenAmount"`
	AuctionCollateralAmount int64  `gorose:"auctionCollateralAmount"`
	Block_number            int    `gorose:"block_number"`
}

func (*EventLiquidateTable) TableName

func (u *EventLiquidateTable) TableName() string

type EventOpenCdcTable

type EventOpenCdcTable struct {
	Event_id string `gorose:"event_id"`
	CdcId    string `gorose:"cdcId"`
	Owner    string `gorose:"owner"`
	////
	SecSinceEpoch     int   `gorose:"secSinceEpoch"`
	CollateralAmount  int64 `gorose:"collateralAmount"`
	StableTokenAmount int64 `gorose:"stableTokenAmount"`
	Block_number      int   `gorose:"block_number"`
}

func (*EventOpenCdcTable) TableName

func (u *EventOpenCdcTable) TableName() string

type EventPayBackTable

type EventPayBackTable struct {
	Event_id          string `gorose:"event_id"`
	CdcId             string `gorose:"cdcId"`
	From_address      string `gorose:"from_address"`
	Fee               int64  `gorose:"fee"`
	RepayPrincipal    int64  `gorose:"repayPrincipal"`
	PayBackAmount     int64  `gorose:"payBackAmount"`
	RealPayBackAmount int64  `gorose:"realPayBackAmount"`
	Block_number      int    `gorose:"block_number"`
}

func (*EventPayBackTable) TableName

func (u *EventPayBackTable) TableName() string

type EventTransferCdcTable

type EventTransferCdcTable struct {
	Event_id     string `gorose:"event_id"`
	CdcId        string `gorose:"cdcId"`
	From_address string `gorose:"from_address"`
	To_address   string `gorose:"to_address"`
	Block_number int    `gorose:"block_number"`
}

func (*EventTransferCdcTable) TableName

func (u *EventTransferCdcTable) TableName() string

type EventWidrawCollateralTable

type EventWidrawCollateralTable struct {
	Event_id               string `gorose:"event_id"`
	CdcId                  string `gorose:"cdcId"`
	From_address           string `gorose:"from_address"`
	WidrawCollateralAmount int64  `gorose:"widrawCollateralAmount"`
	Block_number           int    `gorose:"block_number"`
}

func (*EventWidrawCollateralTable) TableName

func (u *EventWidrawCollateralTable) TableName() string

type HXWalletApi

type HXWalletApi struct {
	Name         string
	Rpc_user     string
	Rpc_password string
	Rpc_url      string
}

construct rpc request msg to hx mainchain

func NewHXWalletApi

func NewHXWalletApi(name string, rpc_user string, rpc_password string, rpc_url string) *HXWalletApi

func (*HXWalletApi) Rpc_request

func (walletApi *HXWalletApi) Rpc_request(method string, args []interface{}) (string, error)

type HxPayLoad

type HxPayLoad struct {
	Id     int
	Method string
	Params []interface{}
}

type PriceFeeder

type PriceFeeder struct {
	Account    string
	Contract   string
	Wallet_api HXWalletApi
}

func NewPriceFeeder

func NewPriceFeeder(account string, contract string, wallet_api HXWalletApi) *PriceFeeder

func (*PriceFeeder) Add_feeder

func (priceFeeder *PriceFeeder) Add_feeder(addr string) (string, error)

func (*PriceFeeder) Change_owner

func (priceFeeder *PriceFeeder) Change_owner(addr string) (string, error)

func (*PriceFeeder) Feed_price

func (priceFeeder *PriceFeeder) Feed_price(price float64) (string, error)

func (*PriceFeeder) Get_base_asset

func (priceFeeder *PriceFeeder) Get_base_asset() (string, error)

func (*PriceFeeder) Get_feedPrices

func (priceFeeder *PriceFeeder) Get_feedPrices() (string, error)

func (*PriceFeeder) Get_feeders

func (priceFeeder *PriceFeeder) Get_feeders() (string, error)

func (*PriceFeeder) Get_owner

func (priceFeeder *PriceFeeder) Get_owner() (string, error)

func (*PriceFeeder) Get_price

func (priceFeeder *PriceFeeder) Get_price() (string, error)

offline api

func (*PriceFeeder) Get_quote_asset

func (priceFeeder *PriceFeeder) Get_quote_asset() (string, error)

func (*PriceFeeder) Get_state

func (priceFeeder *PriceFeeder) Get_state() (string, error)

func (*PriceFeeder) Init_config

func (priceFeeder *PriceFeeder) Init_config(baseAsset string, quoteAsset string, init_price float64, maxChangeRatio float64) (string, error)

apis

func (*PriceFeeder) Remove_feeder

func (priceFeeder *PriceFeeder) Remove_feeder(addr string) (string, error)

type StableTokenSupplyHistoryTable

type StableTokenSupplyHistoryTable struct {
	Block_number int   `gorose:"block_number"`
	Supply       int64 `gorose:"supply"`
}

//

func (*StableTokenSupplyHistoryTable) TableName

func (u *StableTokenSupplyHistoryTable) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL