Skip to content

Add subscribe() token-address validation #243

@orunganiekan

Description

@orunganiekan

Complexity: High (200 points)

Description
subscribe() accepts any Address as token. If a non-contract address is passed, the token::Client::new() call will succeed but allowance() will fail at runtime with an opaque error.

Requirements and context

  • Validate that the token address is a contract (not an account) before storing the subscription
  • Use env.deployer().get_contract_id() or similar Soroban API
  • Add ContractError::InvalidTokenAddress variant
  • Add test: non-contract address as token panics with typed error

Suggested execution

git checkout -b fix/token-address-validation
  • Edit contract/src/lib.rssubscribe()
  • Edit contract/src/errors.rs
  • Add test

Acceptance criteria

  • cargo test passes

Metadata

Metadata

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