Versions in this module Expand all Collapse all v4 v4.2.0 Sep 8, 2022 Changes in this version + func ParseHexOrString(str string) ([]byte, error) v4.1.1 Jul 28, 2022 v4.1.0 Jul 11, 2022 v4.0.2 Mar 5, 2022 Changes in this version type TimeLockItem + func (u *TimeLockItem) UnmarshalJSON(input []byte) error v4.0.1 Nov 9, 2021 v4.0.0 Nov 4, 2021 Changes in this version + const AddressLength + const AssetValueChangeFunc + const BuyTicketFunc + const EmptyFunc + const GenAssetFunc + const GenNotationFunc + const HashLength + const MakeMultiSwapFunc + const MakeSwapFunc + const MakeSwapFuncExt + const OldAssetValueChangeFunc + const PosV1 + const PosV2 + const PosV3 + const RecallMultiSwapFunc + const RecallSwapFunc + const ReportIllegalFunc + const SendAssetFunc + const TakeMultiSwapFunc + const TakeSwapFunc + const TakeSwapFuncExt + const TimeLockForever + const TimeLockFunc + const TimeLockNow + const UnknownFunc + var AssetKeyAddress = HexToAddress("0xfffffffffffffffffffffffffffffffffffffffc") + var AutoBuyTicket = false + var AutoBuyTicketChan = make(chan int, 10) + var Big0 = big.NewInt(0) + var Big1 = big.NewInt(1) + var Big100 = big.NewInt(100) + var Big2 = big.NewInt(2) + var Big256 = big.NewInt(256) + var Big257 = big.NewInt(257) + var Big3 = big.NewInt(3) + var Big32 = big.NewInt(32) + var BigMaxUint64 = new(big.Int).SetUint64(math.MaxUint64) + var DebugMode = false + var DevnetConstantinopleEnableHeight *big.Int = big.NewInt(0) + var ErrAccountFrozen = errors.New("account frozen") + var ErrTransactionsFrozen = errors.New("all transactions unless buytickets are frozen") + var FSNCallAddress = HexToAddress("0xffffffffffffffffffffffffffffffffffffffff") + var LogFusionAssetReceivedTopic = Keccak256Hash([]byte("LogFusionAssetReceived(bytes32,address,uint256,uint64,uint64,uint8)")) + var LogFusionAssetSentTopic = Keccak256Hash([]byte("LogFusionAssetSent(bytes32,address,uint256,uint64,uint64,uint8)")) + var MAINNET_FORKS = []uint64 + var MainnetConstantinopleEnableHeight *big.Int = nil + var MultiSwapKeyAddress = HexToAddress("0xfffffffffffffffffffffffffffffffffffffff9") + var NotationKeyAddress = HexToAddress("0xfffffffffffffffffffffffffffffffffffffffd") + var OwnerUSANAssetID = HexToHash("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe") + var ReceiveAssetFuncHash = Keccak256Hash([]byte("receiveAsset(bytes32,uint64,uint64,uint8,uint256[])")) + var ReportIllegalChan = make(chan []byte) + var ReportKeyAddress = HexToAddress("0xfffffffffffffffffffffffffffffffffffffff8") + var SwapKeyAddress = HexToAddress("0xfffffffffffffffffffffffffffffffffffffffa") + var SystemAsset = Asset + var SystemAssetID = HexToHash("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff") + var TESTNET_FORKS = []uint64 + var TestnetConstantinopleEnableHeight *big.Int = big.NewInt(1577000) + var TicketKeyAddress = HexToAddress("0xfffffffffffffffffffffffffffffffffffffffb") + var TicketLogAddress = HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe") + var UseDevnetRule = false + var UseTestnetRule = false + var VOTE1_FREEZE_TX_END uint64 = 786000 + var VOTE1_FREEZE_TX_START uint64 = 739500 + var Vote1DrainList = []Address + var Vote1RefundAddress = HexToAddress("0xff948d492c31814dEde4CAA0af8824eF02Eb48D2") + func AbsolutePath(datadir string, filename string) string + func BigUint64(v *big.Int) (uint64, bool) + func Bytes2Hex(d []byte) string + func BytesToInt(b []byte) int + func BytesToUint32(b []byte) uint32 + func BytesToUint64(b []byte) uint64 + func CheckSwapTargets(targets []Address, addr Address) error + func CopyBytes(b []byte) (copiedBytes []byte) + func DebugCall(callback func()) + func DebugInfo(msg string, ctx ...interface{}) + func DecodeFsnCallParam(fsnCall *FSNCallParam, funcParam interface{}) (interface{}, error) + func DecodeTxInput(input []byte) (interface{}, error) + func FileExist(filePath string) bool + func FromHex(s string) []byte + func GetBigInt(data []byte, start uint64, size uint64) *big.Int + func GetConstantinopleEnableHeight() *big.Int + func GetData(data []byte, start uint64, size uint64) []byte + func GetForkHeight(n int) uint64 + func GetFsnCallFee(to *Address, funcType FSNCallFunc) *big.Int + func GetPoSHashVersion(blockNumber *big.Int) int + func GetUint64(data []byte, start uint64, size uint64) (uint64, bool) + func Hex2Bytes(str string) []byte + func Hex2BytesFixed(str string, flen int) []byte + func InitDevnet() + func InitTestnet() + func IntToBytes(n int) []byte + func IsFsnCall(to *Address) bool + func IsHardFork(n int, blockNumber *big.Int) bool + func IsHeaderSnapCheckingEnabled(blockNumber *big.Int) bool + func IsHexAddress(s string) bool + func IsMultipleMiningCheckingEnabled(blockNumber *big.Int) bool + func IsPrivateSwapCheckingEnabled(blockNumber *big.Int) bool + func IsReceiveAssetPayableTx(blockNumber *big.Int, input []byte) bool + func IsSmartTransferEnabled(blockNumber *big.Int) bool + func IsVote1ForkBlock(blockNumber *big.Int) bool + func IsWholeAsset(start, end, timestamp uint64) bool + func LeftPadBytes(slice []byte, l int) []byte + func LoadJSON(file string, val interface{}) error + func MakeName(name, version string) string + func MaxUint64(x, y uint64) uint64 + func MinUint64(x, y uint64) uint64 + func ParseReceiveAssetPayableTxInput(p *TransferTimeLockParam, input []byte, timestamp uint64) error + func PrintDepricationWarning(str string) + func Report(extra ...interface{}) + func RightPadBytes(slice []byte, l int) []byte + func TicketPrice(blocknumber *big.Int) *big.Int + func ToHex(b []byte) string + func Uint32ToBytes(n uint32) []byte + func Uint64ToBytes(n uint64) []byte + type Address [AddressLength]byte + func BigToAddress(b *big.Int) Address + func BytesToAddress(b []byte) Address + func HexToAddress(s string) Address + func (a *Address) Scan(src interface{}) error + func (a *Address) SetBytes(b []byte) + func (a *Address) UnmarshalJSON(input []byte) error + func (a *Address) UnmarshalText(input []byte) error + func (a Address) Big() *big.Int + func (a Address) Bytes() []byte + 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) String() string + func (a Address) Value() (driver.Value, error) + func (addr Address) IsSpecialKeyAddress() bool + type Asset struct + CanChange bool + Decimals uint8 + Description string + ID Hash + Name string + Owner Address + Symbol string + Total *big.Int + func (u *Asset) MarshalJSON() ([]byte, error) + type AssetValueChangeExArgs struct + AssetID Hash + IsInc bool + To Address + TransacData string + Value *hexutil.Big + func (args *AssetValueChangeExArgs) ToData() ([]byte, error) + func (args *AssetValueChangeExArgs) ToParam() *AssetValueChangeExParam + type AssetValueChangeExParam struct + AssetID Hash + IsInc bool + To Address + TransacData string + Value *big.Int + func (p *AssetValueChangeExParam) Check(blockNumber *big.Int) error + func (p *AssetValueChangeExParam) ToBytes() ([]byte, error) + type BuyTicketArgs struct + End *hexutil.Uint64 + Start *hexutil.Uint64 + func (args *BuyTicketArgs) Init(defStart uint64) + func (args *BuyTicketArgs) ToData() ([]byte, error) + func (args *BuyTicketArgs) ToParam() *BuyTicketParam + type BuyTicketParam struct + End uint64 + Start uint64 + func (p *BuyTicketParam) Check(blockNumber *big.Int, timestamp uint64) error + func (p *BuyTicketParam) ToBytes() ([]byte, error) + type EmptyParam struct + func (p *EmptyParam) ToBytes() ([]byte, error) + type FSNBaseArgsInterface interface + BaseArgs func() *FusionBaseArgs + ToData func() ([]byte, error) + type FSNCallFunc uint8 + func (f FSNCallFunc) Name() string + type FSNCallParam struct + Data []byte + Func FSNCallFunc + func (p *FSNCallParam) Check(blockNumber *big.Int) error + func (p *FSNCallParam) ToBytes() ([]byte, error) + type FcSendAssetFlag uint8 + const FcInvalidSendAssetFlag + const FcUseAny + const FcUseAnyToTimeLock + const FcUseAsset + const FcUseAssetToTimeLock + const FcUseTimeLock + const FcUseTimeLockToTimeLock + func (flag FcSendAssetFlag) IsToTimeLock() bool + func (flag FcSendAssetFlag) IsUseAsset() bool + func (flag FcSendAssetFlag) IsUseTimeLock() bool + type FusionBaseArgs struct + From Address + Gas *hexutil.Uint64 + GasPrice *hexutil.Big + Nonce *hexutil.Uint64 + func (args *FusionBaseArgs) BaseArgs() *FusionBaseArgs + func (args *FusionBaseArgs) ToData() ([]byte, error) + type GenAssetArgs struct + CanChange bool + Decimals uint8 + Description string + Name string + Symbol string + Total *hexutil.Big + func (args *GenAssetArgs) ToData() ([]byte, error) + func (args *GenAssetArgs) ToParam() *GenAssetParam + type GenAssetParam struct + CanChange bool + Decimals uint8 + Description string + Name string + Symbol string + Total *big.Int + func (p *GenAssetParam) Check(blockNumber *big.Int) error + func (p *GenAssetParam) ToAsset() Asset + func (p *GenAssetParam) ToBytes() ([]byte, error) + type Hash [HashLength]byte + func BigToHash(b *big.Int) Hash + func BytesToHash(b []byte) Hash + func HexToHash(s string) Hash + func Keccak256Hash(data ...[]byte) (h Hash) + func (h *Hash) Scan(src interface{}) error + func (h *Hash) SetBytes(b []byte) + func (h *Hash) UnmarshalJSON(input []byte) error + func (h *Hash) UnmarshalText(input []byte) error + func (h Hash) Big() *big.Int + func (h Hash) Bytes() []byte + func (h Hash) Format(s fmt.State, c rune) + func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value + func (h Hash) Hex() string + func (h Hash) MarshalText() ([]byte, error) + func (h Hash) String() string + func (h Hash) TerminalString() string + func (h Hash) Value() (driver.Value, error) + type KeyValue struct + Key string + Value interface{} + func NewKeyValue(name string, v interface{}) *KeyValue + type MakeMultiSwapArgs struct + Description string + FromAssetID []Hash + FromEndTime []*hexutil.Uint64 + FromStartTime []*hexutil.Uint64 + MinFromAmount []*hexutil.Big + MinToAmount []*hexutil.Big + SwapSize *big.Int + Targes []Address + Time *big.Int + ToAssetID []Hash + ToEndTime []*hexutil.Uint64 + ToStartTime []*hexutil.Uint64 + func (args *MakeMultiSwapArgs) Init(time *big.Int) + func (args *MakeMultiSwapArgs) ToData() ([]byte, error) + func (args *MakeMultiSwapArgs) ToParam() *MakeMultiSwapParam + type MakeMultiSwapParam struct + Description string + FromAssetID []Hash + FromEndTime []uint64 + FromStartTime []uint64 + MinFromAmount []*big.Int + MinToAmount []*big.Int + SwapSize *big.Int + Targes []Address + Time *big.Int + ToAssetID []Hash + ToEndTime []uint64 + ToStartTime []uint64 + func (p *MakeMultiSwapParam) Check(blockNumber *big.Int, timestamp uint64) error + func (p *MakeMultiSwapParam) ToBytes() ([]byte, error) + type MakeSwapArgs struct + Description string + FromAssetID Hash + FromEndTime *hexutil.Uint64 + FromStartTime *hexutil.Uint64 + MinFromAmount *hexutil.Big + MinToAmount *hexutil.Big + SwapSize *big.Int + Targes []Address + Time *big.Int + ToAssetID Hash + ToEndTime *hexutil.Uint64 + ToStartTime *hexutil.Uint64 + func (args *MakeSwapArgs) Init(time *big.Int) + func (args *MakeSwapArgs) ToData() ([]byte, error) + func (args *MakeSwapArgs) ToParam() *MakeSwapParam + type MakeSwapParam struct + Description string + FromAssetID Hash + FromEndTime uint64 + FromStartTime uint64 + MinFromAmount *big.Int + MinToAmount *big.Int + SwapSize *big.Int + Targes []Address + Time *big.Int + ToAssetID Hash + ToEndTime uint64 + ToStartTime uint64 + func (p *MakeSwapParam) Check(blockNumber *big.Int, timestamp uint64) error + func (p *MakeSwapParam) ToBytes() ([]byte, error) + type MixedcaseAddress struct + func NewMixedcaseAddress(addr Address) MixedcaseAddress + func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error) + 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 MultiSwap struct + Description string + FromAssetID []Hash + FromEndTime []uint64 + FromStartTime []uint64 + ID Hash + MinFromAmount []*big.Int + MinToAmount []*big.Int + Notation uint64 + Owner Address + SwapSize *big.Int + Targes []Address + Time *big.Int + ToAssetID []Hash + ToEndTime []uint64 + ToStartTime []uint64 + type PrettyAge time.Time + func (t PrettyAge) String() string + type PrettyDuration time.Duration + func (d PrettyDuration) String() string + type RecallMultiSwapArgs struct + SwapID Hash + func (args *RecallMultiSwapArgs) ToData() ([]byte, error) + func (args *RecallMultiSwapArgs) ToParam() *RecallMultiSwapParam + type RecallMultiSwapParam struct + SwapID Hash + func (p *RecallMultiSwapParam) Check(blockNumber *big.Int, swap *MultiSwap) error + func (p *RecallMultiSwapParam) ToBytes() ([]byte, error) + type RecallSwapArgs struct + SwapID Hash + func (args *RecallSwapArgs) ToData() ([]byte, error) + func (args *RecallSwapArgs) ToParam() *RecallSwapParam + type RecallSwapParam struct + SwapID Hash + func (p *RecallSwapParam) Check(blockNumber *big.Int, swap *Swap) error + func (p *RecallSwapParam) ToBytes() ([]byte, error) + type SendAssetArgs struct + AssetID Hash + To Address + ToUSAN uint64 + Value *hexutil.Big + func (args *SendAssetArgs) ToData() ([]byte, error) + func (args *SendAssetArgs) ToParam() *SendAssetParam + type SendAssetParam struct + AssetID Hash + To Address + Value *big.Int + func (p *SendAssetParam) Check(blockNumber *big.Int) error + func (p *SendAssetParam) ToBytes() ([]byte, error) + type StorageSize float64 + func (s StorageSize) String() string + func (s StorageSize) TerminalString() string + type Swap struct + Description string + FromAssetID Hash + FromEndTime uint64 + FromStartTime uint64 + ID Hash + MinFromAmount *big.Int + MinToAmount *big.Int + Notation uint64 + Owner Address + SwapSize *big.Int + Targes []Address + Time *big.Int + ToAssetID Hash + ToEndTime uint64 + ToStartTime uint64 + type TailFlag int + const TailInBoth + const TailInFirst + const TailInSecond + type TakeMultiSwapArgs struct + Size *big.Int + SwapID Hash + func (args *TakeMultiSwapArgs) ToData() ([]byte, error) + func (args *TakeMultiSwapArgs) ToParam() *TakeMultiSwapParam + type TakeMultiSwapParam struct + Size *big.Int + SwapID Hash + func (p *TakeMultiSwapParam) Check(blockNumber *big.Int, swap *MultiSwap, timestamp uint64) error + func (p *TakeMultiSwapParam) ToBytes() ([]byte, error) + type TakeSwapArgs struct + Size *big.Int + SwapID Hash + func (args *TakeSwapArgs) ToData() ([]byte, error) + func (args *TakeSwapArgs) ToParam() *TakeSwapParam + type TakeSwapParam struct + Size *big.Int + SwapID Hash + func (p *TakeSwapParam) Check(blockNumber *big.Int, swap *Swap, timestamp uint64) error + func (p *TakeSwapParam) ToBytes() ([]byte, error) + type Ticket struct + Owner Address + func (t *Ticket) MarshalJSON() ([]byte, error) + func (t *Ticket) String() string + func (t *Ticket) ToDisplay() TicketDisplay + type TicketBody struct + ExpireTime uint64 + Height uint64 + ID Hash + StartTime uint64 + func (t *TicketBody) BlockHeight() *big.Int + func (t *TicketBody) IsInGenesis() bool + func (t *TicketBody) Value() *big.Int + type TicketBodySlice []TicketBody + func (s TicketBodySlice) DeepCopy() TicketBodySlice + type TicketDisplay struct + ExpireTime uint64 + Height uint64 + Owner Address + StartTime uint64 + Value *big.Int + type TicketPtrSlice []*Ticket + func (s TicketPtrSlice) String() string + type TicketSlice []Ticket + func (s TicketSlice) DeepCopy() TicketSlice + func (s TicketSlice) String() string + func (s TicketSlice) ToMap() map[Hash]TicketDisplay + type TicketsData struct + Owner Address + Tickets TicketBodySlice + func (s TicketsData) DeepCopy() TicketsData + func (s TicketsData) ToMap() map[Hash]TicketDisplay + func (s TicketsData) ToTicketSlice() TicketSlice + type TicketsDataSlice []TicketsData + func (s TicketsDataSlice) AddTicket(ticket *Ticket) (TicketsDataSlice, error) + func (s TicketsDataSlice) ClearExpiredTickets(timestamp uint64) (TicketsDataSlice, error) + func (s TicketsDataSlice) DeepCopy() TicketsDataSlice + func (s TicketsDataSlice) Get(id Hash) (*Ticket, error) + func (s TicketsDataSlice) NumberOfOwners() uint64 + func (s TicketsDataSlice) NumberOfTickets() uint64 + func (s TicketsDataSlice) NumberOfTicketsAndOwners() (uint64, uint64) + func (s TicketsDataSlice) NumberOfTicketsByAddress(addr Address) uint64 + func (s TicketsDataSlice) RemoveTicket(id Hash) (TicketsDataSlice, error) + func (s TicketsDataSlice) ToMap() map[Hash]TicketDisplay + func (s TicketsDataSlice) ToTicketSlice() TicketSlice + type TimeLock struct + Items []*TimeLockItem + func GetSurplusTimeLock(value *big.Int, start, end, timestamp uint64) *TimeLock + func GetTimeLock(value *big.Int, start, end uint64) *TimeLock + func NewTimeLock(items ...*TimeLockItem) *TimeLock + func (z *TimeLock) Add(x, y *TimeLock) *TimeLock + func (z *TimeLock) CanSub(x *TimeLock) bool + func (z *TimeLock) CheckValid() + func (z *TimeLock) ClearExpired(timestamp uint64) *TimeLock + func (z *TimeLock) Clone() *TimeLock + func (z *TimeLock) Cmp(x *TimeLock) int + func (z *TimeLock) EqualTo(x *TimeLock) bool + func (z *TimeLock) GetSpendableValue(start, end uint64) *big.Int + func (z *TimeLock) IsEmpty() bool + func (z *TimeLock) IsValid() error + func (z *TimeLock) Len() int + func (z *TimeLock) Less(i, j int) bool + func (z *TimeLock) RawString() string + func (z *TimeLock) Set(x *TimeLock) *TimeLock + func (z *TimeLock) SetItems(items []*TimeLockItem) + func (z *TimeLock) String() string + func (z *TimeLock) Sub(x, y *TimeLock) *TimeLock + func (z *TimeLock) Swap(i, j int) + func (z *TimeLock) ToDisplay() *TimeLock + type TimeLockArgs struct + EndTime *hexutil.Uint64 + StartTime *hexutil.Uint64 + TimeLockType TimeLockType + func (args *TimeLockArgs) Init(timeLockType TimeLockType) + func (args *TimeLockArgs) ToData() ([]byte, error) + func (args *TimeLockArgs) ToParam() *TimeLockParam + type TimeLockItem struct + EndTime uint64 + StartTime uint64 + Value *big.Int + func (u *TimeLockItem) MarshalJSON() ([]byte, error) + func (z *TimeLockItem) Add(x *TimeLockItem) ([]*TimeLockItem, TailFlag) + func (z *TimeLockItem) AdjustEnd(endTime uint64) *TimeLockItem + func (z *TimeLockItem) AdjustStart(startTime uint64) *TimeLockItem + func (z *TimeLockItem) AdjustStartEnd(startTime uint64, endTime uint64) *TimeLockItem + func (z *TimeLockItem) CanMerge(x *TimeLockItem) bool + func (z *TimeLockItem) Clone() *TimeLockItem + func (z *TimeLockItem) EqualRange(x *TimeLockItem) bool + func (z *TimeLockItem) EqualTo(x *TimeLockItem) bool + func (z *TimeLockItem) IsValid() error + func (z *TimeLockItem) Merge(x *TimeLockItem) *TimeLockItem + func (z *TimeLockItem) String() string + func (z *TimeLockItem) Sub(x *TimeLockItem) ([]*TimeLockItem, *TimeLockItem) + type TimeLockParam struct + AssetID Hash + EndTime uint64 + StartTime uint64 + To Address + Type TimeLockType + Value *big.Int + func (p *TimeLockParam) Check(blockNumber *big.Int, timestamp uint64) error + func (p *TimeLockParam) ToBytes() ([]byte, error) + type TimeLockType uint + const AssetToTimeLock + const SmartTransfer + const TimeLockToAsset + const TimeLockToTimeLock + type TransferTimeLockParam struct + AssetID Hash + BlockNumber *big.Int + EndTime uint64 + Flag FcSendAssetFlag + GasValue *big.Int + IsReceive bool + StartTime uint64 + Timestamp uint64 + Value *big.Int + type UnprefixedAddress Address + func (a *UnprefixedAddress) UnmarshalText(input []byte) error + func (a UnprefixedAddress) MarshalText() ([]byte, error) + type UnprefixedHash Hash + func (h *UnprefixedHash) UnmarshalText(input []byte) error + func (h UnprefixedHash) MarshalText() ([]byte, error) Other modules containing this package github.com/FusionFoundation/efsn github.com/FusionFoundation/efsn/v5