For some months DXdao has been strategically preparing for the launch of Arbitrum One, a decentralized “layer 2” scaling solution built on the Ethereum network. Swapr has aspirations to be THE native AMM on the Arbitrum network, but this won’t come easy. Deploying to a new chain comes with many complications, especially considering the additional variables DXdao has to account for as an Ethereum native DAO. This post outlines the required steps to be undertaken by both DXdao and the community to facilitate a smooth deployment of DXvote, the Swapr dApp and the SWPR token on the Arbitrum One network.
Swapr dApp and Token Community Steps
The Arbitrum Base (DXvote on Arbitrum One), the Swapr Contracts on Arbitrum One, and the SWPR token will need to be deployed by a community member or members. It is suggested here that deployment costs will be reimbursed by DXdao in addition to a .25 ETH reward for deployment of The Arbitrum Base and a .25 ETH reward for deployment of the SWPR token and Swapr smart contracts on Arbitrum One. These reimbursements and rewards can be claimed via a proposal by the deployer address. A step-by-step follows; if anything has been left unclear the prospective deployer is urged to reach out through community social channels, such as the DXdao Discord.
-
Deployment of aDXdao, DXdao Arbitrum One Base (using DXvote) and mainnet signal proposal.
A. Deploy DXvote to Arbitrum One using the parameters in the DXvote Deployment Details section below. The REP should mirror mainnet REP at time of deployment, with the exception of REP held by smart contract addresses. Since smart contract addresses are not the same on Arbitrum One as they are on mainnet, only the addresses mapped during the xDai base deployment are included. See https://daotalk.org/t/dxdao-signaling-contract-reputation-mapping/2087
B. Make a proposal to mainnet indicating the address of the avatar, the controller, the reputation contract, and of the schemes, including the Swapr Wallet Scheme.
-
SWPR Token deployment and mainnet signal proposal
A. Deploy SWPR token contract on Ethereum mainnet. The token contract automatically mints 100M SWPR to an address passed in on deployment. The deployer must pass in his own address as the sole receiver of the 100m SWPR, and after minting the whole supply will be in the hands of the deployer.
B. Send 85,616,000 SWPR tokens to the DXdao treasury, retaining 14,384,000 SWPR which are needed for the airdrop and initial liquidity mining operations on Arbitrum.
C. Make a mainnet signal proposal using the included formatted text. (Ensure you fill in the SWPR token mainnet address under the “Token Information” section). This will use the same address which will be used to deploy Swapr contracts on Arbitrum.
D. When Swapr Dev team sees the mainnet signal proposal it will inform the Arbitrum One team to whitelist the proposing address.
-
Swapr contracts deployment to Arbitrum One and swapr.eth update proposal on mainnet.
A. Bridge the retained SWPR tokens to Arbitrum One and get the SWPR L2 address (you should be able to see it in the official Arbitrum bridge UI after the first bridging operation has completed successfully). The Arbitrum One SWPR token address is needed for setting the L2_SWPR_ADDRESS environment variable when deploying the claimer contract.
B. Generate the Merkle root for the claimer contract. In order to do so, start by cloning the SWPR token contract repository (https://github.com/luzzif/swapr-token-contracts). Install the required dependencies through Yarn by executing
yarn install
or simplyyarn
. After the dependencies are installed, runyarn create-whitelist
to start the whitelist creation process, which will take a while. Once the process is done executing, a few things will be printed out on screen. What we’re interested in is the string that is printed alongside themarketing and unlocked dxd holders airdrop eoa root
log. That’s going to be our airdrop whitelist Merkle root, which will be used in setting the MERKLE_ROOT environment variable when deploying the claimer contract.C. Pin the airdrop whitelist on IPFS. Among other things, the whitelist creation process also writes various JSON files containing various kinds of whitelists under
/whitelist-creation/cache
. What we’re interested in is themarketing-and-unlocked-dxd-holders-airdrop-eoa-leaves.json
one. Make sure to pin this file on IPFS and note down the resulting CID, it will be needed later in order to release the frontend.D. Deploy SWPR claimer contract to Arbitrum One. In order to do it, stay in the previously cloned SWPR token contract repository. At this point you will need to create a
.env
file at the root of your local folder, with the following contents:
PRIVATE_KEY=your-account-private-key
your-account-private-key
needs to be replaced by an actual private key. The private key needs to give access to an account that holds funds on Arbitrum One, enough to perform the deployment.
Once this step is taken care of, you can trigger the claimer’s deployment by using a command formatted in the following way:
yarn deploy-claimer:arbitrum-one --swpr-address $L2_SWPR_ADDRESS --claim-time-limit 1640995200 --merkle-root $MERKLE_ROOT
Where:
-
L2_SWPR_ADDRESS is the address determined at step a
-
MERKLE_ROOT is the string extracted from the whitelist creation script at step b
Once the script is executed, it will print out the claimer contract’s deployment address on Arbitrum One, which is needed for later stages.
E. Send 7M SWPR to claimer contract on Arbitrum One. Send 1M SWPR to the Arbitrum One Base avatar. Send 6,384,000 SWPR to Swapr Wallet Scheme on Arbitrum One.
F. Deploy Swapr contracts to Arbitrum One.
In order to deploy the core and periphery contracts, simply clone this repository (https://github.com/luzzif/swapr-contracts-deployer) and install dependencies through yarn install
. In order to continue, a private key must also be added to a .env
file as done for step d. This private key will need to give access to a properly funded account through which the contracts will be deployed.
After having added the private key, a single task can trigger the whole contract suite deployment, which will take care of the pairs factory, router, fee setter and fee receiver, and it’s the deploy
task. In order to trigger it, just type yarn deploy
in the terminal, passing in the following required parameters:
-
--network
: specifies the network on which you want to perform the deployment. In our case it should be set toarbitrumMainnet
. -
--native-asset-wrapper-address
: the address of the contract that wraps the native asset in the target chain. On Arbitrum, the canonical WETH instance is deployed at0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
, so the parameter should be set to this value. -
--owner-address
: An address that will become the owner of the contracts after deployment. This address will also get all accrued fees (both denominated in native asset, and exotic currencies). This should be set to DXvote’s address on Arbitrum One (which should be known after step 1).
After the command has finished running, make sure to take note of the printed out addresses, which will be needed on later stages.
We can now deploy the liquidity mining campaigns factory contract.
In order to do that, simply clone this repository (https://github.com/luzzif/dxdao-staking-rewards-distribution-contracts).
As previously done, install the dependencies through yarn install
and add a .env
file at the root of the project setting a private key useful for contracts deployment (ideally, the same one used to deploy the core and periphery).
The command to execute this time is yarn deploy:arbitrum-one:no-validators
. The only required parameter is --owner-address
, which must be set to DXvote, in order to give ownership of the farming contracts to the DAO.
At the end of this step, we should have addresses for all these contracts deployed to Arbitrum One:
-
Pairs factory
-
Router
-
Fee Receiver
-
Fee Setter
-
Staking Rewards Factory
G. Build latest release of Swapr and propose update to swapr.eth
In order to build the latest release of Swapr, clone the Swapr Dapp repo https://github.com/levelkdev/dxswap-dapp and check out the tag of the latest release. Using node v12.20.0, install dependencies by running yarn install --force
Once dependencies are installed, create a .env
file at the root of the project with the following variables filled out:
-
REACT_APP_FACTORY_ADDRESS_ARBITRUM_ONE: self explanatory. The value should come from step 3.f.
-
REACT_APP_ROUTER_ADDRESS_ARBITRUM_ONE:: self explanatory. The value should come from step 3.f.
-
REACT_APP_STAKING_REWARDS_FACTORY_ADDRESS_ARBITRUM_ONE: self explanatory. The value should come from step f.
-
REACT_APP_SWPR_ADDRESS_ARBITRUM_ONE: self explanatory. The value should come from step 2.
-
REACT_APP_SWPR_CLAIMER_ADDRESS_ARBITRUM_ONE: self explanatory. The value should come from step 3.d
-
REACT_APP_SWPR_AIRDROP_WHITELIST_IPFS_HASH: self explanatory. The value should come from step 3.c.
Once the .env file is created and updated, run yarn ipfs-build
to bundle the application in a format compatible with IPFS.
To generate the IPFS hash, you can run ipfs add -rn ./build
After building the dapp, upload and pin the dapp to IPFS.
Finally, make a proposal to DXdao to update the content hash of swapr.eth A recent example of such a proposal can be found here and a multicodec version of the IPFS hash can be encoded using https://content-hash.surge.sh/.
DXvote Deployment Details
The plan is to deploy four schemes, the same three schemes we have been using in Rinkeby and Arbitrum Testnet DXvote dapp plus a special scheme that will communicate only with the SWPR protocol and the avatar, this scheme will act as a quick action relayer between dxdao and the SWPR protocol.
Initially the SWPR scheme will be able to call any contract, this permission will be removed and replaced with only calls to SWPR protocol and DXdao avatar in Arbitrum once SWPR is deployed.
-
Registrar Wallet Scheme
-
Calls to Controller: Yes.
-
Max Seconds for calls to be executed after approval (maxSeconsForExecution): 1 Day
-
Maximum Reputation to be changed in a proposal execution (maxRepPercentageChange): 5 %
-
controllerPermissions: Everything
-
Required % vote to execute Queued Proposals (queuedVoteRequiredPercentage): 50 %
-
Required % vote to execute Boosted Proposals (boostedVoteRequiredPercentage): 5 %
-
Time limit for Queued Proposals (queuedVotePeriodLimit): 14 Days
-
Time limit for Boosted Proposals (boostedVotePeriodLimit): 5 Days
-
Time limit for PreBoosted Proposals (preBoostedVotePeriodLimit): 2 Days
-
Threshold Limit Increase to boost proposals (thresholdConst): x2
-
Minimum time for final answer to dont change before execution (quietEndingPeriod): 1 Day
-
REP staked on Queued and PreBoosted Proposals (votersReputationLossRatio): 50%
-
Minimum downstake set by for new proposals (minimumDaoBounty): 5 DXD.
-
-
Master Wallet Scheme
-
callToController: Yes.
-
maxSecondsForExecution: 1 Day
-
maxRepPercentageChange: 5 %
-
controllerPermissions: Only Generic Calls
-
queuedVoteRequiredPercentage: 50 %
-
boostedVoteRequiredPercentage: 1 %
-
queuedVotePeriodLimit: 14 Days
-
boostedVotePeriodLimit: 5 Days
-
preBoostedVotePeriodLimit: 2 Days
-
thresholdConst: x1.5
-
quietEndingPeriod: 1 Day
-
votersReputationLossRatio: 25%
-
minimumDaoBounty: 1 DXD.
-
-
Quick Wallet Scheme
-
callToController: No
-
maxSecondsForExecution: 1 Day
-
maxRepPercentageChange: 0 %
-
controllerPermissions: None
-
queuedVoteRequiredPercentage: 50 %
-
boostedVoteRequiredPercentage: 0.1 %
-
queuedVotePeriodLimit: 7 Days
-
boostedVotePeriodLimit: 3 Days
-
preBoostedVotePeriodLimit: 1 Days
-
thresholdConst: x1.1
-
quietEndingPeriod: 12 Hours
-
votersReputationLossRatio: 10%
-
minimumDaoBounty: 0.1 DXD
-
-
Swapr Wallet Scheme
-
callToController: No
-
maxSecondsForExecution: 1 Day
-
maxRepPercentageChange: 0 %
-
controllerPermissions: None
-
queuedVoteRequiredPercentage: 50 %
-
boostedVoteRequiredPercentage: 7 %
-
queuedVotePeriodLimit: 7 Days
-
boostedVotePeriodLimit: 1 Day
-
preBoostedVotePeriodLimit: 12 hours
-
thresholdConst: x1.3
-
quietEndingPeriod: 12 Hours
-
votersReputationLossRatio: 10%
-
minimumDaoBounty: 1 DXD
-
SWPR Liquidity Mining
The initial liquidity mining pairs and rewards will follow that which has been outlined in the “SWPR Token and Swapr Guild” DAOtalk thread, updated on 2021/08/16. To accomplish this, proposals will be made on aDXdao releasing SWPR tokens to the described pairs through the Swapr DIY farming contracts. The Swapr Wallet Scheme should allow the DXdao community to operate quickly when deploying new SWPR farming campaigns.
aDXdao funding
A signal proposal passed on both xDai and Mainnet authorizing a $2.25m commitment of DXdao capital to be bridged over to Arbitrum One. This will be used for liquidity provisioning on Swapr ($2m) and working capital for aDXdao ($250k).