Skip to content

Commit

Permalink
chore: sync master
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey committed Oct 23, 2023
2 parents efdc39b + 33b30a6 commit 18d963b
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 36 deletions.
2 changes: 0 additions & 2 deletions proto/circle/fiattokenfactory/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import "circle/fiattokenfactory/v1/params.proto";
import "circle/fiattokenfactory/v1/paused.proto";
import "circle/fiattokenfactory/v1/pauser.proto";
import "gogoproto/gogo.proto";
// this line is used by starport scaffolding # genesis/proto/import

option go_package = "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/types";

Expand All @@ -29,5 +28,4 @@ message GenesisState {
Owner owner = 8;
repeated MinterController minter_controller_list = 9 [(gogoproto.nullable) = false];
MintingDenom minting_denom = 10;
// this line is used by starport scaffolding # genesis/proto/state
}
3 changes: 0 additions & 3 deletions proto/circle/fiattokenfactory/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ syntax = "proto3";

package circle.fiattokenfactory.v1;

// this line is used by starport scaffolding # 1
import "circle/fiattokenfactory/v1/blacklisted.proto";
import "circle/fiattokenfactory/v1/blacklister.proto";
import "circle/fiattokenfactory/v1/master_minter.proto";
Expand Down Expand Up @@ -79,7 +78,6 @@ service Query {
rpc MintingDenom(QueryGetMintingDenomRequest) returns (QueryGetMintingDenomResponse) {
option (google.api.http).get = "/circle/fiattokenfactory/v1/minting_denom";
}
// this line is used by starport scaffolding # 2
}

// QueryParamsRequest is request type for the Query/Params RPC method.
Expand Down Expand Up @@ -173,4 +171,3 @@ message QueryGetMintingDenomRequest {}
message QueryGetMintingDenomResponse {
MintingDenom minting_denom = 1 [(gogoproto.nullable) = false];
}
// this line is used by starport scaffolding # 3
4 changes: 0 additions & 4 deletions proto/circle/fiattokenfactory/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ syntax = "proto3";

package circle.fiattokenfactory.v1;

// this line is used by starport scaffolding # proto/tx/import
import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";

Expand All @@ -25,7 +24,6 @@ service Msg {
rpc Unpause(MsgUnpause) returns (MsgUnpauseResponse);
rpc ConfigureMinterController(MsgConfigureMinterController) returns (MsgConfigureMinterControllerResponse);
rpc RemoveMinterController(MsgRemoveMinterController) returns (MsgRemoveMinterControllerResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

message MsgUpdateMasterMinter {
Expand Down Expand Up @@ -132,5 +130,3 @@ message MsgRemoveMinterController {
}

message MsgRemoveMinterControllerResponse {}

// this line is used by starport scaffolding # proto/tx/message
1 change: 0 additions & 1 deletion x/fiattokenfactory/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
cmd.AddCommand(CmdListMinterController())
cmd.AddCommand(CmdShowMinterController())
cmd.AddCommand(CmdShowMintingDenom())
// this line is used by starport scaffolding # 1

return cmd
}
1 change: 0 additions & 1 deletion x/fiattokenfactory/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdUnpause())
cmd.AddCommand(CmdConfigureMinterController())
cmd.AddCommand(CmdRemoveMinterController())
// this line is used by starport scaffolding # 1

return cmd
}
2 changes: 0 additions & 2 deletions x/fiattokenfactory/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func InitGenesis(ctx sdk.Context, k *keeper.Keeper, bankKeeper types.BankKeeper,
}
k.SetMintingDenom(ctx, *genState.MintingDenom)
}
// this line is used by starport scaffolding # genesis/module/init
k.SetParams(ctx, genState.Params)
}

Expand Down Expand Up @@ -87,7 +86,6 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *types.GenesisState {

mintingDenom := k.GetMintingDenom(ctx)
genesis.MintingDenom = &mintingDenom
// this line is used by starport scaffolding # genesis/module/export

return genesis
}
2 changes: 0 additions & 2 deletions x/fiattokenfactory/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func TestGenesis(t *testing.T) {
MintingDenom: &types.MintingDenom{
Denom: "65",
},
// this line is used by starport scaffolding # genesis/test/state
}

k, ctx := keepertest.FiatTokenfactoryKeeper(t)
Expand All @@ -77,5 +76,4 @@ func TestGenesis(t *testing.T) {
require.Equal(t, genesisState.Owner, got.Owner)
require.ElementsMatch(t, genesisState.MinterControllerList, got.MinterControllerList)
require.Equal(t, genesisState.MintingDenom, got.MintingDenom)
// this line is used by starport scaffolding # genesis/test/assert
}
3 changes: 3 additions & 0 deletions x/fiattokenfactory/keeper/msg_server_burn.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import (

func (k msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
return k.Keeper.Burn(ctx, msg)
}

func (k Keeper) Burn(ctx sdk.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) {
_, found := k.GetMinters(ctx, msg.From)
if !found {
return nil, sdkerrors.Wrapf(types.ErrBurn, "%v: you are not a minter", types.ErrUnauthorized)
Expand Down
3 changes: 3 additions & 0 deletions x/fiattokenfactory/keeper/msg_server_mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import (

func (k msgServer) Mint(goCtx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
return k.Keeper.Mint(ctx, msg)
}

func (k Keeper) Mint(ctx sdk.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) {
minter, found := k.GetMinters(ctx, msg.From)
if !found {
return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "you are not a minter")
Expand Down
58 changes: 46 additions & 12 deletions x/fiattokenfactory/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
)

Expand Down Expand Up @@ -79,21 +81,55 @@ const (
opWeightMsgRemoveMinterController = "op_weight_msg_remove_minter_controller"
// TODO: Determine the simulation weight value
defaultWeightMsgRemoveMinterController int = 100

// this line is used by starport scaffolding # simapp/module/const
)

// GenerateGenesisState creates a randomized GenState of the module
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
accs := make([]string, len(simState.Accounts))
for i, acc := range simState.Accounts {
accs[i] = acc.Address.String()
}
tokenfactoryGenesis := types.GenesisState{
Params: types.DefaultParams(),
// this line is used by starport scaffolding # simapp/module/genesisState
// x/fiattokenfactory

genesis := types.GenesisState{
MintersList: []types.Minters{
{
Address: authtypes.NewModuleAddress("cctp").String(),
},
},
MinterControllerList: []types.MinterController{
{
Minter: authtypes.NewModuleAddress("cctp").String(),
},
},
MintingDenom: &types.MintingDenom{Denom: "uusdc"},
}
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&tokenfactoryGenesis)

simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&genesis)

// x/bank

bankGenesisBz := simState.GenState[banktypes.ModuleName]
var bankGenesis banktypes.GenesisState
simState.Cdc.MustUnmarshalJSON(bankGenesisBz, &bankGenesis)

bankGenesis.DenomMetadata = append(bankGenesis.DenomMetadata, banktypes.Metadata{
Description: "USD Coin",
DenomUnits: []*banktypes.DenomUnit{
{
Denom: "uusdc",
Exponent: 0,
Aliases: []string{"microusdc"},
},
{
Denom: "usdc",
Exponent: 6,
Aliases: []string{},
},
},
Base: "uusdc",
Display: "usdc",
Name: "usdc",
Symbol: "USDC",
})

simState.GenState[banktypes.ModuleName] = simState.Cdc.MustMarshalJSON(&bankGenesis)
}

// ProposalContents doesn't return any content functions for governance proposals
Expand Down Expand Up @@ -267,7 +303,5 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
tokenfactorysimulation.SimulateMsgRemoveMinterController(am.accountKeeper, am.bankKeeper, am.keeper),
))

// this line is used by starport scaffolding # simapp/module/operation

return operations
}
3 changes: 0 additions & 3 deletions x/fiattokenfactory/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUnpause{}, "fiattokenfactory/Unpause", nil)
cdc.RegisterConcrete(&MsgConfigureMinterController{}, "fiattokenfactory/ConfigureMinterController", nil)
cdc.RegisterConcrete(&MsgRemoveMinterController{}, "fiattokenfactory/RemoveMinterController", nil)
// this line is used by starport scaffolding # 2
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
Expand All @@ -48,8 +47,6 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
&MsgRemoveMinterController{},
)

// this line is used by starport scaffolding # 3

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

Expand Down
5 changes: 1 addition & 4 deletions x/fiattokenfactory/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ func DefaultGenesis() *GenesisState {
Owner: nil,
MinterControllerList: []MinterController{},
MintingDenom: nil,
// this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(),
Params: DefaultParams(),
}
}

Expand Down Expand Up @@ -115,8 +114,6 @@ func (gs GenesisState) Validate() error {
return fmt.Errorf("minting denom cannot be an empty string")
}

// this line is used by starport scaffolding # genesis/types/validate

return gs.Params.Validate()
}

Expand Down
2 changes: 0 additions & 2 deletions x/fiattokenfactory/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func TestGenesisState_Validate(t *testing.T) {
MintingDenom: &types.MintingDenom{
Denom: "test",
},
// this line is used by starport scaffolding # types/genesis/validField
},
valid: true,
},
Expand Down Expand Up @@ -170,7 +169,6 @@ func TestGenesisState_Validate(t *testing.T) {
},
valid: false,
},
// this line is used by starport scaffolding # types/genesis/testcase
} {
t.Run(tc.desc, func(t *testing.T) {
err := tc.genState.Validate()
Expand Down

0 comments on commit 18d963b

Please sign in to comment.