testnet faucet (#281)

* testnet faucet

* commands

* updates

* faucet module

* genesis state

* fixes

* module.go

* add module to app

* update Fund

* querier route

* querier

* CLI query

* fix query

* add rest routes

* update cli query
This commit is contained in:
Federico Kunze
2020-05-18 17:33:08 -04:00
committed by GitHub
parent 16df7725c5
commit 0351bef644
19 changed files with 878 additions and 145 deletions
+11
View File
@@ -29,6 +29,7 @@ import (
"github.com/cosmos/ethermint/app/ante"
eminttypes "github.com/cosmos/ethermint/types"
"github.com/cosmos/ethermint/x/evm"
"github.com/cosmos/ethermint/x/faucet"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
@@ -64,6 +65,7 @@ var (
slashing.AppModuleBasic{},
evidence.AppModuleBasic{},
evm.AppModuleBasic{},
faucet.AppModuleBasic{},
)
// module account permissions
@@ -74,6 +76,7 @@ var (
staking.BondedPoolName: {supply.Burner, supply.Staking},
staking.NotBondedPoolName: {supply.Burner, supply.Staking},
gov.ModuleName: {supply.Burner},
faucet.ModuleName: {supply.Minter},
}
// module accounts that are allowed to receive tokens
@@ -113,6 +116,7 @@ type EthermintApp struct {
ParamsKeeper params.Keeper
EvidenceKeeper evidence.Keeper
EvmKeeper evm.Keeper
FaucetKeeper faucet.Keeper
// the module manager
mm *module.Manager
@@ -144,6 +148,7 @@ func NewEthermintApp(
bam.MainStoreKey, auth.StoreKey, bank.StoreKey, staking.StoreKey,
supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey,
gov.StoreKey, params.StoreKey, evidence.StoreKey, evm.CodeKey, evm.StoreKey,
faucet.StoreKey,
)
blockKey := sdk.NewKVStoreKey(evm.BlockKey)
@@ -201,6 +206,10 @@ func NewEthermintApp(
app.cdc, blockKey, keys[evm.CodeKey], keys[evm.StoreKey], app.AccountKeeper,
app.BankKeeper,
)
// TODO: use protobuf
app.FaucetKeeper = faucet.NewKeeper(
app.cdc, keys[faucet.StoreKey], app.SupplyKeeper,
)
// create evidence keeper with router
evidenceKeeper := evidence.NewKeeper(
@@ -242,6 +251,7 @@ func NewEthermintApp(
staking.NewAppModule(app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.SupplyKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper),
faucet.NewAppModule(app.FaucetKeeper),
)
// During begin block slashing happens after distr.BeginBlocker so that
@@ -261,6 +271,7 @@ func NewEthermintApp(
auth.ModuleName, distr.ModuleName, staking.ModuleName, bank.ModuleName,
slashing.ModuleName, gov.ModuleName, mint.ModuleName, supply.ModuleName,
crisis.ModuleName, genutil.ModuleName, evidence.ModuleName, evm.ModuleName,
faucet.ModuleName,
)
app.mm.RegisterInvariants(&app.CrisisKeeper)