Skip to content

Commit

Permalink
metadium: updated governance contract
Browse files Browse the repository at this point in the history
  • Loading branch information
sadoci committed Jun 28, 2022
1 parent 55d7585 commit a31adbe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 30 deletions.
23 changes: 7 additions & 16 deletions metadium/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ type metaAdmin struct {
blockInterval int64
blocksPer int64
blockReward *big.Int
gasPrice *big.Int
maxPriorityFeePerGas *big.Int
maxBaseFee *big.Int
gasLimit *big.Int
Expand Down Expand Up @@ -553,7 +552,7 @@ func (ma *metaAdmin) getRewardAccounts(ctx context.Context, block *big.Int) (rew
type govdata struct {
blockNum, modifiedBlock int64
blockInterval, blocksPer, maxIdleBlockInterval int64
blockReward, gasPrice, maxPriorityFeePerGas *big.Int
blockReward, maxPriorityFeePerGas *big.Int
maxBaseFee, gasLimit *big.Int
baseFeeMaxChangeRate, gasTargetPercentage int64
nodes, addedNodes, updatedNodes, deletedNodes []*metaNode
Expand Down Expand Up @@ -605,10 +604,6 @@ func (ma *metaAdmin) getGovData(refresh bool) (data *govdata, err error) {
if err != nil {
return
}
err = metclient.CallContract(ctx, ma.envStorage, "getGasPrice", nil, &data.gasPrice, block.Number)
if err != nil {
return
}
err = metclient.CallContract(ctx, ma.envStorage, "getMaxPriorityFeePerGas", nil, &data.maxPriorityFeePerGas, block.Number)
if err != nil {
return
Expand All @@ -622,11 +617,10 @@ func (ma *metaAdmin) getGovData(refresh bool) (data *govdata, err error) {
data.baseFeeMaxChangeRate = gasLimitAndBaseFee[1].Int64()
data.gasTargetPercentage = gasLimitAndBaseFee[2].Int64()

// err = metclient.CallContract(ctx, ma.envStorage, "getMaxBaseFee", nil, &data.maxBaseFee, block.Number)
// if err != nil {
// return
// }
data.maxBaseFee = big.NewInt(500 * params.GWei)
err = metclient.CallContract(ctx, ma.envStorage, "getMaxBaseFee", nil, &data.maxBaseFee, block.Number)
if err != nil {
return
}

data.nodes, err = ma.getMetaNodes(ctx, block.Number)
if err != nil {
Expand Down Expand Up @@ -721,7 +715,6 @@ func StartAdmin(stack *node.Node, datadir string) {
rpcCli: rpcCli,
cli: cli,
blocksPer: 100,
gasPrice: big.NewInt(100 * params.GWei),
etcdDir: path.Join(datadir, "etcd"),
etcdTimeout: 30 * time.Second,
}
Expand Down Expand Up @@ -789,7 +782,6 @@ func (ma *metaAdmin) update() {
ma.blockInterval = data.blockInterval
ma.blocksPer = data.blocksPer
ma.blockReward = data.blockReward
ma.gasPrice = data.gasPrice
ma.maxPriorityFeePerGas = data.maxPriorityFeePerGas
ma.maxBaseFee = data.maxBaseFee
ma.gasLimit = data.gasLimit
Expand Down Expand Up @@ -839,10 +831,10 @@ func (ma *metaAdmin) update() {
"0x"+data.maxPriorityFeePerGas.Text(16))
if err != nil || !*v {
log.Info("Metadium: set minimum gas price failed",
"gas price", data.gasPrice, "error", err)
"maxPriorityFeePerGas", data.maxPriorityFeePerGas, "error", err)
} else {
log.Info("Metadium: Successfully set",
"gas price", data.gasPrice)
"maxPriorityFeePerGas", data.maxPriorityFeePerGas)
}

if ma.self != nil && !bytes.Equal(ma.self.Addr[:], nilAddress[:]) {
Expand Down Expand Up @@ -1541,7 +1533,6 @@ func Info() interface{} {
"blocksPer": admin.blocksPer,
"blockInterval": admin.blockInterval,
"blockReward": admin.blockReward,
"gasPrice": admin.gasPrice,
"maxPriorityFeePerGas": admin.maxPriorityFeePerGas,
"blockGasLimit": admin.gasLimit,
"maxBaseFee": admin.maxBaseFee,
Expand Down
14 changes: 7 additions & 7 deletions metadium/contracts/MetadiumGovernance.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions metadium/scripts/deploy-governance.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ var GovernanceDeployer = new function() {
web3.sha3("blocksPer"),
web3.sha3("ballotDurationMin"), web3.sha3("ballotDurationMax"),
web3.sha3("stakingMin"), web3.sha3("stakingMax"),
web3.sha3("gasPrice"),
web3.sha3("MaxIdleBlockInterval"),
web3.sha3("blockCreationTime"),
web3.sha3("blockRewardAmount"),
Expand All @@ -274,19 +273,20 @@ var GovernanceDeployer = new function() {
web3.sha3("blockRewardDistributionStakingReward"),
web3.sha3("blockRewardDistributionEcosystem"),
web3.sha3("blockRewardDistributionMaintenance"),
web3.sha3("maxBaseFee"),
web3.sha3("blockGasLimit"),
web3.sha3("baseFeeMaxChangeDenominator"),
web3.sha3("elasticityMultiplier") ],
web3.sha3("baseFeeMaxChangeRate"),
web3.sha3("gasTargetPercentage") ],
envValues = [
1,
86400, 604800,
4980000000000000000000000, 39840000000000000000000000,
100000000000, // 100 gwei
5,
1000,
1000000000000000000, // 1 meta
100000000000, // 100 gwei
4000, 1000, 2500, 2500, // NCPs, WEMIX Staker, Eco System, Maintenance
web3.toWei(1, 'ether'), // mint amount: 1 wemix
web3.toWei(100, 'gwei'), // tip: 100 gwei
4000, 1000, 2500, 2500, // NCPs, WEMIX Staker, Eco System, Maintenance
web3.toWei(50000, 'gwei'), // maxBaseFee * 21000 -> 1.05 wemix
5000 * 21000, 46, 30 ]
txs[txs.length] = this.sendTx(envStorage.address, null,
tmpEnvStorageImp.initialize.getData(envNames, envValues))
Expand Down

0 comments on commit a31adbe

Please sign in to comment.