SafeERC20 Transfer fails despite approval

Hi Guys,

I have a set of the contract with a user proxy like structure wherein each user has a proxy contract like ds-proxy now I additionally have an external that I want to interact with via my proxy through delegate call function now the issue is I am able to approve the external contract to spend my tokens via the proxy but when I try to transfer the tokens from the user to the external contract which uses safe erc20 via the proxy my tx gets reverted which you might be able to see here
Now as I debug in tenderly I see the tx reverts here

(bool success, bytes memory returndata) ={ value: weiValue }(data);

the function is _functionCallWithValue which is in address.sol called by safe erc20
So I wanna Know:

  1. am I doing something wrong here? what point is the _functionCallWithValue called from safe erc20?
1 Like

Hi @viraj124,

Can you give a bit more detail on what contracts are involved?

Are you trying to do a double delegate call?

proxy -> (delegatecall) implementation -> (delegatecall) other contract

Which then calls:

@abcoathup no so it’s like this

  1. user => proxy => approve(in token contract to approve the external contract) this passes
  2. user => proxy => function in external contract this fails
1 Like

Hi @viraj124,

Ok, so if it isn’t a double delegate call, then I assume that the contract doing the transfer doesn’t have an allowance (or sufficient enough allowance). So I would manually check what the allowance the external contract has for the token.

set infinte allowance in fact @abcoathup also bdw changed the logic so changes safeTransferFrom to safeTransfer did this as a reference tx on ropsten can you take a look what happens is while the balance of the user is changed the functionCall get’s called

1 Like

@abcoathup the latest tx you can search the hash on ropsten no I approved the external contract to spend my tokens worth > 100 tokens
and did a tx via the proxy I have transferFrom at the end but it reverts you can see the logs on tenderly if you want just search the hash

1 Like

the latest tx here I approved as well still the issue :sweat_smile:

1 Like

Hi @viraj124,

Sorry, I haven’t had a chance to dig into this.

Were you able to resolve? Would you mind sharing what the issue was?

If you haven’t resolved, can you put together a simple example which reproduces the problem?