Documentation ¶
Index ¶
- Constants
- Variables
- func CheckForCoinSupplyOverflow(current *big.Int, delta *big.Int) error
- func RecoverPlain(sighash types.Hash, R, S, Vb *big.Int) (types.Address, error)
- type BuyCoinData
- func (data BuyCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data BuyCoinData) Gas() int64
- func (data BuyCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data BuyCoinData) String() string
- func (data BuyCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type Conversion
- type CreateCoinData
- func (data CreateCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data CreateCoinData) Commission() int64
- func (data CreateCoinData) Gas() int64
- func (data CreateCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data CreateCoinData) String() string
- func (data CreateCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type CreateMultisigData
- func (data CreateMultisigData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data CreateMultisigData) Gas() int64
- func (data CreateMultisigData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data CreateMultisigData) String() string
- func (data CreateMultisigData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type Data
- type DeclareCandidacyData
- func (data DeclareCandidacyData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data DeclareCandidacyData) Gas() int64
- func (data DeclareCandidacyData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data DeclareCandidacyData) String() string
- func (data DeclareCandidacyData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type Decoder
- type DelegateData
- func (data DelegateData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data DelegateData) Gas() int64
- func (data DelegateData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data DelegateData) String() string
- func (data DelegateData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type MultisendData
- func (data MultisendData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data MultisendData) Gas() int64
- func (data MultisendData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data MultisendData) String() string
- func (data MultisendData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type MultisendDataItem
- type RawData
- type RedeemCheckData
- func (data RedeemCheckData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data RedeemCheckData) CommissionInBaseCoin(tx *Transaction) *big.Int
- func (data RedeemCheckData) Gas() int64
- func (data RedeemCheckData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data RedeemCheckData) String() string
- func (data RedeemCheckData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type Response
- type SellAllCoinData
- func (data SellAllCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data SellAllCoinData) Gas() int64
- func (data SellAllCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data SellAllCoinData) String() string
- func (data SellAllCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type SellCoinData
- func (data SellCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data SellCoinData) Gas() int64
- func (data SellCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data SellCoinData) String() string
- func (data SellCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type SendData
- func (data SendData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data SendData) Gas() int64
- func (data SendData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data SendData) String() string
- func (data SendData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type SetCandidateOffData
- func (data SetCandidateOffData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data SetCandidateOffData) Gas() int64
- func (data SetCandidateOffData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data SetCandidateOffData) String() string
- func (data SetCandidateOffData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type SetCandidateOnData
- func (data SetCandidateOnData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data SetCandidateOnData) Gas() int64
- func (data SetCandidateOnData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data SetCandidateOnData) String() string
- func (data SetCandidateOnData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
- type SigType
- type Signature
- type SignatureMulti
- type TotalSpend
- type TotalSpends
- type Transaction
- func (tx *Transaction) CommissionInBaseCoin() *big.Int
- func (tx *Transaction) Gas() int64
- func (tx *Transaction) GetDecodedData() Data
- func (tx *Transaction) Hash() types.Hash
- func (tx *Transaction) Sender() (types.Address, error)
- func (tx *Transaction) Serialize() ([]byte, error)
- func (tx *Transaction) SetDecodedData(data Data)
- func (tx *Transaction) SetMultisigAddress(address types.Address)
- func (tx *Transaction) SetSignature(sig []byte)
- func (tx *Transaction) Sign(prv *ecdsa.PrivateKey) error
- func (tx *Transaction) String() string
- type TxType
- type UnbondData
- func (data UnbondData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
- func (data UnbondData) Gas() int64
- func (data UnbondData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, ...) Response
- func (data UnbondData) String() string
- func (data UnbondData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
Constants ¶
View Source
const ( TypeSend TxType = 0x01 TypeSellCoin TxType = 0x02 TypeSellAllCoin TxType = 0x03 TypeBuyCoin TxType = 0x04 TypeCreateCoin TxType = 0x05 TypeDeclareCandidacy TxType = 0x06 TypeDelegate TxType = 0x07 TypeUnbond TxType = 0x08 TypeRedeemCheck TxType = 0x09 TypeSetCandidateOnline TxType = 0x0A TypeSetCandidateOffline TxType = 0x0B TypeCreateMultisig TxType = 0x0C TypeMultisend TxType = 0x0D SigTypeSingle SigType = 0x01 SigTypeMulti SigType = 0x02 )
Variables ¶
View Source
var ( ErrInvalidSig = errors.New("invalid transaction v, r, s values") MaxCoinSupply = big.NewInt(0).Exp(big.NewInt(10), big.NewInt(15+18), nil) // 1,000,000,000,000,000 bips )
View Source
var (
CommissionMultiplier = big.NewInt(10e14)
)
View Source
var TxDecoder = Decoder{ // contains filtered or unexported fields }
Functions ¶
func CheckForCoinSupplyOverflow ¶ added in v0.8.0
Types ¶
type BuyCoinData ¶ added in v0.0.6
type BuyCoinData struct { CoinToBuy types.CoinSymbol `json:"coin_to_buy"` ValueToBuy *big.Int `json:"value_to_buy"` CoinToSell types.CoinSymbol `json:"coin_to_sell"` MaximumValueToSell *big.Int `json:"maximum_value_to_sell"` }
func (BuyCoinData) BasicCheck ¶ added in v0.8.0
func (data BuyCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (BuyCoinData) Gas ¶ added in v0.0.6
func (data BuyCoinData) Gas() int64
func (BuyCoinData) Run ¶ added in v0.0.6
func (data BuyCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (BuyCoinData) String ¶ added in v0.0.6
func (data BuyCoinData) String() string
func (BuyCoinData) TotalSpend ¶ added in v0.8.0
func (data BuyCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type Conversion ¶ added in v0.8.0
type CreateCoinData ¶
type CreateCoinData struct { Name string `json:"name"` Symbol types.CoinSymbol `json:"symbol"` InitialAmount *big.Int `json:"initial_amount"` InitialReserve *big.Int `json:"initial_reserve"` ConstantReserveRatio uint `json:"constant_reserve_ratio"` }
func (CreateCoinData) BasicCheck ¶ added in v0.8.0
func (data CreateCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (CreateCoinData) Commission ¶ added in v0.9.0
func (data CreateCoinData) Commission() int64
compute additional commission from letters count
func (CreateCoinData) Gas ¶ added in v0.0.6
func (data CreateCoinData) Gas() int64
func (CreateCoinData) Run ¶ added in v0.0.6
func (data CreateCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (CreateCoinData) String ¶ added in v0.0.6
func (data CreateCoinData) String() string
func (CreateCoinData) TotalSpend ¶ added in v0.8.0
func (data CreateCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type CreateMultisigData ¶ added in v0.5.0
type CreateMultisigData struct { Threshold uint `json:"threshold"` Weights []uint `json:"weights"` Addresses []types.Address `json:"addresses"` }
func (CreateMultisigData) BasicCheck ¶ added in v0.8.0
func (data CreateMultisigData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (CreateMultisigData) Gas ¶ added in v0.5.0
func (data CreateMultisigData) Gas() int64
func (CreateMultisigData) Run ¶ added in v0.5.0
func (data CreateMultisigData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (CreateMultisigData) String ¶ added in v0.5.0
func (data CreateMultisigData) String() string
func (CreateMultisigData) TotalSpend ¶ added in v0.8.0
func (data CreateMultisigData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type Data ¶
type Data interface { String() string Gas() int64 TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response) BasicCheck(tx *Transaction, context *state.StateDB) *Response Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response }
type DeclareCandidacyData ¶
type DeclareCandidacyData struct { Address types.Address `json:"address"` PubKey types.Pubkey `json:"pub_key"` Commission uint `json:"commission"` Coin types.CoinSymbol `json:"coin"` Stake *big.Int `json:"stake"` }
func (DeclareCandidacyData) BasicCheck ¶ added in v0.8.0
func (data DeclareCandidacyData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (DeclareCandidacyData) Gas ¶ added in v0.0.6
func (data DeclareCandidacyData) Gas() int64
func (DeclareCandidacyData) Run ¶ added in v0.0.6
func (data DeclareCandidacyData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (DeclareCandidacyData) String ¶ added in v0.0.6
func (data DeclareCandidacyData) String() string
func (DeclareCandidacyData) TotalSpend ¶ added in v0.8.0
func (data DeclareCandidacyData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type Decoder ¶ added in v0.9.0
type Decoder struct {
// contains filtered or unexported fields
}
func (*Decoder) DecodeFromBytes ¶ added in v0.9.0
func (decoder *Decoder) DecodeFromBytes(buf []byte) (*Transaction, error)
func (*Decoder) RegisterType ¶ added in v0.9.0
type DelegateData ¶
type DelegateData struct { PubKey types.Pubkey `json:"pub_key"` Coin types.CoinSymbol `json:"coin"` Stake *big.Int `json:"stake"` }
func (DelegateData) BasicCheck ¶ added in v0.8.0
func (data DelegateData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (DelegateData) Gas ¶ added in v0.0.6
func (data DelegateData) Gas() int64
func (DelegateData) Run ¶ added in v0.0.6
func (data DelegateData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (DelegateData) String ¶ added in v0.0.6
func (data DelegateData) String() string
func (DelegateData) TotalSpend ¶ added in v0.8.0
func (data DelegateData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type MultisendData ¶ added in v0.7.0
type MultisendData struct {
List []MultisendDataItem `json:"list"`
}
func (MultisendData) BasicCheck ¶ added in v0.8.0
func (data MultisendData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (MultisendData) Gas ¶ added in v0.7.0
func (data MultisendData) Gas() int64
func (MultisendData) Run ¶ added in v0.7.0
func (data MultisendData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (MultisendData) String ¶ added in v0.7.0
func (data MultisendData) String() string
func (MultisendData) TotalSpend ¶ added in v0.8.0
func (data MultisendData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type MultisendDataItem ¶ added in v0.7.0
type RedeemCheckData ¶
func (RedeemCheckData) BasicCheck ¶ added in v0.8.0
func (data RedeemCheckData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (RedeemCheckData) CommissionInBaseCoin ¶ added in v0.8.0
func (data RedeemCheckData) CommissionInBaseCoin(tx *Transaction) *big.Int
func (RedeemCheckData) Gas ¶ added in v0.0.6
func (data RedeemCheckData) Gas() int64
func (RedeemCheckData) Run ¶ added in v0.0.6
func (data RedeemCheckData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (RedeemCheckData) String ¶ added in v0.0.6
func (data RedeemCheckData) String() string
func (RedeemCheckData) TotalSpend ¶ added in v0.8.0
func (data RedeemCheckData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type Response ¶
type Response struct { Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"` Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` GasUsed int64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` Tags []common.KVPair `protobuf:"bytes,7,rep,name=tags" json:"tags,omitempty"` }
type SellAllCoinData ¶ added in v0.1.2
type SellAllCoinData struct { CoinToSell types.CoinSymbol `json:"coin_to_sell"` CoinToBuy types.CoinSymbol `json:"coin_to_buy"` MinimumValueToBuy *big.Int `json:"minimum_value_to_buy"` }
func (SellAllCoinData) BasicCheck ¶ added in v0.8.0
func (data SellAllCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (SellAllCoinData) Gas ¶ added in v0.1.2
func (data SellAllCoinData) Gas() int64
func (SellAllCoinData) Run ¶ added in v0.1.2
func (data SellAllCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (SellAllCoinData) String ¶ added in v0.1.2
func (data SellAllCoinData) String() string
func (SellAllCoinData) TotalSpend ¶ added in v0.8.0
func (data SellAllCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type SellCoinData ¶ added in v0.0.6
type SellCoinData struct { CoinToSell types.CoinSymbol `json:"coin_to_sell"` ValueToSell *big.Int `json:"value_to_sell"` CoinToBuy types.CoinSymbol `json:"coin_to_buy"` MinimumValueToBuy *big.Int `json:"minimum_value_to_buy"` }
func (SellCoinData) BasicCheck ¶ added in v0.8.0
func (data SellCoinData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (SellCoinData) Gas ¶ added in v0.0.6
func (data SellCoinData) Gas() int64
func (SellCoinData) Run ¶ added in v0.0.6
func (data SellCoinData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (SellCoinData) String ¶ added in v0.0.6
func (data SellCoinData) String() string
func (SellCoinData) TotalSpend ¶ added in v0.8.0
func (data SellCoinData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type SendData ¶
type SendData struct { Coin types.CoinSymbol `json:"coin"` To types.Address `json:"to"` Value *big.Int `json:"value"` }
func (SendData) BasicCheck ¶ added in v0.8.0
func (data SendData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (SendData) TotalSpend ¶ added in v0.8.0
func (data SendData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type SetCandidateOffData ¶
func (SetCandidateOffData) BasicCheck ¶ added in v0.8.0
func (data SetCandidateOffData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (SetCandidateOffData) Gas ¶ added in v0.0.6
func (data SetCandidateOffData) Gas() int64
func (SetCandidateOffData) Run ¶ added in v0.0.6
func (data SetCandidateOffData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (SetCandidateOffData) String ¶ added in v0.0.6
func (data SetCandidateOffData) String() string
func (SetCandidateOffData) TotalSpend ¶ added in v0.8.0
func (data SetCandidateOffData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type SetCandidateOnData ¶
func (SetCandidateOnData) BasicCheck ¶ added in v0.8.0
func (data SetCandidateOnData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (SetCandidateOnData) Gas ¶ added in v0.0.6
func (data SetCandidateOnData) Gas() int64
func (SetCandidateOnData) Run ¶ added in v0.0.6
func (data SetCandidateOnData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (SetCandidateOnData) String ¶ added in v0.0.6
func (data SetCandidateOnData) String() string
func (SetCandidateOnData) TotalSpend ¶ added in v0.8.0
func (data SetCandidateOnData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
type SignatureMulti ¶ added in v0.5.0
type TotalSpend ¶ added in v0.8.0
type TotalSpend struct { Coin types.CoinSymbol Value *big.Int }
type TotalSpends ¶ added in v0.8.0
type TotalSpends []TotalSpend
func (*TotalSpends) Add ¶ added in v0.8.0
func (tss *TotalSpends) Add(coin types.CoinSymbol, value *big.Int)
type Transaction ¶
type Transaction struct { Nonce uint64 GasPrice *big.Int GasCoin types.CoinSymbol Type TxType Data RawData Payload []byte ServiceData []byte SignatureType SigType SignatureData []byte // contains filtered or unexported fields }
func (*Transaction) CommissionInBaseCoin ¶ added in v0.8.0
func (tx *Transaction) CommissionInBaseCoin() *big.Int
func (*Transaction) Gas ¶
func (tx *Transaction) Gas() int64
func (*Transaction) GetDecodedData ¶
func (tx *Transaction) GetDecodedData() Data
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() types.Hash
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize() ([]byte, error)
func (*Transaction) SetDecodedData ¶
func (tx *Transaction) SetDecodedData(data Data)
func (*Transaction) SetMultisigAddress ¶ added in v0.5.0
func (tx *Transaction) SetMultisigAddress(address types.Address)
func (*Transaction) SetSignature ¶
func (tx *Transaction) SetSignature(sig []byte)
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(prv *ecdsa.PrivateKey) error
func (*Transaction) String ¶
func (tx *Transaction) String() string
type UnbondData ¶
type UnbondData struct { PubKey types.Pubkey `json:"pub_key"` Coin types.CoinSymbol `json:"coin"` Value *big.Int `json:"value"` }
func (UnbondData) BasicCheck ¶ added in v0.8.0
func (data UnbondData) BasicCheck(tx *Transaction, context *state.StateDB) *Response
func (UnbondData) Gas ¶ added in v0.0.6
func (data UnbondData) Gas() int64
func (UnbondData) Run ¶ added in v0.0.6
func (data UnbondData) Run(tx *Transaction, context *state.StateDB, isCheck bool, rewardPool *big.Int, currentBlock int64) Response
func (UnbondData) String ¶ added in v0.0.6
func (data UnbondData) String() string
func (UnbondData) TotalSpend ¶ added in v0.8.0
func (data UnbondData) TotalSpend(tx *Transaction, context *state.StateDB) (TotalSpends, []Conversion, *big.Int, *Response)
Click to show internal directories.
Click to hide internal directories.