types

package
v0.0.0-...-4fa03f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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 is the code for when an attendee tries to share info with themselves
	CantShareWithSelf
	//InfoAlreadyExists is the code for when someone tries to share info with a person more than once
	InfoAlreadyExists
	//InvalidShareForScan is the code for when someone tries to share info when the corresponding scan is not complete
	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
)
View Source
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
)
View Source
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"
)
View Source
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
)
View Source
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 are the points when you share info with a regular attendee
	ShareAttendeeAwardPoints uint = 3
	//ShareSponsorAwardPoints are the points when you share info with a sponsor attendee
	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
)
View Source
const (
	Tier0 uint = iota
	Tier1
	Tier2
	Tier3
	Tier4
	Tier5
	Tier6
	Tier7
	Tier8
	Tier9
)
View Source
const (
	//MaxDataSize max payload for data
	MaxDataSize = 2048 //2k
)

Variables

View Source
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("::")
)
View Source
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 BonusKey

func BonusKey() []byte

BonusKey -

func BonusServiceKey

func BonusServiceKey() []byte

BonusServiceKey -

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 Decode

func Decode(src string) []byte

Decode decodes a string into a hex byte array

func Encode

func Encode(src []byte) string

Encode encodes a hex byte array

func ErrAccountAddressEmpty

func ErrAccountAddressEmpty(format string, args ...interface{}) sdk.Error

ErrAccountAddressEmpty occurs when an AccAddress is the empty address

func ErrAccountsSame

func ErrAccountsSame(format string, args ...interface{}) sdk.Error

ErrAccountsSame occurs when a scan of with the same 1 account is attempted

func ErrAttendeeClaimed

func ErrAttendeeClaimed(format string, args ...interface{}) sdk.Error

ErrAttendeeClaimed indicates an attendee that is unclaimed

func ErrAttendeeCountMismatch

func ErrAttendeeCountMismatch(format string, args ...interface{}) sdk.Error

ErrAttendeeCountMismatch occurs when network response that is not what is expected, ie 200/201

func ErrAttendeeKeyed

func ErrAttendeeKeyed(format string, args ...interface{}) sdk.Error

ErrAttendeeKeyed indicated the attendee has already keyed their account

func ErrAttendeeNotFound

func ErrAttendeeNotFound(format string, args ...interface{}) sdk.Error

ErrAttendeeNotFound occurs when we cannot find the attendee

func ErrCantShareWithSelf

func ErrCantShareWithSelf(format string, args ...interface{}) sdk.Error

ErrCantShareWithSelf occurs when an attendee tries to share info with themselves

func ErrDataCannotBeEmpty

func ErrDataCannotBeEmpty(format string, args ...interface{}) sdk.Error

ErrDataCannotBeEmpty occurs when the info data in a message is empty

func ErrDataSizeOverLimit

func ErrDataSizeOverLimit(format string, args ...interface{}) sdk.Error

ErrDataSizeOverLimit occurs when the info data is above the size limit

func ErrDefault

func ErrDefault(format string, args ...interface{}) sdk.Error

ErrDefault occurs when a random error occurs that we do not provide a unique code to

func ErrEmptyEncryptedInfo

func ErrEmptyEncryptedInfo(format string, args ...interface{}) sdk.Error

ErrEmptyEncryptedInfo occurs when the encrypted info on a claim key message is empty

func ErrEmptyName

func ErrEmptyName(format string, args ...interface{}) sdk.Error

ErrEmptyName occurs when the name on a claim key message is empty

func ErrEmptyRsaKey

func ErrEmptyRsaKey(format string, args ...interface{}) sdk.Error

ErrEmptyRsaKey occurs when the rsa public key on a claim key message is empty

func ErrEmptySecret

func ErrEmptySecret(format string, args ...interface{}) sdk.Error

ErrEmptySecret occurs when the secret on a claim key message is empty

func ErrEventbriteEnvVariableNotSet

func ErrEventbriteEnvVariableNotSet(format string, args ...interface{}) sdk.Error

ErrEventbriteEnvVariableNotSet occurs when the attendees are not set in the genesis file

func ErrGenesisAttendeesEmpty

func ErrGenesisAttendeesEmpty(format string, args ...interface{}) sdk.Error

ErrGenesisAttendeesEmpty occurs when the attendees are not set in the genesis file

func ErrGenesisKeyServiceAccountInvalid

func ErrGenesisKeyServiceAccountInvalid(format string, args ...interface{}) sdk.Error

ErrGenesisKeyServiceAccountInvalid occurs when the service account bech32 address is invalidly passed to gen

func ErrGenesisKeyServiceAccountNotPresent

func ErrGenesisKeyServiceAccountNotPresent(format string, args ...interface{}) sdk.Error

ErrGenesisKeyServiceAccountNotPresent occurs when the service account is not found in the genesis accounts

func ErrGenesisKeyServiceAddressEmpty

func ErrGenesisKeyServiceAddressEmpty(format string, args ...interface{}) sdk.Error

ErrGenesisKeyServiceAddressEmpty occurs when the re-key service address is not set in the genesis file

func ErrGenesisPrizesEmpty

func ErrGenesisPrizesEmpty(format string, args ...interface{}) sdk.Error

ErrGenesisPrizesEmpty occurs when the prizes are not set in the genesis file

func ErrHashingError

func ErrHashingError(format string, args ...interface{}) sdk.Error

ErrHashingError occurs when the code for when we error on hashing the badge id

func ErrInfoAlreadyExists

func ErrInfoAlreadyExists(format string, args ...interface{}) sdk.Error

ErrInfoAlreadyExists occurs when someone tries to share info with a person more than once

func ErrInsufficientPrivileges

func ErrInsufficientPrivileges(format string, args ...interface{}) sdk.Error

ErrInsufficientPrivileges occurs when we cannot find the attendee

func ErrInvalidCommitmentReveal

func ErrInvalidCommitmentReveal(format string, args ...interface{}) sdk.Error

ErrInvalidCommitmentReveal indicates that the reveal is incorrect for the commitment

func ErrInvalidPublicKey

func ErrInvalidPublicKey(format string, args ...interface{}) sdk.Error

ErrInvalidPublicKey occurs when the code for when the public key for a sig verification is empty or missing

func ErrInvalidShareForScan

func ErrInvalidShareForScan(format string, args ...interface{}) sdk.Error

ErrInvalidShareForScan occurs when someone tries to share info when the corresponding scan is not complete

func ErrInvalidSignature

func ErrInvalidSignature(format string, args ...interface{}) sdk.Error

ErrInvalidSignature occurs when the code for when the signature does not match the message

func ErrItemNotFound

func ErrItemNotFound(format string, args ...interface{}) sdk.Error

ErrItemNotFound occurs when we cannot find an item in the default store

func ErrNetworkResponseError

func ErrNetworkResponseError(format string, args ...interface{}) sdk.Error

ErrNetworkResponseError occurs when network response that is not what is expected, ie 200/201

func ErrPrizeNotFound

func ErrPrizeNotFound(format string, args ...interface{}) sdk.Error

ErrPrizeNotFound occurs when we cannot find a prize in the keeper with the given id

func ErrQRCodeInvalid

func ErrQRCodeInvalid(format string, args ...interface{}) sdk.Error

ErrQRCodeInvalid occurs when a scan message has an invalid QR code, ie not a positive integer

func ErrScanNotAccepted

func ErrScanNotAccepted(format string, args ...interface{}) sdk.Error

ErrScanNotAccepted occurs when a scan is not accepted by both parties

func ErrScanNotFound

func ErrScanNotFound(format string, args ...interface{}) sdk.Error

ErrScanNotFound occurs when we cannot find a scan in the keeper with the given id

func ErrScanQRAlreadyOccurred

func ErrScanQRAlreadyOccurred(format string, args ...interface{}) sdk.Error

ErrScanQRAlreadyOccurred occurs when the scan message has already been sent by the scanner or the scan is complete for those two parties

func ErrSenderNotRedeemerAcct

func ErrSenderNotRedeemerAcct(format string, args ...interface{}) sdk.Error

ErrSenderNotRedeemerAcct occurs when the sender of the MsgRedeem is not the correct account

func ErrServiceAccountNotSet

func ErrServiceAccountNotSet(format string, args ...interface{}) sdk.Error

ErrServiceAccountNotSet occurs when the master account has not been set

func ErrSigDecodeError

func ErrSigDecodeError(format string, args ...interface{}) sdk.Error

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

func GetPrizeIDByTier(tier uint) []byte

GetPrizeIDByTier returns the byte array id for a prize by prefixing its tier

func IsAttendeeKey

func IsAttendeeKey(key []byte) bool

IsAttendeeKey checks the key to see if its for an attendee by checking it starts with the AttendeePrefix

func IsScanKey

func IsScanKey(key []byte) bool

IsScanKey checks the key to see if its for a scan by checking it starts with the ScanPrefix

func Prefix

func Prefix(pre []byte) []byte

Prefix returns the prefix for a given pre key

func PrefixKey

func PrefixKey(pre []byte, key []byte) []byte

PrefixKey adds prifix bits to the key

func PrizeKey

func PrizeKey(id []byte) []byte

PrizeKey returns the prefixed key for managing prizes in the store

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types used by this module

func ScanKey

func ScanKey(id []byte) []byte

ScanKey returns the prefixed key for managing scans in the store

func ServiceKey

func ServiceKey() []byte

ServiceKey will return the store key for the service

func ValidQrCode

func ValidQrCode(code string) bool

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

func NewAttendee(id string, sponsor bool) Attendee

NewAttendee is the constructor for `Attendee`. New attendees default to 0 rep and is unclaimed

func (*Attendee) AddRep

func (a *Attendee) AddRep(r uint)

AddRep will add rep to the attendee {

func (*Attendee) AddScanID

func (a *Attendee) AddScanID(id []byte) (added bool)

AddScanID adds the new scan id if it isn't already added

func (*Attendee) AddWinning

func (a *Attendee) AddWinning(winning *Win) (added bool)

AddWinning adds the winning to the array

func (*Attendee) ClaimWinning

func (a *Attendee) ClaimWinning(tier uint) (claimed bool)

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) GetID

func (a *Attendee) GetID() string

GetID returns the attendee identifier

func (*Attendee) GetRep

func (a *Attendee) GetRep() uint

GetRep returns the attendee's current rep

func (*Attendee) GetTier

func (a *Attendee) GetTier() uint

GetTier returns the tier group that an attendee is in based on their rep value

func (*Attendee) IsClaimed

func (a *Attendee) IsClaimed() bool

IsClaimed indicates if this attendee is claimed

func (*Attendee) IsKeyed

func (a *Attendee) IsKeyed() bool

IsKeyed indicates if this attendee is key'd yet

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 NewBonus

func NewBonus(amt string) Bonus

NewBonus -

func (*Bonus) GetMultiplier

func (b *Bonus) GetMultiplier() float64

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 GenesisScans

type GenesisScans []Scan

GenesisScans is the full array of scans to initialize

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

func NewMsgBonus

func NewMsgBonus(multiplier string, addr sdk.AccAddress) MsgBonus

NewMsgBonus -

func (MsgBonus) GetSignBytes

func (msg MsgBonus) GetSignBytes() []byte

GetSignBytes -

func (MsgBonus) GetSigners

func (msg MsgBonus) GetSigners() []sdk.AccAddress

GetSigners -

func (MsgBonus) Route

func (msg MsgBonus) Route() string

Route -

func (MsgBonus) Type

func (msg MsgBonus) Type() string

Type -

func (MsgBonus) ValidateBasic

func (msg MsgBonus) ValidateBasic() sdk.Error

ValidateBasic -

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) Type

func (msg MsgClaimKey) Type() string

Type is the message type

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 NewMsgClearBonus

func NewMsgClearBonus(addr sdk.AccAddress) MsgClearBonus

NewMsgClearBonus -

func (MsgClearBonus) GetSignBytes

func (msg MsgClearBonus) GetSignBytes() []byte

GetSignBytes -

func (MsgClearBonus) GetSigners

func (msg MsgClearBonus) GetSigners() []sdk.AccAddress

GetSigners -

func (MsgClearBonus) Route

func (msg MsgClearBonus) Route() string

Route -

func (MsgClearBonus) Type

func (msg MsgClearBonus) Type() string

Type -

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

func (msg MsgInfo) GetSignBytes() []byte

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) Route

func (msg MsgInfo) Route() string

Route string for this message

func (MsgInfo) Type

func (msg MsgInfo) Type() string

Type returns the message type, used to tagging transactions

func (MsgInfo) ValidateBasic

func (msg MsgInfo) ValidateBasic() sdk.Error

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

func (msg MsgKey) GetSignBytes() []byte

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) Route

func (msg MsgKey) Route() string

Route defines the route for this message

func (MsgKey) Type

func (msg MsgKey) Type() string

Type is the message type

func (MsgKey) ValidateBasic

func (msg MsgKey) ValidateBasic() sdk.Error

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

func (msg MsgRedeem) GetSignBytes() []byte

GetSignBytes returns the byte array that is signed over

func (MsgRedeem) GetSigners

func (msg MsgRedeem) GetSigners() []sdk.AccAddress

GetSigners returns the

func (MsgRedeem) Route

func (msg MsgRedeem) Route() string

Route defines the route for this message

func (MsgRedeem) Type

func (msg MsgRedeem) Type() string

Type is the message type

func (MsgRedeem) ValidateBasic

func (msg MsgRedeem) ValidateBasic() sdk.Error

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

func (msg MsgScanQr) GetSignBytes() []byte

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) Route

func (msg MsgScanQr) Route() string

Route string for this message

func (MsgScanQr) Type

func (msg MsgScanQr) Type() string

Type returns the message type, used to tagging transactions

func (MsgScanQr) ValidateBasic

func (msg MsgScanQr) ValidateBasic() sdk.Error

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

func (*Prize) GetID

func (p *Prize) GetID() []byte

GetID turns the prize tier into its key, assuming tiers are unique

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) AddPoints

func (s *Scan) AddPoints(p1 uint, p2 uint)

AddPoints adds points to the s1 and s2 respectively

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

func (s *Scan) SetTimeUnixSeconds(unix int64)

SetTimeUnixSeconds sets the unix time in seconds of the block header of when this scan was created

type Tier

type Tier struct {
	PrizeAmount int        `json:"prizeAmount"`
	Attendees   []Attendee `json:"attendees"`
}

Tier is a prize tier in the leader board

type Win

type Win struct {
	Tier    uint   `json:"tier"`
	Name    string `json:"name"`
	Claimed bool   `json:"claimed"`
}

Win is the type for the prizes that an attendee has earned playing the game

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL