testnet
GitHub

Set Contract Policy

SetContractPolicy(MsgSetContractPolicy) → MsgSetContractPolicyResponse

Binds an existing policy template to a specific smart contract address. Once set, the PCL will enforce the template's rules on all transactions interacting with that contract.

Parameters

Name Type Required Description
admin string The administrator address of the contract (must match current policy admin).
contract_address string The target smart contract address.
template_id uint64 The ID of the policy template to apply.

Returns

Type: MsgSetContractPolicyResponse

Empty on success.

Errors

Code Name Description
ErrTemplateNotFound Template Not Found If the template_id does not exist.

Examples

Binding Policy to Token

Enforces template #42 on contract 0x123...

msg := &pclv1.MsgSetContractPolicy{
  Admin: "maroo1...",
  ContractAddress: "0x123...",
  TemplateId: 42,
}
resp, err := client.SetContractPolicy(ctx, msg)
ESC
Type to search