# Final deployment

This deployment summarize all the steps involved in launching XdYe Smart Contracts. This deployment is linked to [final-test](https://rogercapone.gitbook.io/xdye-documentation/testing-smart-contracts/final-test "mention").

{% hint style="info" %}
**Good to Know:** if you would like to make the deployment to main net you should be conscious of where you want fees to finally end. And establish them in the corresponding argument.&#x20;
{% endhint %}

In case we are deploying it to a testnet or mainnet we will need to run the following command:

```
> truffle migrate --reset --network volta
```

The deployment script we need to execute can be found at:

{% embed url="<https://github.com/rogerCapone/XdYe_Deployments/blob/main/Final_deployment.js>" %}
Final XdYe Smart Contract Deployment
{% endembed %}

For all those who are not familiar with source code reading we have explain it. Consider that the code provided above needs to be executed in two steps as we have already explained several times along with this Documentation.&#x20;

### Deployment Steps

1. Deploy WETH Contract
2. Deploy Token A Contract
3. Deploy Token B Contract
4. Deploy Factory Contract
5. We execute *`factory.methods.pairCodeHash().call()`* in a script, we place that information on `UniswapV2Library.sol` file extracting *`0x`*
6. Deploy Router Contract
7. Deploy XdYe Token Contract
8. We execute *`xdye.methods.mint()`* so we can have some XdYe tokens for testing the structure.
9. Deploy MasterChef Contract
10. We change governance over XdYe Token, so now MasterChef contract can mint XdYe for those who provide liquidity. This is done through *`xdye.methods.transferOwnership(MasterChef.address).send({from: xdyeDeploymentAddress}`*)
11. Deploy XdYeBar Contract
12. Deploy XdYeMaker Contract
13. We execute *`factory.methods.setFeeTo(xdyeMaker.address).send({from:factoryDeploymentAddress})`*
14. Deploy Unlocker Contracts&#x20;

Once we have done all those steps we are done with all XdYe Platform Smart Contracts deployments.

{% hint style="warning" %}
**Attention:** There are still some things to do in order to make it run. \
\&#xNAN;*F.e. MasterChef contract has not been set up. Or in other words we need to tell MasterChef which tokens or LPs can he receive in order to distribute rewards.*
{% endhint %}
