YAS is Yet Another Swap on Starknet 😝. It's an AMM based on Uniswap v3 that will add some new features to the Starknet ecosystem.
- Provide a more capital efficient liquidity layer
- Based on a robust and battle-tested protocol. LPs from Uniswap v3 will feel right at home.
- Provide the best prices for aggregators and traders.
At YAS we believe product quality should always be a priority so we are commited to provide the best experience for users that want to put Starknet to the limit.
This project will be built in the open, it's still in development. We love the Starknet developer ecosystem and we know that a lot of smart and hungry developers would like to collaborate in the future of Starknet. If that's your case you are more than welcome to join us!
Follow us on Twitter
Currently, the project is in a development stage, it has not been audited yet and is not ready for production. We are also using our fork of Orion signed integer
implementation until all features are implemented and supported in the latest version of Cairo.
Note: In our Orion fork, we've added the capability for signed integers to be stored in a smart contract.
Run the following command:
make deps
This will end up installing:
- Scarb (Cairo/Starknet packet manager)
- Includes a specific version of the Cairo compiler.
- Starkli (Starknet CLI)
Run the following command:
make build
This command executes the Scrab build process, resulting in the creation of a Sierra program.
This guide will help you declare and deploy contracts o 8000 n a testnet. Please note that you won't be able to use the commands in the Makefile unless you follow these instructions.
A smart wallet consists of two parts: a Signer and an Account Descriptor. The Signer is a smart contract capable of signing transactions (for which we need its private key). The Account Descriptor is a JSON file containing information about the smart wallet, such as its address and public key.
Follow the steps below to set up a testnet smart wallet using starkli
:
-
Connect to a Provider: to interact with the network you need an RPC Provider. For our project we will be using Alchemy's free tier in Goerli Testnet.
- Go to Alchemy website and create an account.
- It will ask which network you want to develop on and choose Starknet.
- Select the Free version of the service (we will only need access to send some transactions to deploy the contracts)
- Once the account creation process is done, go to My apps and create a new Application. Choose Starknet as a Chain and Goerli Starknet as a Network.
- Click on View key on the new Starknet Application and copy the HTTPS url.
- On your terminal run:
export STARKNET_RPC="<ALCHEMY_API_HTTPS_URL>"
-
Create a Keystore: A Keystore is a encrypted
json
file that stores the private keys.-
Create a hidden folder: Use the following command:
mkdir -p ~/.starkli-wallets
-
Generate a new Keystore file: Run the following command to create a new private key stored in the file. It will ask for a password to encrypt the file:
starkli signer keystore new ~/.starkli-wallets/keystore.json
The command will return the Public Key of your account, copy it to your clipboard to fund the account.
-
Set STARKNET_ACCOUNT: To set the environment variable just run:
export STARKNET_KEYSTORE="~/.starkli-wallets/keystore.json"
-
-
Account Creation: In Starknet every account is a smart contract, so to create one it will need to be deployed.
- Initiate the account with the Open Zeppelin Account contract:
starkli account oz init --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json
- Deploy the account by running:
For the deployment
starkli account deploy --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json
starkli
will ask you to fund an account. To do so you will need to fund the address given bystarkli
with the Goerli Starknet Faucet
- Initiate the account with the Open Zeppelin Account contract:
-
Setting Up Environment Variables: There are two primary environment variables vital for effective usage of Starkli’s CLI. These are the location of the keystore file for the Signer, and the location of the Account Descriptor file:
export STARKNET_ACCOUNT=~/.starkli-wallets/account.json export STARKNET_KEYSTORE=~/.starkli-wallets/keystore.json
By following the previous two steps, you should now have a account funded on the Goerli testnet.
Now we have to deploy the simple YASFactory and YASPool contract to the Testnet.
On Starknet, the deployment process is in two steps:
- Declaring the class of your contract, or sending your contract’s code to the network
- Deploying a contract or creating an instance of the previously declared code with the necessary parameters
- Build the project:
make build
- Start Local Testnet
make start-katana
- Declare:
Copy the declared hashes from the Factory and the Pool for the following step.
make declare
- Deploy:
// FACTORY_CLASS_HASH: Include the class hash of the YASFactory declare. // OWNER_ADDRESS: Include a Starknet address. // POOL_CLASS_HASH: Include the class hash of the YASPool declare. make deploy CLASS_HASH="<FACTORY_CLASS_HASH>" CTOR_ARGS="<OWNER_ADDRESS> <POOL_CLASS_HASH>"
- Cairo 2.2.0
- Scarb v0.7.0
- Starkli 0.1.9
- Orion
main
branch (library from Giza)
- Starkli
- Scarb
- Cairo 1.0 VSCode Extension
- Starknet Foundry In the near future once it's more mature
- Cairo Book
- Cairo by example
- Starknet Book
- Uniswap Protocol
- Uniswap V3 Development Book
- Liquidity Math in Uniswap V3
- UNISWAP V3 - New Era Of AMMs? Architecture Explained
- ZK Podcast: Exploring Uniswap V3 and a Multi-L2 Future with Noah and Moody
This project is licensed under the Apache 2.0 license. See LICENSE for more information.
Thanks goes to these wonderful people (emoji key):
Roberto Catalan 💻 |
Damián Piñones 💻 |
Santiago Galván (Dub) 💻 |
Santiago Pittella 💻 |
Francisco Strambini 💻 |
Musa AbdulKareem 💻 |
dblanco 💻 |
Nadai 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!