Revoked references

I have a revoked reference compile time error, very strange
func deposit_reward{syscall_ptr : felt, pedersen_ptr : HashBuiltin, range_check_ptr}(amount :Uint256 ):
alloc_locals
let (local caller_address:felt) = get_caller_address()
let (local reward_token_address:felt) = rewarderc20_address.read()
let (contract_address) = get_contract_address()

IERC20.transferFrom(contract_address=reward_token_address, sender=caller_address,recipient=contract_address,amount =amount)
    # Instanciating a zero in uint format
let zero_as_uint256: Uint256 = Uint256(0,0)
let cur_total_supply :Uint256 = total_supply.read()
let (is_equal) = uint256_eq(cur_total_supply, zero_as_uint256)
if is_equal == 0:
    let (local tmp_reward_factorinc:Uint256, ) = uint256_unsigned_div_rem(amount,cur_total_supply )
    let (local cur_reward:Uint256) = reward_factor.read()
    let (local newreward:Uint256,) = uint256_add(tmp_reward_factor_inc, cur_reward)
    reward_factor.write(value=new_reward)
end

deposit_reward_called.emit(user=caller_address, reward_amount=amount)

return ()
on → deposit_reward_called.emit(user=caller_address, reward_amount=amount)
any hints would be nice, thanks