Documentation ¶
Index ¶
- type GitcoinPassport
- func (g *GitcoinPassport) Address(_ []byte) common.Address
- func (g *GitcoinPassport) BalanceAt(_ context.Context, _ common.Address, _ []byte, _ uint64) (*big.Int, error)
- func (g *GitcoinPassport) BalanceOf(addr common.Address, stamp []byte) (*big.Int, error)
- func (g *GitcoinPassport) BlockRootHash(_ context.Context, insertTime uint64) ([]byte, error)
- func (g *GitcoinPassport) BlockTimestamp(_ context.Context, insertTime uint64) (string, error)
- func (p *GitcoinPassport) CensusKeys(data map[common.Address]*big.Int) (map[common.Address]*big.Int, error)
- func (g *GitcoinPassport) ChainID() uint64
- func (g *GitcoinPassport) Close() error
- func (g *GitcoinPassport) CreationBlock(_ context.Context, _ []byte) (uint64, error)
- func (g *GitcoinPassport) Decimals(_ []byte) (uint64, error)
- func (g *GitcoinPassport) HoldersBalances(_ context.Context, stamp []byte, _ uint64) (map[common.Address]*big.Int, uint64, uint64, bool, *big.Int, error)
- func (g *GitcoinPassport) IconURI(_ []byte) (string, error)
- func (g *GitcoinPassport) Init(iconf any) error
- func (g *GitcoinPassport) IsExternal() bool
- func (g *GitcoinPassport) IsSynced(_ []byte) bool
- func (g *GitcoinPassport) LatestBlockNumber(_ context.Context, _ []byte) (uint64, error)
- func (g *GitcoinPassport) Name(stamp []byte) (string, error)
- func (g *GitcoinPassport) SetLastBalances(_ context.Context, _ []byte, balances map[common.Address]*big.Int, _ uint64) error
- func (g *GitcoinPassport) SetLastBlockNumber(_ uint64)
- func (g *GitcoinPassport) SetRef(_ any) error
- func (g *GitcoinPassport) Symbol(stamp []byte) (string, error)
- func (g *GitcoinPassport) TotalSupply(stamp []byte) (*big.Int, error)
- func (g *GitcoinPassport) Type() uint64
- func (g *GitcoinPassport) TypeName() string
- type GitcoinPassportConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitcoinPassport ¶
type GitcoinPassport struct {
// contains filtered or unexported fields
}
func (*GitcoinPassport) Address ¶
func (g *GitcoinPassport) Address(_ []byte) common.Address
Address returns the address of the Gitcoin Passport contract.
func (*GitcoinPassport) BalanceAt ¶
func (g *GitcoinPassport) BalanceAt(_ context.Context, _ common.Address, _ []byte, _ uint64) (*big.Int, error)
BalanceAt is not implemented for Gitcoin Passport.
func (*GitcoinPassport) BalanceOf ¶
BalanceOf method returns the current score of the address provided from the database. If any stamp name is provided, the score returned is about it and not the global Gitcoin Passport score.
func (*GitcoinPassport) BlockRootHash ¶
BlockRootHash method returns the block root hash for the provided block number, in this case, the unix seconds when the last score was inserted. The block root hash is emulated hashing the string representation of the block number (or last insert time) with sha256.
func (*GitcoinPassport) BlockTimestamp ¶
BlockTimestamp method returns the timestamp for the provided block number, in this case, the block number is the time in unix seconds of the last insert in the gitcoin database, so the transformation is direct.
func (*GitcoinPassport) CensusKeys ¶
func (p *GitcoinPassport) CensusKeys(data map[common.Address]*big.Int) (map[common.Address]*big.Int, error)
CensusKeys method returns the holders and balances provided transformed. The Gitcoin Passport provider does not need to transform the holders and balances, so it returns the data as is.
func (*GitcoinPassport) ChainID ¶
func (g *GitcoinPassport) ChainID() uint64
ChainID returns the chain ID of the Gitcoin Passport contract.
func (*GitcoinPassport) Close ¶
func (g *GitcoinPassport) Close() error
Close cancels the download context.
func (*GitcoinPassport) CreationBlock ¶
CreationBlock is not implemented for Gitcoin Passport.
func (*GitcoinPassport) Decimals ¶
func (g *GitcoinPassport) Decimals(_ []byte) (uint64, error)
Decimals is not implemented for Gitcoin Passport.
func (*GitcoinPassport) HoldersBalances ¶
func (*GitcoinPassport) IconURI ¶
func (g *GitcoinPassport) IconURI(_ []byte) (string, error)
IconURI is not implemented for Gitcoin Passport.
func (*GitcoinPassport) Init ¶
func (g *GitcoinPassport) Init(iconf any) error
Init initializes the Gitcoin Passport provider with the given config. If the config is not of type GitcoinPassportConf, or the API endpoint is missing, it returns an error. If the cooldown is not set, it defaults to 6 hours.
func (*GitcoinPassport) IsExternal ¶
func (g *GitcoinPassport) IsExternal() bool
IsExternal returns true because Gitcoin Passport is an external provider.
func (*GitcoinPassport) IsSynced ¶
func (g *GitcoinPassport) IsSynced(_ []byte) bool
IsSynced returns true if the balances are not empty.
func (*GitcoinPassport) LatestBlockNumber ¶
LatestBlockNumber method returns the number of the last block of the network, in this case, the last block number is emulated by the last time where an score was updated or inserted in the database.
func (*GitcoinPassport) Name ¶
func (g *GitcoinPassport) Name(stamp []byte) (string, error)
Name returns the name of the Gitcoin Passport contract. If a stamp is provided, check if it exists and if so, compose the name with it.
func (*GitcoinPassport) SetLastBalances ¶
func (g *GitcoinPassport) SetLastBalances(_ context.Context, _ []byte, balances map[common.Address]*big.Int, _ uint64, ) error
SetLastBalances stores the balances of the last block (or other kind of reference). It is used to calculate the partial balances of the current block.
func (*GitcoinPassport) SetLastBlockNumber ¶
func (g *GitcoinPassport) SetLastBlockNumber(_ uint64)
SetLastBlockNumber is not implemented for Gitcoin Passport.
func (*GitcoinPassport) SetRef ¶
func (g *GitcoinPassport) SetRef(_ any) error
SetRef is not implemented for Gitcoin Passport.
func (*GitcoinPassport) Symbol ¶
func (g *GitcoinPassport) Symbol(stamp []byte) (string, error)
Symbol returns the symbol of the Gitcoin Passport contract. If a stamp is provided, check if it exists and if so, compose the symbol with it.
func (*GitcoinPassport) TotalSupply ¶
func (g *GitcoinPassport) TotalSupply(stamp []byte) (*big.Int, error)
TotalSupply method returns the sum of the scores of every holder in the database. If a stamp is provided, the total supply is calculated with the sum of the holders scores for that stamp.
func (*GitcoinPassport) Type ¶
func (g *GitcoinPassport) Type() uint64
Type returns the type of the Gitcoin Passport contract.
func (*GitcoinPassport) TypeName ¶
func (g *GitcoinPassport) TypeName() string
TypeName returns the type name of the Gitcoin Passport contract.