Bitcord DEX Laravel

Contract Deployment


Contract Deployment

Smart contract files can be found under "Contracts/Swap.sol".

 

Copy the file contents and move to the next section. :)

Using REMIX

To deploy the smart contract using REMIX on the BSC Mainnet, you need to have at least 0.014 BNB on your metamask wallet.

 

1. Open: https://remix.ethereum.org/

2. Create a new file with the name "Swap.sol" under the contracts directory.

 

It should look like this after you paste the copied smart contract from our files.

3. Compile the smart contract

Make sure everything is the same as on our screen, you need to choose the 0.8.1 version for the compiler. If all is the same, click "Compile".

4. Deploy the contract.

Make sure to select Injected Provider - Metamask on the first dropdown.

In the deploy section, you can see that there are three constructor parameters.

_FEEACCOUNT -> BEP-20 Address of an account that will receive the fees.

_ROUTER -> Pancake Swap Router address (0x10ed43c718714eb63d5aa57b78b54704e256024e)

_WBNB -> Wrapped BNB Address (0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c)

 

Now you can hit "deploy". On the terminal you will see the notification like:

[block:20405329 txIndex:138]from: 0xD10...F6Aa7to: ZiLabSwap.(constructor)value: 0 weidata: 0x608...c095clogs: 1hash: 0xe73...6ef90

Now you can open your smart contract on the blockchain! 

Smart Contract Verification

To be able to interact with the smart contract, you must verify it.

To do so, open your contract on BSCScan.com

The address looks similar to this:

https://bscscan.com/address/{Contract Address}#contracts

 

1. Click on the text "Verify and Publish"

2. 

3. 

On the textarea "Enter the Solidity Contract Code below" you must paste the contract code from the remix website.

4. Click "Verify"

Add whitelisted tokens

You can add as many whitelisted tokens as you want, but keep in mind that in the background we are using Pancake swap router.

This means that it's recommended to choose the tokens from their website, who has some liquidity pool, otherwise your users will not be able to purchase any tokens.

 

You can see Pancake Swap tokens here - https://pancakeswap.finance/swap

Add as many as you want.

To add whitelisted tokens you will need to open your bscscan.com/ smart contract and go to the "contract" section.

Make sure that you are connected as an contract owner to the bsc website.

The method "addWhitelistedTokens" only accepts one parameter.

- Array of whitelisted tokens.

Here is the sample value from https://bitcord-dex-laravel.zilab.co

 

[0x0000000000000000000000000000000000000000,0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F,0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56,0x2170Ed0880ac9A755fd29B2688956BD959F933F8,0x55d398326f99059fF775485246999027B3197955,0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c,0xA7f552078dcC247C2684336020c03648500C6d9F,0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c,0xC9849E6fdB743d08fAeE3E34dd2D1bc69EA11a51,0x97A266490eFA4Fb564aD625AcCabE5641de2f805,0x101C35E6EeD9ca13046f1DE0487388Cdff6943A8,0x2cD96e8C3FF6b5E01169F6E3b61D28204E7810Bb]

It Should look like this:

Set Platform Fee

To change the default platform fee which is 1%, you will need to go to

https://bscscan.com/address/{YOUR CONTRACT}#writeContract

And search for the method "setFeePercent",

you can change it to as many as you want.

1% = 100

2% = 200

3% = 300 

and so on...