contract

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contract

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

Contract data

func New

func New(provider, coreAddrStr, serviceAccount string, logger *logrus.Entry) (*Contract, error)

New Contract instance

func (*Contract) Close

func (c *Contract) Close() error

Close instance

func (*Contract) GetLatestAvailableBlock

func (c *Contract) GetLatestAvailableBlock() (*big.Int, error)

GetLatestAvailableBlock helper

func (*Contract) GetMntpSwapEvent

func (c *Contract) GetMntpSwapEvent(blockFrom, blockTo *big.Int) (events []*MntpSwapEventWrapper, err error)

GetMntpSwapEvent reads contract logs and collects swap-events

func (*Contract) GetTransactionStatus

func (c *Contract) GetTransactionStatus(hash string) (status TxStatus, err error)

GetTransactionStatus helper

func (*Contract) IsActive

func (c *Contract) IsActive() (bool, error)

IsActive checks if contract is active/enabled

func (*Contract) MntpBalance

func (c *Contract) MntpBalance() (*amount.Amount, error)

MntpBalance checks this contract's MNTP balance

func (*Contract) SendMntp

func (c *Contract) SendMntp(dst common.Address, src mint.PublicKey, amo *amount.Amount) (hash common.Hash, err error)

SendMntp calls contract's sendMntp method, returns transaction hash

func (*Contract) ServiceHasRights

func (c *Contract) ServiceHasRights() (bool, error)

ServiceHasRights checks service account address has rights on the contract

type MntpSwapEvent

type MntpSwapEvent struct {
	From   common.Address
	Amount *big.Int
	To     [32]byte
}

MntpSwapEvent contains related event data

type MntpSwapEventWrapper

type MntpSwapEventWrapper struct {
	Event           *MntpSwapEvent
	TransactionHash common.Hash
}

MntpSwapEventWrapper wraps MntpSwapEvent with extra data

type TxStatus

type TxStatus uint64

TxStatus describes Ethereum transaction status

const (
	// EthTxUnknown means transaction wasn't found (possibly provider still hasn't received it)
	EthTxUnknown TxStatus = 0
	// EthTxPending means transaction is in a queue
	EthTxPending TxStatus = 1
	// EthTxSuccess means transaction is confirmed
	EthTxSuccess TxStatus = 2
	// EthTxFailed means transaction is failed
	EthTxFailed TxStatus = 3
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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