Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeBytes(bs []byte, offset byte) []byte
- func GetGasLimit(f *Function) uint64
- func IsLocalSupportFunction(ftype FunctionType) bool
- func MinimalByteArray(value int) []byte
- func ToByteArray(value int) []byte
- type BytesSlice
- type CallResponse
- type Config
- type Credentials
- type DposNetworkParameters
- type Function
- type FunctionExecutor
- type FunctionType
- type HexStringParam
- type NodeId
- type ParamEncoder
- type ProgramVersion
- type RlpEncoder
- type RlpList
- type RlpString
- type StakingAmountType
- type StakingContract
- type StakingParam
- type TransactionHash
- type TransactionReceipt
- type UInt16
- type UInt256
- type UInt32
- type UInt64
- type Utf8String
Constants ¶
View Source
const ( /** * [0x80] * If a string is 0-55 bytes long, the RLP encoding consists of a single * byte with value 0x80 plus the length of the string followed by the * string. The range of the first byte is thus [0x80, 0xb7]. */ OFFSET_SHORT_STRING = 0x80 /** * [0xb7] * If a string is more than 55 bytes long, the RLP encoding consists of a * single byte with value 0xb7 plus the length of the length of the string * in binary form, followed by the length of the string, followed by the * string. For example, a length-1024 string would be encoded as * \xb9\x04\x00 followed by the string. The range of the first byte is thus * [0xb8, 0xbf]. */ OFFSET_LONG_STRING = 0xb7 /** * [0xc0] * If the total payload of a list (i.e. the combined length of all its * items) is 0-55 bytes long, the RLP encoding consists of a single byte * with value 0xc0 plus the length of the list followed by the concatenation * of the RLP encodings of the items. The range of the first byte is thus * [0xc0, 0xf7]. */ OFFSET_SHORT_LIST = 0xc0 /** * [0xf7] * If the total payload of a list is more than 55 bytes long, the RLP * encoding consists of a single byte with value 0xf7 plus the length of the * length of the list in binary form, followed by the length of the list, * followed by the concatenation of the RLP encodings of the items. The * range of the first byte is thus [0xf8, 0xff]. */ OFFSET_LONG_LIST = 0xf7 )
View Source
const ( BASE_DEFAULT_GAS_LIMIT = uint64(21000) BASE_NON_ZERO_GAS_LIMIT = uint64(68) BASE_ZERO_GAS_LIMIT = uint64(4) )
View Source
const MainFanAccount = "0xf35894c6b663e1E0934812c81CF4984898D5d8d2"
View Source
const PrivateKey = "f77192cea69effdf050308a18f16dc0213d061d553363adbbb3219381186e5a9"
Variables ¶
View Source
var ( DefaultMainNetConfig = Config{core.RpcUrl, big.NewInt(configs.ChainId)} DposMainNetParams = &DposNetworkParameters{ DefaultMainNetConfig, vm.StakingContractAddr.String(), } )
View Source
var KeyCredentials, _ = NewCredential(PrivateKey)
Functions ¶
func EncodeBytes ¶
func GetGasLimit ¶
func IsLocalSupportFunction ¶
func IsLocalSupportFunction(ftype FunctionType) bool
func MinimalByteArray ¶
func ToByteArray ¶
Types ¶
type BytesSlice ¶
type BytesSlice []byte
func EncodeBytesSlice ¶
func EncodeBytesSlice(list []BytesSlice) BytesSlice
type CallResponse ¶
type CallResponse struct { Code uint64 `json:"Code"` Ret json.RawMessage `json:"Ret"` }
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
func NewCredential ¶
func NewCredential(hexPrivateKeyStr string) (*Credentials, error)
func (*Credentials) Address ¶
func (c *Credentials) Address() common.Address
func (*Credentials) MustStringToAddress ¶
func (c *Credentials) MustStringToAddress(addr string) common.Address
func (*Credentials) PrivateKey ¶
func (c *Credentials) PrivateKey() *ecdsa.PrivateKey
func (*Credentials) SignTx ¶
func (c *Credentials) SignTx(tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
type DposNetworkParameters ¶
type Function ¶
type Function struct { Type FunctionType InputParams []interface{} }
func NewFunction ¶
func NewFunction(typ FunctionType, params []interface{}) *Function
type FunctionExecutor ¶
type FunctionExecutor struct {
// contains filtered or unexported fields
}
func (*FunctionExecutor) SendWithRaw ¶
func (fe *FunctionExecutor) SendWithRaw(f *Function) (string, error)
func (*FunctionExecutor) SendWithResult ¶
func (fe *FunctionExecutor) SendWithResult(f *Function, result *string) error
type FunctionType ¶
type FunctionType int
const ( STAKING_FUNC_TYPE FunctionType = 1000 UPDATE_STAKING_INFO_FUNC_TYPE FunctionType = 1001 ADD_STAKING_FUNC_TYPE FunctionType = 1002 WITHDREW_STAKING_FUNC_TYPE FunctionType = 1003 )
func (FunctionType) GetType ¶
func (ft FunctionType) GetType() int
type HexStringParam ¶
type HexStringParam struct {
HexStringValue string
}
func (HexStringParam) GetEncodeData ¶
func (hsp HexStringParam) GetEncodeData() BytesSlice
type NodeId ¶
type NodeId struct {
HexStringId string
}
func (NodeId) GetEncodeData ¶
func (ni NodeId) GetEncodeData() BytesSlice
type ParamEncoder ¶
type ParamEncoder interface {
GetEncodeData() BytesSlice
}
type ProgramVersion ¶
type RlpEncoder ¶
type RlpEncoder struct{}
func (RlpEncoder) Encode ¶
func (re RlpEncoder) Encode(intf interface{}) []byte
type RlpString ¶
type RlpString struct {
// contains filtered or unexported fields
}
func RlpStringFromBig ¶
type StakingAmountType ¶
type StakingAmountType uint16
const ( FREE_AMOUNT_TYPE StakingAmountType = 0 RESTRICTING_AMOUNT_TYPE StakingAmountType = 1 )
func (StakingAmountType) GetValue ¶
func (sat StakingAmountType) GetValue() uint16
type StakingContract ¶
type StakingContract struct {
// contains filtered or unexported fields
}
func NewStakingContract ¶
func NewStakingContract(dposConfig *DposNetworkParameters, credentials *Credentials) *StakingContract
func (*StakingContract) Staking ¶
func (sc *StakingContract) Staking(stakingParam StakingParam) (string, error)
type StakingParam ¶
type StakingParam struct { NodeId string Amount *big.Int StakingAmountType StakingAmountType BenefitAddress string ExternalId string NodeName string WebSite string Details string ProcessVersion ProgramVersion BlsPubKey string BlsProof string RewardPer *big.Int }
func (StakingParam) SubmitInputParameters ¶
func (sp StakingParam) SubmitInputParameters() []interface{}
type TransactionHash ¶
type TransactionHash string
type TransactionReceipt ¶
type UInt16 ¶
type UInt16 struct {
ValueInner uint16
}
func (UInt16) GetEncodeData ¶
func (u16 UInt16) GetEncodeData() BytesSlice
type UInt256 ¶
func (UInt256) GetEncodeData ¶
func (u256 UInt256) GetEncodeData() BytesSlice
type UInt32 ¶
func (UInt32) GetEncodeData ¶
func (u32 UInt32) GetEncodeData() BytesSlice
type UInt64 ¶
func (UInt64) GetEncodeData ¶
func (u64 UInt64) GetEncodeData() BytesSlice
type Utf8String ¶
type Utf8String struct {
ValueInner string
}
func (Utf8String) GetEncodeData ¶
func (u8str Utf8String) GetEncodeData() BytesSlice
Click to show internal directories.
Click to hide internal directories.