diff --git a/app/app.go b/app/app.go index a54c4a12..b1925f43 100644 --- a/app/app.go +++ b/app/app.go @@ -94,7 +94,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/noble-assets/noble/v7/app/upgrades/xenon" + "github.com/noble-assets/noble/v7/app/upgrades/numus" "github.com/noble-assets/noble/v7/cmd" "github.com/noble-assets/noble/v7/docs" "github.com/noble-assets/noble/v7/x/globalfee" @@ -120,6 +120,10 @@ import ( "github.com/noble-assets/halo/x/halo" halokeeper "github.com/noble-assets/halo/x/halo/keeper" halotypes "github.com/noble-assets/halo/x/halo/types" + + "github.com/noble-assets/florin/x/florin" + florinkeeper "github.com/noble-assets/florin/x/florin/keeper" + florintypes "github.com/noble-assets/florin/x/florin/types" ) const ( @@ -165,6 +169,7 @@ var ( forwarding.AppModuleBasic{}, aura.AppModuleBasic{}, halo.AppModuleBasic{}, + florin.AppModuleBasic{}, ) // module account permissions @@ -180,6 +185,7 @@ var ( cctptypes.ModuleName: nil, auratypes.ModuleName: {authtypes.Burner, authtypes.Minter}, halotypes.ModuleName: {authtypes.Burner, authtypes.Minter}, + florintypes.ModuleName: {authtypes.Burner, authtypes.Minter}, } ) @@ -246,6 +252,7 @@ type App struct { ForwardingKeeper *forwardingkeeper.Keeper AuraKeeper *aurakeeper.Keeper HaloKeeper *halokeeper.Keeper + FlorinKeeper *florinkeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration @@ -284,7 +291,7 @@ func New( paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, tokenfactorymoduletypes.StoreKey, fiattokenfactorymoduletypes.StoreKey, packetforwardtypes.StoreKey, stakingtypes.StoreKey, - cctptypes.StoreKey, forwardingtypes.StoreKey, auratypes.ModuleName, halotypes.ModuleName, + cctptypes.StoreKey, forwardingtypes.StoreKey, auratypes.ModuleName, halotypes.ModuleName, florintypes.ModuleName, ) tkeys := sdk.NewTransientStoreKeys( paramstypes.TStoreKey, @@ -359,6 +366,12 @@ func New( interfaceRegistry, ) + app.FlorinKeeper = florinkeeper.NewKeeper( + keys[florintypes.ModuleName], + app.AccountKeeper, + nil, + ) + app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, keys[banktypes.StoreKey], @@ -367,9 +380,11 @@ func New( app.BlockedModuleAccountAddrs(), ). WithSendCoinsRestriction(app.AuraKeeper.SendRestrictionFn). - WithSendCoinsRestriction(app.HaloKeeper.SendRestrictionFn) + WithSendCoinsRestriction(app.HaloKeeper.SendRestrictionFn). + WithSendCoinsRestriction(app.FlorinKeeper.SendRestrictionFn) app.AuraKeeper.SetBankKeeper(app.BankKeeper) app.HaloKeeper.SetBankKeeper(app.BankKeeper) + app.FlorinKeeper.SetBankKeeper(app.BankKeeper) app.StakingKeeper = stakingkeeper.NewKeeper( appCodec, @@ -588,6 +603,7 @@ func New( forwarding.NewAppModule(app.ForwardingKeeper), aura.NewAppModule(app.AuraKeeper), halo.NewAppModule(app.HaloKeeper), + florin.NewAppModule(app.FlorinKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -622,6 +638,7 @@ func New( forwardingtypes.ModuleName, auratypes.ModuleName, halotypes.ModuleName, + florintypes.ModuleName, ) app.mm.SetOrderEndBlockers( @@ -651,6 +668,7 @@ func New( forwardingtypes.ModuleName, auratypes.ModuleName, halotypes.ModuleName, + florintypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -685,6 +703,7 @@ func New( forwardingtypes.ModuleName, auratypes.ModuleName, halotypes.ModuleName, + florintypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) @@ -923,12 +942,13 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino func (app *App) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( - xenon.UpgradeName, - xenon.CreateUpgradeHandler( + numus.UpgradeName, + numus.CreateUpgradeHandler( app.mm, app.configurator, - app.HaloKeeper, app.BankKeeper, + app.FlorinKeeper, + app.ParamsKeeper, ), ) @@ -943,8 +963,8 @@ func (app *App) setupUpgradeHandlers() { var storeLoader baseapp.StoreLoader switch upgradeInfo.Name { - case xenon.UpgradeName: - storeLoader = xenon.CreateStoreLoader(upgradeInfo.Height) + case numus.UpgradeName: + storeLoader = numus.CreateStoreLoader(upgradeInfo.Height) } if storeLoader != nil { diff --git a/app/upgrades/xenon/constants.go b/app/upgrades/numus/constants.go similarity index 85% rename from app/upgrades/xenon/constants.go rename to app/upgrades/numus/constants.go index 04e1af6d..cdff7c56 100644 --- a/app/upgrades/xenon/constants.go +++ b/app/upgrades/numus/constants.go @@ -1,7 +1,7 @@ -package xenon +package numus // UpgradeName is the name of this specific software upgrade used on-chain. -const UpgradeName = "xenon" +const UpgradeName = "numus" // MainnetChainID is the Chain ID of the Noble mainnet. const MainnetChainID = "noble-1" diff --git a/app/upgrades/xenon/store.go b/app/upgrades/numus/store.go similarity index 75% rename from app/upgrades/xenon/store.go rename to app/upgrades/numus/store.go index 5c85e163..f428f9b7 100644 --- a/app/upgrades/xenon/store.go +++ b/app/upgrades/numus/store.go @@ -1,15 +1,15 @@ -package xenon +package numus import ( "github.com/cosmos/cosmos-sdk/baseapp" storetypes "github.com/cosmos/cosmos-sdk/store/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - halotypes "github.com/noble-assets/halo/x/halo/types" + florintypes "github.com/noble-assets/florin/x/florin/types" ) func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{halotypes.ModuleName}, + Added: []string{florintypes.ModuleName}, } return upgradetypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) diff --git a/app/upgrades/xenon/upgrade.go b/app/upgrades/numus/upgrade.go similarity index 54% rename from app/upgrades/xenon/upgrade.go rename to app/upgrades/numus/upgrade.go index b6f7f761..d053193d 100644 --- a/app/upgrades/xenon/upgrade.go +++ b/app/upgrades/numus/upgrade.go @@ -1,21 +1,22 @@ -package xenon +package numus import ( "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - halokeeper "github.com/noble-assets/halo/x/halo/keeper" + florinkeeper "github.com/noble-assets/florin/x/florin/keeper" + paramskeeper "github.com/strangelove-ventures/paramauthority/x/params/keeper" ) func CreateUpgradeHandler( mm *module.Manager, cfg module.Configurator, - haloKeeper *halokeeper.Keeper, bankKeeper bankkeeper.Keeper, + florinKeeper *florinkeeper.Keeper, + paramsKeeper paramskeeper.Keeper, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { vm, err := mm.RunMigrations(ctx, cfg, vm) @@ -23,36 +24,37 @@ func CreateUpgradeHandler( return vm, err } + authority := paramsKeeper.GetAuthority(ctx) + florinKeeper.SetAuthority(ctx, authority) + switch ctx.ChainID() { case TestnetChainID: - haloKeeper.SetOwner(ctx, "noble1u0nahk4wltsp89tpce4cyayd63a69dhpkfq9wq") - haloKeeper.SetAggregatorOwner(ctx, "noble1u0nahk4wltsp89tpce4cyayd63a69dhpkfq9wq") - haloKeeper.SetEntitlementsOwner(ctx, "noble1u0nahk4wltsp89tpce4cyayd63a69dhpkfq9wq") + florinKeeper.SetOwner(ctx, "ueure", "noble1tv9u97jln0k3anpzhahkeahh66u74dug302pyn") + florinKeeper.SetBlacklistOwner(ctx, "noble1tv9u97jln0k3anpzhahkeahh66u74dug302pyn") case MainnetChainID: - haloKeeper.SetOwner(ctx, "noble184afdqq8x575e4m4khm0e52p4duxe6lxaxju3f") - haloKeeper.SetAggregatorOwner(ctx, "noble184afdqq8x575e4m4khm0e52p4duxe6lxaxju3f") - haloKeeper.SetEntitlementsOwner(ctx, "noble184afdqq8x575e4m4khm0e52p4duxe6lxaxju3f") + florinKeeper.SetOwner(ctx, "ueure", "") // TODO + florinKeeper.SetBlacklistOwner(ctx, "") // TODO default: return vm, fmt.Errorf("%s upgrade not allowed to execute on %s chain", UpgradeName, ctx.ChainID()) } bankKeeper.SetDenomMetaData(ctx, banktypes.Metadata{ - Description: "Hashnote US Yield Coin", + Description: "Monerium EUR emoney", DenomUnits: []*banktypes.DenomUnit{ { - Denom: "uusyc", + Denom: "ueure", Exponent: 0, - Aliases: []string{"microusyc"}, + Aliases: []string{"microeure"}, }, { - Denom: "usyc", + Denom: "eure", Exponent: 6, }, }, - Base: "uusyc", - Display: "usyc", - Name: "Hashnote US Yield Coin", - Symbol: "USYC", + Base: "ueure", + Display: "eure", + Name: "Monerium EUR emoney", + Symbol: "EURe", }) return vm, nil diff --git a/go.mod b/go.mod index 1b210aef..29955507 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/noble-assets/florin v1.0.0-rc.1 github.com/noble-assets/forwarding v1.1.0 github.com/noble-assets/halo v1.0.0 github.com/ondoprotocol/usdy-noble v1.0.0 @@ -31,6 +32,7 @@ require ( ) require ( + adr36.dev v0.0.0-20240829163820-17879c0e838f // indirect cosmossdk.io/api v0.2.6 // indirect cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect diff --git a/go.sum b/go.sum index 803073c2..c9692df9 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ 4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= 4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= 4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= +adr36.dev v0.0.0-20240829163820-17879c0e838f h1:GM7s+hh4g6VmxtduPyAj/hkXpkwt9N/aZ0WC5OreuOw= +adr36.dev v0.0.0-20240829163820-17879c0e838f/go.mod h1:E6HaE8hVk+ss7kpa9wlj8Iue/G9sSKOca4eG95WHZDw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= @@ -963,6 +965,8 @@ github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/noble-assets/cosmos-sdk v0.45.16-send-restrictions h1:oQwbCoejkXp2/ozQSwc//A6UW9wJl71YgP7o04MsYq0= github.com/noble-assets/cosmos-sdk v0.45.16-send-restrictions/go.mod h1:bScuNwWAP0TZJpUf+SHXRU3xGoUPp+X9nAzfeIXts40= +github.com/noble-assets/florin v1.0.0-rc.1 h1:0O8Xr0Jqos7lvyvdtQE8Y0WcNH5PvfIJsocPeYLufh8= +github.com/noble-assets/florin v1.0.0-rc.1/go.mod h1:W+6DjaZdSRQe2oqv8eCHQtbyp36LUNImGRCLdPNSA2o= github.com/noble-assets/forwarding v1.1.0 h1:2TXBs2Y9vWqgHyDKtdcHht6i7OT+pLaVHE3bPvfpmJY= github.com/noble-assets/forwarding v1.1.0/go.mod h1:o64ZfzCHteRDhOlkpi7GeKAcjlcbWUihC7Y34Er2/3U= github.com/noble-assets/halo v1.0.0 h1:JG5TAZZcuLArYgl/9dgwJJ9KAOIo2f03/S010WRVNV8= diff --git a/interchaintest/upgrade_grand-1_test.go b/interchaintest/upgrade_grand-1_test.go index 066f35bb..938fd942 100644 --- a/interchaintest/upgrade_grand-1_test.go +++ b/interchaintest/upgrade_grand-1_test.go @@ -155,6 +155,11 @@ func TestGrand1ChainUpgrade(t *testing.T) { upgradeName: "xenon", image: ghcrImage("v6.0.0-rc.0"), }, + { + // numus is a major release that introduced the florin module. + upgradeName: "numus", + image: nobleImageInfo[0], + }, } testNobleChainUpgrade(t, "grand-1", genesis, denomMetadataUsdc, numValidators, numFullNodes, upgrades) diff --git a/interchaintest/upgrade_noble-1_test.go b/interchaintest/upgrade_noble-1_test.go index fa2b50e0..78305e9b 100644 --- a/interchaintest/upgrade_noble-1_test.go +++ b/interchaintest/upgrade_noble-1_test.go @@ -142,6 +142,11 @@ func TestNoble1ChainUpgrade(t *testing.T) { upgradeName: "xenon", image: ghcrImage("v6.0.0"), }, + { + // numus is a major release that introduced the florin module. + upgradeName: "numus", + image: nobleImageInfo[0], + }, } testNobleChainUpgrade(t, "noble-1", genesis, denomMetadataFrienzies, numValidators, numFullNodes, upgrades)