aboutsummaryrefslogtreecommitdiffstats
path: root/dex/governance.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@cobinhood.com>2018-10-12 13:54:32 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commitcb49d3ced400076fb5d58b98c5e33edece2aa2d4 (patch)
treea53df3d3af9434e658dbb40da635936ea5538dea /dex/governance.go
parent99c57e329cdc2d4c75305d6df8463f77c71e608d (diff)
downloaddexon-cb49d3ced400076fb5d58b98c5e33edece2aa2d4.tar
dexon-cb49d3ced400076fb5d58b98c5e33edece2aa2d4.tar.gz
dexon-cb49d3ced400076fb5d58b98c5e33edece2aa2d4.tar.bz2
dexon-cb49d3ced400076fb5d58b98c5e33edece2aa2d4.tar.lz
dexon-cb49d3ced400076fb5d58b98c5e33edece2aa2d4.tar.xz
dexon-cb49d3ced400076fb5d58b98c5e33edece2aa2d4.tar.zst
dexon-cb49d3ced400076fb5d58b98c5e33edece2aa2d4.zip
dex: governance: implement governance interface
Diffstat (limited to 'dex/governance.go')
-rw-r--r--dex/governance.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/dex/governance.go b/dex/governance.go
index e990f32f3..f49355816 100644
--- a/dex/governance.go
+++ b/dex/governance.go
@@ -4,19 +4,30 @@ import (
coreCommon "github.com/dexon-foundation/dexon-consensus-core/common"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
+ "github.com/dexon-foundation/dexon/core/vm"
)
type DexconGovernance struct {
+ b *DexAPIBackend
}
// NewDexconGovernance retruns a governance implementation of the DEXON
// consensus governance interface.
-func NewDexconGovernance() *DexconGovernance {
- return &DexconGovernance{}
+func NewDexconGovernance(backend *DexAPIBackend) *DexconGovernance {
+ return &DexconGovernance{
+ b: backend,
+ }
}
// Configuration return the total ordering K constant.
func (d *DexconGovernance) Configuration(round uint64) *types.Config {
+ state, _, err := d.b.StateAndHeaderByNumber(ctx, blockNr)
+ if state == nil || err != nil {
+ return nil, err
+ }
+
+ s := vm.GovernanceStateHelper{state}
+
return &types.Config{}
}