Git Product home page Git Product logo

2022-12-caviar's Introduction

Caviar contest details

  • Total Prize Pool: $36,500 USDC
    • HM awards: $25,500 USDC
    • QA report awards: $3,000 USDC
    • Gas report awards: $1,500 USDC
    • Judge + presort awards: $6,000
    • Scout awards: $500 USDC
  • Join C4 Discord to register
  • Submit findings using the C4 form
  • Read our guidelines for more details
  • Starts December 12, 2022 20:00 UTC
  • Ends December 19, 2022 20:00 UTC

C4udit / Publicly Known Issues

The C4audit output for the contest can be found here within an hour of contest opening.

Note for C4 wardens: Anything included in the C4udit output is considered a publicly known issue and is ineligible for awards.

Caviar

Caviar is a fully on-chain NFT AMM that allows you to trade every NFT in a collection (from floors to superrares). You can also trade fractional amounts of each NFT too. It's designed with a heavy emphasis on composability, flexibility and usability. View demo app here.

Index

Quickstart command

rm -Rf 2022-12-caviar || true && git clone https://github.com/code-423n4/2022-12-caviar.git --recurse-submodules -j8 && cd 2022-12-caviar && yarn && foundryup && forge install && forge test --gas-report

Getting started

yarn
foundryup
forge install
forge test --gas-report

Contracts in scope

File SLOC Description and coverage Libraries
Contracts (3)
Caviar.sol 26 Factory contract that creates pairs and maintains a registry (100%) solmate
Pair.sol 212 Pair contract that contains ERC20 AMM, NFT wrapping and NFT AMM logic (100%) solmate openzeppelin
LpToken.sol 15 ERC20 token which represents liquidity ownership in pair contracts (100%) solmate
Libraries (1)
SafeERC20Namer.sol 65 Helper contract that fetches the name and symbol of an ERC20/ERC721 (0%) openzeppelin
Total 318

External imports

Deployments

Goerli: (demo app)

Contract Address
Caviar 0x4442fD4a38c6FBe364AdC6FF2CFA9332F0E7D378
FBAYC 0xC1A308D95344716054d4C078831376FC78c4fd72
Pair (Rare FBAYC:ETH) 0x7033A7A1980e019BA6A2016a14b3CD783e35300a
LP Token (FBAYC:ETH) 0x96E6B35Cc73070FCDB42Abe5a39BfD7f16c37cFc

Security considerations

Rebase/fee-on-transfer tokens

Rebase and fee-on-transfer tokens are not supported by the AMM. Using these tokens will break the swap curve and liquidity maths.

Stuck tokens/nfts

There exists no recovery mechanism for tokens that are accidentally transferred to the AMM. If tokens or NFTs are accidentally sent to the contract, then they cannot be withdrawn.

Malicious base token or NFT contracts

It's assumed that all NFTs and base token contracts used to create new pairs are honest. The user must use their own discretion when deciding whether or not to interact with a particular pair contract and check that the NFT and base token contracts are honest.

Trusted admin

There exists functionality which allows an admin to withdraw NFTs from pairs. It's assumed that the admin is trusted and legitimate. However, as an additional precaution, there is a one week grace period in which the admin must signal their intent to withdraw before actually withdrawing. This allows LPs and traders to withdraw their NFTs from the contract prior to the admin.

Scoping Details

- If you have a public code repo, please share it here: https://github.com/outdoteth/Caviar
- How many contracts are in scope?:   4
- Total SLoC for these contracts?:  250
- How many external imports are there?: 7
- How many separate interfaces and struct definitions are there for the contracts within scope?:  3
- Does most of your code generally use composition or inheritance?:   Yes
- How many external calls?:   5
- What is the overall line coverage percentage provided by your tests?:  100
- Is there a need to understand a separate part of the codebase / get context in order to audit this part of the protocol?:  false
- Please describe required context:
- Does it use an oracle?:  false
- Does the token conform to the ERC20 standard?:  Yes
- Are there any novel or unique curve logic or mathematical models?: Nothing novel - using uni v2 style curves
- Does it use a timelock function?:  Yes
- Is it an NFT?: No
- Does it have an AMM?:   Yes
- Is it a fork of a popular project?:   false
- Does it use rollups?:   false
- Is it multi-chain?:  false
- Does it use a side-chain?: false

2022-12-caviar's People

Contributors

outdoteth avatar kartoonjoy avatar itsmetechjay avatar

Stargazers

sindyacpopy avatar

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.