Redeemables
Introduction
This contract, which has been designed to facilitate the exchange of tokens for non-fungible tokens (NFTs), enables token owners to have the opportunity to own unique assets from the organization's collection. Token owners initiate the redemption process by interacting with a smart contract, which verifies their tokens and triggers the issuance of NFTs. The organization maintains a collection of NFTs eligible for redemption, and upon successful verification, the smart contract transfers the NFTs from the organization to the token owner.
Deployments
Sepolia Testnet
Name of the Contract | Contract address |
---|---|
Redeemable | 0x9a0555452c9e7129Af0bba1768EfD708741a107d |
Architecture Overview
The architecture for redeambale typically involves the following components:
Here's a breakdown of the architecture into separate components:
- Creator/Admin Component:
- Responsible for managing redemption details.
- Interacts with the Redemption Contract to set up, update, or delete redemption details.
- Can view redeemed data and perform administrative functions.
- Claimant Component:
- Participants who can claim redemption and view redeemed details.
- Interacts with the Redemption Contract to initiate the redemption process.
- Can view redeemed data and the status of their redemption.
- Redemption Contract Component:
- Smart contract responsible for handling the redemption process.
- Stores redemption details, including collection addresses, token holding address, and other parameters.
- Validates redemption requests and verifies the eligibility of claimants.
- Transfers the specified NFT from the claimant's wallet to the Organization Wallet.
- Mints a new token representing the redeemed NFT and transfers it to the claimant's wallet from the Collection Contract.
- Stores transaction details and redeemed data.
- Organization Wallet Component:
- Wallet address associated with the organization.
- Receives the claimed NFTs transferred from the claimant's wallet.
- Claimant Wallet Component:
- Wallet address of the claimant.
- Receives the newly minted token representing the redeemed NFT from the Collection Contract.
- Collection Contract Component:
- Smart contract or external service managing the organization's collection of NFTs.
- Handles the minting and transfer of NFTs.
Smart Contract Interaction
Admin Related Methods
function createorUpdateRedeem(
address redeemCollectionAddress,
RedeemDetails memory list
) external
The createorUpdateRedeem
function is an external function defined in the Redeemable
smart contract. Its purpose is to create or update redemption-related details for a specific collection address. The function allows users with the admin role or specific collection-related roles to manage the redemption settings.
The RedeemDetails
struct contains various details related to the redemption process, such as the address of the new collection where redeemed tokens will be minted (newCollectionAddress
), the address holding the original NFT tokens to be redeemed (tokenHoldingAddress
), the maximum number of tokens that can be minted during redemption (mintLimit
), the maxId range (maxEndRange), boolean flag indicating whether to use an extended base URI for token metadata (extensionBaseUri
), and the name of the client or entity associated with the redemption (clientName
).
function removeCollectionAddress(address redeemCollectionAddress) external
This function allows contract administrators, collection administrators, or collection owners to disable redemption functionality for a specific collection.
function setBaseURI(
address redeemcollectionaddress,
string memory baseURI_
) external
The purpose of this is to update the base URI used for token metadata extension in the new collection specified by redeemcollectionaddress
.
User Related Methods
function redeem(
address redeemCollectionAddress,
uint256 tokenId,
address claimer,
uint256 quantity,
string memory tokenURI,
Approval calldata approval
) external returns (uint256[] memory nftTokenId)
The redeem
function allows users to redeem NFT tokens from one collection to another. The user-owned token in redeemCollectionAddress
is transferred to the token holding address, and new tokens are minted in the new collection for user based on the provided redemption details.
Getter Methods
function getRedeem(
address walletAddress
) external view returns (nftIds[] memory list)
The purpose of getRedeem
function is to retrieve the redeemed NFT token IDs and their associated collection addresses for a specific walletAddress
function getbaseURL(
address collectionAddress,
uint256 tokenId
) internal view returns (string memory uri)
The getBaseURL
function retrieves the base URI for token metadata associated with specific token IDs.
Updated about 1 year ago