mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35:18 +00:00
adjust genesis tokens amounts
This commit is contained in:
parent
fd475f4777
commit
942af6c388
@ -17,9 +17,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// bonded tokens given to genesis validators/accounts
|
// Tokens given to genesis validators and accounts
|
||||||
freeFermionVal = int64(100)
|
numStartingTokensValidators = int64(500000)
|
||||||
freeFermionsAcc = int64(50)
|
numStartingTokensAccounts = int64(500000)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Initial app state to be written to (and read from) genesis file
|
// Initial app state to be written to (and read from) genesis file
|
||||||
@ -133,7 +133,7 @@ func KavaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.AccAddress, name
|
|||||||
// Create the validator
|
// Create the validator
|
||||||
validator = tmtypes.GenesisValidator{
|
validator = tmtypes.GenesisValidator{
|
||||||
PubKey: pk,
|
PubKey: pk,
|
||||||
Power: freeFermionVal,
|
Power: numStartingTokensValidators,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -149,6 +149,8 @@ func KavaAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState
|
|||||||
|
|
||||||
// start with the default staking genesis state
|
// start with the default staking genesis state
|
||||||
stakeData := stake.DefaultGenesisState()
|
stakeData := stake.DefaultGenesisState()
|
||||||
|
// change denom of staking coin
|
||||||
|
stakeData.Params.BondDenom = "KVA"
|
||||||
|
|
||||||
// get genesis flag account information
|
// get genesis flag account information
|
||||||
genaccs := make([]GenesisAccount, len(appGenTxs))
|
genaccs := make([]GenesisAccount, len(appGenTxs))
|
||||||
@ -163,11 +165,11 @@ func KavaAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState
|
|||||||
// create the genesis account
|
// create the genesis account
|
||||||
accAuth := auth.NewBaseAccountWithAddress(genTx.Address)
|
accAuth := auth.NewBaseAccountWithAddress(genTx.Address)
|
||||||
accAuth.Coins = sdk.Coins{
|
accAuth.Coins = sdk.Coins{
|
||||||
{"KVA", sdk.NewInt(freeFermionsAcc)},
|
{"KVA", sdk.NewInt(numStartingTokensAccounts)},
|
||||||
}
|
}
|
||||||
acc := NewGenesisAccount(&accAuth)
|
acc := NewGenesisAccount(&accAuth)
|
||||||
genaccs[i] = acc
|
genaccs[i] = acc
|
||||||
stakeData.Pool.LooseTokens = stakeData.Pool.LooseTokens.Add(sdk.NewRat(freeFermionsAcc)) // increase the supply
|
stakeData.Pool.LooseTokens = stakeData.Pool.LooseTokens.Add(sdk.NewRat(numStartingTokensAccounts)) // increase the supply
|
||||||
|
|
||||||
// add the validator
|
// add the validator
|
||||||
if len(genTx.Name) > 0 {
|
if len(genTx.Name) > 0 {
|
||||||
@ -175,11 +177,11 @@ func KavaAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState
|
|||||||
validator := stake.NewValidator(genTx.Address,
|
validator := stake.NewValidator(genTx.Address,
|
||||||
sdk.MustGetAccPubKeyBech32(genTx.PubKey), desc)
|
sdk.MustGetAccPubKeyBech32(genTx.PubKey), desc)
|
||||||
|
|
||||||
stakeData.Pool.LooseTokens = stakeData.Pool.LooseTokens.Add(sdk.NewRat(freeFermionVal)) // increase the supply
|
stakeData.Pool.LooseTokens = stakeData.Pool.LooseTokens.Add(sdk.NewRat(numStartingTokensValidators)) // increase the supply
|
||||||
|
|
||||||
// add some new shares to the validator
|
// add some new shares to the validator
|
||||||
var issuedDelShares sdk.Rat
|
var issuedDelShares sdk.Rat
|
||||||
validator, stakeData.Pool, issuedDelShares = validator.AddTokensFromDel(stakeData.Pool, freeFermionVal)
|
validator, stakeData.Pool, issuedDelShares = validator.AddTokensFromDel(stakeData.Pool, numStartingTokensValidators)
|
||||||
stakeData.Validators = append(stakeData.Validators, validator)
|
stakeData.Validators = append(stakeData.Validators, validator)
|
||||||
|
|
||||||
// create the self-delegation from the issuedDelShares
|
// create the self-delegation from the issuedDelShares
|
||||||
|
Loading…
Reference in New Issue
Block a user