Skip to content

FukuNFT/fuku-nft-diamond

Repository files navigation

Fuku

Earn DeFi yields while trading NFTs. Fuku is a decentralized marketplace that allows buyers to place bids on non-fungible tokens (NFTs) while the underlying assets on their bids are earning yield by farming various DeFi protocols. Fuku bridges the two largest user bases in web3 and provides additional liquidity for NFT collections while giving buyers and sellers increased functionality in making NFT purchases. Fuku also offers advanced trading features such as batch bidding and options trading.

Fuku Diamond

Fuku implements the diamond pattern, EIP-2535. This architecture was chosen to allow the Fuku marketplace to develop into a highly modular, gas optimized, and easily upgradeable codebase. This design pattern has the added benefit of providing a single point-of-entry and limitless contract size for easy front-end integration.

Further reference material on the diamond pattern include the following:

Terminology

The diamond pattern introduces new terminology for describing the components of its architecture.

  • The diamond is the proxy contract, it is the single point-of-entry to the different facets.
  • A facet is a logical component of the diamond with a set of exposed public functions. These facets are added to the diamond through a cut function call.
  • The cut function provides functionality to add, remove, or update facets of the diamond. The cut is also used for the initialization of the diamond.
  • A selector is the first four bytes of the call data for a function call. Cutting multiple of the same selector is not allowed.
  • Each diamond will provide a loupe facet that provides introspection functions for the diamond itself. This can be used to lookup facets and functions already registered with the diamond.

Organization

The various smart contracts are organized into a few different places.

Diamond Storage

Contract state is shared with a pattern called Diamond Storage.

Implementation references

Much of the Fuku Diamond code was based on Nick Mudge's diamond-3-hardhat repository at the 7feb995 commit.

Deployment

Rinkeby

Diamond: 0x92b5E83e22AE79DA3BbF811A3dC4f2036cB3623f

CryptoPunks: 0x4f599C9703691a545F752C3c0d50e97fC030146C

Fuku Token: 0xcAc88c6f414a30a124F243d77f4a054eB99b0A7d

Empty Vault Name: 0xeeeeeeeeeeeeeeeeeeeeeeee

Setup

After cloning the repository, run:

> npm install

To compile, run:

> npx hardhat compile

To run the tests, create .env file according to .env.example, and run:

> npx hardhat test

To create documentation, run:

> npx hardhat docgen

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published