- $47,500 USDC main award pot
- $2,500 USDC gas optimization award pot
- Join C4 Discord to register
- Submit findings using the C4 form
- Read our guidelines for more details
- Starts June 14, 2022 20:00 UTC
- Ends June 19, 2022 19:59 UTC
These contracts will be used in production. They are gas optimized and a subset of our Certik audited v1 contracts. These are also reviewed by an independent auditor that helped us patch a few vulnerabilities and helped us optimize them for gas efficiency. We tested a version of these contracts with ERC721 and ERC20 transfer functions written in assembly for gas optimization. We've found that the gains are not significant (esp when compared to gas savings offered by batching orders) and decided to favor code readability over these optimizations. We hope to write them in Vyper with the help of Vyper community in the future. Contributions welcome.
Together with our off chain sniping engine, the contracts support a host of features:
- Auto sniping
- Limit orders
- Dutch auctions and reverse dutch auctions
- Batched operations for a fluid UX and gas efficiency
- Listings
- Offers
- Buys
- Sells
- Transfers
- Set based offers and listings like collection wide offers, multi collection wide offers, any collection offers and 'm of n' offers/listings
- Example 1: User has a budget of 10 ETH. They wish to acquire any one NFT from either Goblintown, Moonbirds or Doodles. They can place an offer that specifies these criteria. As soon as a match is found from any of these collections, order will be executed automatically.
- Example 2: User has a budget of 10 ETH. They wish to acquire any one NFT from Goblintown NFTs with token ids 10, 20, 30, 40 and 50. They can place an offer that specifies these criteria. As soon as a match is found from any of these token ids, order will be executed automatically.
Contracts are designed to be extensible. The main contract is InfinityExchange.sol
which is used for taking approvals for spending NFTs and transaction currencies like WETH
. It also has transfer functions that move assets between addresses. The contract is extensible via Complications
. Complications are used to extend the functionality of the main contract to support different order types. We currently have one complication - InfinityOrderBookComplication
that supports the order types above. More complications
are in the works.
- InfinityExchange.sol - main contract that stores state and has user approvals for spending assets
- InfinityOrderBookComplication.sol - our first complication that helps execute the order types listed above
This repo also includes our Staking and Token contracts.
Staking contract allows people to stake Infinity tokens to earn voting power. Votes are needed to curate collections on the Infinity marketplace. Curation helps surface upcoming/prominent collections. All exchange fees generated from the trading activity of curated collections go to curators in proportion to how many votes they used to curate a collection. As an example: if Doodles was curated with a total of 100 votes (for a given time period) and a curator used 10 of his votes to curate it, they will get 10% of the trading fee for that time period.
Token contract defines the Infinity ($NFT) token. It comes with a timelock config that allows gradual supply increase overtime. There is a max supply of 1B tokens. Initial supply will be 250M. There are 3 inflation epochs, each with a time gap of 6 months. Each inflation epoch adds 250M tokens to the supply. After 1B max supply is reached there won't be any more supply unless the max number of epochs is increased. Any change to timelock config requires a thawing period of 30 days so that the community has enough time to be updated on any changes.
Our contracts are the most efficient NFT exchange contracts in the world. Users save upto 60% gas compared to Opensea and Looksrare. We achieve these gas savings via contract supported batch execution.
Match orders gas table (auto sniped):
Take orders gas table (user initiated):
The contracts have been extensively tested. All tests can be found in the test
folder organized into different files. Tests can be run individually with npx hardhat test --grep <test name>
or all at once with ./runTests.sh
Coming soon.