erc20

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

package erc20reward implements a meta extension that manages all rewards on a Kwil network. It is used to create other extensions with which users can distribute erc20 tokens to users. It works by exposing an action to the DB owner which allows creation of new extensions for specific erc20s. When the action is called, it starts event listeners which sync information about the escrow contract, erc20, and multisig from the EVM chain. When an extension is in this state, we consider it "pending". Once synced, the extension is no longer "pending", but instead ready. At this point, users can access the extension's namespace to distribute rewards. Internally, the node will start another event listener which is responsible for tracking the erc20's Transfer event. When a transfer event is detected, the node will update the reward balance of the recipient.

Index

Constants

View Source
const (
	RewardMetaExtensionName = "kwil_erc20_meta"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Epoch

type Epoch struct {
	PendingEpoch
	EndHeight *int64 // nil if not finalized
	Root      []byte // merkle root of all rewards, nil if not finalized
	Total     *types.Decimal
	BlockHash []byte // hash of the block that finalized the epoch, nil if not finalized
	Confirmed bool
	EpochVoteInfo
}

Epoch is a period in which rewards are distributed.

type EpochReward

type EpochReward struct {
	Recipient ethcommon.Address
	Amount    *types.Decimal // numeric(78, 0)
}

EpochReward is a reward given to a user within an epoch

type EpochVoteInfo

type EpochVoteInfo struct {
	Voters     []ethcommon.Address
	VoteSigs   [][]byte
	VoteNonces []int64
}

type PendingEpoch

type PendingEpoch struct {
	ID          *types.UUID
	StartHeight int64
	StartTime   int64
}

PendingEpoch is an epoch that has been started but not yet finalized.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳