Documentation ¶
Index ¶
- Constants
- Variables
- func AttendeeKey(addr sdk.AccAddress) []byte
- func BonusKey() []byte
- func BonusServiceKey() []byte
- func CheckSameness(s1 sdk.AccAddress, s2 sdk.AccAddress) (err sdk.Error)
- func ClaimServiceKey() []byte
- func Decode(src string) []byte
- func Encode(src []byte) string
- func ErrAccountAddressEmpty(format string, args ...interface{}) sdk.Error
- func ErrAccountsSame(format string, args ...interface{}) sdk.Error
- func ErrAttendeeClaimed(format string, args ...interface{}) sdk.Error
- func ErrAttendeeCountMismatch(format string, args ...interface{}) sdk.Error
- func ErrAttendeeKeyed(format string, args ...interface{}) sdk.Error
- func ErrAttendeeNotFound(format string, args ...interface{}) sdk.Error
- func ErrCantShareWithSelf(format string, args ...interface{}) sdk.Error
- func ErrDataCannotBeEmpty(format string, args ...interface{}) sdk.Error
- func ErrDataSizeOverLimit(format string, args ...interface{}) sdk.Error
- func ErrDefault(format string, args ...interface{}) sdk.Error
- func ErrEmptyEncryptedInfo(format string, args ...interface{}) sdk.Error
- func ErrEmptyName(format string, args ...interface{}) sdk.Error
- func ErrEmptyRsaKey(format string, args ...interface{}) sdk.Error
- func ErrEmptySecret(format string, args ...interface{}) sdk.Error
- func ErrEventbriteEnvVariableNotSet(format string, args ...interface{}) sdk.Error
- func ErrGenesisAttendeesEmpty(format string, args ...interface{}) sdk.Error
- func ErrGenesisKeyServiceAccountInvalid(format string, args ...interface{}) sdk.Error
- func ErrGenesisKeyServiceAccountNotPresent(format string, args ...interface{}) sdk.Error
- func ErrGenesisKeyServiceAddressEmpty(format string, args ...interface{}) sdk.Error
- func ErrGenesisPrizesEmpty(format string, args ...interface{}) sdk.Error
- func ErrHashingError(format string, args ...interface{}) sdk.Error
- func ErrInfoAlreadyExists(format string, args ...interface{}) sdk.Error
- func ErrInsufficientPrivileges(format string, args ...interface{}) sdk.Error
- func ErrInvalidCommitmentReveal(format string, args ...interface{}) sdk.Error
- func ErrInvalidPublicKey(format string, args ...interface{}) sdk.Error
- func ErrInvalidShareForScan(format string, args ...interface{}) sdk.Error
- func ErrInvalidSignature(format string, args ...interface{}) sdk.Error
- func ErrItemNotFound(format string, args ...interface{}) sdk.Error
- func ErrNetworkResponseError(format string, args ...interface{}) sdk.Error
- func ErrPrizeNotFound(format string, args ...interface{}) sdk.Error
- func ErrQRCodeInvalid(format string, args ...interface{}) sdk.Error
- func ErrScanNotAccepted(format string, args ...interface{}) sdk.Error
- func ErrScanNotFound(format string, args ...interface{}) sdk.Error
- func ErrScanQRAlreadyOccurred(format string, args ...interface{}) sdk.Error
- func ErrSenderNotRedeemerAcct(format string, args ...interface{}) sdk.Error
- func ErrServiceAccountNotSet(format string, args ...interface{}) sdk.Error
- func ErrSigDecodeError(format string, args ...interface{}) sdk.Error
- func GenScanID(s1, s2 sdk.AccAddress) (id []byte, err sdk.Error)
- func GetPrizeIDByTier(tier uint) []byte
- func IsAttendeeKey(key []byte) bool
- func IsScanKey(key []byte) bool
- func Prefix(pre []byte) []byte
- func PrefixKey(pre []byte, key []byte) []byte
- func PrizeKey(id []byte) []byte
- func RegisterCodec(cdc *codec.Codec)
- func ScanKey(id []byte) []byte
- func ServiceKey() []byte
- func ValidQrCode(code string) bool
- type Attendee
- func (a *Attendee) AddRep(r uint)
- func (a *Attendee) AddScanID(id []byte) (added bool)
- func (a *Attendee) AddWinning(winning *Win) (added bool)
- func (a *Attendee) ClaimWinning(tier uint) (claimed bool)
- func (a *Attendee) CurrentCommitment() util.Commitment
- func (a *Attendee) GetAddress() sdk.AccAddress
- func (a *Attendee) GetID() string
- func (a *Attendee) GetRep() uint
- func (a *Attendee) GetTier() uint
- func (a *Attendee) IsClaimed() bool
- func (a *Attendee) IsKeyed() bool
- func (a *Attendee) ResetCommitment()
- func (a *Attendee) SetClaimed()
- func (a *Attendee) SetCommitment(commitment util.Commitment)
- type Bonus
- type GenesisAttendees
- type GenesisPrizes
- type GenesisScans
- type GenesisService
- type LeaderBoard
- type MsgBonus
- type MsgClaimKey
- type MsgClearBonus
- type MsgInfo
- type MsgKey
- type MsgRedeem
- type MsgScanQr
- type Prize
- type Scan
- type Tier
- type Win
Constants ¶
const ( // LongyCodeSpace is the codespace type for errors LongyCodeSpace sdk.CodespaceType = ModuleName // ItemNotFound is the code for no item ItemNotFound sdk.CodeType = iota + 1 // AttendeeNotFound is the code for when the attendee cannot be found in the keeper AttendeeNotFound // ScanNotFound is the code when we cannot find a scan in the keeper with the given id ScanNotFound // PrizeNotFound is the code when we cannot find an info in the keeper with the given id PrizeNotFound // InsufficientPrivileges is the code for when a transaction signer doesn't have the necessary privilege InsufficientPrivileges // GenesisKeyServiceAddressEmpty is the code for when the service account address is not set in the genesis file GenesisKeyServiceAddressEmpty // GenesisAttendeesEmpty is the code for when the attendees are not set in the genesis file GenesisAttendeesEmpty // GenesisPrizesEmpty is the code for when the prizes are not set in the genesis file GenesisPrizesEmpty // EventbriteEnvVariableNotSet is the code for when the eventbrite environmental var containing the auth key is //not set EventbriteEnvVariableNotSet // NetworkResponseError is the code for any network response that is not what is expected, ie 200/201 NetworkResponseError // AttendeeCountMismatch is the code for when there is a mis match between the expected and received number of // attendees from the indexing of the eventbrite calls AttendeeCountMismatch // GenesisKeyServiceAccountInvalid is the code when the service account bech32 address is invalidly passed to gen GenesisKeyServiceAccountInvalid // GenesisKeyServiceAccountNotPresent is the code when the service account is not found in the genesis accounts GenesisKeyServiceAccountNotPresent // QRCodeInvalid is the code when QRCodeInvalid // AttendeeClaimed is the code when AttendeeClaimed // AttendeeKeyed is the code when the attendee has already been key'd by the rekey service AttendeeKeyed //InvalidCommitmentReveal is the code when InvalidCommitmentReveal // AccountsSame is the code when a scan of with the same 1 account is attempted AccountsSame // AccountAddressEmpty is the code when an AccAddress is the empty address AccountAddressEmpty // ScanQRAlreadyOccurred is the code for when the scan message has already been sent by the scanner or the scan // is complete for those two parties ScanQRAlreadyOccurred //ScanNotAccepted is the code for when a scan is not complete ScanNotAccepted //DataCannotBeEmpty is the code for when the info data in a message is empty DataCannotBeEmpty //DataSizeOverLimit is the code for when the info data is above the size limit DataSizeOverLimit CantShareWithSelf //InfoAlreadyExists is the code for when someone tries to share info with a person more than once InfoAlreadyExists InvalidShareForScan //EmptySecret is the code for when the secret on a claim key message is empty EmptySecret //EmptyName is the code for when the name on a claim key is empty EmptyName //EmptyRsaKey is the code for when the rsa public key on a claim key message is empty EmptyRsaKey //EmptyEncryptedInfo is the code for when the encrypted info on a claim key message is empty EmptyEncryptedInfo //SenderNotRedeemerAcct is the code for when the sender of the MsgRedeem is not the correct account SenderNotRedeemerAcct //HashingError is the code for when we error on hashing the badge id HashingError //SigDecodeError is the code for when we cannot hex decode the signature SigDecodeError //InvalidSignature is the code for when the signature does not match the message InvalidSignature //InvalidPublicKey is the code for when the public key for a sig verification is empty or missing InvalidPublicKey //ServiceAccountNotSet is the code for when the service account has not been set ServiceAccountNotSet // DefaultError is the code for when a random error occurs that we do not provide a unique code to DefaultError )
const ( // ModuleName is the name of this module ModuleName = "longy" // StoreKey is the key used to access the store StoreKey = ModuleName // RouterKey is the package route RouterKey = ModuleName )
const ( //ServiceSeed is the seed for the service account ServiceSeed = "master" //BonusServiceSeed is the seed for the bonus service account BonusServiceSeed = "bonus" //ClaimServiceSeed is the seed for the claim service account ClaimServiceSeed = "claim" )
const ( //LeaderBoardCount is the total number of attendees on the board LeaderBoardCount = 30 //LeaderBoardTier1Prize is the tier 1 prize pool in USD LeaderBoardTier1Prize = 5000 //LeaderBoardTier2Prize is the tier 2 prize pool in USD LeaderBoardTier2Prize = 2000 //LeaderBoardTier1Count is the number of people in the first tier LeaderBoardTier1Count = 10 )
const ( ClaimBadgeAwardPoints uint = 5 //ScanAttendeeAwardPoints are the points given when you scan a regular attendee ScanAttendeeAwardPoints uint = 1 //ScanSponsorAwardPoints are the points given when you scan a sponsor attendee ScanSponsorAwardPoints uint = 2 ShareAttendeeAwardPoints uint = 3 ShareSponsorAwardPoints uint = 6 //Tier is the rep needed to be in that tier level Tier1Rep uint = 30 //20 Tier2Rep uint = 50 //30 Tier3Rep uint = 75 //40 Tier4Rep uint = 100 //50 Tier5Rep uint = 125 //75 Tier6Rep uint = 150 //100 Tier7Rep uint = 175 //125 Tier8Rep uint = 250 //170 Tier9Rep uint = 600 //220 //Quantity of prizes per tier Tier1Quantity uint = 150 Tier2Quantity uint = 200 Tier3Quantity uint = 300 Tier4Quantity uint = 50 Tier5Quantity uint = 150 Tier6Quantity uint = 100 Tier7Quantity uint = 100 Tier8Quantity uint = 150 Tier9Quantity uint = 1 )
const ( Tier0 uint = iota Tier1 Tier2 Tier3 Tier4 Tier5 Tier6 Tier7 Tier8 Tier9 )
const ( //MaxDataSize max payload for data MaxDataSize = 2048 //2k )
Variables ¶
var ( //AttendeePrefix is the prefix for the attendee type AttendeePrefix = []byte{0x0} //ScanPrefix is the prefix for the scan type ScanPrefix = []byte{0x1} //PrizePrefix is the prefix for the prize type PrizePrefix = []byte{0x2} //ServicePrefix is the prefix for storing the public address of the service account ServicePrefix = []byte{0x3} //BonusKeyPrefix is the prefix for retrieving the active bonus BonusKeyPrefix = []byte{0x4} //BonusServicePrefix = BonusServicePrefix = []byte{0x5} //ClaimServicePrefix is the prefix for the account that sends claims ClaimServicePrefix = []byte{0x6} //KeySeparator is the separator between the prefix and the type key KeySeparator = []byte("::") )
var ModuleCdc *codec.Codec
ModuleCdc is the codec for the module
Functions ¶
func AttendeeKey ¶
func AttendeeKey(addr sdk.AccAddress) []byte
AttendeeKey will construct the appropriate key for the attendee with `id`
func CheckSameness ¶
func CheckSameness(s1 sdk.AccAddress, s2 sdk.AccAddress) (err sdk.Error)
CheckSameness checks the address are not empty or the same
func ClaimServiceKey ¶
func ClaimServiceKey() []byte
ClaimServiceKey returns the prefix for the claim key
func ErrAccountAddressEmpty ¶
ErrAccountAddressEmpty occurs when an AccAddress is the empty address
func ErrAccountsSame ¶
ErrAccountsSame occurs when a scan of with the same 1 account is attempted
func ErrAttendeeClaimed ¶
ErrAttendeeClaimed indicates an attendee that is unclaimed
func ErrAttendeeCountMismatch ¶
ErrAttendeeCountMismatch occurs when network response that is not what is expected, ie 200/201
func ErrAttendeeKeyed ¶
ErrAttendeeKeyed indicated the attendee has already keyed their account
func ErrAttendeeNotFound ¶
ErrAttendeeNotFound occurs when we cannot find the attendee
func ErrCantShareWithSelf ¶
ErrCantShareWithSelf occurs when an attendee tries to share info with themselves
func ErrDataCannotBeEmpty ¶
ErrDataCannotBeEmpty occurs when the info data in a message is empty
func ErrDataSizeOverLimit ¶
ErrDataSizeOverLimit occurs when the info data is above the size limit
func ErrDefault ¶
ErrDefault occurs when a random error occurs that we do not provide a unique code to
func ErrEmptyEncryptedInfo ¶
ErrEmptyEncryptedInfo occurs when the encrypted info on a claim key message is empty
func ErrEmptyName ¶
ErrEmptyName occurs when the name on a claim key message is empty
func ErrEmptyRsaKey ¶
ErrEmptyRsaKey occurs when the rsa public key on a claim key message is empty
func ErrEmptySecret ¶
ErrEmptySecret occurs when the secret on a claim key message is empty
func ErrEventbriteEnvVariableNotSet ¶
ErrEventbriteEnvVariableNotSet occurs when the attendees are not set in the genesis file
func ErrGenesisAttendeesEmpty ¶
ErrGenesisAttendeesEmpty occurs when the attendees are not set in the genesis file
func ErrGenesisKeyServiceAccountInvalid ¶
ErrGenesisKeyServiceAccountInvalid occurs when the service account bech32 address is invalidly passed to gen
func ErrGenesisKeyServiceAccountNotPresent ¶
ErrGenesisKeyServiceAccountNotPresent occurs when the service account is not found in the genesis accounts
func ErrGenesisKeyServiceAddressEmpty ¶
ErrGenesisKeyServiceAddressEmpty occurs when the re-key service address is not set in the genesis file
func ErrGenesisPrizesEmpty ¶
ErrGenesisPrizesEmpty occurs when the prizes are not set in the genesis file
func ErrHashingError ¶
ErrHashingError occurs when the code for when we error on hashing the badge id
func ErrInfoAlreadyExists ¶
ErrInfoAlreadyExists occurs when someone tries to share info with a person more than once
func ErrInsufficientPrivileges ¶
ErrInsufficientPrivileges occurs when we cannot find the attendee
func ErrInvalidCommitmentReveal ¶
ErrInvalidCommitmentReveal indicates that the reveal is incorrect for the commitment
func ErrInvalidPublicKey ¶
ErrInvalidPublicKey occurs when the code for when the public key for a sig verification is empty or missing
func ErrInvalidShareForScan ¶
ErrInvalidShareForScan occurs when someone tries to share info when the corresponding scan is not complete
func ErrInvalidSignature ¶
ErrInvalidSignature occurs when the code for when the signature does not match the message
func ErrItemNotFound ¶
ErrItemNotFound occurs when we cannot find an item in the default store
func ErrNetworkResponseError ¶
ErrNetworkResponseError occurs when network response that is not what is expected, ie 200/201
func ErrPrizeNotFound ¶
ErrPrizeNotFound occurs when we cannot find a prize in the keeper with the given id
func ErrQRCodeInvalid ¶
ErrQRCodeInvalid occurs when a scan message has an invalid QR code, ie not a positive integer
func ErrScanNotAccepted ¶
ErrScanNotAccepted occurs when a scan is not accepted by both parties
func ErrScanNotFound ¶
ErrScanNotFound occurs when we cannot find a scan in the keeper with the given id
func ErrScanQRAlreadyOccurred ¶
ErrScanQRAlreadyOccurred occurs when the scan message has already been sent by the scanner or the scan is complete for those two parties
func ErrSenderNotRedeemerAcct ¶
ErrSenderNotRedeemerAcct occurs when the sender of the MsgRedeem is not the correct account
func ErrServiceAccountNotSet ¶
ErrServiceAccountNotSet occurs when the master account has not been set
func ErrSigDecodeError ¶
ErrSigDecodeError occurs when the code for when we cannot hex decode the signature
func GenScanID ¶
func GenScanID(s1, s2 sdk.AccAddress) (id []byte, err sdk.Error)
GenScanID creates the unique id between a scan pair, regardless of the order of the account addresses passed into it
func GetPrizeIDByTier ¶
GetPrizeIDByTier returns the byte array id for a prize by prefixing its tier
func IsAttendeeKey ¶
IsAttendeeKey checks the key to see if its for an attendee by checking it starts with the AttendeePrefix
func IsScanKey ¶
IsScanKey checks the key to see if its for a scan by checking it starts with the ScanPrefix
func RegisterCodec ¶
RegisterCodec registers concrete types used by this module
func ValidQrCode ¶
ValidQrCode returns true if the qr code is valid, ie its a positive integer
Types ¶
type Attendee ¶
type Attendee struct { ID string `json:"id"` Address sdk.AccAddress `json:"address"` PubKey crypto.PubKey `json:"pubKey,omitempty"` Name string `json:"name,omitempty"` UnixTimeSecClaimed int64 `json:"unixTimeSecClaimed,omitempty"` //time when this attendee account was claimed Commitment util.Commitment `json:"commitment,omitempty"` Claimed bool `json:"claimed,omitempty"` Sponsor bool `json:"sponsor,omitempty"` RsaPublicKey string `json:"rsaPublicKey,omitempty"` EncryptedInfo []byte `json:"encryptedInfo,omitempty"` ScanIDs []string `json:"scanIds,omitempty"` Winnings []Win `json:"winnings,omitempty"` Rep uint `json:"rep,omitempty"` }
Attendee encapsulates attendee information
func NewAttendee ¶
NewAttendee is the constructor for `Attendee`. New attendees default to 0 rep and is unclaimed
func (*Attendee) AddWinning ¶
AddWinning adds the winning to the array
func (*Attendee) ClaimWinning ¶
ClaimWinning claims the winning by tier and returns true. Returns false if the win is not there
func (*Attendee) CurrentCommitment ¶
func (a *Attendee) CurrentCommitment() util.Commitment
CurrentCommitment returns the current commitment associated with this attendee
func (*Attendee) GetAddress ¶
func (a *Attendee) GetAddress() sdk.AccAddress
GetAddress returns the deterministic address associated with the attendee
func (*Attendee) GetTier ¶
GetTier returns the tier group that an attendee is in based on their rep value
func (*Attendee) ResetCommitment ¶
func (a *Attendee) ResetCommitment()
ResetCommitment will reset this attendee's commitment to nil
func (*Attendee) SetClaimed ¶
func (a *Attendee) SetClaimed()
SetClaimed will mark this attendee as claimed
func (*Attendee) SetCommitment ¶
func (a *Attendee) SetCommitment(commitment util.Commitment)
SetCommitment will set the claim hash for this attendee
type Bonus ¶
type Bonus struct {
Multiplier string `json:"multiplier"`
}
Bonus -
func (*Bonus) GetMultiplier ¶
GetMultiplier - will return 1 if it fails to convert
type GenesisAttendees ¶
type GenesisAttendees []Attendee
GenesisAttendees is the full array of attendees to initialize
type GenesisPrizes ¶
type GenesisPrizes []Prize
GenesisPrizes is the full array of prizes for the event
func GetGenesisPrizes ¶
func GetGenesisPrizes() GenesisPrizes
GetGenesisPrizes returns the array of prizes that we start the chain with
type GenesisService ¶
type GenesisService struct { Address sdk.AccAddress `json:"address"` PubKey crypto.PubKey `json:"pubkey"` }
GenesisService is the genesis type for the re-key service
type LeaderBoard ¶
type LeaderBoard struct { TotalCount int `json:"totalCount"` Tier1 Tier `json:"tier1"` Tier2 Tier `json:"tier2"` Time time.Time `json:"time"` }
LeaderBoard is the leader board struct
func NewLeaderBoard ¶
func NewLeaderBoard(count int, top []Attendee) *LeaderBoard
NewLeaderBoard returns an initialized leader board with some constants
type MsgBonus ¶
type MsgBonus struct { BonusServiceAddress sdk.AccAddress `json:"bonus_service_address"` Multiplier string `json:"multiplier"` }
MsgBonus triggers a bonus period
type MsgClaimKey ¶
type MsgClaimKey struct { AttendeeAddress sdk.AccAddress `json:"attendeeAddress"` Name string `json:"name"` Secret string `json:"secret"` RsaPublicKey string `json:"rsaPublicKey"` EncryptedInfo []byte `json:"encryptedInfo"` }
MsgClaimKey is used to claim a prior rekey message
func NewMsgClaimKey ¶
func NewMsgClaimKey(address sdk.AccAddress, name string, secret string, rsaPublicKey string, encryptedInfo []byte) MsgClaimKey
NewMsgClaimKey in the constructor for `MsgClaimKey`
func (MsgClaimKey) GetSignBytes ¶
func (msg MsgClaimKey) GetSignBytes() []byte
GetSignBytes returns the byte array that is signed over
func (MsgClaimKey) GetSigners ¶
func (msg MsgClaimKey) GetSigners() []sdk.AccAddress
GetSigners returns the
func (MsgClaimKey) Route ¶
func (msg MsgClaimKey) Route() string
Route defines the route for this message
func (MsgClaimKey) ValidateBasic ¶
func (msg MsgClaimKey) ValidateBasic() sdk.Error
ValidateBasic performs sanity checks on the message
type MsgClearBonus ¶
type MsgClearBonus struct {
BonusServiceAddress sdk.AccAddress `json:"bonus_service_address"`
}
MsgClearBonus -
func (MsgClearBonus) GetSigners ¶
func (msg MsgClearBonus) GetSigners() []sdk.AccAddress
GetSigners -
func (MsgClearBonus) ValidateBasic ¶
func (msg MsgClearBonus) ValidateBasic() sdk.Error
ValidateBasic -
type MsgInfo ¶
type MsgInfo struct { Sender sdk.AccAddress `json:"sender"` //Standard for all messages Receiver sdk.AccAddress `json:"receiver"` //the person that is getting the info Data []byte `json:"data"` //the encrypted data to store }
MsgInfo defines the message for sharing our info with another attendee
func NewMsgInfo ¶
func NewMsgInfo(sender sdk.AccAddress, receiver sdk.AccAddress, data []byte) MsgInfo
NewMsgInfo is the constructor function for MsgInfo
func (MsgInfo) GetSignBytes ¶
GetSignBytes returns byte representation of the message
func (MsgInfo) GetSigners ¶
func (msg MsgInfo) GetSigners() []sdk.AccAddress
GetSigners returns the signers of this message for the authentication module
func (MsgInfo) ValidateBasic ¶
ValidateBasic performs basic checks of the message
type MsgKey ¶
type MsgKey struct { AttendeeAddress sdk.AccAddress `json:"attendeeAddress"` NewAttendeePublicKey tmcrypto.PubKey `json:"newAttendeePublicKey"` // expected signer of this message MasterAddress sdk.AccAddress `json:"masterAddress"` // Commitmentment that needs to be reclaimed Commitment util.Commitment `json:"commitment"` }
MsgKey implements the `sdk.Msg` interface
func NewMsgKey ¶
func NewMsgKey(attendeeAddress, masterAddress sdk.AccAddress, newPublicKey tmcrypto.PubKey, commit util.Commitment) MsgKey
NewMsgKey is the creator for `RekeyMsg`
func (MsgKey) GetSignBytes ¶
GetSignBytes returns the byte array that is signed over
func (MsgKey) GetSigners ¶
func (msg MsgKey) GetSigners() []sdk.AccAddress
GetSigners returns the the master public key expected to sign this message
func (MsgKey) ValidateBasic ¶
ValidateBasic peforms sanity checks on the message
type MsgRedeem ¶
type MsgRedeem struct { Sender sdk.AccAddress `json:"sender"` //Standard for all messages Attendee sdk.AccAddress `json:"attendee"` //the hex address of the attendee }
MsgRedeem is used to claim prizes by the booth operators
func NewMsgRedeem ¶
func NewMsgRedeem(sender sdk.AccAddress, addr sdk.AccAddress) MsgRedeem
NewMsgRedeem in the constructor for `MsgRedeem`
func (MsgRedeem) GetSignBytes ¶
GetSignBytes returns the byte array that is signed over
func (MsgRedeem) GetSigners ¶
func (msg MsgRedeem) GetSigners() []sdk.AccAddress
GetSigners returns the
func (MsgRedeem) ValidateBasic ¶
ValidateBasic performs sanity checks on the message
type MsgScanQr ¶
type MsgScanQr struct { Sender sdk.AccAddress `json:"sender"` //Standard for all messages ScannedQR string `json:"scannedQR"` //the string representation of the other attendee's QR badge Data []byte `json:"data,omitempty"` //the encrypted data to store }
MsgScanQr defines the message for starting off a QR scan meet of another attendee
func NewMsgQrScan ¶
func NewMsgQrScan(sender sdk.AccAddress, qrCode string, data []byte) MsgScanQr
NewMsgQrScan is the constructor function for MsgScanQr
func (MsgScanQr) GetSignBytes ¶
GetSignBytes returns byte representation of the message
func (MsgScanQr) GetSigners ¶
func (msg MsgScanQr) GetSigners() []sdk.AccAddress
GetSigners returns the signers of this message for the authentication module
func (MsgScanQr) ValidateBasic ¶
ValidateBasic performs basic checks of the message
type Prize ¶
type Prize struct { Tier uint `json:"tier"` RepNeeded uint `json:"repNeeded"` PrizeText string `json:"prizeText"` PrizeDescription string `json:"prizeDescription"` Quantity uint `json:"quantity"` }
Prize is the genesis type for the prizes
type Scan ¶
type Scan struct { //ID is the key we use to store this struct in the keyStore, it is unique per S1-S2 pair ID []byte `json:"id"` //S1 is the scanner that initiates the scan S1 sdk.AccAddress `json:"s1"` //S2 is the person who's QR code is scanned S2 sdk.AccAddress `json:"s2"` //D1 is the encrypted data shared by S1 with S2 D1 []byte `json:"d1"` //D2 is the encrypted data shared by S2 with S1 D2 []byte `json:"d2"` //P1 are the points earned by S1 for a scan P1 uint `json:"p1"` //P2 are the points earned by S2 for a scan P2 uint `json:"p2"` //UnixTimeSec is the unix time in seconds of the block header of when this scan was created UnixTimeSec int64 `json:"unixTimeSec"` //Accepted is true when S2, the scanned participant, posts on-chain that they accept the connection //this is equivalent of posting their own MsgScanQR or MsgInfo Accepted bool `json:"accepted"` }
Scan represents an unique scan between two parties, can only be one scan between the same parties
func NewScan ¶
func NewScan(s1 sdk.AccAddress, s2 sdk.AccAddress, d1 []byte, d2 []byte, p1 uint, p2 uint) (*Scan, sdk.Error)
NewScan creates a new scan and sets its id
func (*Scan) AddPointsToAccount ¶
func (s *Scan) AddPointsToAccount(address sdk.AccAddress, points uint)
AddPointsToAccount Adds points to the given account, assumes address is one of S1 or S2
func (*Scan) SetTimeUnixSeconds ¶
SetTimeUnixSeconds sets the unix time in seconds of the block header of when this scan was created