Asset Contract

Contract to manage various dynamic Assets created using BUK protocol

Asset Contract

The Assetcontract is a Solidity smart contract designed as an overall controller contract for other 'purpose driven' contracts such as NFT, Marketplace or Treasury. The Asset contract acts as a 'master' of all other contracts associated with the dynamic Asset.

Overview

The contract is designed with the following key components:

  • Asset Status: Different statuses of an asset can be

    • Event ticket: Available (off-chain), booked, confirmed, used, expired etc.

    • Airline or Hotel room booking: booked, confirmed, checked-in, etc.

    • Gaming assets: Latent (not yet available to be used), Generated In-game, Minted On-chain, locked-on-chain, Exhausted

  • Asset Details: Struct capturing all relevant details of a dynamic asset.

  • NFT Interaction: Functions related to the creation, transfer, and management of NFTs representing bookings.

  • Pausable: Pausable controls for contract

Features

  • NFT-based Creation: Each dynamic asset is represented as an NFT, providing uniqueness and tradeability.

  • Role-based Access: Different functionalities accessible by users, NFT owners, and admins.

  • Emergency Cancellation: Special function for admins to handle unforeseen cancellations.

  • Royalty System: Integration with a royalty system for NFT transactions.

  • Pausable : Controls contract pause and unpause functions

Functions

Public and External Functions:

  • setAdmin: Set the admin wallet address.

  • setSignatureVerifier: Set the address of the signature verifier contract.

  • setTreasury: Update the treasury address for this asset.

  • setWallet: Update the Wallet address to collect commission for this asset.

  • setStableToken: Update the stable token address - this stable will be used to conduct transactions.

  • setNFTs: Update the Asset's NFTs contract address.

  • setPosNFTs: Update the PosNFTs contract address. PosNFT is minted after expiry of the asset NFT's life - PosNFT's are used to run 'post expiry' functionalities such as loyalty program features.

  • setRoyaltiesContract: Sets the royalties contract address for this asset.

  • setCommission: Set the commission percentage for this asset.

  • toggleTradeability: Toggle the tradeability of an asset.

  • pause: To pause contract, only admin.

  • unpause: To pause contract, only admin.

  • createAsset / buyTicket / bookTicket/ bookRooms: Function to create a new instance of asset - buy a new event ticket, book a hotel room, book a flight, create a gaming asset etc.

  • createAssetOwner / buyTicketOwner / bookTicketOwner / bookRoomsOwner: Function for gasless creation of the asset on-chain by admins.

  • Refund: Function to refund tokens and updates the status

  • mintNFT: Function mints the for this asset NFT to the user account via the NFT contract

  • mintNFTOwner: Function mints the asset NFT to the user account by admin

  • checkin: Allows users to check in i.e. confirm ownership of their assets. This function is also relevant to halt trading of an asset closer to the expiry time. For example, trading of an event ticket is halted 6 hours before the event, and the owner of the NFT gains a permanent right to attend the event.

  • checkout: Admin function to check out / destroy / archive an asset after its expiry. This function also serves the dual prupose of minting the PosNFT.

  • cancel: Admin function to burn the NFT before its expiry (similar to canceling a ticket, reservation, booking etc.). This function is available only to admin to deal with unavoidable (ex. force majuer) events. This function does not refund the commissions.

  • emergencyCancellation: Admin function for emergency cancellations. Similar to cancel, but only for certain emergency situations. This function also refunds the commissions collected.

  • getWallets: Retrieve addresses of related contracts .

  • getAssetDetails: Fetch details of a specific asset.

  • getRoyaltyInfo: Retrieve royalty information for a given NFT.

  • getWallets: Retrieve all wallets for the contract.

Private Functions:

  • _setAdmin: Set the Admin Wallet address.

  • _setSignatureVerifier: Set the Signature Verifier contract address.

  • _setRoyaltiesContract: Set the royalty contract address.

  • _setTreasury: Set the Treasury contract address for this asset.

  • _setWallet: Set the BukWallet contract address for this asset.

  • _setStableToken: Set the stable token contract address for this asset.

  • _bookingPayment: Function to do the booking payment.

  • _booking: Function to do the booking and captures the booking data.

  • _mintNFT: Function mints the NFT for this asset.

Events

  • SetAdminWallet: Triggered when the admin wallet is updated.

  • SetCommission: Emitted when the commission is set.

  • SetNFTs: Emitted when NFTs contract address is updated for this asset.

  • SetPosNFTs: Emitted when POSNFTs contract address is updated for this asset.

  • SetRoyaltiesContract: Emitted when Royalties contract address is updated for this asset.

  • SetSignerVerifier: Emitted when signer verifier is updated for this asset.

  • SetTreasury: Emitted when Buk treasury is updated for this asset.

  • SetWallet: Emitted when Wallet is updated for this asset.

  • SetStableToken: Emitted when stable token is updated for this asset.

  • ToggleTradeability: Emitted when the tradeability of a NFT is toggled for this asset.

  • CreateAsset / BookRoom / BuyTicket / BookTicket: Emitted when asset is confirmed off-chain by Oracles for this asset.

  • Refund: Emitted when booking refund is done for this asset.

  • MintdAssetNFT: Emitted when assets are confirmed on-chain for this asset.

  • Checkin: Emitted when check-in is done for this asset.

  • Checkout: Emitted upon checkout for this asset.

  • Cancel: Emitted when an asset is cancelled.

  • EmergencyCancellation: Emitted when an asset is cancelled.

Interface: IBukProtocol

The IBukProtocol interface provides a blueprint for the main BukProtocol contract. It defines the essential functions, events, and data structures that the main contract should implement.

Key Components:

  • AssetStatus Enum: Represents the different statuses a booking can have.

  • Asset Struct: Captures all the details of a booking.

  • Events: Various events like SetAdminWallet, CreateAsset, BookRoom, Checkin, etc.

  • Functions: Functions like setAdminWallet, setSignatureVerifier, setBukTreasury, etc.

License

This project is licensed under the MIT License.

Last updated