Documentation ¶
Index ¶
- Constants
- func CallFail(t *testing.T, url string, msg ...string)
- func CallJSON(t *testing.T, url string) (body []byte)
- func DeclarePools(pools ...string)
- func DeleteTables(t *testing.T)
- func HideTestLogs(t *testing.T)
- func InitTest(t *testing.T)
- func InitTestBlocks(t *testing.T) *blockCreator
- func InsertBlockLog(t *testing.T, height int64, fakeTimestamp string) (hash string)
- func InsertBlockPoolDepth(t *testing.T, pool string, assetE8, runeE8 int64, blockTimestamp string)
- func InsertBondEvent(t *testing.T, fake FakeBond)
- func InsertMintBurnEvent(t *testing.T, fake FakeMintBurn)
- func InsertPoolEvents(t *testing.T, pool, status string)
- func InsertRewardsEvent(t *testing.T, bondE8 int64, fakeTimestamp string)
- func InsertRewardsEventEntry(t *testing.T, bondE8 int64, pool, fakeTimestamp string)
- func InsertStakeEvent(t *testing.T, fake FakeStake)
- func InsertSwapEvent(t *testing.T, fake FakeSwap)
- func InsertSwitchEvent(t *testing.T, fake FakeSwitch)
- func InsertUpdateNodeAccountStatusEvent(t *testing.T, fake FakeNodeStatus, blockTimestamp string)
- func InsertWithdrawEvent(t *testing.T, fake FakeWithdraw)
- func JSONFailGeneral(t *testing.T, url string)
- func MustExec(t *testing.T, query string, args ...interface{})
- func MustUnmarshal(t *testing.T, data []byte, v interface{})
- func RegisterThornodeNodes(nodeAccounts []notinchain.NodeAccount)
- func RegisterThornodeReserve(totalReserve int64)
- func RoughlyEqual(t *testing.T, expected float64, actual string)
- func ScenarioTenSwaps(t *testing.T, blocks *blockCreator)
- func SecToString(s db.Second) string
- func SetThornodeConstant(t *testing.T, name string, value int64, timestamp string)
- func SetupTestDB(t *testing.T)
- func StartMockThornode() (deactivateCallback func())
- func StrToNano(s string) db.Nano
- type ActiveVault
- type AddLiquidity
- type Amount
- type Donate
- type FakeBond
- type FakeEvent
- type FakeMintBurn
- type FakeNodeStatus
- type FakeStake
- type FakeSwap
- type FakeSwitch
- type FakeWithdraw
- type Fee
- type LoanOpen
- type LoanOpenV118
- type LoanRepayment
- type LoanRepaymentV118
- type Outbound
- type PendingLiquidity
- type PendingTypeEnum
- type PoolStatus
- type Refund
- type Rewards
- type ScheduledOutbound
- type SetMimir
- type StatusName
- type StreamingSwapDetails
- type Swap
- type Switch
- type THORName
- type Transfer
- type UpdateNodeAccountStatus
- type Version
- type Withdraw
Constants ¶
View Source
const OMIT_FIELD = "OMIT_FIELD"
Variables ¶
This section is empty.
Functions ¶
func DeclarePools ¶
func DeclarePools(pools ...string)
func DeleteTables ¶
func InitTestBlocks ¶
Use this when full blocks are added.
func InsertBlockLog ¶
func InsertBlockPoolDepth ¶
func InsertBondEvent ¶
func InsertMintBurnEvent ¶
func InsertMintBurnEvent(t *testing.T, fake FakeMintBurn)
func InsertPoolEvents ¶
func InsertRewardsEventEntry ¶
func InsertStakeEvent ¶
func InsertSwapEvent ¶
func InsertSwitchEvent ¶
func InsertSwitchEvent(t *testing.T, fake FakeSwitch)
func InsertUpdateNodeAccountStatusEvent ¶
func InsertUpdateNodeAccountStatusEvent(t *testing.T, fake FakeNodeStatus, blockTimestamp string)
func InsertWithdrawEvent ¶
func InsertWithdrawEvent(t *testing.T, fake FakeWithdraw)
func JSONFailGeneral ¶
func MustUnmarshal ¶
func RegisterThornodeNodes ¶
func RegisterThornodeNodes(nodeAccounts []notinchain.NodeAccount)
func RegisterThornodeReserve ¶
func RegisterThornodeReserve(totalReserve int64)
func ScenarioTenSwaps ¶
A test scenario with 10 swaps 4x rune -> asset: volume 40, fee 4, slip 5 3x asset -> rune: volume 3000 + 300, fee 300, slip 6 2x rune -> synth: volume 200000, fee 20000, slip 7 1x synth -> rune: volume 10000000 + 1000000, fee 1000000, slip 8
func SecToString ¶
func SetThornodeConstant ¶
func SetupTestDB ¶
func StartMockThornode ¶
func StartMockThornode() (deactivateCallback func())
Starts Thornode HTTP mock with some simiple / empty results.
Types ¶
type ActiveVault ¶
type ActiveVault struct {
AddVault string
}
func (ActiveVault) ToTendermint ¶
func (x ActiveVault) ToTendermint() abci.Event
type AddLiquidity ¶
type AddLiquidity struct { Pool string AssetAmount int64 RuneAmount int64 AssetAddress string RuneAddress string RuneTxID string AssetTxID string LiquidityProviderUnits int64 // If 0 defaults to 1 }
func (AddLiquidity) ToTendermint ¶
func (x AddLiquidity) ToTendermint() abci.Event
type Donate ¶
type Donate struct { Chain string Coin string FromAddress string ToAddress string TxID string Memo string Pool string }
func (Donate) ToTendermint ¶
type FakeMintBurn ¶
type FakeNodeStatus ¶
type FakeSwap ¶
type FakeSwap struct { Tx string Pool string FromAsset string FromE8 int64 FromAddr string ToE8 int64 ToAddr string LiqFeeInRuneE8 int64 LiqFeeE8 int64 SwapSlipBP int64 ToE8Min int64 BlockTimestamp string }
TODO(muninn): Remove, migrate remaining tests to FakeBlocks.
type FakeSwitch ¶
type FakeWithdraw ¶
type Fee ¶
func (Fee) ToTendermint ¶
type LoanOpen ¶
type LoanOpen struct { Owner string CollateralUp int64 DebtUpTor int64 CollateralAsset string CollateralizationRatio int64 TargetAsset string }
func (LoanOpen) ToTendermint ¶
type LoanOpenV118 ¶
type LoanOpenV118 struct { Owner string CollateralDeposited int64 DebtIssuedTor int64 CollateralAsset string CollateralizationRatio int64 TargetAsset string }
func (LoanOpenV118) ToTendermint ¶
func (x LoanOpenV118) ToTendermint() abci.Event
type LoanRepayment ¶
type LoanRepayment struct { Owner string CollateralDown int64 DebtDownTor int64 CollateralAsset string }
func (LoanRepayment) ToTendermint ¶
func (x LoanRepayment) ToTendermint() abci.Event
type LoanRepaymentV118 ¶
type LoanRepaymentV118 struct { Owner string CollateralWithdrawn int64 DebtRepaidTor int64 CollateralAsset string }
func (LoanRepaymentV118) ToTendermint ¶
func (x LoanRepaymentV118) ToTendermint() abci.Event
type Outbound ¶
type Outbound struct { Chain string Coin string FromAddress string ToAddress string TxID string InTxID string Memo string }
func (Outbound) ToTendermint ¶
type PendingLiquidity ¶
type PendingLiquidity struct { Pool string AssetAmount int64 RuneAmount int64 AssetAddress string RuneAddress string RuneTxID string AssetTxID string PendingType PendingTypeEnum }
Note that this intentionally doesn't have a base class together with AddLiquidity. Unfortunately initializing fields of embedded structs is cumbersome, it would make writing the unit tests harder.
func (PendingLiquidity) ToTendermint ¶
func (x PendingLiquidity) ToTendermint() abci.Event
type PendingTypeEnum ¶
type PendingTypeEnum int
const ( PendingAdd PendingTypeEnum = iota PendingWithdraw )
type PoolStatus ¶
type PoolStatus struct { Pool string Status StatusName }
func PoolActivate ¶
func PoolActivate(pool string) PoolStatus
func (PoolStatus) ToTendermint ¶
func (x PoolStatus) ToTendermint() abci.Event
type Refund ¶
type Refund struct { TxID string Chain string Coin string FromAddress string ToAddress string Reason string Memo string }
func (Refund) ToTendermint ¶
type Rewards ¶
func (Rewards) ToTendermint ¶
type ScheduledOutbound ¶
type ScheduledOutbound struct { Chain string CoinAmount string CoinAsset string CoinDecimals string GasRate string MaxGasAmount []string MaxGasAsset []string MaxGasDecimal []string ModuleName string OutHash string ToAddress string InHash string Memo string VaultPubKey string }
func (ScheduledOutbound) ToTendermint ¶
func (x ScheduledOutbound) ToTendermint() abci.Event
type SetMimir ¶
func (SetMimir) ToTendermint ¶
type StatusName ¶
type StatusName string
const ( StatusAvailable StatusName = "available" StatusSuspended StatusName = "suspended" StatusStaged StatusName = "staged" )
type StreamingSwapDetails ¶
type StreamingSwapDetails struct { TxID string Interval int64 Quantity int64 Count int64 LastHeight int64 Deposit string In string Out string }
func (StreamingSwapDetails) ToTendermint ¶
func (x StreamingSwapDetails) ToTendermint() abci.Event
type Swap ¶
type Swap struct { Pool string Coin string EmitAsset string LiquidityFee int64 LiquidityFeeInRune int64 Slip int64 FromAddress string ToAddress string TxID string PriceTarget int64 Memo string StreamingCount int64 StreamingQuantity int64 }
func (Swap) ToTendermint ¶
type Switch ¶
type Switch struct { FromAddress string ToAddress string Burn string Mint int64 // Omitted if 0 TxID string }
func (Switch) ToTendermint ¶
type THORName ¶
type THORName struct { Name string Chain string Address string RegistrationFee int64 FundAmount int64 ExpireHeight int64 Owner string }
func (THORName) ToTendermint ¶
type Transfer ¶
func (Transfer) ToTendermint ¶
type UpdateNodeAccountStatus ¶
func (UpdateNodeAccountStatus) ToTendermint ¶
func (x UpdateNodeAccountStatus) ToTendermint() abci.Event
Click to show internal directories.
Click to hide internal directories.