Environment
Unable to execute transfer function though relay in Mainnet
Details
I given all permission to Relay and Relay having Minter role, but while executing the withdraw function though SDK or Relay interface I am getting "Transaction would revert: could not estimate gas for transaction.", Urgent help required because same code I tried on Testnet it is working so I deployed over the Mainnet but not my client ETH is stuck
function withdrawAll() public payable onlyRole(MINTER_ROLE) {
payable(address(x)).transfer(address(this).balance);
}
If relay doesn't have Minter Role then it will give permission issue not gas issue, I am assure about all permission given to relay. Please do let me know if you required more details so that you may help. I am updating Etherscan code
The error message `"Transaction would revert: could not estimate gas for transaction." simply tells you that the transaction is going to revert, and that you therefore cannot get an accurate estimation of how much gas it is going to cost you.
Two options:
The t1 address is that of a contract which does not implement the fallback function and the receive function.
You have not granted Minter permission to the account that you are using in order to execute this transaction.
Sorry, I thought it is x but as per the give code I am trying to withdraw though Paiverse contract where t1 is address public t1 = 0xA7de0063e7197009c4E67a4356A70d6473bD0587;, and Relay having Minter Role because minting is working fine.
Well, the fact of the matter is that this address - pointed by t1 in your contract - happens to be the address of a contract on mainnet, and not "just simple ETH address" as you have previously claimed in response to my speculation:
The t1 address is that of a contract which does not implement the fallback function and the receive function.
Hence, most likely, this is indeed what's causing your transaction to revert.
It might also explain why it works for you on a testnet, where unlike mainnet, no contract is deployed at the address the pointed by t1.
BTW, it is possible that the contract at that address DOES implement a fallback function or a receive function, and that this function reverts internally for whatever reason.
In short, you'll need to look into the code of that contract in order to find out for sure.
Hi, I am having the same issue as originally described Transaction would revert: could not estimate gas for transaction.
I am using remix to build the contract and everything works through their GUI injected & on testnet.. so I am having a hard time debugging the issue.
contract address is here: 0x4a396205e94fe6474a2de647933466c1e84a9d54
I can paste the code but I am calling a function which reduces a internal struct balance and transfers the number of tokens out, similar to a staking contract