8

I've been trying out in the past few days SushiSwap and lately SashimiSwap Contracts & Frontend and while I'm still getting familiar with the code. It turned out to be quite a challenge to make it work... Something is definitely missing since there are no tokens being minted after LP Deposits 😂.

Here are the steps that I did so far: Tested on KOVAN Network

  1. Created SushiToken
  2. Created MasterChef
  3. Transferred Ownership from SushiToken to MasterChef
  4. Created 3 LP Pairs on Uniswap (Sushi-WETH/Mock-WETH/Sushi-Mock).
  5. Used Masterchef.add(allocPoints, lpAddress, true) for all 3 pools.
  6. Matched SushiToken, MasterChef, and LP addresses on the FrontEnd.
  7. Approved & Deposited the LP on the FrontEnd Farm Deposit Section.
  8. Should see tokens being minted on the left side but they stay at 0.00.....

This is what I got so far regarding the migration. I added MockERC20 which is actually a clone of SashimiToken and WETH9 is a WETH Clone. Here comes some code:

Migrations: 2_deploy_contracts.js

const GnosisWallet = artifacts.require('./GnosisWallet')
const Timelock = artifacts.require('./Timelock')
const SashimiToken = artifacts.require('./SashimiToken')
const MockERC20 = artifacts.require('./MockERC20')
const WETH9 = artifacts.require('./WETH9.sol')
const MasterChef = artifacts.require('./MasterChef')
const UniswapV2Pair = artifacts.require('UniswapV2Pair');
const UniswapV2Factory = artifacts.require('UniswapV2Factory');
// const Migrator = artifacts.require('Migrator');
// const UniswapV2Migrator = artifacts.require('UniswapV2Migrator');

const Web3 = require('web3');
const web3 = new Web3();
const web3ToWei = (amount) => web3.utils.toWei((amount).toString(), "ether");

module.exports = function (deployer, network, accounts) {
    const DEV = accounts[0]; 
    const VESTING = accounts[1];
    deployer.then(async () => {
        try {
            // DEPLOY MULTISIG WALLET - SASHIMI & MOCK TOKENS
            await deployer.deploy(GnosisWallet, [DEV, VESTING, GOVERNANCE], 2); 
            await deployer.deploy(Timelock, DEV, 172800);
            await deployer.deploy(SashimiToken).deployed() 
            await deployer.deploy(MockERC20); 
            await deployer.deploy(WETH9);
            const GnosisWalletInstance = await GnosisWallet.deployed(); console.log(`GnosisWalletInstance: ${GnosisWalletInstance.address}`);
            const TimelockInstance = await Timelock.deployed(); console.log(`TimelockInstance: ${TimelockInstance.address}`);
            const SashimiTokenInstance = await SashimiToken.deployed(); console.log(`SashimiTokenInstance: ${SashimiTokenInstance.address}`)
            const MockERC20Instance = await MockERC20.deployed(); console.log(`MockERC20Instance: ${MockERC20Instance.address}`)
            const WETH9Instance = await WETH9.deployed(); console.log(`WETH9Instance: ${WETH9Instance.address}`)
            const MasterChefInstance = await MasterChef.deployed(); console.log(`MasterChefInstance: ${MasterChefInstance.address}`);
        
            // DEPLOY MASTERCHEF
            await deployer.deploy(MasterChef, SashimiTokenInstance.address, '100', '21093333', '21093777'); 
        
            // SET TIMELOCK MULTISIG ADMIN
            await TimelockInstance.setPendingAdmin(GnosisWalletInstance.address, { from: DEV });

            // INITIAL SASHIMI
            console.log(`Balance SASHIMI DEV before: ${await SashimiTokenInstance.balanceOf(DEV)}`)
            await SashimiTokenInstance.mint(DEV, web3ToWei(1000000), { from: DEV }) // - TESTING
            await SashimiTokenInstance.mint(VESTING, web3ToWei(1000000), { from: DEV }) // - TESTING
            await MockERC20Instance.mint(DEV, web3ToWei(1000000), { from: DEV }) // - TESTING
            await MockERC20Instance.mint(VESTING, web3ToWei(1000000), { from: DEV }) // - TESTING
            console.log(`Balance SASHIMI DEV after: ${await SashimiTokenInstance.balanceOf(DEV)}`)

            // TRANSFER OWNERSHIP TO MASTERCHEF
            await SashimiTokenInstance.transferOwnership(MasterChefInstance.address, { from: DEV });
            await MockERC20Instance.transferOwnership(MasterChefInstance.address, { from: DEV });

            let UniswapV2FactoryInstance;
            let SASHIMI_ETH, MOCKERC20_ETH, TOGETHER
            if (network == 'kovan') {

                // CREATE UNISWAP FACTORY CONTRACT
                const UniswapV2FactoryAddress = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';
                UniswapV2FactoryInstance = await UniswapV2Factory.at(UniswapV2FactoryAddress);
            
                // CREATE 3 POOLS - First Pool > Sashimi-Weth
                SASHIMI_ETH = await UniswapV2Pair.at((await UniswapV2FactoryInstance.createPair(SashimiTokenInstance.address, WETH9Instance.address)).logs[0].args.pair);
                await SashimiTokenInstance.transfer(SASHIMI_ETH.address, '10000000000000000000', { from: DEV }); // 10 SUSHI
                await WETH9Instance.transfer(SASHIMI_ETH.address, '1000000000000000', { from: DEV }); // 0.001 WETH
                await SASHIMI_ETH.mint(DEV);
                console.log(`SUSHI_WETH Address: ${SASHIMI_ETH.address}`);

                // Second Pool > MockERC20-Weth
                MOCKERC20_ETH = await UniswapV2Pair.at((await UniswapV2FactoryInstance.createPair(MockERC20Instance.address, WETH9Instance.address)).logs[0].args.pair);
                await MockERC20Instance.transfer(MOCKERC20_ETH.address, '10000000000000000000', { from: DEV }); // 10 MOCKERC20
                await WETH9Instance.transfer(MOCKERC20_ETH.address, '1000000000000000', { from: DEV }); // 0.001 WETH
                await MOCKERC20_ETH.mint(DEV);
                console.log(`MOCKERC20_WETH Address: ${MOCKERC20_ETH.address}`)
            
                // Third Pool > Sashimi-MockERC20
                TOGETHER = await UniswapV2Pair.at((await UniswapV2FactoryInstance.createPair(SashimiTokenInstance.address, MockERC20Instance.address)).logs[0].args.pair);
                await MockERC20Instance.transfer(TOGETHER.address, '10000000000000000000', { from: DEV }); // 10 MOCKERC20
                await SashimiTokenInstance.transfer(TOGETHER.address, '10000000000000000000', { from: DEV }); // 10 SUSHI
                await TOGETHER.mint(DEV);
                console.log(`MOCKERC20_SUSHI Address: ${TOGETHER.address}`)

                await MasterChefInstance.add('2000', SASHIMI_ETH.address, true);
                await MasterChefInstance.add('3000', MOCKERC20_ETH.address, true);
                await MasterChefInstance.add('5000', TOGETHER.address, true);
            }
        
            console.log(`Successfully deployed the project to ${network}. `)

        } catch (e) {
            console.log(e);
        }

    })
}

Frontend Changes:

  1. Commented out 3 lines to connect to exclusively to Kovan. https://github.com/SashimiProject/sashimiswap/blob/master/frontend/src/utils/getEthChainInfo.ts#L7-L9
  2. Updated the constants.js file to match all LP's and Token Addresses. https://github.com/SashimiProject/sashimiswap/blob/master/frontend/src/sushi/lib/constants.js

constants.js

export const supportedPools = [
  {
    pid: 0,
    lpAddresses: {
       42: '0x339cCd6d6656e29940429c70646c1EAbD521c644'
    },
    tokenAddresses: {
       42: '0xB4e5cC47eAD7898871Bc3873e25c8D3D8a24DA6f'
    },
    name: 'SASHIMI',
    symbol: 'SASHIMI-ETH UNI-V2 LP',
    tokenSymbol: 'SASHIMI',
    icon: '🍣',
  },
  {
    pid: 1,
    lpAddresses: {
       42: '0xe0a065a249e97bF7E08c3962ce3FF2b98bc964a9',
    },
    tokenAddresses: {
       42: '0x16856f7b53F22675a68e7Cd85D3b8d3b1B783a92'
    },
    name: 'MOCKERC20',
    symbol: 'MOCKERC20-ETH UNI-V2 LP',
    tokenSymbol: 'MOCKERC20',
    icon: '🍣',
  },
  {
    pid: 2,
    lpAddresses: {
      42: '0x673Fc3D7bB7b248f639e0c0da8D795B70FE6753e',
    },
    tokenAddresses: {
      42: '0xB4e5cC47eAD7898871Bc3873e25c8D3D8a24DA6f',
    },
    name: 'MOCKERC20-SASHIMI',
    symbol: 'SASHIMI-MOCKERC20 UNI-V2 LP',
    tokenSymbol: 'SASHIMI-MOCKERC20',
    icon: '🍣',
  },
]


export const contractAddresses = {
  sushi: {
    42: '0xB4e5cC47eAD7898871Bc3873e25c8D3D8a24DA6f', // aelf sushi new one 9.9
    // 42: '0x43a7903E3a839a67192151eE300e11198985E54b', // sushi
    1: '0xC28E27870558cF22ADD83540d2126da2e4b464c2', // aelf sashimi
    // 1: '0x6b3595068778dd592e39a122f4f5a5cf09c90fe2', // sushi use
  },
  masterChef: {
    42: '0xA20951552BdF184155DDBAC913540b5A27C867A1', // aelf sushi new one 9.9
    // 42: '0x245A074cA9814fB46A21562bC70fAB92F8A3F779', // sushi
    1: '0x1daed74ed1dd7c9dabbe51361ac90a69d851234d', // aelf master
    // 1: '0xc2edad668740f1aa35e4d8f227fb8e17dca888cd', // sushi use
  },
  weth: {
    42: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // aelf sushi
    // 42: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', // weth in kovan
    1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // sushi use
  },
}

UPDATE 25 Sep:Found out that Uniswap uses different versions for the Factories and Interfaces which are deployed mostly on Solidity ^0.5.0 and some are on ^0.6.0 or =0.6.6. After updating to make them all to pragma solidity =0.6.6; The pools give accSushiPerShare and we can see RewardDebt but still no yield is being generated.

UPDATE 30 Sep: Still can't figure out what I'm doing wrong. This is the repo that I managed to put together so far. The only step that does not work is the actual token minting after you deposit the UniswapV2 Pair LP.

https://github.com/Liberalite/Sashimi-Tests

1
  • 1
    1. This has been an ultra big help with setting up the front-end and thank you! 2. This resource has been some-what helpful in regard to your issue... bvcryptonews.com/… I am however still having issues with trying to get the original uniswap I forked to mint LP tokens, before reading your experience with this it wouldn't even try to connect with the smart contract, but after combining what you wrote and the resource that I mentioned I was able to at least get a pool started, but it won't issue out Apr 18, 2021 at 18:29

0

Browse other questions tagged or ask your own question.