Background:
The transfer-adoption contract allows initiating a transfer without cancelling previous ones. In theory, only one transfer can be pending at a time, but the code does not enforce this, allowing state confusion.
Problem:
initiate_transfer does not check if a transfer is already pending for the pet.
What "done" looks like:
initiate_transfer returns TransferError::TransferAlreadyPending if a pending transfer exists.
- The caller must cancel the existing transfer before initiating a new one.
- Tests cover: first transfer succeeds, second attempt fails, cancel + re-initiate succeeds.
Implementation guidelines:
- Key file:
stellar-contracts/contracts/pet-transfer-adoption/src/lib.rs.
PR must include:
- Pending transfer check
- Three tests
cargo test passing
Background:
The transfer-adoption contract allows initiating a transfer without cancelling previous ones. In theory, only one transfer can be pending at a time, but the code does not enforce this, allowing state confusion.
Problem:
initiate_transferdoes not check if a transfer is already pending for the pet.What "done" looks like:
initiate_transferreturnsTransferError::TransferAlreadyPendingif a pending transfer exists.Implementation guidelines:
stellar-contracts/contracts/pet-transfer-adoption/src/lib.rs.PR must include:
cargo testpassing