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-04-09 21:32:49 +0800
commit139b719ec39da205841c857b865a340f370bafb2 (patch)
treefceed7f6e1b595f64c1458decc0ab8ea8ca0b5c8 /dex/governance.go
parent7df00d48a6c8ad89de221c5d9a3606e2b39d55a3 (diff)
downloaddexon-139b719ec39da205841c857b865a340f370bafb2.tar
dexon-139b719ec39da205841c857b865a340f370bafb2.tar.gz
dexon-139b719ec39da205841c857b865a340f370bafb2.tar.bz2
dexon-139b719ec39da205841c857b865a340f370bafb2.tar.lz
dexon-139b719ec39da205841c857b865a340f370bafb2.tar.xz
dexon-139b719ec39da205841c857b865a340f370bafb2.tar.zst
dexon-139b719ec39da205841c857b865a340f370bafb2.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{}
}