[DEX Viking Fork] Cannot approve LP staking contract on testnet

Hey guys !

I am currently experimenting with making a fork of vikingswap.finance to study Solidity & the inner working of DEX, and i am running into an issue

Whenever i attempt to stake a LP Token of BNB + My own version of Viking token, on the Farms page, i click on the “Approve” button, the transaction is called & processed… and the Approve button comes back and the staking is not enabled

My process was ( All addresses on BSC Testnet) :

  • Copy the Viking contracts (Token + Masterchef) & deploy them myself (NO code modification), verify them in order to interact with them, and mint a bunch of Viking to myself
    The token contract : 0xbd8a0322d9166d4f89196d457e00aef37751f628
    The masterchef t0x83753e9c58ce02aa2dcb2389132fd35a8e33ca92

  • Using https://test-exchange-pancake.pages.dev/, i created a LP using BNB + “my” Viking token
    The LP contract : 0x82e6a9e8882eb7dedb907a1d102fbb65d5eae70e

  • Using the masterchef contract, use the “Add” function with the following parameters to add the LP to the contract
    Example Add transaction : 0x016ab7a1fa205f7ce0f751e6e538f82c90247819a9929fd07ea3205df01f3d40

  • Copy the Viking Frontend to make my own website ; the only code modified was the farms.ts & the contracts.ts, to add my Masterchef, my token, and the newly created LP
    Farms.ts :
    {
    pid: 1,
    risk: 5,
    lpSymbol: ‘BVIKING-BNB LP’,
    lpAddresses: {
    97: ‘0x82e6a9e8882eb7dedb907a1d102fbb65d5eae70e’,
    56: ‘0x82e6a9e8882eb7dedb907a1d102fbb65d5eae70e’,
    },
    tokenSymbol: ‘VIKING’,
    tokenAddresses: {
    97: ‘0xbD8a0322D9166D4F89196D457e00AEF37751F628’,
    56: ‘0xbD8a0322D9166D4F89196D457e00AEF37751F628’,
    },
    quoteTokenSymbol: QuoteToken.BNB,
    quoteTokenAdresses: contracts.wbnb,
    },
    Contracts.ts :
    cake: {
    56: ‘0xbD8a0322D9166D4F89196D457e00AEF37751F628’,
    97: ‘0xbD8a0322D9166D4F89196D457e00AEF37751F628’,
    },
    masterChef: {
    56: ‘0x83753E9C58ce02AA2DcB2389132fD35A8E33cA92’,
    97: ‘0x83753E9C58ce02AA2DcB2389132fD35A8E33cA92’,
    },

  • Attempt to Approve, which starts a transaction, then the Approve button comes back
    An example of the “Approve” transaction :
    0xb71377760890d2e0a3a6ca3aa1e1508a388d008209ffe008c1407e4286bc6eba

I tried to do the whole operation a couple times, in case i just made a stupid mistake the first time, but ended up with the exact same result

I have no idea of what’s missing here, wether it is in the contracts themselves, which would be odd as i’m using the ones posted in VikingSwap github, or something else entirely.

Thanks in advance for the input :slight_smile:

Hi, welcome! :wave:

A little complex, could you please share the failed transaction hash?

Hey thanks for the answer :slight_smile:
As far as i can see, no transaction is failed

An example of the Approve transaction :
0xb71377760890d2e0a3a6ca3aa1e1508a388d008209ffe008c1407e4286bc6eba

If there is an error in there, i’m missing it

Hello! Did you find solution? I have the same problem(

Sorry for responding so late, so have you solve your question?

It seems like you have called approve() successfully, so do you still can not stake your token? Maybe there is something wrong with your front-end, have you replaces all tokens that you deployed?

I replaced masterchef contract, token contract and replaced LP address in farms. Transaction is successful, I approved token for masterchef and I tried to make a deposit in pool via bscscan and it was successful too. I think that mistake somewhere in frontend, but cant find it. Maybe I need to change something else? Thanks in advance!