Open cqlyj opened 1 month ago
Maybe you're missing approval for the token? 0xfe opcode was used in old solidity versions for failed assertions/requires
Maybe you're missing approval for the token? 0xfe opcode was used in old solidity versions for failed assertions/requires
Here is the MockLinkToken Contract: https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/mocks/MockLinkToken.sol
I think it has nothing to do with approval
because it works on sepolia testnet and if I try to call the setBalance
function on mainnet forking, it will also revert. But the setBalance
function in the MockLinkContract got no modifier or anything related to owner, it should not revert.
I don't know why it behaves differently on testnet sepolia and the mainnet.
MockLinkToken(linkTokenAddress).setBalance(
address(this),
FUND_AMOUNT
);
│ │ ├─ [327] LinkToken::setBalance(FundSubscriptionDistribution: [0xDDc10602782af652bB913f7bdE1fD82981Db7dd9], 3000000000000000000 [3e18])
│ │ │ └─ ← [Revert] EvmError: Revert
│ │ └─ ← [Revert] EvmError: Revert
│ └─ ← [Revert] EvmError: Revert
└─ ← [Revert] EvmError: Revert
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0
What command(s) is the bug in?
forge test --fork-url $MAINNET_RPC_URL --mt testFulfillRandomWordsUpdatesRandomWords -vvvvv
Operating System
Linux
Describe the bug
I was writing a foundry script:
And for the test:
This test will first deploy the contract and then
createSubscription
on chainlink VRFv2, thenfundSubscription
it andaddConsumer
to get the randomWords back. The test works fine on localanvil
chain and testnetsepolia
. But it reverts on forkmainnet
and reverts with the error below:I have no idea why this revert on mainnet fork testing.