Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
Can't get swapExactTokensForTokens on pancakeswap to work

I'm struggling with getting swapExactTokensForTokens to work on pancakeswap I just cannot see why it keeps failing I call giveAllowances() and send 0.1 cake to the contract then call sellCake() - both egg and cake has liquidity with wbnb so I really don't understand what the issue is.

See the partial code below

    address public egg = 0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6;
    address public cake = 0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82;
    address public router = 0xF491e7B69E4244ad4002BC14e878a34207E38c29;
    address public dead = 0x000000000000000000000000000000000000dEaD;
    address public wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
    address[] public route = [cake, wbnb, egg];


    function giveAllowances() external onlyOwner {
        IBEP20(cake).safeApprove(router, uint256(-1));
    }


    function sellCake() public onlyOwner {
        uint256 _bal = IBEP20(cake).balanceOf(address(this));

        if (_bal > 0) {
            IUniswapV2Router02(router).swapExactTokensForTokens(_bal, 0, route, dead, now);
        }
    }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!