libeth

package module
v0.0.0-...-333d3bb Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: GPL-3.0 Imports: 23 Imported by: 2

README

LibETH

CircleCI

A decent Ethereum library, written in Go.

Documentation

Index

Constants

View Source
const (
	Nil = TxExecutionSpeed(iota)
	Slow
	Standard
	Fast
)

TxExecutionSpeed values.

View Source
const (
	Mainnet  = RenNetwork("mainnet")
	Ropsten  = RenNetwork("ropsten")
	Testnet  = RenNetwork("testnet")
	Devnet   = RenNetwork("devnet")
	Localnet = RenNetwork("localnet")
)

Ren networks.

Variables

View Source
var ContractABIs = map[string]string{
	"0xF228173631461642c737855d0a4Be25ce89Dd486": "[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"bytes\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"commitment\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_sig\",\"type\":\"bytes\"}],\"name\":\"mint\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"_sig\",\"type\":\"bytes\"}],\"name\":\"LogMint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_to\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LogBurn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"}]",
	"0x44831d9CDD36FB829eb2D9aA904b1078C496DB56": `[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"},{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]`,
	"0xd56aed911840bd15316ae3038ac7381ebbebd909": "[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_hash\",\"type\":\"bytes32\"},{\"name\":\"_r\",\"type\":\"bytes32\"},{\"name\":\"_s\",\"type\":\"bytes32\"},{\"name\":\"_v\",\"type\":\"uint8\"}],\"name\":\"mint\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"bytes\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"spent\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_hash\",\"type\":\"bytes32\"}],\"name\":\"commitment\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_hash\",\"type\":\"bytes32\"},{\"name\":\"_r\",\"type\":\"bytes32\"},{\"name\":\"_s\",\"type\":\"bytes32\"},{\"name\":\"_v\",\"type\":\"uint8\"}],\"name\":\"verifySig\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_name\",\"type\":\"string\"},{\"name\":\"_symbol\",\"type\":\"string\"},{\"name\":\"_decimals\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LogMint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_to\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LogBurn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"}]",
	"0x981A342073215904C5069CD64204898501689E0f": "[{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"withdrawFees\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"string\"}],\"name\":\"shiftedTokens\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"},{\"name\":\"_symbol\",\"type\":\"string\"},{\"name\":\"_decimals\",\"type\":\"uint8\"}],\"name\":\"newShiftedToken\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_hash\",\"type\":\"bytes32\"},{\"name\":\"_commitment\",\"type\":\"bytes32\"}],\"name\":\"sigHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"spent\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_hash\",\"type\":\"bytes32\"},{\"name\":\"_commitment\",\"type\":\"bytes32\"},{\"name\":\"_sig\",\"type\":\"bytes\"}],\"name\":\"shiftIn\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"bytes\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"shiftOut\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"name\":\"\",\"type\":\"uint16\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"isShiftedToken\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"vault\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_hash\",\"type\":\"bytes32\"},{\"name\":\"_commitment\",\"type\":\"bytes32\"},{\"name\":\"_sig\",\"type\":\"bytes\"}],\"name\":\"verifySig\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_vault\",\"type\":\"address\"},{\"name\":\"_fee\",\"type\":\"uint16\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_token\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LogShiftIn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_token\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"_to\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LogShiftOut\",\"type\":\"event\"}]",
}
View Source
var DevnetAddressBook = AddressBook{

	"DarknodeRegistry":      common.HexToAddress("0x6E1a6b85f05bfec5c24C7a26E302cB28e639651c"),
	"DarknodeRegistryStore": common.HexToAddress("0xC126a308dd07Adfa4a445686dcF7CbC423185593"),
	"DarknodePayment":       common.HexToAddress("0x1f1b1d015Fc31d425C616cC35E39e31686DA69A8"),
	"DarknodePaymentStore":  common.HexToAddress("0x6341DF1012E862f766Fcd72e0fCAAc5a3839CFef"),

	"ShifterRegistry": common.HexToAddress("0x797029C0e76Bb9c8827802c68a5df6e6D93aC14f"),
	"zBTC":            common.HexToAddress("0x4eB1403f565c3e3145Afc3634F16e2F092545C2a"),
	"BTCShifter":      common.HexToAddress("0x7a40fE9FB464510215C41Eae1216973514eeEBB1"),
	"zZEC":            common.HexToAddress("0x92E9aC7c07bb40eD9DAF1DbD88E7Dd77f5754529"),
	"ZECShifter":      common.HexToAddress("0x5345425363A49904De0746E7c991B05380E42E27"),

	"WBTC": common.HexToAddress("0xA1D3EEcb76285B4435550E4D963B8042A8bffbF0"),
	"REN":  common.HexToAddress("0x2CD647668494c1B15743AB283A0f980d90a87394"),
	"ZRX":  common.HexToAddress("0x6EB628dCeFA95802899aD3A9EE0C7650Ac63d543"),
	"OMG":  common.HexToAddress("0x66497ba75dD127b46316d806c077B06395918064"),
	"USDC": common.HexToAddress("0x3f0a4aed397c66d7b7dde1d170321f87656b14cc"),
	"GUSD": common.HexToAddress("0xA9CF366E9fb4F7959452d7a17A6F88ee2A20e9DA"),
	"DAI":  common.HexToAddress("0xc4375b7de8af5a38a93548eb8453a498222c4ff2"),
	"TUSD": common.HexToAddress("0x525389752ffe6487d33EF53FBcD4E5D3AD7937a0"),
	"DGX":  common.HexToAddress("0x7d6D31326b12B6CBd7f054231D47CbcD16082b71"),
	"PAX":  common.HexToAddress("0x3584087444dabf2e0d29284766142ac5c3a9a2b7"),
}

DevnetAddressBook is the address book for the Devnet Ren network on the Kovan Ethereum network.

View Source
var ErrAddressNotFound = errors.New("key does not have an entry in the address book")

ErrAddressNotFound indicates that the given key is not present in the address book.

View Source
var ErrCannotConvertToBigInt = errors.New("cannot convert hex string to int: invalid format")

ErrCannotConvertToBigInt is returned when string cannot be parsed into a big.Int format.

View Source
var ErrDuplicateAddress = errors.New("the key has already been mapped to another address")

ErrDuplicateAddress indicates that there exists another address that has been mapped to the same key.

View Source
var ErrNonceIsOutOfSync = errors.New("nonce is out of sync")

ErrNonceIsOutOfSync indicates that there exists another transaction with the same nonce and a higher or equal gas price as the present transaction.

View Source
var ErrPostConditionCheckFailed = errors.New("post-condition check failed")

ErrPostConditionCheckFailed indicates that the post-condition for executing a transaction failed.

View Source
var ErrPreConditionCheckFailed = errors.New("pre-condition check failed")

ErrPreConditionCheckFailed indicates that the pre-condition for executing a transaction failed.

View Source
var LocalnetAddressBook = AddressBook{

	"DarknodeRegistry":      common.HexToAddress("0xA7F5B11657AA2796B9355DceF075202C26507B9B"),
	"DarknodeRegistryStore": common.HexToAddress("0x46d016F50837a5DF8fe229127e54fb18B621bAeF"),
	"DarknodePayment":       common.HexToAddress("0x7c71E53853863ce0a3BE7D024EF99aba7d872bfe"),
	"DarknodePaymentStore":  common.HexToAddress("0x72Acdf4f0E3245262E46Bd8daCc207Df7CF3A534"),

	"ShifterRegistry": common.HexToAddress("0x33666067A7741B9e88520285C96B776E73281811"),
	"zBTC":            common.HexToAddress("0xDE027035d33CEB2757685E325de1A0b924aA73E6"),
	"BTCShifter":      common.HexToAddress("0x7012ECc13De5Ce416C14C013d9b02b7c37154b37"),
	"zZEC":            common.HexToAddress("0xB7b7be50B13E6817afBb30C93161D0eB388b8f08"),
	"ZECShifter":      common.HexToAddress("0x69AC72Cb35B1AA818e90842C048719a3246ba0BE"),

	"WBTC": common.HexToAddress("0xA1D3EEcb76285B4435550E4D963B8042A8bffbF0"),
	"REN":  common.HexToAddress("0x2CD647668494c1B15743AB283A0f980d90a87394"),
	"ZRX":  common.HexToAddress("0x6EB628dCeFA95802899aD3A9EE0C7650Ac63d543"),
	"OMG":  common.HexToAddress("0x66497ba75dD127b46316d806c077B06395918064"),
	"USDC": common.HexToAddress("0x3f0a4aed397c66d7b7dde1d170321f87656b14cc"),
	"GUSD": common.HexToAddress("0xA9CF366E9fb4F7959452d7a17A6F88ee2A20e9DA"),
	"DAI":  common.HexToAddress("0xc4375b7de8af5a38a93548eb8453a498222c4ff2"),
	"TUSD": common.HexToAddress("0x525389752ffe6487d33EF53FBcD4E5D3AD7937a0"),
	"DGX":  common.HexToAddress("0x7d6D31326b12B6CBd7f054231D47CbcD16082b71"),
	"PAX":  common.HexToAddress("0x3584087444dabf2e0d29284766142ac5c3a9a2b7"),
}

LocalnetAddressBook is the address book for the Localnet Ren network on the Kovan Ethereum network.

View Source
var MainnetAddressBook = AddressBook{

	"DarknodeRegistry":      common.HexToAddress("0x34bd421C7948Bc16f826Fd99f9B785929b121633"),
	"DarknodeRegistryStore": common.HexToAddress("0x06df0657ba5e8f5339e742212669f6e7ee3c5057"),
	"DarknodePayment":       common.HexToAddress("0x5a7802E66b067cB1770ee5b1165AA201690A8B6a"),
	"DarknodePaymentStore":  common.HexToAddress("0x731Ea4Ba77fF184d89dBeB160A0078274Acbe9D2"),

	"DGX":  common.HexToAddress("0x4f3AfEC4E5a3F2A6a1A411DEF7D7dFe50eE057bF"),
	"TUSD": common.HexToAddress("0x0000000000085d4780B73119b644AE5ecd22b376"),
	"REN":  common.HexToAddress("0x408e41876cccdc0f92210600ef50372656052a38"),
	"WBTC": common.HexToAddress("0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"),
	"ZRX":  common.HexToAddress("0xE41d2489571d322189246DaFA5ebDe1F4699F498"),
	"OMG":  common.HexToAddress("0xd26114cd6EE289AccF82350c8d8487fedB8A0C07"),
	"USDC": common.HexToAddress("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"),
	"GUSD": common.HexToAddress("0x056fd409e1d7a124bd7017459dfea2f387b6d5cd"),
	"DAI":  common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
	"PAX":  common.HexToAddress("0x8e870d67f660d95d5be530380d0ec0bd388289e1"),
}

MainnetAddressBook is the address book for the Mainnet Ren network on the main Ethereum network.

View Source
var RopstenAddressBook = AddressBook{}

RopstenAddressBook is the empty address book for the Ropsten Ethereum network.

View Source
var TestnetAddressBook = AddressBook{

	"DarknodeRegistry":      common.HexToAddress("0x1C6309618338D0EDf9a7Ea8eA18E060fD323020D"),
	"DarknodeRegistryStore": common.HexToAddress("0x88e4477e4fdd677aee2dc9376471d45c198669fa"),
	"DarknodePayment":       common.HexToAddress("0x8E11B87547f4072CC8A094F2888201CAF4EA0B9e"),
	"DarknodePaymentStore":  common.HexToAddress("0xA9411C3AD1fBE168fd119A3B32fB481a0b9877A9"),

	"ShifterRegistry": common.HexToAddress("0x1a62cE8d00d061A05A70dB318f7dfE9Ecd9fFcB0"),
	"zBTC":            common.HexToAddress("0x1aFf7F90Bab456637a17d666D647Ea441A189F2d"),
	"BTCShifter":      common.HexToAddress("0x8a0E8dfC2389726DF1c0bAB874dd2C9A6031b28f"),
	"zZEC":            common.HexToAddress("0x51f41985134842Aa009CACdD28B2C69fA97C4738"),
	"ZECShifter":      common.HexToAddress("0xEeC88ec22E6582409631530F44E48057E7Ed9bBa"),

	"WBTC": common.HexToAddress("0xA1D3EEcb76285B4435550E4D963B8042A8bffbF0"),
	"REN":  common.HexToAddress("0x2CD647668494c1B15743AB283A0f980d90a87394"),
	"ZRX":  common.HexToAddress("0x6EB628dCeFA95802899aD3A9EE0C7650Ac63d543"),
	"OMG":  common.HexToAddress("0x66497ba75dD127b46316d806c077B06395918064"),
	"USDC": common.HexToAddress("0x3f0a4aed397c66d7b7dde1d170321f87656b14cc"),
	"GUSD": common.HexToAddress("0xA9CF366E9fb4F7959452d7a17A6F88ee2A20e9DA"),
	"DAI":  common.HexToAddress("0xc4375b7de8af5a38a93548eb8453a498222c4ff2"),
	"TUSD": common.HexToAddress("0x525389752ffe6487d33EF53FBcD4E5D3AD7937a0"),
	"DGX":  common.HexToAddress("0x7d6D31326b12B6CBd7f054231D47CbcD16082b71"),
	"PAX":  common.HexToAddress("0x3584087444dabf2e0d29284766142ac5c3a9a2b7"),
}

TestnetAddressBook is the address book for the Testnet Ren network on the Kovan Ethereum network.

Functions

func SuggestedGasPrice

func SuggestedGasPrice(txSpeed TxExecutionSpeed) (*big.Int, error)

SuggestedGasPrice returns the gas price that ethGasStation recommends for transactions to be mined on Ethereum blockchain based on the speed provided.

Types

type Account

type Account interface {

	// Client that the account is connected to. Using the Client, read-only
	// operations can be executed on Ethereum.
	Client() Client

	// EthClient returns the actual Ethereum client.
	EthClient() *ethclient.Client

	// Address returns the ethereum address of the account holder.
	Address() common.Address

	// BalanceAt returns the wei balance of the account. The block number can be
	// nil, in which case the balance is taken from the latest known block.
	BalanceAt(ctx context.Context, blockNumber *big.Int) (*big.Int, error)

	// Store address in address book.
	WriteAddress(key string, address common.Address)

	// ReadAddress returns address mapped to the given key in the address book.
	ReadAddress(key string) (common.Address, error)

	// Transfer sends the specified value of Eth to the given address.
	Transfer(ctx context.Context, to common.Address, value *big.Int, speed TxExecutionSpeed, confirmBlocks int64, sendAll bool) (*types.Transaction, error)

	ContractTransactCtor(ctx context.Context, contractAddress common.Address, fnName string, params ...[]byte) (func(transactOpts *bind.TransactOpts) (*types.Transaction, error), error)

	// Transact performs a write operation on the Ethereum blockchain. It will
	// first conduct a preConditionCheck and if the check passes, it will
	// repeatedly execute the transaction followed by a postConditionCheck,
	// until the transaction passes and the postConditionCheck returns true.
	// Transact will immediately stop retrying if an ErrReplaceUnderpriced is
	// returned from ethereum.
	Transact(ctx context.Context, speed TxExecutionSpeed, preConditionCheck func() bool, f func(*bind.TransactOpts) (*types.Transaction, error), postConditionCheck func() bool, confirmBlocks int64) (*types.Transaction, error)

	// Sign the given message with the account's private key.
	Sign(msgHash []byte) ([]byte, error)

	// SetGasPrice allows the account holder to set the gasPrice to a specific
	// value.
	SetGasPrice(gasPrice float64)

	// ResetToPendingNonce will wait for a 'coolDown' time (in milliseconds)
	// before updating transaction nonce to current pending nonce.
	ResetToPendingNonce(ctx context.Context, coolDown time.Duration) error

	// FormatTransactionView returns the formatted string with the URL at which
	// the transaction can be viewed.
	FormatTransactionView(msg, txHash string) (string, error)

	NewERC20(addressOrAlias string) (ERC20, error)
}

Account is an Ethereum external account that can submit write transactions to the Ethereum blockchain. An Account is defined by its public address and respective private key.

func NewAccount

func NewAccount(client Client, privateKey *ecdsa.PrivateKey) (Account, error)

NewAccount returns a user account for the provided private key which is connected to an Ethereum client.

type AddressBook

type AddressBook map[string]common.Address

AddressBook maps contract names to their addresses.

func NetworkAddressBook

func NetworkAddressBook(network RenNetwork) AddressBook

type Client

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

Client will have a connection to an ethereum client (specified by the url)

func Connect

func Connect(renNetwork RenNetwork, url string) (Client, error)

Deprecated Connect to an infura network (Supported networks: mainnet and kovan).

func NewClient

func NewClient(renNetwork RenNetwork, URL, wsURL string) (Client, error)

NewClient creates a new client

func NewFullInfuraClient

func NewFullInfuraClient(renNetwork RenNetwork, apiKey string) (Client, error)

NewFullInfuraClient creates a new infura client

func NewInfuraClient

func NewInfuraClient(renNetwork RenNetwork, apiKey string) (Client, error)

NewInfuraClient creates a new infura client

func NewMercuryClient

func NewMercuryClient(renNetwork RenNetwork, tag string) (Client, error)

NewMercuryClient creates a new infura client

func (*Client) BalanceOf

func (client *Client) BalanceOf(ctx context.Context, addr common.Address) (val *big.Int, err error)

BalanceOf returns the ethereum balance of the addr passed.

func (Client) Call

func (client Client) Call(ctx context.Context, address, fnName string, params ...interface{}) ([]interface{}, error)

Call a function on a contract with the given parameters

func (*Client) CurrentBlockNumber

func (client *Client) CurrentBlockNumber(ctx context.Context) (*big.Int, error)

CurrentBlockNumber will retrieve the current block that is confirmed by infura.

func (*Client) EthClient

func (client *Client) EthClient() *ethclient.Client

EthClient returns the ethereum client connection.

func (*Client) EthWSClient

func (client *Client) EthWSClient() *ethclient.Client

EthWSClient returns the ethereum ws client connection.

func (*Client) FormatTransactionView

func (client *Client) FormatTransactionView(msg, txHash string) (string, error)

FormatTransactionView returns the formatted string with the URL at which the transaction can be viewed.

func (*Client) Get

func (client *Client) Get(ctx context.Context, f func() error) (err error)

Get will perform a read-only transaction on the ethereum blockchain.

func (*Client) Network

func (client *Client) Network() (string, error)

Network returns the network of the underlying client.

func (*Client) NewERC20View

func (client *Client) NewERC20View(addressOrAlias string) (ERC20View, error)

func (Client) Query

func (client Client) Query(ctx context.Context, address, fnName string, params ...[]byte) ([]interface{}, error)

Query a function on a contract with the given parameters

func (*Client) ReadAddress

func (client *Client) ReadAddress(key string) (common.Address, error)

ReadAddress from the address book, return an error if the address does not exist

func (*Client) Relay

func (client *Client) Relay(address, fnName string, params ...[]byte) (string, error)

Relay the following transaction.

func (*Client) TxBlockNumber

func (client *Client) TxBlockNumber(ctx context.Context, hash string) (*big.Int, error)

TxBlockNumber retrieves tx's block number using the tx hash.

func (*Client) WaitMined

func (client *Client) WaitMined(ctx context.Context, tx *types.Transaction) (*types.Receipt, error)

WaitMined waits for tx to be mined on the blockchain. It stops waiting when the context is canceled.

func (*Client) WriteAddress

func (client *Client) WriteAddress(key string, address common.Address)

WriteAddress to the address book, overwrite if already exists

type Contracts

type Contracts map[common.Address]string

type ERC20

type ERC20 interface {
	ERC20View
	Transfer(ctx context.Context, to common.Address, amount *big.Int, speed TxExecutionSpeed, sendAll bool) (*types.Transaction, error)
	Approve(ctx context.Context, spender common.Address, amount *big.Int, speed TxExecutionSpeed) (*types.Transaction, error)
	TransferFrom(ctx context.Context, from, to common.Address, amount *big.Int, speed TxExecutionSpeed) (*types.Transaction, error)
}

type ERC20View

type ERC20View interface {
	Decimals(ctx context.Context) (int64, error)
	BalanceOf(ctx context.Context, who common.Address) (*big.Int, error)
	Allowance(ctx context.Context, owner, spender common.Address) (*big.Int, error)
}

type RenNetwork

type RenNetwork string

RenNetwork identifies which set of contract to use.

type TxExecutionSpeed

type TxExecutionSpeed uint8

The TxExecutionSpeed indicates the tier of speed that the transaction falls under while writing to the blockchain.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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