distributor

package module
v0.0.0-...-f935f2e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToNode

func ToNode(index int, account common.Address, amount *big.Int) common.Hash

func VerifyProof

func VerifyProof(index int, account common.Address, amount *big.Int, proof Elements, root common.Hash) bool

Types

type Balance

type Balance struct {
	Account common.Address
	Amount  *big.Int
}

type BalanceTree

type BalanceTree struct {
	// contains filtered or unexported fields
}

func NewBalanceTree

func NewBalanceTree(balances []Balance) (*BalanceTree, error)

func (*BalanceTree) GetProof

func (b *BalanceTree) GetProof(index int, account common.Address, amount *big.Int) ([]common.Hash, error)

func (*BalanceTree) GetRoot

func (b *BalanceTree) GetRoot() common.Hash

type Claim

type Claim struct {
	Index  int           `json:"index"`
	Amount string        `json:"amount"`
	Proof  []common.Hash `json:"proof"`
}

type Elements

type Elements []common.Hash

func (Elements) Dedup

func (x Elements) Dedup() Elements

func (Elements) Len

func (x Elements) Len() int

func (Elements) Less

func (x Elements) Less(i, j int) bool

func (Elements) Swap

func (x Elements) Swap(i, j int)

func (Elements) ToHexArray

func (x Elements) ToHexArray() []string

type MerkleDistributorInfo

type MerkleDistributorInfo struct {
	MerkleRoot common.Hash `json:"merkleRoot"`
	TokenTotal string      `json:"tokenTotal"`
	Claims     []Claim     `json:"claims"`
}

func ParseBalanceMap

func ParseBalanceMap(balances []Balance) (MerkleDistributorInfo, error)

type MerkleTree

type MerkleTree struct {
	// contains filtered or unexported fields
}

func NewMerkleTree

func NewMerkleTree(elements Elements) (*MerkleTree, error)

func (*MerkleTree) GetLayers

func (m *MerkleTree) GetLayers(elements Elements) ([][]common.Hash, error)

func (*MerkleTree) GetNextLayer

func (m *MerkleTree) GetNextLayer(elements Elements) Elements

func (*MerkleTree) GetProof

func (m *MerkleTree) GetProof(el common.Hash) ([]common.Hash, error)

func (*MerkleTree) GetRoot

func (m *MerkleTree) GetRoot() common.Hash

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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