Here ether scan links to failed transactions :
- last failed attempt : etherscan link
- others : etherscan link
- traced view of contract calls etherscan link (you may just change the tx hash on the URL to view other failed tx's in detail)
The contract call falls into gas error. It is basically chains of contracts making calls to one and another. As we have dig into the problem, we've seen that it fails on the method below.
Launchpad.sol
go to contract
/**
* @dev Function to setup liquidity and transfer all amounts according to defined percents, if softcap not reached set Refunded flag.
*/
function setupLiquidity() public onlyOwner {
require(_isSoldOut == true || block.timestamp > _end , "LaunchpadToken: not sold out or time not elapsed yet" );
require(_isRefunded == false, "Launchpad: refunded is activated");
require(_isLiquiditySetup == false, "Setup has already been completed");
_isLiquiditySetup = true;
if(_raisedETH < _softCap){
_isRefunded = true;
return;
}
uint256 ethBalance = address(this).balance;
require(ethBalance > 0, "LaunchpadToken: eth balance needs to be above zero" );
uint256 liquidityAmount = ethBalance.mul(_liquidityPercent).div(_totalPercent);
uint256 tokensAmount = _token.balanceOf(address(this));
require(tokensAmount >= liquidityAmount.mul(_BASE_PRICE).div(_priceUniInv), "Launchpad: Not sufficient tokens amount");
uint256 teamAmount = ethBalance.mul(_teamPercent).div(_totalPercent);
uint256 layerFeeAmount = ethBalance.mul(_fee3).div(_totalPercent);
uint256 supportFeeAmount = ethBalance.mul(_fee1).div(_totalPercent);
uint256 stakeFeeAmount = ethBalance.mul(_fee1).div(_totalPercent);
payable(_layerFeeAddress).transfer(layerFeeAmount);
payable(_supportFeeAddress).transfer(supportFeeAmount);
payable(_stakeFeeAddress).transfer(stakeFeeAmount);
payable(_teamWallet).transfer(teamAmount);
payable(_liquidityCreator).transfer(liquidityAmount);
_token.safeTransfer(address(_liquidityCreator), liquidityAmount.mul(_BASE_PRICE).div(_priceUniInv));
}
Somehow, it works on testnet; but fails on mainnet.
Theories are;
Chained contract calls have a higher gas limit requirement, the highest attempt so far is with 666,666 gas limit but it still fails. Maybe a number of investors caused this, as on testnet very few of them exist. If this is the case, how can we estimate the required gas limit?
Contract triggered transactions use 2300 gas, no matter how much gas limit initiator transaction has. That looks weird too.
Contracts :