internalcontract

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: LGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminControl

type AdminControl struct {
	sdk.Contract
}

AdminControl contract

func NewAdminControl

func NewAdminControl(client sdk.ClientOperator) (ac AdminControl, err error)

NewAdminControl gets the AdminControl contract object

func (*AdminControl) Destroy

func (ac *AdminControl) Destroy(option *types.ContractMethodSendOption, contractAddr types.Address) (types.Hash, error)

Destroy destroies contract `contractAddr`.

func (*AdminControl) GetAdmin

func (ac *AdminControl) GetAdmin(option *types.ContractMethodCallOption, contractAddr types.Address) (types.Address, error)

GetAdmin returns admin of specific contract

func (*AdminControl) SetAdmin

func (ac *AdminControl) SetAdmin(option *types.ContractMethodSendOption, contractAddr types.Address, newAdmin types.Address) (types.Hash, error)

SetAdmin sets the administrator of contract `contractAddr` to `newAdmin`.

type Sponsor struct {
	sdk.Contract
}

Sponsor represents SponsorWhitelistControl contract

func NewSponsor

func NewSponsor(client sdk.ClientOperator) (s Sponsor, err error)

NewSponsor gets the SponsorWhitelistControl contract object

func (*Sponsor) AddPrivilegeByAdmin

func (s *Sponsor) AddPrivilegeByAdmin(option *types.ContractMethodSendOption, contractAddr types.Address, userAddresses []types.Address) (types.Hash, error)

AddPrivilegeByAdmin for admin adds user to whitelist

func (*Sponsor) GetSponsorForCollateral

func (s *Sponsor) GetSponsorForCollateral(option *types.ContractMethodCallOption, contractAddr types.Address) (address types.Address, err error)

GetSponsorForCollateral gets collateral sponsor address

func (*Sponsor) GetSponsorForGas

func (s *Sponsor) GetSponsorForGas(option *types.ContractMethodCallOption, contractAddr types.Address) (address types.Address, err error)

GetSponsorForGas gets gas sponsor address of specific contract

func (*Sponsor) GetSponsoredBalanceForCollateral

func (s *Sponsor) GetSponsoredBalanceForCollateral(option *types.ContractMethodCallOption, contractAddr types.Address) (*big.Int, error)

GetSponsoredBalanceForCollateral gets current Sponsored Balance for collateral

func (*Sponsor) GetSponsoredBalanceForGas

func (s *Sponsor) GetSponsoredBalanceForGas(option *types.ContractMethodCallOption, contractAddr types.Address) (*big.Int, error)

GetSponsoredBalanceForGas gets current Sponsored Balance for gas

func (*Sponsor) GetSponsoredGasFeeUpperBound

func (s *Sponsor) GetSponsoredGasFeeUpperBound(option *types.ContractMethodCallOption, contractAddr types.Address) (*big.Int, error)

GetSponsoredGasFeeUpperBound gets current Sponsored Gas fee upper bound

func (*Sponsor) IsAllWhitelisted

func (s *Sponsor) IsAllWhitelisted(option *types.ContractMethodCallOption, contractAddr types.Address) (bool, error)

IsAllWhitelisted checks if all users are in a contract's whitelist

func (*Sponsor) IsWhitelisted

func (s *Sponsor) IsWhitelisted(option *types.ContractMethodCallOption, contractAddr types.Address, userAddr types.Address) (bool, error)

IsWhitelisted checks if a user is in a contract's whitelist

func (*Sponsor) RemovePrivilegeByAdmin

func (s *Sponsor) RemovePrivilegeByAdmin(option *types.ContractMethodSendOption, contractAddr types.Address, userAddresses []types.Address) (types.Hash, error)

RemovePrivilegeByAdmin for admin removes user from whitelist

func (*Sponsor) SetSponsorForCollateral

func (s *Sponsor) SetSponsorForCollateral(option *types.ContractMethodSendOption, contractAddr types.Address) (types.Hash, error)

SetSponsorForCollateral for someone sponsor the storage collateral for contract `contractAddr`, it is payable

func (*Sponsor) SetSponsorForGas

func (s *Sponsor) SetSponsorForGas(option *types.ContractMethodSendOption, contractAddr types.Address, upperBound *big.Int) (types.Hash, error)

SetSponsorForGas for someone sponsor the gas cost for contract `contractAddr` with an `upper_bound` for a single transaction, it is payable

type Staking

type Staking struct {
	sdk.Contract
}

Staking contract

func NewStaking

func NewStaking(client sdk.ClientOperator) (s Staking, err error)

NewStaking gets the Staking contract object

func (*Staking) Deposit

func (s *Staking) Deposit(option *types.ContractMethodSendOption, amount *big.Int) (types.Hash, error)

Deposit `amount` cfx in this contract

func (*Staking) GetLockedStakingBalance

func (ac *Staking) GetLockedStakingBalance(option *types.ContractMethodCallOption, user types.Address, blockNumber *big.Int) (*big.Int, error)

GetLockedStakingBalance returns user's locked staking balance at given blockNumber Note: if the blockNumber is less than the current block number, function will return current locked staking balance.

func (*Staking) GetStakingBalance

func (ac *Staking) GetStakingBalance(option *types.ContractMethodCallOption, user types.Address) (*big.Int, error)

GetStakingBalance returns user's staking balance

func (*Staking) GetVotePower

func (ac *Staking) GetVotePower(option *types.ContractMethodCallOption, user types.Address, blockNumber *big.Int) (*big.Int, error)

GetVotePower returns user's vote power staking balance at given blockNumber

func (*Staking) VoteLock

func (s *Staking) VoteLock(option *types.ContractMethodSendOption, amount *big.Int, unlockBlockNumber *big.Int) (types.Hash, error)

VoteLock will locks `amount` cfx from current to next `unlockBlockNumber` blocks for obtain vote power

func (*Staking) Withdraw

func (s *Staking) Withdraw(option *types.ContractMethodSendOption, amount *big.Int) (types.Hash, error)

Withdraw `amount` cfx from this contract

Jump to

Keyboard shortcuts

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