Documentation ¶
Index ¶
- Constants
- Variables
- func EthAddrLessThan(e, o string) bool
- func NewEthereumSignature(hash []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)
- func SignerFnForPk(privKey *ecdsa.PrivateKey) bind.SignerFn
- func ValidateEthAddress(a string) error
- func ValidateEthereumSignature(hash []byte, signature []byte, ethAddress string) error
- func ValidatePeggyCoin(v sdk.Coin) (string, error)
- type BoundContract
- func (contract *BoundContract) ABI() abi.ABI
- func (contract *BoundContract) Address() common.Address
- func (contract *BoundContract) Client() *ethclient.Client
- func (c *BoundContract) DeployContract(opts *bind.TransactOpts, params ...interface{}) (common.Address, *types.Transaction, error)
- func (contract *BoundContract) SetAddress(address common.Address)
- func (contract *BoundContract) SetClient(client *ethclient.Client)
- func (contract *BoundContract) SetTransact(fn TransactFunc)
- func (contract *BoundContract) Source() *Contract
- func (c *BoundContract) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)
- func (c *BoundContract) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)
- type Contract
- type ERC20Token
- type KeyCache
- type NonceCache
- type TransactFunc
- type Uniquify
- type Wei
- func (w *Wei) Add(amount *Wei) *Wei
- func (w Wei) Bytes() []byte
- func (w *Wei) Div(m int64) *Wei
- func (w *Wei) Ether() float64
- func (w *Wei) Gwei() uint64
- func (w *Wei) Mul(m int64) *Wei
- func (w *Wei) Scan(v interface{}) error
- func (w *Wei) SplitEqual(parts int) []*Wei
- func (w Wei) String() string
- func (w Wei) StringGwei() string
- func (w *Wei) Sub(amount *Wei) *Wei
- func (w *Wei) ToInt() *big.Int
- func (w *Wei) Tokens() float64
Constants ¶
const ( // PeggyDenomPrefix indicates the prefix for all assests minted by this module PeggyDenomPrefix = "inj" // PeggyDenomSeperator is the seperator for peggy denoms PeggyDenomSeperator = "/" // ETHContractAddressLen is the length of contract address strings ETHContractAddressLen = 42 // PeggyDenomLen is the length of the denoms generated by the peggy module PeggyDenomLen = len(PeggyDenomPrefix) + len(PeggyDenomSeperator) + ETHContractAddressLen )
Variables ¶
var ( ErrNoKeyStore = errors.New("no keystore or file for account") ErrKeyDecrypt = errors.New("private key decryption failed") )
Functions ¶
func EthAddrLessThan ¶
EthAddrLessThan migrates the Ethereum address less than function
func NewEthereumSignature ¶
func NewEthereumSignature(hash []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)
NewEthereumSignature creates a new signuature over a given byte array
func SignerFnForPk ¶
func SignerFnForPk(privKey *ecdsa.PrivateKey) bind.SignerFn
func ValidateEthAddress ¶
ValidateEthAddress validates the ethereum address strings
func ValidateEthereumSignature ¶
ValidateEthereumSignature takes a message, an associated signature and public key and returns an error if the signature isn't valid
Types ¶
type BoundContract ¶
type BoundContract struct { *bind.BoundContract // contains filtered or unexported fields }
func BindContract ¶
func BindContract(client *ethclient.Client, contract *Contract) (*BoundContract, error)
func (*BoundContract) ABI ¶
func (contract *BoundContract) ABI() abi.ABI
func (*BoundContract) Address ¶
func (contract *BoundContract) Address() common.Address
func (*BoundContract) Client ¶
func (contract *BoundContract) Client() *ethclient.Client
func (*BoundContract) DeployContract ¶
func (c *BoundContract) DeployContract(opts *bind.TransactOpts, params ...interface{}) (common.Address, *types.Transaction, error)
func (*BoundContract) SetAddress ¶
func (contract *BoundContract) SetAddress(address common.Address)
func (*BoundContract) SetClient ¶
func (contract *BoundContract) SetClient(client *ethclient.Client)
func (*BoundContract) SetTransact ¶
func (contract *BoundContract) SetTransact(fn TransactFunc)
func (*BoundContract) Source ¶
func (contract *BoundContract) Source() *Contract
func (*BoundContract) Transact ¶
func (c *BoundContract) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)
func (*BoundContract) Transfer ¶
func (c *BoundContract) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)
type ERC20Token ¶
type ERC20Token struct { Amount *big.Int `json:"amount"` Contract common.Address `json:"contract,omitempty"` }
func ERC20FromPeggyCoin ¶
func ERC20FromPeggyCoin(v sdk.Coin) (*ERC20Token, error)
ERC20FromPeggyCoin returns the ERC20 representation of a given peggy coin
func NewERC20Token ¶
func NewERC20Token(amount uint64, contract string) *ERC20Token
NewERC20Token returns a new instance of an ERC20
func (*ERC20Token) Add ¶
func (e *ERC20Token) Add(o *ERC20Token) *ERC20Token
Add adds one ERC20 to another
func (*ERC20Token) PeggyCoin ¶
func (e *ERC20Token) PeggyCoin() sdk.Coin
PeggyCoin returns the peggy representation of the ERC20
func (*ERC20Token) ValidateBasic ¶
func (e *ERC20Token) ValidateBasic() error
ValidateBasic permforms stateless validation
type KeyCache ¶
type KeyCache interface { SetPath(account common.Address, path string) bool UnsetPath(account common.Address, path string) PrivateKey(account common.Address, password string) (key *ecdsa.PrivateKey, ok bool) SetPrivateKey(account common.Address, pk *ecdsa.PrivateKey) UnsetKey(account common.Address, password string) SignerFn(account common.Address, password string) bind.SignerFn }
func NewKeyCache ¶
func NewKeyCache() KeyCache
type NonceCache ¶
type NonceCache interface { Serialize(account common.Address, fn func() error) error Sync(account common.Address, syncFn func() (uint64, error)) Set(account common.Address, nonce int64) Get(account common.Address) int64 Incr(account common.Address) int64 Decr(account common.Address) int64 }
func NewNonceCache ¶
func NewNonceCache() NonceCache
type TransactFunc ¶
type TransactFunc func(opts *bind.TransactOpts, contract *common.Address, input []byte) (*types.Transaction, error)
type Uniquify ¶
type Uniquify interface { // Call executes only one callable with same id at a time. // Multilpe asynchronous calls with same id will be executed sequentally. Call(id string, callable func() error) error }
Uniquify is a type of advanced mutex. It allows to create named resource locks.
func NewUniquify ¶
func NewUniquify() Uniquify
NewUniquify returns a new thread-safe uniquify object.
type Wei ¶
func DecimalToWei ¶
func DecimalWei ¶
func (*Wei) Gwei ¶
Gwei is an unsafe way to represent Wei as uint64, used for gas price reporting and should not be used for math.
func (*Wei) SplitEqual ¶
SplitEqual splits the amount into n-1 equal amounts and one remainder. Example: (1000).SplitEqual(7) yields [142 142 142 142 142 142 148]