test_helpers

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FakeIlk = TestIlk{
		Hex:        "0x464b450000000000000000000000000000000000000000000000000000000000",
		Identifier: "FKE",
	}

	AnotherFakeIlk = TestIlk{
		Hex:        "0x464b453200000000000000000000000000000000000000000000000000000000",
		Identifier: "FKE2",
	}

	EmptyMetadatas []utils.StorageValueMetadata

	FakeIlkRateMetadata = utils.GetStorageValueMetadata(vat.IlkRate, map[utils.Key]string{constants.Ilk: FakeIlk.Hex}, utils.Uint256)
	FakeIlkArtMetadata  = utils.GetStorageValueMetadata(vat.IlkArt, map[utils.Key]string{constants.Ilk: FakeIlk.Hex}, utils.Uint256)
	FakeIlkSpotMetadata = utils.GetStorageValueMetadata(vat.IlkSpot, map[utils.Key]string{constants.Ilk: FakeIlk.Hex}, utils.Uint256)
	FakeIlkLineMetadata = utils.GetStorageValueMetadata(vat.IlkLine, map[utils.Key]string{constants.Ilk: FakeIlk.Hex}, utils.Uint256)
	FakeIlkDustMetadata = utils.GetStorageValueMetadata(vat.IlkDust, map[utils.Key]string{constants.Ilk: FakeIlk.Hex}, utils.Uint256)

	FakeIlkVatMetadatas = []utils.StorageValueMetadata{
		FakeIlkRateMetadata,
		FakeIlkArtMetadata,
		FakeIlkSpotMetadata,
		FakeIlkLineMetadata,
		FakeIlkDustMetadata,
	}
	FakeIlkCatMetadatas = []utils.StorageValueMetadata{
		fakeIlkChopMetadata,
		fakeIlkLumpMetadata,
		fakeIlkFlipMetadata,
	}
	FakeIlkJugMetadatas = []utils.StorageValueMetadata{
		fakeIlkRhoMetadata,
		fakeIlkTaxMetadata,
	}
	FakeIlkSpotMetadatas = []utils.StorageValueMetadata{
		fakeIlkPipMetadata,
		fakeIlkMatMetadata,
	}

	AnotherFakeIlkVatMetadatas = []utils.StorageValueMetadata{
		anotherFakeIlkRateMetadata,
		anotherFakeIlkArtMetadata,
		anotherFakeIlkSpotMetadata,
		anotherFakeIlkLineMetadata,
		anotherFakeIlkDustMetadata,
	}
	AnotherFakeIlkCatMetadatas = []utils.StorageValueMetadata{
		anotherFakeIlkChopMetadata,
		anotherFakeIlkLumpMetadata,
		anotherFakeIlkFlipMetadata,
	}
	AnotherFakeIlkJugMetadatas = []utils.StorageValueMetadata{
		anotherFakeIlkRhoMetadata,
		anotherFakeIlkTaxMetadata,
	}
	AnotherFakeIlkSpotMetadatas = []utils.StorageValueMetadata{
		anotherFakeIlkPipMetadata,
		anotherFakeIlkMatMetadata,
	}
)

Functions

func AssertUrn

func AssertUrn(actual, expected UrnState)

func CreateCatRecords

func CreateCatRecords(header core.Header, valuesMap map[string]string, metadatas []utils.StorageValueMetadata, repository cat.CatStorageRepository)

func CreateDeal added in v0.2.10

func CreateDeal(input DealCreationInput) (err error)

func CreateDent added in v0.2.11

func CreateDent(input DentCreationInput) (err error)

func CreateFlap added in v0.2.10

func CreateFlap(db *postgres.DB, header core.Header, valuesMap map[string]interface{}, flapMetadatas []utils.StorageValueMetadata, contractAddress string)

func CreateFlapKick added in v0.2.11

func CreateFlapKick(contractAddress string, bidId int, headerId, logId int64, repo flap_kick.FlapKickRepository) error

func CreateFlip added in v0.2.10

func CreateFlip(db *postgres.DB, header core.Header, valuesMap map[string]interface{}, flipMetadatas []utils.StorageValueMetadata, contractAddress string)

func CreateFlipKick added in v0.2.10

func CreateFlipKick(contractAddress string, bidId int, headerId, logId int64, usr string, repo flip_kick.FlipKickRepository) error

func CreateFlop added in v0.2.10

func CreateFlop(db *postgres.DB, header core.Header, valuesMap map[string]interface{}, flopMetadatas []utils.StorageValueMetadata, contractAddress string)

func CreateFlopKick added in v0.2.11

func CreateFlopKick(contractAddress string, bidId int, headerId, logId int64, repo flop_kick.FlopKickRepository) error

func CreateIlk added in v0.2.4

func CreateIlk(db *postgres.DB, header core.Header, valuesMap map[string]string, vatMetadatas, catMetadatas, jugMetadatas, spotMetadatas []utils.StorageValueMetadata)

func CreateJugRecords

func CreateJugRecords(header core.Header, valuesMap map[string]string, metadatas []utils.StorageValueMetadata, repository jug.JugStorageRepository)

func CreateManagedCdp added in v0.2.11

func CreateManagedCdp(db *postgres.DB, header core.Header, valuesMap map[string]interface{}, metadatas []utils.StorageValueMetadata) error

func CreateSpotRecords added in v0.2.7

func CreateSpotRecords(header core.Header, valuesMap map[string]string, metadatas []utils.StorageValueMetadata, repository spot.SpotStorageRepository)

func CreateTend added in v0.2.10

func CreateTend(input TendCreationInput) (err error)

func CreateTick added in v0.2.11

func CreateTick(input TickCreationInput) (err error)

func CreateUrn

func CreateUrn(setupData UrnSetupData, metadata UrnMetadata, vatRepo vat.VatStorageRepository, headerRepo repositories.HeaderRepository)

Creates urn by creating necessary state diffs and the corresponding header

func CreateVatRecords

func CreateVatRecords(header core.Header, valuesMap map[string]string, metadatas []utils.StorageValueMetadata, repository vat.VatStorageRepository)

func CreateYank added in v0.2.10

func CreateYank(input YankCreationInput) (err error)

func GetCdpManagerMetadatas added in v0.2.11

func GetCdpManagerMetadatas(cdpi string) []utils.StorageValueMetadata

func GetCdpManagerStorageValues added in v0.2.11

func GetCdpManagerStorageValues(seed int, ilkHex string, urnGuy string, cdpi int) map[string]interface{}

func GetEmptyNullString added in v0.2.4

func GetEmptyNullString() sql.NullString

func GetExpectedTimestamp added in v0.2.3

func GetExpectedTimestamp(epoch int) string

func GetFlapMetadatas added in v0.2.10

func GetFlapMetadatas(bidId string) []utils.StorageValueMetadata

func GetFlapStorageValues added in v0.2.10

func GetFlapStorageValues(seed, bidId int) map[string]interface{}

func GetFlipMetadatas added in v0.2.10

func GetFlipMetadatas(bidId string) []utils.StorageValueMetadata

func GetFlipStorageValues added in v0.2.10

func GetFlipStorageValues(seed int, ilk string, bidId int) map[string]interface{}

func GetFlopMetadatas added in v0.2.10

func GetFlopMetadatas(bidId string) []utils.StorageValueMetadata

func GetFlopStorageValues added in v0.2.10

func GetFlopStorageValues(seed, bidId int) map[string]interface{}

func GetIlkValues

func GetIlkValues(seed int) map[string]string

func GetRandomInt added in v0.2.4

func GetRandomInt(min, max int) int

func GetValidNullString added in v0.2.4

func GetValidNullString(val string) sql.NullString

func SetUpFlapBidContext added in v0.2.11

func SetUpFlapBidContext(setupData FlapBidCreationInput) (err error)

func SetUpFlipBidContext added in v0.2.10

func SetUpFlipBidContext(setupData FlipBidContextInput) (ilkId, urnId int64, err error)

func SetUpFlopBidContext added in v0.2.11

func SetUpFlopBidContext(setupData FlopBidCreationInput) (err error)

Types

type BidEvent added in v0.2.10

type BidEvent struct {
	BidId           string `db:"bid_id"`
	Lot             string
	BidAmount       string `db:"bid_amount"`
	Act             string
	ContractAddress string `db:"contract_address"`
}

type BiteEvent added in v0.2.4

type BiteEvent struct {
	IlkIdentifier string `db:"ilk_identifier"`
	UrnIdentifier string `db:"urn_identifier"`
	Ink           string
	Art           string
	Tab           string
}

type DealCreationInput added in v0.2.10

type DealCreationInput struct {
	Db              *postgres.DB
	BidId           int
	ContractAddress string
	DealRepo        deal.DealRepository
	DealHeaderId    int64
}

type DentCreationInput added in v0.2.11

type DentCreationInput struct {
	ContractAddress string
	BidId           int
	Lot             int
	BidAmount       int
	DentRepo        dent.DentRepository
	DentHeaderId    int64
	DentLogId       int64
}

type FlapBid added in v0.2.10

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

func FlapBidFromValues added in v0.2.10

func FlapBidFromValues(bidId, dealt, updated, created string, bidValues map[string]interface{}) FlapBid

type FlapBidCreationInput added in v0.2.11

type FlapBidCreationInput struct {
	DealCreationInput
	Dealt            bool
	FlapKickRepo     flap_kick.FlapKickRepository
	FlapKickHeaderId int64
}

type FlipBid added in v0.2.10

type FlipBid struct {
	IlkId string `db:"ilk_id"`
	UrnId string `db:"urn_id"`
	Gal   string
	Tab   string
	// contains filtered or unexported fields
}

func FlipBidFromValues added in v0.2.10

func FlipBidFromValues(bidId, ilkId, urnId, dealt, updated, created string, bidValues map[string]interface{}) FlipBid

type FlipBidContextInput added in v0.2.11

type FlipBidContextInput struct {
	DealCreationInput
	Dealt            bool
	IlkHex           string
	UrnGuy           string
	FlipKickRepo     flip_kick.FlipKickRepository
	FlipKickHeaderId int64
}

type FlopBid added in v0.2.10

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

func FlopBidFromValues added in v0.2.10

func FlopBidFromValues(bidId, dealt, updated, created string, bidValues map[string]interface{}) FlopBid

type FlopBidCreationInput added in v0.2.11

type FlopBidCreationInput struct {
	DealCreationInput
	Dealt            bool
	FlopKickRepo     flop_kick.FlopKickRepository
	FlopKickHeaderId int64
}

type FrobEvent

type FrobEvent struct {
	IlkIdentifier string `db:"ilk_identifier"`
	UrnIdentifier string `db:"urn_identifier"`
	Dink          string
	Dart          string
	Rate          string `db:"ilk_rate"`
}

type IlkFileEvent added in v0.2.4

type IlkFileEvent struct {
	IlkIdentifier sql.NullString `db:"ilk_identifier"`
	What          string
	Data          string
}

type IlkState

type IlkState struct {
	IlkIdentifier string `db:"ilk_identifier"`
	Rate          string
	Art           string
	Spot          string
	Line          string
	Dust          string
	Chop          string
	Lump          string
	Flip          string
	Rho           string
	Duty          string
	Pip           string
	Mat           string
	Created       sql.NullString
	Updated       sql.NullString
}

func IlkStateFromValues

func IlkStateFromValues(ilk, updated, created string, ilkValues map[string]string) IlkState

type ManagedCdp added in v0.2.11

type ManagedCdp struct {
	Id            string `db:"cdpi"`
	Usr           string
	UrnIdentifier string `db:"urn_identifier"`
	IlkIdentifier string `db:"ilk_identifier"`
	Created       sql.NullString
}

func ManagedCdpFromValues added in v0.2.11

func ManagedCdpFromValues(ilkIdentifier, created string, cdpValues map[string]interface{}) ManagedCdp

type PokeEvent added in v0.2.7

type PokeEvent struct {
	IlkId string `db:"ilk_id"`
	Val   string
	Spot  string
}

type SinQueueEvent added in v0.2.4

type SinQueueEvent struct {
	Era         string
	Act         string
	BlockHeight string `db:"block_height"`
}

type TendCreationInput added in v0.2.10

type TendCreationInput struct {
	ContractAddress string
	BidId           int
	Lot             int
	BidAmount       int
	TendRepo        tend.TendRepository
	TendHeaderId    int64
	TendLogId       int64
}

type TestIlk added in v0.2.3

type TestIlk struct {
	Hex        string
	Identifier string
}

type TickCreationInput added in v0.2.11

type TickCreationInput struct {
	BidId           int
	ContractAddress string
	TickRepo        tick.TickRepository
	TickHeaderId    int64
	TickLogId       int64
}

type UrnMetadata

type UrnMetadata struct {
	UrnInk  utils.StorageValueMetadata
	UrnArt  utils.StorageValueMetadata
	IlkSpot utils.StorageValueMetadata
	IlkRate utils.StorageValueMetadata
}

func GetUrnMetadata

func GetUrnMetadata(ilk, urn string) UrnMetadata

type UrnSetupData

type UrnSetupData struct {
	Header core.Header
	Ink    int
	Art    int
	Spot   int
	Rate   int
}

func GetUrnSetupData

func GetUrnSetupData(block, timestamp int) UrnSetupData

Does not return values computed by the query (updated, created)

type UrnState

type UrnState struct {
	UrnIdentifier string `db:"urn_identifier"`
	IlkIdentifier string `db:"ilk_identifier"`
	BlockHeight   int    `db:"block_height"`
	Ink           string
	Art           string
	Created       sql.NullString
	Updated       sql.NullString
}

type YankCreationInput added in v0.2.10

type YankCreationInput struct {
	ContractAddress string
	BidId           int
	YankRepo        yank.YankRepository
	YankHeaderId    int64
	YankLogId       int64
}

Jump to

Keyboard shortcuts

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