Documentation ¶
Index ¶
- Constants
- func NormalRandom(seed int64, expect uint64, min, max uint64) uint64
- type OldPacket
- type OldPacketAllocationRecord
- type Packet
- type PacketAllocationRecord
- type PacketAllocationRecordJson
- type PacketBalance
- type PacketJson
- type PacketMgr
- func (p *PacketMgr) CreatePacket(stub shim.ChaincodeStubInterface, pubKey []byte, count uint32, ...) error
- func (p *PacketMgr) GetAllPacketInfo(stub shim.ChaincodeStubInterface) ([]*PacketJson, error)
- func (p *PacketMgr) GetPacketAllocationHistory(stub shim.ChaincodeStubInterface, pubKey []byte) ([]*PacketAllocationRecordJson, error)
- func (p *PacketMgr) GetPacketInfo(stub shim.ChaincodeStubInterface, pubKey []byte) (*PacketJson, error)
- func (p *PacketMgr) Init(stub shim.ChaincodeStubInterface) pb.Response
- func (p *PacketMgr) Invoke(stub shim.ChaincodeStubInterface) pb.Response
- func (p *PacketMgr) IsPulledPacket(stub shim.ChaincodeStubInterface, pubKey []byte, msg string) bool
- func (p *PacketMgr) PullPacket(stub shim.ChaincodeStubInterface, pubKey []byte, msg string, signature []byte, ...) error
- func (p *PacketMgr) RecyclePacket(stub shim.ChaincodeStubInterface, pubKey []byte) error
- func (p *PacketMgr) UpdatePacket(stub shim.ChaincodeStubInterface, pubKey []byte, count uint32, ...) error
- type RecordTokens
- type RecordTokensJson
- type Tokens
- type TokensJson
Constants ¶
View Source
const PACKET_ADDRESS = "PCGTta3M4t3yXu8uRgkKvaWd2d8DSDC6K99"
View Source
const PacketAllocationRecordPrefix = "R-"
View Source
const PacketBalancePrefix = "B-"
View Source
const PacketPrefix = "P-"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OldPacket ¶ added in v1.0.8
type OldPacket struct { PubKey []byte //红包对应的公钥,也是红包的唯一标识 Creator common.Address //红包发放人员地址 Token *modules.Asset //红包中的TokenID Amount uint64 //红包总金额 Count uint32 //红包数,为0表示可以无限领取 MinPacketAmount uint64 //单个红包最小额 MaxPacketAmount uint64 //单个红包最大额,最大额最小额相同,则说明不是随机红包,0则表示完全随机 ExpiredTime uint64 //红包过期时间,0表示永不过期 Remark string //红包的备注 Constant bool //是否固定数额 }
old packet
type OldPacketAllocationRecord ¶ added in v1.0.8
type OldPacketAllocationRecord struct { PubKey []byte //红包公钥 Message string //领取红包用的消息,防止重复领取 Amount uint64 //领取的Token数量 Token *modules.Asset ToAddress common.Address //领取人的地址 RequestHash common.Hash //领取请求的Hash Timestamp uint64 //领取的时间戳,主要用于排序 }
旧的红包领取记录
type Packet ¶
type Packet struct { PubKey []byte //红包对应的公钥,也是红包的唯一标识 Creator common.Address //红包发放人员地址 Tokens []*Tokens //红包中的TokenID Amount uint64 //红包总金额 Count uint32 //红包数,为0表示可以无限领取 MinPacketAmount uint64 //单个红包最小额 MaxPacketAmount uint64 //单个红包最大额,最大额最小额相同,则说明不是随机红包,0则表示完全随机 ExpiredTime uint64 //红包过期时间,0表示永不过期 Remark string //红包的备注 Constant bool //是否固定数额 }
new Packet
func OldPacket2New ¶ added in v1.0.8
func (*Packet) GetPullAmount ¶
func (*Packet) IsFixAmount ¶
func (*Packet) PubKeyAddress ¶ added in v1.0.8
type PacketAllocationRecord ¶
type PacketAllocationRecord struct { PubKey []byte //红包公钥 Message string //领取红包用的消息,防止重复领取 Tokens []*RecordTokens ToAddress common.Address //领取人的地址 RequestHash common.Hash //领取请求的Hash Timestamp uint64 //领取的时间戳,主要用于排序 }
红包领取记录
func OldRecord2New ¶ added in v1.0.8
func OldRecord2New(old *OldPacketAllocationRecord) *PacketAllocationRecord
兼容
type PacketJson ¶
type PacketJson struct { PubKey string //红包对应的公钥,也是红包的唯一标识 Creator common.Address //红包发放人员地址 Token []*TokensJson //红包中的TokenID TotalAmount decimal.Decimal //红包总金额 PacketCount uint32 //红包数,为0表示可以无限领取 MinPacketAmount decimal.Decimal //单个红包最小额 MaxPacketAmount decimal.Decimal //单个红包最大额,最大额最小额相同,则说明不是随机红包 ExpiredTime string //红包过期时间,0表示永不过期 Remark string //红包的备注 IsConstant string //是否固定数额 BalanceAmount decimal.Decimal //红包剩余额度 BalanceCount uint32 //红包剩余次数 }
type PacketMgr ¶
type PacketMgr struct { }
func (*PacketMgr) CreatePacket ¶
func (*PacketMgr) GetAllPacketInfo ¶
func (p *PacketMgr) GetAllPacketInfo(stub shim.ChaincodeStubInterface) ([]*PacketJson, error)
func (*PacketMgr) GetPacketAllocationHistory ¶
func (p *PacketMgr) GetPacketAllocationHistory(stub shim.ChaincodeStubInterface, pubKey []byte) ([]*PacketAllocationRecordJson, error)
func (*PacketMgr) GetPacketInfo ¶
func (p *PacketMgr) GetPacketInfo(stub shim.ChaincodeStubInterface, pubKey []byte) (*PacketJson, error)
func (*PacketMgr) IsPulledPacket ¶
func (*PacketMgr) PullPacket ¶
func (p *PacketMgr) PullPacket(stub shim.ChaincodeStubInterface, pubKey []byte, msg string, signature []byte, pullAddr common.Address, amounts string) error
领取红包,如果该红包有多种Token,那么amounts参数就可以是一个以逗号分割金额的字符串,并根据对应的index领取对应金额的Token
func (*PacketMgr) RecyclePacket ¶
func (p *PacketMgr) RecyclePacket(stub shim.ChaincodeStubInterface, pubKey []byte) error
type RecordTokens ¶ added in v1.0.8
type RecordTokensJson ¶ added in v1.0.8
Click to show internal directories.
Click to hide internal directories.