Git Product home page Git Product logo

crocswap-protocol's Introduction

CrocSwap-protocol

Decentralized exchange with concentrated liquidity and low gas fees

Frontend available at

https://ambient.finance

Installation

Clone the repository. In the repository home directory run the following commands:

$ yarn install
$ npx hardhat compile

To verify that the code is functioning run:

$ npx hardhat test

Test coverage can be run with

Documentation

Primary docs can be found at our Gitbook

Additional technical documentation can be found

  • Repo Layout: Top-level overview of the Solidity source files in the project.
  • Control Flow: Illustrated flow charts mapping the smart contract logic associated with common CrocSwap operations.
  • Encoding Guide: Technical specification for clients outlining how to encode arguments to the CrocSwap contract methods that don't use standard Solidity args.

Risks

Users of the CrocSwap protocol should be aware of the implicit risks to the protocol design. Among other major risk sare

  • Protocol Risk - Although carefully reviewed the protocol could have an implementation error that leads to loss of funds
  • Governance Risk - CrocSwap governance has fairly extensive powers, and users should fully trust the entities holding governance roles.
  • Token Risk - CrocSwap expects has fairly stringent conformance requirements to guarantee safe and defined behavior. Users interacting with pools on non-compliant or malicious tokens risk loss of funds.
  • Upgrade Risk - CrocSwap allows for smart contract code upgrade. Any upgrade represents a risk to the entire protocol and users funds if implemented incorrectly. Users should monitor all proposed upgrades and trust the governance process for approving upgrade proposals.

crocswap-protocol's People

Contributors

mister-meeseeks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

crocswap-protocol's Issues

seekMezzSpill Tests - Border Start

seekMezzSpill changes input behavior but not yet reflected in unit tests. Sell border will occur at the first tick in the previous bitmap.

initPool

Current initPool function is not ready for production. Let's user set anything they want. Have to upgrade before release

Pool Infinity Unit Tests

Currently the unit tests in testPool.inf.ts aren't passing.

We're deferring working on them, because it's likely that initializing the pool will require permanently locked liquidity. Therefore we may not need to test for 0 or low liquidity situations.

Events where appropriate

Add event logs where appropriate. Not in gas hot path, but in certain out-of-band situations. Especially related to protocol authority and fee collection.

Test stacked directives

Add unit tests for pool directives which combine multiple operations on a single pool. E.g. mint and swap, mint and multiple bookends, postPassive, etc.

Typescript error in knockout counter tests

Hello there!

It seems that the commit 73440a9 introduced a typescript error in some TestKnockoutCounter.ts unit tests, since the name hre is not known.

When writing tests in Typescript, the globally injected hre will not be recognized (confirmed by the docs), so one way to solve this would be to either import hre through import hre from "hardhat" or, since only the ethers module is being used, just import { ethers } from "hardhat" and changing usages accordingly would work. I've done this locally some days ago to be able to run the tests.

Let me know what you think. Cheers!

SafeCast Everywhere

Check the whole codebase for unsafe casts, and replace with safe cast versions

Initialize - Min Burn Commitment

Initializing a position shouldn't be costless for the caller. The caller should be required to burn some small amount of ambient liquidity that's permanently locked in the pool. Uniswap V2's model is to require a minimum of 1000 ambient seeds. We probably want to do something like that.

PoolInitialize Security tests

  • Trading before init
  • Initializing a non-template
  • Setting a template as non-authority
  • Initializing without paying the burn fee

Test block timestamp

Positions have timestamp attached, test that it's being set correctly. Also make sure priority is correctly calculated: reset on liquidity increase, keep the same on decreases.

Unit Test TickCensus PoolIdx

The tick census unit tests don't currently test to make sure that different poolIdx arguments avoid collision. The test contract hardcodes a single idx, so we'd have to support calling with multiple idxs.

comments can be written in NatSpec for better DX

croc's contracts are fairly abstract, so devs often need to jump in and follow the source code to understand how many of the features work

although well documented, i think its better to format comments into the NatSpec standard, so the comments can be picked up by toolings automatically. for example, etherscan injects the comments into the "contract ui" for all documented public methods, vscode shows the entire comments on hover, and docs can be auto generated as well

not sure if etherscan allows reverifying contract source code

currently, the comments start with /*

image image

vs

image

TestPool.ext.ts

Review to see what is no longer relevant and fix rest (if any)

Improve contract "CrocSwapDex.sol" code

Remove Duplicate Import: The contract CrocSwapDex is importing MarketSequencer.sol twice. You can remove one of the duplicate import statements to clean up the code.

Use the Latest Solidity Version: Since the current version of Solidity is 0.8.19, consider using the latest stable version (at the time of your implementation) to take advantage of new features and bug fixes.

Consider Separating Contracts: If the contract size is becoming too large, consider breaking it down into smaller contracts with logical separations. This can help improve code maintainability and readability.

Assign me this issue, so i can solve them. This is a brilliant contract btw

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.