systemSmartContracts

package
v1.0.113 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthStaking        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowStaking          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupStaking = fmt.Errorf("proto: unexpected end of group")
)

Functions

func CheckIfNil

func CheckIfNil(args *vmcommon.ContractCallInput) error

CheckIfNil verifies if contract call input is not nil

func NewStakingAuctionSmartContract

func NewStakingAuctionSmartContract(
	args ArgsStakingAuctionSmartContract,
) (*stakingAuctionSC, error)

NewStakingAuctionSmartContract creates an auction smart contract

func NewStakingSmartContract

func NewStakingSmartContract(
	args ArgsNewStakingSmartContract,
) (*stakingSC, error)

NewStakingSmartContract creates a staking smart contract

func NewVMContext

func NewVMContext(
	blockChainHook vmcommon.BlockchainHook,
	cryptoHook vmcommon.CryptoHook,
	inputParser vm.ArgumentsParser,
) (*vmContext, error)

NewVMContext creates a context where smart contracts can run and write

Types

type ArgsNewStakingSmartContract

type ArgsNewStakingSmartContract struct {
	MinNumNodes              uint32
	MinStakeValue            *big.Int
	UnBondPeriod             uint64
	Eei                      vm.SystemEI
	StakingAccessAddr        []byte
	JailAccessAddr           []byte
	NumRoundsWithoutBleed    uint64
	BleedPercentagePerRound  float64
	MaximumPercentageToBleed float64
	GasCost                  vm.GasCost
}

ArgsNewStakingSmartContract holds the arguments needed to create a StakingSmartContract

type ArgsStakingAuctionSmartContract

type ArgsStakingAuctionSmartContract struct {
	NodesConfigProvider vm.NodesConfigProvider
	ValidatorSettings   vm.ValidatorSettingsHandler
	Eei                 vm.SystemEI
	SigVerifier         vm.MessageSignVerifier
	StakingSCAddress    []byte
	AuctionSCAddress    []byte
	GasCost             vm.GasCost
}

ArgsStakingAuctionSmartContract is the arguments structure to create a new StakingAuctionSmartContract

type AuctionConfig

type AuctionConfig struct {
	MinStakeValue *big.Int `json:"MinStakeValue"`
	NumNodes      uint32   `json:"NumNodes"`
	TotalSupply   *big.Int `json:"TotalSupply"`
	MinStep       *big.Int `json:"MinStep"`
	NodePrice     *big.Int `json:"NodePrice"`
	UnJailPrice   *big.Int `json:"UnJailPrice"`
}

AuctionConfig represents the settings for a specific epoch

type AuctionData

type AuctionData struct {
	RewardAddress   []byte   `json:"RewardAddress"`
	RegisterNonce   uint64   `json:"RegisterNonce"`
	Epoch           uint32   `json:"Epoch"`
	BlsPubKeys      [][]byte `json:"BlsPubKeys"`
	TotalStakeValue *big.Int `json:"TotalStakeValue"`
	LockedStake     *big.Int `json:"LockedStake"`
	MaxStakePerNode *big.Int `json:"MaxStakePerNode"`
}

AuctionData represents what is saved for each validator / bid

type StakedData

type StakedData struct {
	RegisterNonce uint64        `protobuf:"varint,1,opt,name=RegisterNonce,proto3" json:"RegisterNonce"`
	Staked        bool          `protobuf:"varint,2,opt,name=Staked,proto3" json:"Staked"`
	UnStakedNonce uint64        `protobuf:"varint,3,opt,name=UnStakedNonce,proto3" json:"UnStakedNonce"`
	UnStakedEpoch uint32        `protobuf:"varint,6,opt,name=UnStakedEpoch,proto3" json:"UnStakedEpoch"`
	RewardAddress []byte        `protobuf:"bytes,4,opt,name=RewardAddress,proto3" json:"RewardAddress"`
	StakeValue    *math_big.Int `` /* 142-byte string literal not displayed */
	JailedRound   uint64        `protobuf:"varint,7,opt,name=JailedRound,proto3" json:"JailedRound"`
	JailedNonce   uint64        `protobuf:"varint,8,opt,name=JailedNonce,proto3" json:"JailedNonce"`
	UnJailedNonce uint64        `protobuf:"varint,9,opt,name=UnJailedNonce,proto3" json:"UnJailedNonce"`
}

func (*StakedData) Descriptor

func (*StakedData) Descriptor() ([]byte, []int)

func (*StakedData) Equal

func (this *StakedData) Equal(that interface{}) bool

func (*StakedData) GetJailedNonce added in v1.0.110

func (m *StakedData) GetJailedNonce() uint64

func (*StakedData) GetJailedRound

func (m *StakedData) GetJailedRound() uint64

func (*StakedData) GetRegisterNonce

func (m *StakedData) GetRegisterNonce() uint64

func (*StakedData) GetRewardAddress

func (m *StakedData) GetRewardAddress() []byte

func (*StakedData) GetStakeValue

func (m *StakedData) GetStakeValue() *math_big.Int

func (*StakedData) GetStaked

func (m *StakedData) GetStaked() bool

func (*StakedData) GetUnJailedNonce added in v1.0.110

func (m *StakedData) GetUnJailedNonce() uint64

func (*StakedData) GetUnStakedEpoch

func (m *StakedData) GetUnStakedEpoch() uint32

func (*StakedData) GetUnStakedNonce

func (m *StakedData) GetUnStakedNonce() uint64

func (*StakedData) GoString

func (this *StakedData) GoString() string

func (*StakedData) Marshal

func (m *StakedData) Marshal() (dAtA []byte, err error)

func (*StakedData) MarshalTo

func (m *StakedData) MarshalTo(dAtA []byte) (int, error)

func (*StakedData) MarshalToSizedBuffer

func (m *StakedData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StakedData) ProtoMessage

func (*StakedData) ProtoMessage()

func (*StakedData) Reset

func (m *StakedData) Reset()

func (*StakedData) Size

func (m *StakedData) Size() (n int)

func (*StakedData) String

func (this *StakedData) String() string

func (*StakedData) Unmarshal

func (m *StakedData) Unmarshal(dAtA []byte) error

func (*StakedData) XXX_DiscardUnknown

func (m *StakedData) XXX_DiscardUnknown()

func (*StakedData) XXX_Marshal

func (m *StakedData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StakedData) XXX_Merge

func (m *StakedData) XXX_Merge(src proto.Message)

func (*StakedData) XXX_Size

func (m *StakedData) XXX_Size() int

func (*StakedData) XXX_Unmarshal

func (m *StakedData) XXX_Unmarshal(b []byte) error

type StakingNodesConfig added in v1.0.110

type StakingNodesConfig struct {
	MinNumNodes int64
	StakedNodes int64
	JailedNodes int64
}

StakingNodesConfig is the structure which is saved in the storage of the contract to monitor the nodes leaving and registering

Jump to

Keyboard shortcuts

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