Skip to content

Commit

Permalink
Add events for setAccessConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jan 26, 2023
1 parent 33bf579 commit 8a2d601
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 8 additions & 0 deletions x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,14 @@ func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAd

info.InstantiateConfig = newConfig
k.storeCodeInfo(ctx, codeID, *info)

ctx.EventManager().EmitEvent(sdk.NewEvent(
types.EventTypeSetAccessConfig,
sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(codeID, 10)),
sdk.NewAttribute(types.AttributeKeyCodePermission, newConfig.Permission.String()),
sdk.NewAttribute(types.AttributeKeyAuthorizedAddresses, strings.Join(newConfig.Addresses, ", ")),
))

return nil
}

Expand Down
15 changes: 9 additions & 6 deletions x/wasm/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ const (
EventTypeGovContractResult = "gov_contract_result"
EventTypeUpdateContractAdmin = "update_contract_admin"
EventTypeClearContractAdmin = "clear_contract_admin"
EventTypeSetAccessConfig = "set_access_config"
)

// event attributes returned from contract execution
const (
AttributeReservedPrefix = "_"

AttributeKeyContractAddr = "_contract_address"
AttributeKeyCodeID = "code_id"
AttributeKeyChecksum = "code_checksum"
AttributeKeyResultDataHex = "result"
AttributeKeyRequiredCapability = "required_capability"
AttributeKeyAdmin = "admin"
AttributeKeyContractAddr = "_contract_address"
AttributeKeyCodeID = "code_id"
AttributeKeyChecksum = "code_checksum"
AttributeKeyCodePermission = "code_permission"
AttributeKeyAuthorizedAddresses = "auth_addresses"
AttributeKeyResultDataHex = "result"
AttributeKeyRequiredCapability = "required_capability"
AttributeKeyAdmin = "admin"
)

0 comments on commit 8a2d601

Please sign in to comment.