blockchain

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ETHAddr is ethereum address
	ETHAddr = common.HexToAddress("0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")

	// KNCAddr is KNC token address
	KNCAddr = common.HexToAddress("0xdd974D5C2e2928deA5F71b9825b8b646686BD200")

	// WETHAddr is wrapped ETH address
	WETHAddr = common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")

	// KCCAddr is Kyber Community Coupon token address
	KCCAddr = common.HexToAddress("0x09677D0175DEC51E2215426Cddd055a71bf4228d")
)

Functions

func EthToWei

func EthToWei(n float64) *big.Int

EthToWei converts Gwei as a float to Wei as a big int

func IsBurnable

func IsBurnable(token ethereum.Address) bool

IsBurnable indicate if the burn fee event was emitted when the given token was trade on KyberNetwork

Types

type BlockTimeResolver

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

BlockTimeResolver is a helper to get transaction timestamp from block number. It has a cache for one block.

func NewBlockTimeResolver

func NewBlockTimeResolver(sugar *zap.SugaredLogger, client *ethclient.Client) (*BlockTimeResolver, error)

NewBlockTimeResolver returns BlockTimeResolver instance given a ethereum client.

func (*BlockTimeResolver) Resolve

func (btr *BlockTimeResolver) Resolve(blockNumber uint64) (time.Time, error)

Resolve returns timestamp from block number. It cachedHeaders block number and block header to reduces the number of request to node.

type BlockTimeResolverInterface

type BlockTimeResolverInterface interface {
	Resolve(blockNumber uint64) (time.Time, error)
}

BlockTimeResolverInterface define the functionality

type MockBlockTimeResolve

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

MockBlockTimeResolve is the mock implementation of blockTimeResolver for testing

func NewMockBlockTimeResolve

func NewMockBlockTimeResolve(ts time.Time) *MockBlockTimeResolve

NewMockBlockTimeResolve creates new instance of MockBlockTimeResolve

func (*MockBlockTimeResolve) Resolve

func (btr *MockBlockTimeResolve) Resolve(_ uint64) (time.Time, error)

Resolve return current time as mock result for block time

Jump to

Keyboard shortcuts

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