exitscan

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package exitscan NodeDAO operator exit scan

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExitFilter

type ExitFilter interface {
	// Filter To filter for exit
	// @return []*VnftRecord{} Filtered
	Filter(operatorId *big.Int, vnftRecords []*VnftRecord) ([]*VnftRecord, error)
}

ExitFilter filter the exit for vNFT and nETH. Validator's exit is asynchrony. The reasons for asynchrony are: 1. The validator exit goes through the lifetime of the beacon. 2. NodeDAO-Oracle is required to report to settle. -------------------------------------------- Filter The operator needs to implement it by itself, and the easiest way is to use db. An example implementation will be provided, based on MySQL, see Example.

type ExitMarker

type ExitMarker interface {
	// ExitMark Mark the exit of the Vnft Record.
	ExitMark(operatorId *big.Int, vnftRecords []*VnftRecord) error
}

ExitMarker To perform a validator exit, it needs to be flagged, and then it is used for filter. -------------------------------------------- The simplest way to implement the operator is to use db, see example.

type ExitScanner

type ExitScanner interface {
	ExitScan(operatorId *big.Int) ([]*VnftRecord, error)
}

ExitScanner Scan the smart contract for records that need to be exited.

type NETHExitScan

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

NETHExitScan nETH exit scan Only largeRequest nETH needs to be scanned to exit

func NewNETHExitScan

func NewNETHExitScan(ctx context.Context, network, elAddr string) (*NETHExitScan, error)

NewNETHExitScan new nETH exit scan

func (*NETHExitScan) ExitCounter

func (s *NETHExitScan) ExitCounter(filterWithdrawalRequests []*WithdrawalRequest) (uint32, error)

ExitCounter Calculate the number of validators that need to be exited by a Withdrawal Request @param filterWithdrawalRequests A list of offline filtered Withdrawal Requests -------------------------------------------------------- if sumETHAmount = 64 ether, need to exit 2 validator if sumETHAmount = 66 ether, need to exit 3 validator

func (*NETHExitScan) ExitScan

func (s *NETHExitScan) ExitScan(operatorId *big.Int) ([]*VnftRecord, error)

ExitScan Filter for exits !!! Use the filtered []WithdrawalRequest to operator @param operatorId operator id

func (*NETHExitScan) WithdrawalRequestScan

func (s *NETHExitScan) WithdrawalRequestScan(operatorId *big.Int) ([]*WithdrawalRequest, error)

WithdrawalRequestScan Scanning the smart contract requires processing the exiting WithdrawalRequest. !!! Handling exits is delayed, and additional operations are required to mark and filter the WithdrawalRequest, the simplest way is to use db, see example for this part.

type StakeType

type StakeType uint32
const (
	VNFT StakeType = iota
	NETH
)

type VnftExitScan

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

VnftExitScan vnft exit scan

func NewVnftExitScan

func NewVnftExitScan(ctx context.Context, network, elAddr string) (*VnftExitScan, error)

NewVnftExitScan new vnft exit scan

func (*VnftExitScan) ExitScan

func (s *VnftExitScan) ExitScan(operatorId *big.Int) ([]*VnftRecord, error)

ExitScan get contract need exit vnft list

type VnftOwner

type VnftOwner uint32
const (
	USER VnftOwner = iota
	LiquidStaking
)

func GetVnftOwner

func GetVnftOwner(stakeType StakeType) VnftOwner

type VnftOwnerValidator

type VnftOwnerValidator interface {
	// VerifyVnftOwner Verify that the stakeType of vnft tokenIds and vnftOwner match.
	// ----------------------------------------------------------------
	// The relationship between StakeType and VnftOwner is as follows:
	// ----------------------
	// StakeType | VnftOwner
	// ----------------------
	// VNFT      | USER
	// NETH      | LiquidStaking
	VerifyVnftOwner(network string, stakeType StakeType, vnftOwner VnftOwner, tokenIds []*big.Int) (bool, error)
}

VnftOwnerValidator 'VnftOwnerValidator' is used to verify that the relationship between the validator 'StakeType' and 'VnftOwner' is correct.

type VnftOwnerVerify

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

func NewVnftOwnerVerify

func NewVnftOwnerVerify(ctx context.Context, network, elAddr string) (*VnftOwnerVerify, error)

NewVnftOwnerVerify new vnft owner verify

func (*VnftOwnerVerify) VerifyStakeType added in v1.0.0

func (e *VnftOwnerVerify) VerifyStakeType(network string, tokenId *big.Int) (StakeType, error)

VerifyStakeType Verify that the stakeType of vnft tokenIds

func (*VnftOwnerVerify) VerifyVnftOwner

func (e *VnftOwnerVerify) VerifyVnftOwner(network string, stakeType StakeType, vnftOwner VnftOwner, tokenIds []*big.Int) (bool, error)

VerifyVnftOwner Verify that the stakeType of vnft tokenIds and vnftOwner match ---------------------------------------------------------------- The relationship between StakeType and VnftOwner is as follows: ---------------------- StakeType | VnftOwner ---------------------- VNFT | USER NETH | LiquidStaking

type VnftRecord

type VnftRecord struct {
	Network    string
	OperatorId *big.Int
	TokenId    *big.Int
	Pubkey     string
	Type       StakeType
}

func (*VnftRecord) String

func (v *VnftRecord) String() string

type WithdrawalRequest

type WithdrawalRequest struct {
	ID                    *big.Int
	WithdrawalRequestInfo *withdrawalRequest.WithdrawalRequestWithdrawalInfo
}

func (*WithdrawalRequest) String

func (v *WithdrawalRequest) String() string

type WithdrawalRequestExitValidatorCounter

type WithdrawalRequestExitValidatorCounter interface {
	// ExitCounter Calculate the number of validators that need to be exited by a Withdrawal Request
	// @param filterWithdrawalRequests  A list of offline filtered Withdrawal Requests
	ExitCounter(filterWithdrawalRequests []*WithdrawalRequest) (uint32, error)
}

WithdrawalRequestExitValidatorCounter Calculate the number of validators that need to be exited by a Withdrawal Request

type WithdrawalRequestFilter

type WithdrawalRequestFilter interface {
	// WithdrawalRequestFilter To filter for WithdrawalRequests.
	// @return []*WithdrawalRequest Filtered WithdrawalRequests.
	WithdrawalRequestFilter(operatorId *big.Int, withdrawalRequests []*WithdrawalRequest) ([]*WithdrawalRequest, error)
}

WithdrawalRequestFilter To filter for WithdrawalRequests. -------------------------------------------- The simplest way to implement the operator is to use db, see example.

type WithdrawalRequestMarker

type WithdrawalRequestMarker interface {
	// WithdrawalRequestMark To mark deal for WithdrawalRequest
	WithdrawalRequestMark(operatorId *big.Int, withdrawalRequests []*WithdrawalRequest) error
}

WithdrawalRequestMarker To mark deal for WithdrawalRequest. -------------------------------------------- The simplest way to implement the operator is to use db, see example.

type WithdrawalRequestScanner

type WithdrawalRequestScanner interface {
	ExitScanner

	// WithdrawalRequestScan Scan for unclaimed Withdrawal Requests
	WithdrawalRequestScan(operatorId *big.Int) ([]*withdrawalRequest.WithdrawalRequestWithdrawalInfo, error)
}

WithdrawalRequestScanner nETH exit depends on the WithdrawalRequest. vNFT exit can be used directly with Exit Scanner.

Jump to

Keyboard shortcuts

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