From 5c6dee9e982f4219ce8cbba208e4d536db092d62 Mon Sep 17 00:00:00 2001 From: Daniel Bejarano <58019353+dbejarano820@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:39:14 -0600 Subject: [PATCH] ci: prettier lint check (#118) --- .github/workflows/linters.yaml | 14 +++ .github/workflows/security.yaml | 4 +- .github/workflows/tests.yaml | 10 +- README.md | 174 ++++++++++++++++---------------- 4 files changed, 108 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/linters.yaml diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml new file mode 100644 index 00000000..c7a85cb8 --- /dev/null +++ b/.github/workflows/linters.yaml @@ -0,0 +1,14 @@ +name: Task - Linters + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run prettier + run: |- + npx prettier --check . diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 0d1fc413..e1232b8f 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -1,6 +1,6 @@ name: Security -on: +on: pull_request: types: [opened, synchronize, reopened] @@ -49,4 +49,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: caracal-cairo - path: caracal-output.txt \ No newline at end of file + path: caracal-output.txt diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 07d7a349..ec99f0c7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,10 +1,10 @@ name: Tests on: - merge_group: - push: - branches: [ main ] - pull_request: - branches: [ '*' ] + merge_group: + push: + branches: [main] + pull_request: + branches: ["*"] jobs: check: runs-on: ubuntu-latest diff --git a/README.md b/README.md index d1d9106c..9074e745 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ 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. +- 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. @@ -44,9 +44,9 @@ make deps This will end up installing: -- [Scarb](https://docs.swmansion.com/scarb) (Cairo/Starknet packet manager) - - Includes a specific version of the Cairo compiler. -- [Starkli](https://github.com/xJonathanLEI/starkli) (Starknet CLI) +- [Scarb](https://docs.swmansion.com/scarb) (Cairo/Starknet packet manager) - + Includes a specific version of the Cairo compiler. +- [Starkli](https://github.com/xJonathanLEI/starkli) (Starknet CLI) ## Build Project @@ -76,75 +76,75 @@ Follow the steps below to set up a testnet smart wallet using `starkli`: Provider. For our project we will be using Alchemy's free tier in Goerli Testnet. - 1. Go to [Alchemy website](https://www.alchemy.com/) 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: - - ```bash - export STARKNET_RPC="" - ``` + 1. Go to [Alchemy website](https://www.alchemy.com/) 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: + + ```bash + export STARKNET_RPC="" + ``` 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: + 1. **Create a hidden folder**: Use the following command: - ```bash - mkdir -p ~/.starkli-wallets - ``` + ```bash + 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: + 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: - ```bash - starkli signer keystore new ~/.starkli-wallets/keystore.json - ``` + ```bash + 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. + 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: + 3. **Set STARKNET_ACCOUNT**: To set the environment variable just run: - ```bash - export STARKNET_KEYSTORE="~/.starkli-wallets/keystore.json" - ``` + ```bash + 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**: + 1. **Initiate the account with the Open Zeppelin Account contract**: - ```bash - starkli account oz init --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json - ``` + ```bash + starkli account oz init --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json + ``` - 2. **Deploy the account by running**: + 2. **Deploy the account by running**: - ```bash - starkli account deploy --keystore ~/.starkli-wallets/keystore.json ~/.starkli-wallets/account.json - ``` + ```bash + 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](https://faucet.goerli.starknet.io) + 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](https://faucet.goerli.starknet.io) 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: - ```bash - export STARKNET_ACCOUNT=~/.starkli-wallets/account.json - export STARKNET_KEYSTORE=~/.starkli-wallets/keystore.json - ``` + ```bash + export STARKNET_ACCOUNT=~/.starkli-wallets/account.json + export STARKNET_KEYSTORE=~/.starkli-wallets/keystore.json + ``` ## Declare and Deploy Contracts @@ -155,36 +155,36 @@ 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 +- 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: - ```bash - make build - ``` + ```bash + make build + ``` 2. Start Local Testnet - ```bash - make start-katana - ``` + ```bash + make start-katana + ``` 3. Declare and Deploy: Using [deploy.rs](./scripts/deploy.rs) script, we sequentially declare and deploy the contracts. Local deployment needs `katana` running. The account used for deployment is a pre-funded one. -- When running in development for the first time +- When running in development for the first time - ```bash - ./scripts/make_with_env.sh deploy - ``` + ```bash + ./scripts/make_with_env.sh deploy + ``` -- After the [.env](./.env) file is created, you may edit the values and run +- After the [.env](./.env) file is created, you may edit the values and run - ```bash - make deploy - ``` + ```bash + make deploy + ``` ## Override `.env` file @@ -201,29 +201,29 @@ make deploy ## Version Specifications -- Cairo 2.2.0 -- Scarb v0.7.0 -- Starkli 0.1.9 -- Orion `main` branch (library from Giza) +- Cairo 2.2.0 +- Scarb v0.7.0 +- Starkli 0.1.9 +- Orion `main` branch (library from Giza) ## Tooling -- [Starkli](https://book.starkli.rs/) -- [Scarb](https://book.starknet.io/chapter_2/scarb.html) -- [Cairo 1.0 VSCode Extension](https://marketplace.visualstudio.com/items?itemName=starkware.cairo1) -- [Starknet Foundry](https://foundry-rs.github.io/starknet-foundry/) **In the - near future once it's more mature** +- [Starkli](https://book.starkli.rs/) +- [Scarb](https://book.starknet.io/chapter_2/scarb.html) +- [Cairo 1.0 VSCode Extension](https://marketplace.visualstudio.com/items?itemName=starkware.cairo1) +- [Starknet Foundry](https://foundry-rs.github.io/starknet-foundry/) **In the + near future once it's more mature** ## Useful resources -- [Cairo Book](https://book.cairo-lang.org/) -- [Cairo by example](https://cairo-by-example.com/) -- [Starknet Book](https://book.starknet.io/index.html) -- [Uniswap Protocol](https://docs.uniswap.org/concepts/uniswap-protocol) -- [Uniswap V3 Development Book](https://uniswapv3book.com/docs/introduction/uniswap-v3/) -- [Liquidity Math in Uniswap V3](https://atiselsts.github.io/pdfs/uniswap-v3-liquidity-math.pdf) -- [UNISWAP V3 - New Era Of AMMs? Architecture Explained](https://www.youtube.com/watch?v=Ehm-OYBmlPM) -- [ZK Podcast: Exploring Uniswap V3 and a Multi-L2 Future with Noah and Moody](https://zeroknowledge.fm/185-2/) +- [Cairo Book](https://book.cairo-lang.org/) +- [Cairo by example](https://cairo-by-example.com/) +- [Starknet Book](https://book.starknet.io/index.html) +- [Uniswap Protocol](https://docs.uniswap.org/concepts/uniswap-protocol) +- [Uniswap V3 Development Book](https://uniswapv3book.com/docs/introduction/uniswap-v3/) +- [Liquidity Math in Uniswap V3](https://atiselsts.github.io/pdfs/uniswap-v3-liquidity-math.pdf) +- [UNISWAP V3 - New Era Of AMMs? Architecture Explained](https://www.youtube.com/watch?v=Ehm-OYBmlPM) +- [ZK Podcast: Exploring Uniswap V3 and a Multi-L2 Future with Noah and Moody](https://zeroknowledge.fm/185-2/) ## License