Documentation
¶
Overview ¶
Package daemon is responsible for assembling, running and cleanly shutting down the swap daemon (swapd) and its numerous subcomponents.
Index ¶
- Constants
- func GetMockTokens(t *testing.T, ec extethclient.EthClient) map[string]ethcommon.Address
- func LaunchDaemons(t *testing.T, timeout time.Duration, configs ...*SwapdConfig) context.Context
- func RunSwapDaemon(ctx context.Context, conf *SwapdConfig) (err error)
- func WaitForSwapdStart(t *testing.T, rpcPort uint16)
- type SwapdConfig
Constants ¶
const ( MockDAI = "DAI" MockTether = "USDT" )
map indexes for our mock tokens
Variables ¶
This section is empty.
Functions ¶
func GetMockTokens ¶
GetMockTokens returns a symbol=>address map of our mock ERC20 tokens, deploying them if they haven't already been deployed. Use the constants defined earlier to access the map elements.
func LaunchDaemons ¶
LaunchDaemons launches one or more swapd daemons and blocks until they are started. If more than one config is passed, the bootnode settings of the passed config are modified to make the first daemon the bootnode for the remaining daemons.
func RunSwapDaemon ¶
func RunSwapDaemon(ctx context.Context, conf *SwapdConfig) (err error)
RunSwapDaemon assembles and runs a swapd instance blocking until swapd is shut down. Typically, shutdown happens because a signal handler cancels the passed in context, or when the shutdown RPC method is called.
func WaitForSwapdStart ¶
WaitForSwapdStart takes the rpcPort of a swapd instance and waits for it to be in a listening state. Fails the test if the server isn't listening after a little over 60 seconds.
Types ¶
type SwapdConfig ¶
type SwapdConfig struct {
EnvConf *common.Config
MoneroClient monero.WalletClient
EthereumClient extethclient.EthClient
Libp2pPort uint16
Libp2pKeyfile string
RPCPort uint16
IsRelayer bool
NoTransferBack bool
}
SwapdConfig provides startup parameters for swapd.
func CreateTestConf ¶
func CreateTestConf(t *testing.T, ethKey *ecdsa.PrivateKey) *SwapdConfig
CreateTestConf creates a localhost-only dev environment SwapdConfig config for testing