Documentation ¶
Overview ¶
Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Package common contains various helper functions.
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- func Bytes2Hex(d []byte) string
- func ContractConsensusPOA_BatchAddAdminsFunction() string
- func ContractConsensusPOA_BatchAddValidatorsFunction() string
- func ContractConsensusPOA_BatchRemoveAdminsFunction() string
- func ContractConsensusPOA_BatchRemoveValidatorsFunction() string
- func ContractConsensusPOA_CanPerformFunction() string
- func ContractConsensusPOA_ConfigureAddressRoleFunction() string
- func ContractConsensusPOA_ConfigureFunctionAddressAdvancedFunction() string
- func ContractConsensusPOA_ConfigureFunctionAddressFunction() string
- func ContractConsensusPOA_ConfigureFunctionAddressSuperFunction() string
- func ContractConsensusPOA_ConfigureFunctionRoleAdvancedFunction() string
- func ContractConsensusPOA_ConfigureFunctionRoleFunction() string
- func ContractConsensusPOA_ConfigureFunctionRoleSuperFunction() string
- func ContractConsensusPOA_GetAddressRolesMapFunction() string
- func ContractConsensusPOA_GetAdminsAndValidatorsFunction() string
- func ContractConsensusPOA_GetSignupValidatorsFunction() string
- func ContractConsensusPOA_InitFunction() string
- func ContractConsensusPOA_TransferAssetFunction() string
- func ContractConsensusPOA_UpdateValidatorsBlockInfoFunction() string
- func ContractConsensusSatoshiPlus_GetSignupValidatorsFunction() string
- func ContractConsensusSatoshiPlus_GetValidatorBlockInfoFunction() string
- func ContractConsensusSatoshiPlus_InitFunction() string
- func ContractConsensusSatoshiPlus_SignupFunction() string
- func ContractConsensusSatoshiPlus_UpdateValidatorsBlockInfoFunction() string
- func ContractGenesisOrganization_ExistedFunction() string
- func ContractGenesisOrganization_InitFunction() string
- func ContractGenesisOrganization_StartProposalFunction() string
- func ContractGenesisOrganization_VoteFunction() string
- func ContractRegistryCenter_BurnAssetFunction() string
- func ContractRegistryCenter_CloseOrganizationFunction() string
- func ContractRegistryCenter_CreateFunction() string
- func ContractRegistryCenter_DeactivateTemplateFunction() string
- func ContractRegistryCenter_FindAssetFunction() string
- func ContractRegistryCenter_GetAssetInfoByAssetIdFunction() string
- func ContractRegistryCenter_GetOrganizationAddressByIdFunction() string
- func ContractRegistryCenter_GetOrganizationAddressesByAssetsFunction() string
- func ContractRegistryCenter_GetOrganizationIdFunction() string
- func ContractRegistryCenter_HasRegisteredFunction() string
- func ContractRegistryCenter_InitFunction() string
- func ContractRegistryCenter_IsRestrictedAssetFunction() string
- func ContractRegistryCenter_MintAssetFunction() string
- func ContractRegistryCenter_NewAssetInfoFunction() string
- func ContractRegistryCenter_RegisterOrganizationFunction() string
- func ContractRegistryCenter_RemoveAssetRestrictionFunction() string
- func ContractRegistryCenter_RenameOrganizationFunction() string
- func ContractRegistryCenter_UpdateOrganizationStatusFunction() string
- func ContractTemplateWarehouse_ALL_APPROVERFunction() string
- func ContractTemplateWarehouse_CreateFunction() string
- func ContractTemplateWarehouse_DisableFunction() string
- func ContractTemplateWarehouse_EnableFunction() string
- func ContractTemplateWarehouse_GetApprovedTemplateFunction() string
- func ContractTemplateWarehouse_GetApprovedTemplatesCountFunction() string
- func ContractTemplateWarehouse_GetSubmittedTemplateFunction() string
- func ContractTemplateWarehouse_GetSubmittedTemplatesCountFunction() string
- func ContractTemplateWarehouse_GetTemplateFunction() string
- func ContractTemplateWarehouse_InitFunction() string
- func ContractTemplateWarehouse_NameExistFunction() string
- func ContractTemplateWarehouse_THRESHOLDFunction() string
- func ContractValidatorCommittee_CanPerformFunction() string
- func ContractValidatorCommittee_ConfigureAddressRoleFunction() string
- func ContractValidatorCommittee_ConfigureFunctionAddressAdvancedFunction() string
- func ContractValidatorCommittee_ConfigureFunctionAddressFunction() string
- func ContractValidatorCommittee_ConfigureFunctionAddressSuperFunction() string
- func ContractValidatorCommittee_ConfigureFunctionRoleAdvancedFunction() string
- func ContractValidatorCommittee_ConfigureFunctionRoleFunction() string
- func ContractValidatorCommittee_ConfigureFunctionRoleSuperFunction() string
- func ContractValidatorCommittee_GetAddressRolesMapFunction() string
- func ContractValidatorCommittee_GetAssetFeeListFunction() string
- func ContractValidatorCommittee_GetRoundLastUpdateHeightFunction() string
- func ContractValidatorCommittee_InitFunction() string
- func ContractValidatorCommittee_SignupFunction() string
- func ContractValidatorCommittee_StartNewRoundFunction() string
- func ContractValidatorCommittee_StartProposalFunction() string
- func ContractValidatorCommittee_VoteFunction() string
- func CopyBytes(b []byte) (copiedBytes []byte)
- func Decode(dst *Hash, src string) error
- func DoubleHashB(b []byte) []byte
- func FromHex(s string) []byte
- func GetConsensus(name string) int32
- func Hash160(buf []byte) []byte
- func HashB(b []byte) []byte
- func Hex2Bytes(str string) []byte
- func IsDeserializeErr(err error) bool
- func IsHexAddress(s string) bool
- func LeftPadBytes(slice []byte, l int) []byte
- func PackCanTransferInput(transferAddress []byte, assetIndex uint32) []byte
- func PackGetOrganizationAddressByIdInput(organizationId uint32, assetIndex uint32) []byte
- func PackGetTemplateCountInput(funcName string, category uint16) []byte
- func PackGetTemplateDetailInput(funcName string, category uint16, index uint64) []byte
- func PackGetTemplateInput(category uint16, name string) []byte
- func PackIsRestrictedAssetInput(organizationId uint32, assetIndex uint32) []byte
- func RightPadBytes(slice []byte, l int) []byte
- func UnPackBoolResult(ret []byte) (bool, error)
- func UnPackGetTemplateDetailResult(ret []byte) (string, []byte, int64, uint8, uint8, uint8, uint8, error)
- func UnPackGetTemplatesCountResult(ret []byte) (uint64, error)
- func UnPackIsRestrictedAssetResult(ret []byte) (bool, bool, error)
- type Address
- func (a Address) Big() *big.Int
- func (a Address) Bytes() []byte
- func (a *Address) EncodeAddress() string
- func (a Address) Format(s fmt.State, c rune)
- func (a Address) Hash() Hash
- func (a Address) Hex() string
- func (a Address) MarshalText() ([]byte, error)
- func (a *Address) Scan(src interface{}) error
- func (a *Address) ScriptAddress() []byte
- func (a *Address) SetBytes(b []byte)
- func (a *Address) StandardAddress() [AddressLength]byte
- func (a Address) String() string
- func (a *Address) UnmarshalJSON(input []byte) error
- func (a *Address) UnmarshalText(input []byte) error
- func (a Address) Value() (driver.Value, error)
- type AddressList
- type Amount
- type AsimovNet
- type AssertError
- type BehaviorFlags
- type DeserializeError
- type Hash
- func (h Hash) Big() *big.Int
- func (h Hash) Bytes() []byte
- func (h *Hash) CloneBytes() []byte
- func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value
- func (h Hash) Hex() string
- func (h *Hash) IsEqual(target *Hash) bool
- func (h Hash) MarshalText() ([]byte, error)
- func (h *Hash) Scan(src interface{}) error
- func (h *Hash) SetBytes(b []byte)
- func (h Hash) String() string
- func (h Hash) TerminalString() string
- func (h *Hash) UnmarshalJSON(input []byte) error
- func (h *Hash) UnmarshalText(input []byte) error
- func (h Hash) UnprefixString() string
- func (h Hash) Value() (driver.Value, error)
- type IAddress
- type MixedcaseAddress
- func (ma *MixedcaseAddress) Address() Address
- func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error)
- func (ma *MixedcaseAddress) Original() string
- func (ma *MixedcaseAddress) String() string
- func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error
- func (ma *MixedcaseAddress) ValidChecksum() bool
- type ServiceFlag
- type StorageSize
- type UnprefixedAddress
- type UnprefixedHash
Constants ¶
const ( //consensus type SOLO = iota POA SATOSHIPLUS ConsensusCount )
const ( // XingPerAsimov is the number of xing in one asimov coin (1 ASC). XingPerAsimov int64 = 1e8 // MaxXing is the maximum transaction amount allowed in xing. // 10 billion MaxXing = 1e10 * XingPerAsimov // MaxPrice is the maximum gas price limit. MaxPrice = 1000 // Considering that evm costs 21000 gas, we suppose the average transaction's // length is 1k bytes, hence each byte cost 21 gas. GasPerByte = 21 // CoinbaseTxGas use 100000, constantly. CoinbaseTxGas = 100000 // CommandSize is the fixed size of all commands in the common bitcoin message // header. Shorter commands must be zero padded. CommandSize = 12 // MaxBlockSize is the maximum number of bytes within a block MaxBlockSize = 2 * 1024 * 1024 // CoreTeamPercent is the percent of block reward CoreTeamPercent = 0.2 // The gas is used when consensus invoke some readonly function in contract. ReadOnlyGas = 2300 // The gas is used when checking whether an address is in whitelist on limit assets. SupportCheckGas = 6000 // The gas is used when consensus invoke some readonly function in system contract. SystemContractReadOnlyGas = 30000000 // max block height depth which can be included in header. // such as block N can include block sign of N-1, ... N-BlockSignDepth BlockSignDepth = 10 // Target gas floor for mined blocks. GasFloor = 160000000 // Target gas ceiling for mined blocks. GasCeil = 160000000 // Min interval time seconds of blocks MinBlockInterval = 3 // Max interval time seconds of blocks MaxBlockInterval = 15 // The default interval time seconds of blocks DefaultBlockInterval = 5 // LockTimeThreshold is the number below which a lock time is // interpreted to be a block number. Since an average of one block // is generated per 5 seconds, this allows blocks for about 237 // years. LockTimeThreshold = 1.5e8 // Tue Jul 14 02:40:00 2017 UTC )
const ( // A standard template contract must contains // two functions, getTemplateInfo and initTemplate // Following two fields are name for these functions. GetTemplateInfoFunc = "getTemplateInfo" InitTemplateFunc = "initTemplate" // empty value of an address type, formatted with string EmptyAddressValue = "0x000000000000000000000000000000000000000000" // This is the standard template's abi. TemplateABI = "" /* 507-byte string literal not displayed */ )
const ( // HashLength is the expected length of the hash HashLength = 32 // AddressLength is the expected length of the address AddressLength = 21 // AssetLength is the expected length of the assets AssetLength = 12 // AmountSize is the expected size of amount AmountSize = 8 // MaxHashStringSize is the maximum length of a Hash hash string. MaxHashStringSize = HashLength * 2 )
Lengths of hashes and addresses in bytes.
const ( // ProtocolVersion is the latest protocol version this package supports. ProtocolVersion uint32 = 1 MinRequestVersion uint32 = 1 MaxRequestVersion uint32 = 1 )
XXX pedro: we will probably need to bump this.
Variables ¶
var ( Big1 = big.NewInt(1) Big2 = big.NewInt(2) Big0 = big.NewInt(0) Big32 = big.NewInt(32) Big256 = big.NewInt(256) Big257 = big.NewInt(257) BigMaxuint32 = big.NewInt(math.MaxUint32) BigMaxint64 = big.NewInt(math.MaxInt64) BigMaxxing = big.NewInt(MaxXing) )
Common big integers often used
var ( ConsensusPOA = HexToAddress("0x63000000000000000000000000000000000000006c") ConsensusSatoshiPlus = HexToAddress("0x63000000000000000000000000000000000000006a") GenesisOrganization = HexToAddress("0x630000000000000000000000000000000000000064") RegistryCenter = HexToAddress("0x630000000000000000000000000000000000000065") TemplateWarehouse = HexToAddress("0x630000000000000000000000000000000000000067") ValidatorCommittee = HexToAddress("0x63000000000000000000000000000000000000006b") )
var ( // callCode for `getTemplateInfo` function. GetTemplateInfoCallCode = Hex2Bytes("2fb97c1d") // callCode for `canTransfer` function of organization CanTransferFuncByte = Hex2Bytes("fc588476") // callCode for `isRestrictedAsset` function. IsRestrictedAssetByte = Hex2Bytes("f0d94a13") // callCode for `getOrganizationAddressById` function. GetOrganizationAddressByIdByte = Hex2Bytes("c0bb5900") // callCode for `getApprovedTemplatesCount` function. GetApprovedTemplatesCountByte = Hex2Bytes("ff2e9b4d") // callCode for `getSubmittedTemplatesCount` function. GetSubmittedTemplatesCountByte = Hex2Bytes("2c47086a") // callCode for `getApprovedTemplate` function. GetApprovedTemplateByte = Hex2Bytes("214b38d9") // callCode for `getSubmittedTemplate` function. GetSubmittedTemplateByte = Hex2Bytes("c17168bc") // callCode for `getTemplate` function. GetTemplateByte = Hex2Bytes("e9e89524") )
var ( PubKeyHashAddrID byte = 'f' // First byte of a P2PKH address ScriptHashAddrID byte = 's' // First byte of a P2SH address ContractHashAddrID byte = 'c' // First byte of a contract address PrivateKeyID byte = 'k' // First byte of a WIF private key )
var ContractCodeStrings = map[Address]string{
ConsensusPOA: "ConsensusPOA",
ConsensusSatoshiPlus: "ConsensusSatoshiPlus",
GenesisOrganization: "GenesisOrganization",
RegistryCenter: "RegistryCenter",
TemplateWarehouse: "TemplateWarehouse",
ValidatorCommittee: "ValidatorCommittee",
}
Map of ContractCode values back to their constant names for pretty printing.
var ErrHashStrSize = fmt.Errorf("max hash string length is %v bytes", MaxHashStringSize)
ErrHashStrSize describes an error that indicates the caller specified a hash string that has too many characters.
var ( // ErrUnknownAddressType describes an error where an address can not // decoded as a specific address type due to the string encoding // begining with an identifier byte unknown to any standard or // registered (via chaincfg.Register) network. ErrUnknownAddressType = errors.New("unknown address type") )
Functions ¶
func ContractConsensusPOA_BatchAddAdminsFunction ¶
func ContractConsensusPOA_BatchAddAdminsFunction() string
func ContractConsensusPOA_BatchAddValidatorsFunction ¶
func ContractConsensusPOA_BatchAddValidatorsFunction() string
func ContractConsensusPOA_BatchRemoveAdminsFunction ¶
func ContractConsensusPOA_BatchRemoveAdminsFunction() string
func ContractConsensusPOA_BatchRemoveValidatorsFunction ¶
func ContractConsensusPOA_BatchRemoveValidatorsFunction() string
func ContractConsensusPOA_CanPerformFunction ¶
func ContractConsensusPOA_CanPerformFunction() string
func ContractConsensusPOA_ConfigureAddressRoleFunction ¶
func ContractConsensusPOA_ConfigureAddressRoleFunction() string
func ContractConsensusPOA_ConfigureFunctionAddressAdvancedFunction ¶
func ContractConsensusPOA_ConfigureFunctionAddressAdvancedFunction() string
func ContractConsensusPOA_ConfigureFunctionAddressFunction ¶
func ContractConsensusPOA_ConfigureFunctionAddressFunction() string
func ContractConsensusPOA_ConfigureFunctionAddressSuperFunction ¶
func ContractConsensusPOA_ConfigureFunctionAddressSuperFunction() string
func ContractConsensusPOA_ConfigureFunctionRoleAdvancedFunction ¶
func ContractConsensusPOA_ConfigureFunctionRoleAdvancedFunction() string
func ContractConsensusPOA_ConfigureFunctionRoleFunction ¶
func ContractConsensusPOA_ConfigureFunctionRoleFunction() string
func ContractConsensusPOA_ConfigureFunctionRoleSuperFunction ¶
func ContractConsensusPOA_ConfigureFunctionRoleSuperFunction() string
func ContractConsensusPOA_GetAddressRolesMapFunction ¶
func ContractConsensusPOA_GetAddressRolesMapFunction() string
func ContractConsensusPOA_GetAdminsAndValidatorsFunction ¶
func ContractConsensusPOA_GetAdminsAndValidatorsFunction() string
func ContractConsensusPOA_GetSignupValidatorsFunction ¶
func ContractConsensusPOA_GetSignupValidatorsFunction() string
func ContractConsensusPOA_InitFunction ¶
func ContractConsensusPOA_InitFunction() string
func ContractConsensusPOA_TransferAssetFunction ¶
func ContractConsensusPOA_TransferAssetFunction() string
func ContractConsensusPOA_UpdateValidatorsBlockInfoFunction ¶
func ContractConsensusPOA_UpdateValidatorsBlockInfoFunction() string
func ContractConsensusSatoshiPlus_GetSignupValidatorsFunction ¶
func ContractConsensusSatoshiPlus_GetSignupValidatorsFunction() string
func ContractConsensusSatoshiPlus_GetValidatorBlockInfoFunction ¶
func ContractConsensusSatoshiPlus_GetValidatorBlockInfoFunction() string
func ContractConsensusSatoshiPlus_InitFunction ¶
func ContractConsensusSatoshiPlus_InitFunction() string
func ContractConsensusSatoshiPlus_SignupFunction ¶
func ContractConsensusSatoshiPlus_SignupFunction() string
func ContractConsensusSatoshiPlus_UpdateValidatorsBlockInfoFunction ¶
func ContractConsensusSatoshiPlus_UpdateValidatorsBlockInfoFunction() string
func ContractGenesisOrganization_ExistedFunction ¶
func ContractGenesisOrganization_ExistedFunction() string
func ContractGenesisOrganization_InitFunction ¶
func ContractGenesisOrganization_InitFunction() string
func ContractGenesisOrganization_StartProposalFunction ¶
func ContractGenesisOrganization_StartProposalFunction() string
func ContractGenesisOrganization_VoteFunction ¶
func ContractGenesisOrganization_VoteFunction() string
func ContractRegistryCenter_BurnAssetFunction ¶
func ContractRegistryCenter_BurnAssetFunction() string
func ContractRegistryCenter_CloseOrganizationFunction ¶
func ContractRegistryCenter_CloseOrganizationFunction() string
func ContractRegistryCenter_CreateFunction ¶
func ContractRegistryCenter_CreateFunction() string
func ContractRegistryCenter_DeactivateTemplateFunction ¶
func ContractRegistryCenter_DeactivateTemplateFunction() string
func ContractRegistryCenter_FindAssetFunction ¶
func ContractRegistryCenter_FindAssetFunction() string
func ContractRegistryCenter_GetAssetInfoByAssetIdFunction ¶
func ContractRegistryCenter_GetAssetInfoByAssetIdFunction() string
func ContractRegistryCenter_GetOrganizationAddressByIdFunction ¶
func ContractRegistryCenter_GetOrganizationAddressByIdFunction() string
func ContractRegistryCenter_GetOrganizationAddressesByAssetsFunction ¶
func ContractRegistryCenter_GetOrganizationAddressesByAssetsFunction() string
func ContractRegistryCenter_GetOrganizationIdFunction ¶
func ContractRegistryCenter_GetOrganizationIdFunction() string
func ContractRegistryCenter_HasRegisteredFunction ¶
func ContractRegistryCenter_HasRegisteredFunction() string
func ContractRegistryCenter_InitFunction ¶
func ContractRegistryCenter_InitFunction() string
func ContractRegistryCenter_IsRestrictedAssetFunction ¶
func ContractRegistryCenter_IsRestrictedAssetFunction() string
func ContractRegistryCenter_MintAssetFunction ¶
func ContractRegistryCenter_MintAssetFunction() string
func ContractRegistryCenter_NewAssetInfoFunction ¶
func ContractRegistryCenter_NewAssetInfoFunction() string
func ContractRegistryCenter_RegisterOrganizationFunction ¶
func ContractRegistryCenter_RegisterOrganizationFunction() string
func ContractRegistryCenter_RemoveAssetRestrictionFunction ¶
func ContractRegistryCenter_RemoveAssetRestrictionFunction() string
func ContractRegistryCenter_RenameOrganizationFunction ¶
func ContractRegistryCenter_RenameOrganizationFunction() string
func ContractRegistryCenter_UpdateOrganizationStatusFunction ¶
func ContractRegistryCenter_UpdateOrganizationStatusFunction() string
func ContractTemplateWarehouse_ALL_APPROVERFunction ¶
func ContractTemplateWarehouse_ALL_APPROVERFunction() string
func ContractTemplateWarehouse_CreateFunction ¶
func ContractTemplateWarehouse_CreateFunction() string
func ContractTemplateWarehouse_DisableFunction ¶
func ContractTemplateWarehouse_DisableFunction() string
func ContractTemplateWarehouse_EnableFunction ¶
func ContractTemplateWarehouse_EnableFunction() string
func ContractTemplateWarehouse_GetApprovedTemplateFunction ¶
func ContractTemplateWarehouse_GetApprovedTemplateFunction() string
func ContractTemplateWarehouse_GetApprovedTemplatesCountFunction ¶
func ContractTemplateWarehouse_GetApprovedTemplatesCountFunction() string
func ContractTemplateWarehouse_GetSubmittedTemplateFunction ¶
func ContractTemplateWarehouse_GetSubmittedTemplateFunction() string
func ContractTemplateWarehouse_GetSubmittedTemplatesCountFunction ¶
func ContractTemplateWarehouse_GetSubmittedTemplatesCountFunction() string
func ContractTemplateWarehouse_GetTemplateFunction ¶
func ContractTemplateWarehouse_GetTemplateFunction() string
func ContractTemplateWarehouse_InitFunction ¶
func ContractTemplateWarehouse_InitFunction() string
func ContractTemplateWarehouse_NameExistFunction ¶
func ContractTemplateWarehouse_NameExistFunction() string
func ContractTemplateWarehouse_THRESHOLDFunction ¶
func ContractTemplateWarehouse_THRESHOLDFunction() string
func ContractValidatorCommittee_CanPerformFunction ¶
func ContractValidatorCommittee_CanPerformFunction() string
func ContractValidatorCommittee_ConfigureAddressRoleFunction ¶
func ContractValidatorCommittee_ConfigureAddressRoleFunction() string
func ContractValidatorCommittee_ConfigureFunctionAddressAdvancedFunction ¶
func ContractValidatorCommittee_ConfigureFunctionAddressAdvancedFunction() string
func ContractValidatorCommittee_ConfigureFunctionAddressFunction ¶
func ContractValidatorCommittee_ConfigureFunctionAddressFunction() string
func ContractValidatorCommittee_ConfigureFunctionAddressSuperFunction ¶
func ContractValidatorCommittee_ConfigureFunctionAddressSuperFunction() string
func ContractValidatorCommittee_ConfigureFunctionRoleAdvancedFunction ¶
func ContractValidatorCommittee_ConfigureFunctionRoleAdvancedFunction() string
func ContractValidatorCommittee_ConfigureFunctionRoleFunction ¶
func ContractValidatorCommittee_ConfigureFunctionRoleFunction() string
func ContractValidatorCommittee_ConfigureFunctionRoleSuperFunction ¶
func ContractValidatorCommittee_ConfigureFunctionRoleSuperFunction() string
func ContractValidatorCommittee_GetAddressRolesMapFunction ¶
func ContractValidatorCommittee_GetAddressRolesMapFunction() string
func ContractValidatorCommittee_GetAssetFeeListFunction ¶
func ContractValidatorCommittee_GetAssetFeeListFunction() string
func ContractValidatorCommittee_GetRoundLastUpdateHeightFunction ¶
func ContractValidatorCommittee_GetRoundLastUpdateHeightFunction() string
func ContractValidatorCommittee_InitFunction ¶
func ContractValidatorCommittee_InitFunction() string
func ContractValidatorCommittee_SignupFunction ¶
func ContractValidatorCommittee_SignupFunction() string
func ContractValidatorCommittee_StartNewRoundFunction ¶
func ContractValidatorCommittee_StartNewRoundFunction() string
func ContractValidatorCommittee_StartProposalFunction ¶
func ContractValidatorCommittee_StartProposalFunction() string
func ContractValidatorCommittee_VoteFunction ¶
func ContractValidatorCommittee_VoteFunction() string
func Decode ¶
Decode decodes the byte-reversed hexadecimal string encoding of a Hash to a destination.
func DoubleHashB ¶
DoubleHashB calculates hash(hash(b)) and returns the resulting bytes.
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func GetConsensus ¶
GetConsensus returns consensus type according to the given name
func IsDeserializeErr ¶
IsDeserializeErr returns whether or not the passed error is an DeserializeError error.
func IsHexAddress ¶
IsHexAddress verifies whether a string can represent a valid hex-encoded Ethereum address or not.
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func PackCanTransferInput ¶
PackCanTransferInput returns a byte slice according to given parameters
func PackGetOrganizationAddressByIdInput ¶
PackGetOrganizationAddressByIdInput returns a byte slice according to given parameters
func PackGetTemplateCountInput ¶
PackGetTemplateCountInput returns a byte slice according to given parameters
func PackGetTemplateDetailInput ¶
PackGetTemplateDetailInput returns a byte slice according to given parameters
func PackGetTemplateInput ¶
PackGetTemplateInput returns a byte slice according to given parameters
func PackIsRestrictedAssetInput ¶
PackIsRestrictedAssetInput returns a byte slice according to given parameters
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
func UnPackBoolResult ¶
UnPackBoolResult returns bool value by unpacking given byte slice
func UnPackGetTemplateDetailResult ¶
func UnPackGetTemplateDetailResult(ret []byte) (string, []byte, int64, uint8, uint8, uint8, uint8, error)
UnPackGetTemplateDetailResult returns template detail by unpacking given byte slice
func UnPackGetTemplatesCountResult ¶
UnPackGetTemplatesCountResult returns template number by unpacking given byte slice
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the 21 byte address of an Ethereum account.
func BigToAddress ¶
BigToAddress returns Address with byte values of b. If b is larger than len(h), b will be cropped from the left.
func BytesToAddress ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func HexToAddress ¶
HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.
func NewAddress ¶
func (*Address) EncodeAddress ¶
Implement for IAddress EncodeAddress returns the string encoding of a pay-to-pubkey-hash address. Part of the Address interface.
func (Address) Format ¶
Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.
func (Address) MarshalText ¶
MarshalText returns the hex representation of a.
func (*Address) ScriptAddress ¶
ScriptAddress returns the bytes to be included in a txout script to pay to a pubkey hash. Part of the Address interface.
func (*Address) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.
func (*Address) StandardAddress ¶
func (a *Address) StandardAddress() [AddressLength]byte
func (*Address) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*Address) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.
type AddressList ¶
type AddressList []Address
func (AddressList) Len ¶
func (al AddressList) Len() int
func (AddressList) Less ¶
func (al AddressList) Less(i, j int) bool
func (AddressList) Swap ¶
func (al AddressList) Swap(i, j int)
type Amount ¶
type Amount int64
Amount describes a method of converting an Amount to something other than the base unit of an asimov.
type AsimovNet ¶
type AsimovNet uint32
AsimovNet represents which asimov network a message belongs to.
const ( // MainNet represents the main asimov network. MainNet AsimovNet = 0xd9b4bef9 // DevelopNet represents the regression test network. DevelopNet AsimovNet = 0x39b187f3 // TestNet represents the test network. TestNet AsimovNet = 0x0709110b )
Constants used to indicate the message asimov network. They can also be used to seek to the next message when a stream's state is unknown, but this package does not provide that functionality since it's generally a better idea to simply disconnect clients that are misbehaving over TCP.
type AssertError ¶
type AssertError string
AssertError identifies an error that indicates an internal code consistency issue and should be treated as a critical and unrecoverable error.
func (AssertError) Error ¶
func (e AssertError) Error() string
Error returns the assertion error as a human-readable string and satisfies the error interface.
type BehaviorFlags ¶
type BehaviorFlags uint32
BehaviorFlags is a bitmask defining tweaks to the normal behavior when performing chain processing and consensus rules checks.
const ( // BFFastAdd may be set to indicate that several checks can be avoided // for the block since it is already known to fit into the chain due to // already proving it correct links into the chain up to a known // state db. This is primarily used for miner. BFFastAdd BehaviorFlags = 1 << iota // BFNone is a convenience value to specifically indicate no flags. BFNone BehaviorFlags = 0 )
type DeserializeError ¶
type DeserializeError string
DeserializeError signifies that a problem was encountered when deserializing data.
func (DeserializeError) Error ¶
func (e DeserializeError) Error() string
Error implements the error interface.
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.
func BigToHash ¶
BigToHash sets byte representation of b to hash. If b is larger than len(h), b will be cropped from the left.
func BytesToHash ¶
BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.
func DoubleHashH ¶
DoubleHashH calculates hash(hash(b)) and returns the resulting bytes as a Hash.
func HexToHash ¶
HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.
func NewHashFromStr ¶
NewHashFromStr creates a Hash from a hash string. The string should be the hexadecimal string of a byte-reversed hash, but any missing characters result in zero padding at the end of the Hash.
func (*Hash) CloneBytes ¶
CloneBytes returns a copy of the bytes which represent the hash as a byte slice.
NOTE: It is generally cheaper to just slice the hash directly thereby reusing the same bytes rather than calling this method.
func (Hash) MarshalText ¶
MarshalText returns the hex representation of h.
func (*Hash) SetBytes ¶
SetBytes sets the hash to the value of b. If b is larger than len(h), b will be cropped from the left.
func (Hash) String ¶
String implements the stringer interface and is used also by the logger when doing full logging into a file.
func (Hash) TerminalString ¶
TerminalString implements log.TerminalStringer, formatting a string for console output during logging.
func (*Hash) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*Hash) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.
func (Hash) UnprefixString ¶
UnprefixString returns unprefix hex string.
type IAddress ¶
type IAddress interface { // String returns the string encoding of the transaction output // destination. // // Please note that String differs subtly from EncodeAddress: String // will return the value as a string without any conversion, while // EncodeAddress may convert destination types (for example, // converting pubkeys to P2PKH addresses) before encoding as a // payment address string. String() string // EncodeAddress returns the string encoding of the payment address // associated with the Address value. See the comment on String // for how this method differs from String. EncodeAddress() string //21 bytes StandardAddress() [AddressLength]byte // ScriptAddress returns the raw bytes of the address to be used // when inserting the address into a txout's script. ScriptAddress() []byte }
Address is an interface type for any type of destination a transaction output may spend to. This includes pay-to-pubkey (P2PK), pay-to-pubkey-hash (P2PKH), and pay-to-script-hash (P2SH). Address is designed to be generic enough that other kinds of addresses may be added in the future without changing the decoding and encoding API.
type MixedcaseAddress ¶
type MixedcaseAddress struct {
// contains filtered or unexported fields
}
MixedcaseAddress retains the original string, which may or may not be correctly checksummed
func (*MixedcaseAddress) Address ¶
func (ma *MixedcaseAddress) Address() Address
Address returns the address
func (*MixedcaseAddress) MarshalJSON ¶
func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error)
MarshalJSON marshals the original value
func (*MixedcaseAddress) Original ¶
func (ma *MixedcaseAddress) Original() string
Original returns the mixed-case input string
func (*MixedcaseAddress) String ¶
func (ma *MixedcaseAddress) String() string
String implements fmt.Stringer
func (*MixedcaseAddress) UnmarshalJSON ¶
func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error
UnmarshalJSON parses MixedcaseAddress
func (*MixedcaseAddress) ValidChecksum ¶
func (ma *MixedcaseAddress) ValidChecksum() bool
ValidChecksum returns true if the address has valid checksum
type ServiceFlag ¶
type ServiceFlag uint64
ServiceFlag identifies services supported by a bitcoin peer.
const ( // SFNodeNetwork is a flag used to indicate a peer is a full node. SFNodeNetwork ServiceFlag = 1 << iota // SFNodeBloom is a flag used to indicate a peer supports bloom // filtering. SFNodeBloom // SFNodeCF is a flag used to indicate a peer supports committed // filters (CFs). SFNodeCF )
func (ServiceFlag) String ¶
func (f ServiceFlag) String() string
String returns the ServiceFlag in human-readable form.
type StorageSize ¶
type StorageSize float64
StorageSize is a wrapper around a float value that supports user friendly formatting.
func (StorageSize) String ¶
func (s StorageSize) String() string
String implements the stringer interface.
func (StorageSize) TerminalString ¶
func (s StorageSize) TerminalString() string
TerminalString implements log.TerminalStringer, formatting a string for console output during logging.
type UnprefixedAddress ¶
type UnprefixedAddress Address
UnprefixedAddress allows marshaling an Address without 0x prefix.
func (UnprefixedAddress) MarshalText ¶
func (a UnprefixedAddress) MarshalText() ([]byte, error)
MarshalText encodes the address as hex.
func (*UnprefixedAddress) UnmarshalText ¶
func (a *UnprefixedAddress) UnmarshalText(input []byte) error
UnmarshalText decodes the address from hex. The 0x prefix is optional.
type UnprefixedHash ¶
type UnprefixedHash Hash
UnprefixedHash allows marshaling a Hash without 0x prefix.
func (UnprefixedHash) MarshalText ¶
func (h UnprefixedHash) MarshalText() ([]byte, error)
MarshalText encodes the hash as hex.
func (*UnprefixedHash) UnmarshalText ¶
func (h *UnprefixedHash) UnmarshalText(input []byte) error
UnmarshalText decodes the hash from hex. The 0x prefix is optional.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package base58 provides an API for working with modified base58 and Base58Check encodings.
|
Package base58 provides an API for working with modified base58 and Base58Check encodings. |
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173.
|
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173. |
Package hexutil implements hex encoding with 0x prefix.
|
Package hexutil implements hex encoding with 0x prefix. |