Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
chain-wenchang: Do not read zoracle genesis in db_app
Browse files Browse the repository at this point in the history
  • Loading branch information
sorawit committed Apr 4, 2020
1 parent b3a0dbf commit 7ac2d26
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions chain/app/db_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package app

import (
"io"
"time"

bam "github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -16,7 +15,6 @@ import (
dbm "github.com/tendermint/tm-db"

"github.com/bandprotocol/bandchain/chain/db"
"github.com/bandprotocol/bandchain/chain/x/zoracle"
)

type dbBandApp struct {
Expand Down Expand Up @@ -95,43 +93,43 @@ func (app *dbBandApp) InitChain(req abci.RequestInitChain) abci.ResponseInitChai
}

// Zoracle genesis
var zoracleState zoracle.GenesisState
zoracle.ModuleCdc.MustUnmarshalJSON(genesisState[zoracle.ModuleName], &zoracleState)
// var zoracleState zoracle.GenesisState
// zoracle.ModuleCdc.MustUnmarshalJSON(genesisState[zoracle.ModuleName], &zoracleState)

// Save data source
for idx, dataSource := range zoracleState.DataSources {
err := app.dbBand.AddDataSource(
int64(idx+1),
dataSource.Name,
dataSource.Description,
dataSource.Owner,
dataSource.Fee,
dataSource.Executable,
time.Now(),
0,
nil,
)
if err != nil {
panic(err)
}
}
// for idx, dataSource := range zoracleState.DataSources {
// err := app.dbBand.AddDataSource(
// int64(idx+1),
// dataSource.Name,
// dataSource.Description,
// dataSource.Owner,
// dataSource.Fee,
// dataSource.Executable,
// time.Now(),
// 0,
// nil,
// )
// if err != nil {
// panic(err)
// }
// }

// Save oracle script
for idx, oracleScript := range zoracleState.OracleScripts {
err := app.dbBand.AddOracleScript(
int64(idx+1),
oracleScript.Name,
oracleScript.Description,
oracleScript.Owner,
oracleScript.Code,
time.Now(),
0,
nil,
)
if err != nil {
panic(err)
}
}
// for idx, oracleScript := range zoracleState.OracleScripts {
// err := app.dbBand.AddOracleScript(
// int64(idx+1),
// oracleScript.Name,
// oracleScript.Description,
// oracleScript.Owner,
// oracleScript.Code,
// time.Now(),
// 0,
// nil,
// )
// if err != nil {
// panic(err)
// }
// }

app.dbBand.Commit()

Expand Down

0 comments on commit 7ac2d26

Please sign in to comment.