Skip to main content

Staking Contract Technical Reference

The Staking contract allows the Marketplace contract to stake Uniswap V3 Positions NFTs in name of users to become providers, and also provides a way to retrieve the NFT ID of a provider and the stake amount.

Details:

Inheritance

The Staking contract inherits Recoverable, IERC721Receiver, and ReentrancyGuard contracts.

State Variables

  • token: The staking ERC20 Token.
  • WETH9: The WETH9 contract address.
  • marketplace: The address of the marketplace contract.
  • nftIds: A mapping of provider addresses to NFT IDs.
  • positionManager: The Uniswap V3 position manager contract.
  • factory: The Uniswap V3 factory contract.

Functions


Write Functions

setMarketplace

Sets the marketplace contract address.

function setMarketplace(address _marketplaceAddress) external onlyOwner returns (bool)

Parameters:

NameType
_marketplaceAddressaddressThe address of the marketplace contract.

Return values:

Type
boolWhether the setting was successful or not.

setMediaToken

Sets the MEDIA token address.

function setMediaToken(address _tokenAddress) external onlyOwner returns (bool)

Parameters:

NameType
_tokenAddressaddressThe address of the MEDIA token.

Return values:

Type
boolWhether the setting was successful or not.

Read Functions

getMarketplace

Retrieves the marketplace contract address.

function getMarketplace() public view returns(address addr)

Return values:

NameType
addraddressThe address of the marketplace contract.

getNftId

Retrieves the Uniswap V3 NFT ID of a provider.

function getNftId(uint marketplaceId, address provider) public view returns (uint256 nftId)

Parameters:

NameType
marketplaceIduintThe id of the marketplace where you are registered.
provideraddressThe address of the provider.

Return values:

NameType
nftIduint256The NFT ID of the provider.

getStakeAmount

Retrieves the stake amount of a provider.

function getStakeAmount(uint marketplaceId, address provider) public view returns (uint256 liquidity)

Parameters:

NameType
marketplaceIduintThe id of the marketplace where you are registered.
provideraddressThe address of the provider.

Return values:

NameType
liquidityuint256The stake amount.

note

This is a high-level technical breakdown. For a deep understanding of each function's inner workings and logic, refer to the smart contract's actual implementation.