Quickstart: Deploy a liquidity pool
This tutorial will walk you through the example of building a constant product AMM liquidity pool using the two most important Shell Protocol components: the Ocean and Proteus, Shell's novel AMM primitive. We will do this on Arbitrum Goerli testnet. The process is the same for Arbitrum One, you will just use different contract addresses.
You don't need to worry about the inner workings of the Ocean and Proteus for now.
Getting started
Clone the Shell Protocol public repo, cd
into it and run npm install
In the root folder, go to hardhat.config.js
and add your private key on line 27.
WARNING: Do not just simply paste the private key. Use something like dot-env
and environment variables instead. Be sure that you ad the file containing secrets to the .gitignore
Be sure that your account has enough test tokens on Arbitrum Goerli network. You can use this faucet to fund your account https://faucet.quicknode.com/arbitrum/goerli. You can also obtain up to 1000 testnet ERC-20 tokens by calling the claimTokens
function on the following contract: https://testnet.arbiscan.io/address/0xEaE5B59499a461887fBf2BF47887e4e4cB91D703#writeContract
Creating and deploying pool
A pool deployment script can be found at scripts/deployPool.js
.
We're going to focus on the main function starting at line 164. You can ignore everything else in this file as it's not relevant for now and will be throughly explained in the later sections.
First thing we have to do is to pass an Ocean contract address in line 171.
All contract addresses can be found here.
Ocean is the accounting system that Shell Protocol is using internally. Every interaction that requires moving tokens and updating balances is done by the Ocean. Now that we have an Ocean contract instance it's time to create the pool.
You can see in lines 174 and 175 two constants, tokenOne
and wrappedEtherID
. These will be the tokens we will create pool from. On line 174 paste the ERC20 token address you want to create pool with.
const tokenOne = 'TOKEN_ADDRESS_HERE';
After you paste the address of your desired token, go to the terminal window and run the following command (make sure you are in the project's root folder):
Voila! You have successfully deployed a constant product pool 🥳
Don't forget to tweet about your accomplishment!
Last updated