OracleSwap is a DEX that is a fork of Uniswap.
The end goal is I am trying to add liquidity https://docs.uniswap.org/contracts/v2/reference/smart-contracts/router-01#addliquidity
In order to do this, first we need to approve the OracleSwapRouter contract to spend the erc20 token.
I get below error when I am trying to approve
to OracleSwapRouter
in songbird (EVM compatible) network so that I can provide liquidity on the farm. I am not sure if this is an RPC rate-limiting issue or if something is wrong with the code.
ProviderError: HttpProviderError
at HttpProvider.request (<path>/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)
at LocalAccountsProvider.request (<path>/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async EthersProviderWrapper.send (<path>/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
Any help is appreciated. Thank you in advance
Relevant links
oracle erc20 token --> https://songbird-explorer.flare.network/address/0xD7565b16b65376e2Ddb6c71E7971c7185A7Ff3Ff
contract to approve (OracleSwapRouter) --> https://songbird-explorer.flare.network/address/0x73E93D9657E6f32203f900fe1BD81179a5bf6Ce4
Below are the relevant code snippets
const OracleSwapRouterContract = await ethers.getContractAt(OracleSwapRouterAbi.default,
"0x73E93D9657E6f32203f900fe1BD81179a5bf6Ce4");
const oracleContract = await ethers.getContractAt(oracleAbi.default, "0xd7565b16b65376e2ddb6c71e7971c7185a7ff3ff");
await oracleContract.approve(
"0x73E93D9657E6f32203f900fe1BD81179a5bf6Ce4",
oracleBalance
);
The below code gives me the balance for the account so I know oracleContract is not the problem.
const oracleBalance = await oracleContract.balanceOf(SONGBIRD_ACC);
my hardhat network config
songbird: {
url: "https://songbird-api.flare.network/ext/C/rpc",
chainId: 19,
accounts:
SONGBIRD_PRIVATE_KEY !== undefined ? [SONGBIRD_PRIVATE_KEY] : [],
gasPrice: 900000000,
},
You can add some lines to node_modules/hardhat/internal/core/providers/http.js
to debug. After every isErrorResponse
check, add: console.log(response)
or console.log(jsonRpcResponse)
.
Most likely it's an error inside your contracts or deploy script (or both).