Skip to content

[CT-17] Add input validation and transfer rules in multisig_transfer/rules.rs in opsce crate #827

@yusuftomilola

Description

@yusuftomilola

Problem

contracts/multisig_transfer/src/rules.rs exists as a module but the validation logic is incomplete. Transfer amounts are not validated against min/max thresholds, and there are no checks for self-transfers or transfers to blocked addresses.

Proposed Solution

Create contracts/opsce/src/transfer_rules.rs. Implement a validate_transfer(env, from, to, asset_id, amount) guard function called at the start of every transfer execution.

Acceptance Criteria

  • Returns Err(ContractError::SelfTransfer) if from == to
  • Returns Err(ContractError::AmountBelowMinimum) if amount < min_transfer_amount
  • Returns Err(ContractError::AmountAboveMaximum) if amount > max_transfer_amount
  • Returns Err(ContractError::RecipientBlocked) if to is in a blocked addresses list
  • set_transfer_limits(env, asset_id, min, max) configures limits (admin only)
  • block_address(env, address) adds an address to the blocked list (admin only)
  • Unit tests cover each validation rule and the happy path

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions