rewards

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const AddSenderMessagePrefix = "add"

Variables

This section is empty.

Functions

func GetCreateSenderAttestation added in v1.0.1

func GetCreateSenderAttestation(signer *ecdsa.PrivateKey, params *CreateSenderAttestationParams) (ownerWallet string, signedAttestation string, err error)

func SignClaim added in v1.0.1

func SignClaim(claim RewardClaim, privateKey *ecdsa.PrivateKey) (string, error)

SignClaim is a utility function that compiles and signs a reward claim. This is used by claim authorities to create signatures for reward claims.

func VerifyClaim added in v1.0.1

func VerifyClaim(claim RewardClaim, signature string) (string, error)

VerifyClaim is a utility function that verifies a reward claim signature. It returns the signer's address if the signature is valid.

Types

type ClaimAuthority

type ClaimAuthority struct {
	Address string `json:"address"`
	Name    string `json:"name"`
}

type CreateSenderAttestationParams added in v1.0.1

type CreateSenderAttestationParams struct {
	// must be existing validator
	NewSenderAddress string

	// base58 encoded pubkey
	RewardsManagerAccountPubKey string
}

type Reward

type Reward struct {
	ClaimAuthorities []ClaimAuthority `json:"claim_authorities"`
	Amount           uint64           `json:"amount"`
	RewardId         string           `json:"reward_id"`
	Name             string           `json:"name"`
}

type RewardAttester

type RewardAttester struct {
	EthereumAddress string
	EthereumKey     *ecdsa.PrivateKey
	Rewards         []Reward
}

func NewRewardAttester

func NewRewardAttester(ethereumKey *ecdsa.PrivateKey, rewards []Reward) *RewardAttester

func (*RewardAttester) Attest

func (rs *RewardAttester) Attest(claim RewardClaim) (message []byte, signature string, err error)

func (*RewardAttester) Authenticate

func (rs *RewardAttester) Authenticate(claim RewardClaim, signature string) error

func (*RewardAttester) Validate

func (rs *RewardAttester) Validate(claim RewardClaim) error

type RewardClaim

type RewardClaim struct {
	RecipientEthAddress string
	Amount              uint64
	RewardID            string
	RewardAddress       string // Optional - for programmatic rewards
	Specifier           string
	ClaimAuthority      string
	Decimals            uint32
}

func (RewardClaim) Compile

func (claim RewardClaim) Compile() ([]byte, error)

Jump to

Keyboard shortcuts

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