Swpr Deployer smart contract on mainnet

The DXswapDeployer smart contract to be used by the swpr dapp has been deployed on mainnet.

DXswapDeployer Mainnet: DXswapDeployer | 0xa3fe3aef12f0b017e6eb21acda192cdacf4ca9f5

DXswapDeployer Rinkeby: DXswapDeployer | 0x1388b4c283f4443bd05c891d0d5f8ad75a264693

ELI5 source code, bytecode and constructor arguments


Every smart contract has a source code that is it decides what to do with the ETH, tokens and data received from transactions that are sent to it.
Ethereum is a network of devices running a virtual machine, in order for this machines to understand the source it it needs to be encoded, this is why the readable and nice source is transformed into bytecode, so these machines can understand and process what is happening in the network.
When you create a contract you have to send the encoded source code (bytecode) and the encoded constructor arguments, this arguments have information that is needed for the contract to be created. So if you send the contract bytecode + constructor arguments encoded to the address zero (0x000…) you will deploy a smart contract in the ethereum network.

Now that we know this we can check that the contract of the smart contract used in rinkeby fro dapp testing is the same as the one we have in mainnet, therefore we will have the same dapp behavior on both networks :slight_smile:

If you used the bytecode from dxswap-core/DXswapDeployer.json at master · levelkdev/dxswap-core · GitHub you can see that it is present in the section “Contract Creation Code” in etherscan, both in mainnet and rinkeby.

This is the result when I search for the bytecode in the website, I open the search bar by hiting ctrl + F key and copy the bytecode in there and I can see the match in the “Contract Creation Code” section.

The other part of the code are the constructor arguments, which are:

  • The address of the contract that will receive the protocol fee revenue in ETH.
  • The address of the DXdao avatar.
  • The address of the WETH token in the network.
  • The array of the initial pairs to be deployed, in both cases I used: [WETH], [DXD], [DEFAULT_FEE]

I encoded the constructor arguments with and online ABI encoder, Online Ethereum abi encoder

Argument types:

address,address,address,address[],address[],uint32[]

Argument Values:

"0xa1d65E8fB6e87b60FECCBc582F7f97804B725521","0x519b70055af55a007110b4ff99b0ea33071c720a","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",[0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2],[0xa1d65E8fB6e87b60FECCBc582F7f97804B725521],[25]

In short the argument values are: DXD, dxAavatar, WETH, [WETH], [DXD],[DEFAULT_FEE]

And I got the constructor arguments:

000000000000000000000000a1d65e8fb6e87b60feccbc582f7f97804b725521000000000000000000000000519b70055af55a007110b4ff99b0ea33071c720a000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a1d65e8fb6e87b60feccbc582f7f97804b72552100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000019

And you can see that the rest of the contract constructor code are the arguments encoded.

Whats Next ?

The DXswapDeployer will deploy DXswap smart contracts after we sent any amount of ETH to the DXswapDeployer, so the next step will be to create a proposal to send funds to the address 0xa3fe3aef12f0b017e6eb21acda192cdacf4ca9f5, after that we will be able to build and publish the first version on Swpr-Dapp using DXswap smart contracts on mainnet.

3 Likes

Proposal to deploy DXswap from DXdao created https://alchemy.daostack.io/dao/0x519b70055af55a007110b4ff99b0ea33071c720a/proposal/0x9c398b4d4a7e7d61cbdb2346ea3e7a7f13818804299c03be9b90d4e545b9e287

Why should this be 5 ETH for the deployer? If I look at the Rinkeby Deploy transaction here https://rinkeby.etherscan.io/tx/0x668f9f2033ca4a109c0fb8363833dad96a41ca18526b83455011f7aa21660ec0 the gas used is just over 6 million. Plugging that in here https://ethgasstation.info/calculatorTxV.php it’s less than 1 ETH to deploy, unless I’m missing something.

Just thought since it is a one time thing and with high gas prices can go to 2-3 eth costs It would be cool to had an extra reward for anyone who called the deploy function.