This commit is contained in:
Sam Ricotta
2022-11-10 09:06:34 +01:00
parent 07804ea061
commit e1f3d5c58c
3 changed files with 39 additions and 3 deletions
+10 -3
View File
@@ -32,9 +32,16 @@ type StateMachine struct {
markets map[string]*Market // i.e. ATOM/USDC
}
func New() *StateMachine {
StateMachine := StateMachine {}
return &StateMachine{}
func New(db dbm.DB) *StateMachine {
// execute a database call that fetches the data for accounts
StateMachine := StateMachine {
accounts: map[uint64]*Account{},
pairs: map[string]struct{},
commodities: map[string]struct{},
publicKeys: map[string]struct{},
markets: map[string]*Market{},
}
return &StateMachine
}
func (sm *StateMachine) Info(req types.RequestInfo) types.ResponseInfo {
+17
View File
@@ -9,6 +9,8 @@ import (
func TestNew(t *testing.T) {
StateMachine := New()
// initialise market
market := orderbook.NewMarket(testPair)
// create transaction
@@ -18,3 +20,18 @@ func TestNew(t *testing.T) {
// test to see if the tradeset is valid
// require.EqualValues(t, )
}
func TestNew(t *testing.T) {
var b map[string]string
var a StateMachine
}
type B struct {
Field string
anotherField []int
anotherField2 [10]int
}
+12
View File
@@ -0,0 +1,12 @@
package orderbook
type AccountStore struct {
db dbm.DB
}
// iterate over the account database
// Add to the account database
// find an account