Normal flow is alice approves contractA to transfer tokens from her account. Then she calls a method in contractA that would call tokenContract.transferFrom. However, bc spender = Blockchain.origin this is going to check that alice approved alice to do a transfer instead of alice approved contractA. It ends up not working for the normal uses cases of approve and transferFrom. It would work if const spender = Blockchain.sender;
Note: unable to test this due to bug where Blockchain.sender is not correct. It is always equal to what is passed/mocked in unit tests and does not work in case where a contract calls another contract
Normal flow is
alice
approvescontractA
to transfer tokens from her account. Then she calls a method incontractA
that would calltokenContract.transferFrom
. However, bcspender = Blockchain.origin
this is going to check thatalice
approvedalice
to do a transfer instead ofalice
approvedcontractA
. It ends up not working for the normal uses cases of approve and transferFrom. It would work ifconst spender = Blockchain.sender;
bug is here: https://github.com/btc-vision/btc-runtime/blob/2ab2144aeb89c1826b8579813fb51f0e6c49255f/runtime/contracts/DeployableOP_20.ts#L358
Note: unable to test this due to bug where Blockchain.sender is not correct. It is always equal to what is passed/mocked in unit tests and does not work in case where a contract calls another contract