8000 GitHub - 0xKermo/yet-another-swap: YAS is Yet Another Swap on Starknet but bringing the best prices and yield to Degens.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

0xKermo/yet-another-swap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YAS - Yet Another Swap

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

Important Disclaimer

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.

Install dependencies

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)

Build Project

Run the following command:

make build   

This command executes the Scrab build process, resulting in the creation of a Sierra program.

Setting up a Testnet Smart Wallet

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:

  1. 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.

    1. Go to Alchemy website and create an account.
    2. It will ask which network you want to develop on and choose Starknet.
    3. Select the Free version of the service (we will only need access to send some transactions to deploy the contracts)
    4. 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.
    5. Click on View key on the new Starknet Application and copy the HTTPS url.
    6. On your terminal run:
      export STARKNET_RPC="<ALCHEMY_API_HTTPS_URL>"
  2. Create a Keystore: A Keystore is a encrypted json file that stores the private keys.

    1. Create a hidden folder: Use the following command:

      mkdir -p ~/.starkli-wallets
    2. 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.

    3. Set STARKNET_ACCOUNT: To set the environment variable just run:

      export STARKNET_KEYSTORE="~/.starkli-wallets/keystore.json"
  3. Account Creation: In Starknet every account is a smart contract, so to create one it will need to be deployed.

    1. Initiate the account with the Open Zeppelin Account contract:
      starkli account oz init --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json
    2. Deploy the account by running:
      starkli account deploy --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json
      For the deployment starkli will ask you to fund an account. To do so you will need to fund the address given by starkli with the Goerli Starknet Faucet
  4. 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

Declare and Deploy Contracts

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
  1. Build the project:
    make build
  2. Start Local Testnet
    make start-katana
  3. Declare:
    make declare
    Copy the declared hashes from the Factory and the Pool for the following step.
  4. 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>"
    

Version Specifications

  • Cairo 2.2.0
  • Scarb v0.7.0
  • Starkli 0.1.9
  • Orion main branch (library from Giza)

Tooling

Useful resources

License

This project is licensed under the Apache 2.0 license. See LICENSE for more information.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Roberto Catalan
Roberto Catalan

💻
Damián Piñones
Damián Piñones

💻
Santiago Galván (Dub)
Santiago Galván (Dub)

💻
Santiago Pittella
Santiago Pittella

💻
Francisco Strambini
Francisco Strambini

💻
Musa AbdulKareem
Musa AbdulKareem

💻
dblanco
dblanco

💻
Nadai
Nadai

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

YAS is Yet Another Swap on Starknet but bringing the best prices and yield to Degens.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Cairo 99.8%
  • Makefile 0.2%
0