diff --git a/abci/example/orderbook/app.go b/abci/example/orderbook/app.go index 0132126fc..b47508250 100644 --- a/abci/example/orderbook/app.go +++ b/abci/example/orderbook/app.go @@ -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 { diff --git a/abci/example/orderbook/app_test.go b/abci/example/orderbook/app_test.go index 774506da7..191567aef 100644 --- a/abci/example/orderbook/app_test.go +++ b/abci/example/orderbook/app_test.go @@ -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 +} \ No newline at end of file diff --git a/abci/example/orderbook/store.go b/abci/example/orderbook/store.go new file mode 100644 index 000000000..8c21fc16c --- /dev/null +++ b/abci/example/orderbook/store.go @@ -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 +