vc

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrZeroSubject = errors.New("subject cannot be 0")
)

Functions

func AbiEncodeClaim

func AbiEncodeClaim(claim AgentData) ([]byte, error)

func Digest

func Digest(
	chainId int64, verifyingContract common.Address, vc *abigen.VerifiableCredential,
) (common.Hash, error)

func NewVerifiableCredential

func NewVerifiableCredential(
	issuer common.Address,
	subject *big.Int,
	epochIssued *big.Int,
	epochValidUntil *big.Int,
	value *big.Int,
	action [4]byte,
	target uint64,
	claim AgentData,
) (*abigen.VerifiableCredential, error)

func NullishVerifiableCredential

func NullishVerifiableCredential(claim AgentData) (*abigen.VerifiableCredential, error)

func TypedEIP712

func TypedEIP712(
	chainId int64,
	verifyingContract common.Address,
	vc *abigen.VerifiableCredential,
) apitypes.TypedData

Types

type AgentData

type AgentData struct {
	AgentValue                  *big.Int
	CollateralValue             *big.Int
	ExpectedDailyFaultPenalties *big.Int
	ExpectedDailyRewards        *big.Int
	Gcred                       *big.Int
	QaPower                     *big.Int
	Principal                   *big.Int
	FaultySectors               *big.Int
	LiveSectors                 *big.Int
	GreenScore                  *big.Int
}

func AbiDecodeClaim

func AbiDecodeClaim(claim []byte) (*AgentData, error)

func DecodeVCClaims added in v1.1.0

func DecodeVCClaims(vcred *abigen.VerifiableCredential) (*AgentData, error)

func EmptyAgentData

func EmptyAgentData() *AgentData

Jump to

Keyboard shortcuts

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