Skip to content

Commit

Permalink
Remove exposed functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pinosu committed Nov 9, 2022
1 parent cf09ba6 commit f4ac252
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 53 deletions.
24 changes: 0 additions & 24 deletions x/wasm/keeper/contract_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ type decoratedKeeper interface {
authZ AuthorizationPolicy,
) (sdk.AccAddress, []byte, error)

createAndInstantiate(
ctx sdk.Context,
creator, admin sdk.AccAddress,
wasmCode []byte,
instantiateAccess *types.AccessConfig,
initMsg []byte,
label string,
deposit sdk.Coins,
addressGenerator AddressGenerator,
authZ AuthorizationPolicy,
) (sdk.AccAddress, []byte, error)

migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte, authZ AuthorizationPolicy) ([]byte, error)
setContractAdmin(ctx sdk.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ AuthorizationPolicy) error
pinCode(ctx sdk.Context, codeID uint64) error
Expand Down Expand Up @@ -140,15 +128,3 @@ func (p PermissionedKeeper) SetContractInfoExtension(ctx sdk.Context, contract s
func (p PermissionedKeeper) SetAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig) error {
return p.nested.setAccessConfig(ctx, codeID, caller, newConfig, p.authZPolicy)
}

func (p PermissionedKeeper) CreateAndInstantiate(
ctx sdk.Context,
creator, admin sdk.AccAddress,
wasmCode []byte,
instantiateAccess *types.AccessConfig,
initMsg []byte,
label string,
deposit sdk.Coins,
) (sdk.AccAddress, []byte, error) {
return p.nested.createAndInstantiate(ctx, creator, admin, wasmCode, instantiateAccess, initMsg, label, deposit, p.nested.ClassicAddressGenerator(), p.authZPolicy)
}
18 changes: 0 additions & 18 deletions x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,24 +398,6 @@ func (k Keeper) instantiate(
return contractAddress, data, nil
}

func (k Keeper) createAndInstantiate(
ctx sdk.Context,
creator, admin sdk.AccAddress,
wasmCode []byte,
instantiateAccess *types.AccessConfig,
initMsg []byte,
label string,
deposit sdk.Coins,
addressGenerator AddressGenerator,
authZ AuthorizationPolicy,
) (sdk.AccAddress, []byte, error) {
codeID, _, err := k.create(ctx, creator, wasmCode, instantiateAccess, authZ)
if err != nil {
return nil, nil, err
}
return k.instantiate(ctx, codeID, creator, admin, initMsg, label, deposit, addressGenerator, authZ)
}

// Execute executes the contract instance
func (k Keeper) execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) {
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "execute")
Expand Down
10 changes: 0 additions & 10 deletions x/wasm/types/exported_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ type ContractOpsKeeper interface {
fixMsg bool,
) (sdk.AccAddress, []byte, error)

CreateAndInstantiate(
ctx sdk.Context,
creator, admin sdk.AccAddress,
wasmCode []byte,
instantiateAccess *AccessConfig,
initMsg []byte,
label string,
deposit sdk.Coins,
) (sdk.AccAddress, []byte, error)

// Execute executes the contract instance
Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error)

Expand Down
14 changes: 13 additions & 1 deletion x/wasm/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func init() { // register new content types with the sdk
govtypes.RegisterProposalType(string(ProposalTypePinCodes))
govtypes.RegisterProposalType(string(ProposalTypeUnpinCodes))
govtypes.RegisterProposalType(string(ProposalTypeUpdateInstantiateConfig))
govtypes.RegisterProposalType(string(ProposalTypeStoreAndInstantiateContractProposal))
govtypes.RegisterProposalTypeCodec(&StoreCodeProposal{}, "wasm/StoreCodeProposal")
govtypes.RegisterProposalTypeCodec(&InstantiateContractProposal{}, "wasm/InstantiateContractProposal")
govtypes.RegisterProposalTypeCodec(&MigrateContractProposal{}, "wasm/MigrateContractProposal")
Expand Down Expand Up @@ -265,7 +266,18 @@ func NewStoreAndInstantiateContractProposal(
msg RawContractMessage,
funds sdk.Coins,
) *StoreAndInstantiateContractProposal {
return &StoreAndInstantiateContractProposal{title, description, runAs, wasmBz, permission, unpinCode, admin, label, msg, funds}
return &StoreAndInstantiateContractProposal{
Title: title,
Description: description,
RunAs: runAs,
WASMByteCode: wasmBz,
InstantiatePermission: permission,
UnpinCode: unpinCode,
Admin: admin,
Label: label,
Msg: msg,
Funds: funds,
}
}

// ProposalRoute returns the routing key of a parameter change proposal.
Expand Down

0 comments on commit f4ac252

Please sign in to comment.