Solidity – Why Internal Transactions Fail in a Transaction

chainlinkfailed-transactioninternal-transactionsoraclessolidity

I've deployed the chainlink alarm job to an oracle on bsc testnet. I'm attempting to transfer tokens from one address to another at a set time in my smart contract, and the transaction appears to be successful but the internal txns as failing.

Here are the failed transactions

The job on the oracle shows that the incoming transaction was completed successfully.

The contract function that calls to to the oracle:

    function requestAlarmClock(uint256 durationInSeconds) public returns (bytes32 requestId) 
{
    Chainlink.Request memory request = buildChainlinkRequest(_jobId, address(this), this.fulfillAlarm.selector);
    // This will return in 90 seconds
    request.addUint("until", block.timestamp + durationInSeconds);
    return sendChainlinkRequestTo(_oracle, request, oraclePayment);
}

 /**
 * Receive the response in the form of uint256
 */ 
function fulfillAlarm(bytes32 _requestId, uint256 _volume) public recordChainlinkFulfillment(_requestId)
{

    token.transferFrom(owner, _reciver, 2e18);
}

The contract is funded with LINK, as it's able to pay the oracle price. I'm not noticing any issues on the oracle side. The oracle contract is funded with LINK as well.
The oracle contract is 0x46cC5EbBe7DA04b45C0e40c061eD2beD20ca7755 and the source for this contract is here

Best Answer

From the transaction trace it fails when the contract 0xFcABC46b.. tries to transfer RGP tokens (0x9f0227A2..) from 0x2289Bc37.. using transferFrom but the owner hasn't approved them.

{
  "type": "CALL",
  "from": "0xdd4b35fb5efe3975a937ca9cab81ba17f3b9208e",
  "to": "0x46cc5ebbe7da04b45c0e40c061ed2bed20ca7755",
  "value": "0x0",
  "gas": "0x748cc",
  "gasUsed": "0x15e2b",
  "input": "0x4ab0d190934d8bb17ebb8000127b45f1c53c18a0829f4819d58670191bbae16341cd4ea8000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000fcabc46bfc565f708972332d71124c073ba0084d01e13b510000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000611384520000000000000000000000000000000000000000000000000000000000000000",
  "output": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "time": "22.9388ms",
  "calls": [
    {
      "type": "CALL",
      "from": "0x46cc5ebbe7da04b45c0e40c061ed2bed20ca7755",
      "to": "0xfcabc46bfc565f708972332d71124c073ba0084d",
      "value": "0x0",
      "gas": "0x6ef38",
      "gasUsed": "0x1206d",
      "input": "0x01e13b51934d8bb17ebb8000127b45f1c53c18a0829f4819d58670191bbae16341cd4ea80000000000000000000000000000000000000000000000000000000000000000",
      "error": "execution reverted",
      "calls": [
        {
          "type": "CALL",
          "from": "0xfcabc46bfc565f708972332d71124c073ba0084d",
          "to": "0x9f0227a21987c1ffab1785ba3eba60578ec1501b",
          "value": "0x0",
          "gas": "0x6a111",
          "gasUsed": "0xed01",
          "input": "0x23b872dd0000000000000000000000002289bc372bc6a46dd3ebc070fc5b7b7a49597a4e000000000000000000000000d6bc7f57755a4dece5c863794c7f37718d10064a0000000000000000000000000000000000000000000000001bc16d674ec80000",
          "error": "execution reverted"
        }
      ]
    }
  ]
}
Related Topic