Deepak.eth/.sol
03/09/2026, 9:46 AMlet has_sufficient = e_ge(balance, amount)?;
let actual_amount = e_select(has_sufficient, amount, zero)?; // Transfer amount OR zero
balance = e_sub(balance, actual_amount)?;
If the customer doesn't have enough, actual_amount becomes zero, the transaction still succeeds, just with nothing transferred.
The problem for your NFT shop, you can't know on-chain whether the payment actually went through! The transfer "succeeds" either way.
Check balance first, then transfer:
let has_funds: Ebool = e_ge(cpi_ctx, customer_balance, price, 0)?;
// Store has_funds handle, require customer to prove they paid
Use attested decrypt for verification:
After transfer, customer decrypts their has_funds result
Submit proof on-chain via is_validsignature
Only then transfer NFT
Hope u undertand what I am trying to say?!