Documentation ¶
Overview ¶
Package containing objects and functions which aid in the contruction and execution of our Geth-based spec suite
Index ¶
- Constants
- Variables
- func Commafy(n *big.Int) string
- func GenBytes32(str string) [32]byte
- func GetAuthObject() *bind.TransactOpts
- func GetCallOpts(auth *bind.TransactOpts) *bind.CallOpts
- func GetTxOpts(auth *bind.TransactOpts, val *big.Int, price *big.Int, limit uint64) *bind.TransactOpts
- func IfNotNil(l logish, err error, msg string)
- func MaybeIncreaseMarketTokenAllowance(c *Ctx, d *Dep, owner *bind.TransactOpts, spender common.Address, ...) error
- func MaybeTransferMarketToken(c *Ctx, d *Dep, from *bind.TransactOpts, to common.Address, thresh *big.Int) error
- type Ctx
- type Dep
- type Params
Constants ¶
const MIN_VOTE_BY = 86400
MIN_VOTE_BY is one day, in seconds
const ONE_ETH = 1000000000000000000
const ONE_FINNEY = 1000000000000000
const ONE_GWEI = 1000000000
const ONE_KWEI = 1000
const ONE_MWEI = 1000000
const ONE_SZABO = 1000000000000
Variables ¶
var APPLICATION = big.NewInt(1)
var BACKEND_PAYMENT = big.NewInt(8)
var CHALLENGE = big.NewInt(2)
var COST_PER_BYTE = big.NewInt(11)
var LIST_REWARD = big.NewInt(5)
var MAKER_PAYMENT = big.NewInt(9)
var PLURALITY = big.NewInt(6)
var PRICE_FLOOR = big.NewInt(2)
var REGISTRATION = big.NewInt(4)
var REPARAM = big.NewInt(3)
var SPREAD = big.NewInt(4)
var STAKE = big.NewInt(1)
var UNDEFINED = big.NewInt(0)
var VOTE_BY = big.NewInt(7)
Functions ¶
func Commafy ¶
Commafy will take a big integer and return a string with commas so that logging big integers is human readable
func GenBytes32 ¶
GenBytes32 is a convenience function for some tests where a "GetHash" method is not available. Returns a type compatible with bytes32, given a string 32 chars or less.
func GetCallOpts ¶
func GetCallOpts(auth *bind.TransactOpts) *bind.CallOpts
GetCallOpts is a function which allows us to more succinctly place Call options
func GetTxOpts ¶
func GetTxOpts(auth *bind.TransactOpts, val *big.Int, price *big.Int, limit uint64) *bind.TransactOpts
GetTxOpts is a function which allows us to more succintly place the transaction options into a "send" type transaction. We do this in place of wrapping our TX in a global session variable, as, we tend to use different values in various places. Returns the assembled Geth TransactOpts
func MaybeIncreaseMarketTokenAllowance ¶
func MaybeIncreaseMarketTokenAllowance(c *Ctx, d *Dep, owner *bind.TransactOpts, spender common.Address, thresh *big.Int) error
MaybeApprove is a convenience method that inspects the Market Token Allowance of one address to another. If it is below the given threshold, increase the allowance until it meets said threshold Returns any error incurred.
func MaybeTransferMarketToken ¶
func MaybeTransferMarketToken(c *Ctx, d *Dep, from *bind.TransactOpts, to common.Address, thresh *big.Int) error
MaybeTransferMarketToken is a convenience method that inspects the Market Token balance of a given address. If it is below the given threshold, increase the balance via transfer until it meets said threshold Returns any error incurred.
Types ¶
type Ctx ¶
type Ctx struct { Alloc core.GenesisAlloc AuthOwner *bind.TransactOpts AuthBackend *bind.TransactOpts AuthUser1 *bind.TransactOpts AuthUser2 *bind.TransactOpts AuthUser3 *bind.TransactOpts Blockchain *backends.SimulatedBackend }
Ctx, holds Auth objects capable of signing transactions. Not every spec will use every Auth object but they all should be available here, rather than scattered about many specs. Also holds the Geth simulated backend.
func GetContext ¶
GetContext returns a hydrated Ctx struct, ready for use. Given a bal argument, it assigns this as the wallet balance for each authorization object in the Ctx
type Dep ¶
type Dep struct { EtherTokenAddress common.Address EtherTokenContract *ethertoken.EtherToken EtherTokenTransaction *types.Transaction MarketTokenAddress common.Address MarketTokenContract *markettoken.MarketToken MarketTokenTransaction *types.Transaction VotingAddress common.Address VotingContract *voting.Voting VotingTransaction *types.Transaction ParameterizerAddress common.Address ParameterizerContract *parameterizer.Parameterizer ParameterizerTransaction *types.Transaction DatatrustAddress common.Address DatatrustContract *datatrust.Datatrust DatatrustTransaction *types.Transaction ListingAddress common.Address ListingContract *listing.Listing ListingTransaction *types.Transaction ReserveAddress common.Address ReserveContract *reserve.Reserve ReserveTransaction *types.Transaction }
The deployed struct holds references to the instantiated contracts on the simulated backend. Also, refernces to each contract's adress and the deployment transaction itself, in case we want to inspect it.
func Deploy ¶
Deploy function which, well, deploys our contracts - returning a hydrated Dep object ready for use. The mtBal argument is an amount of market token(in wei) credited to the AuthOwner Also passed a hydrated Ctx object, used to aid the deploying. Params arg is hydrated with values for the parameterizer. Returns a hydrated Dep object or any error incurred.