Bitmark Inc.
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Feral File v2.0 Exhibition Contract ###### tags: `Feral File` `Smart Contract` ###### Status: Wait for review ###### Reviewer: Sean and Casey Reas Learn from [previous contract design](/z_qDgKYqQWmN4Ve3zCznUA). ## Repository - [feralfile-exhibition-smart-contract](https://github.com/bitmark-inc/feralfile-exhibition-smart-contract) - Commit: `ff80a5d488e21cf2de3a9db980bde83b1f56952d` - Files: - contracts ├── Authorizable.sol ├── ECDSASigner.sol ├── FeralfileArtworkV4.sol <- main contract ├── FeralfileSaleData.sol ├── FeralfileVault.sol ├── IFeralfileSaleData.sol ├── IFeralfileVault.sol └── UpdateableOperatorFilterer.sol ## Design Requirements 1. Token Exhibition + Sale (only pay function, no auction) 2. Pre-mint tokens to contract address 3. Only support ETH (native token) 4. Start, pause and resume the sale 5. Close the sale options: - Burn all remaining tokens - Tranfer all remaining tokens to artists 6. Can buy to another address 7. Can pay to buy a list of tokens (to support set) 8. Collectors submit purchasing transaction (pay in native token) - Collectors request valid purchase intent (sale info) from server 9. Target purchasing token is assigned by the FF server - An expiration will set to each sale info - The expiration time is 3 minutes starting from the time an intent is created 10. `OperatorFilter` is required 11. Credit card payment collector will get a price which is added up with the gas price in `fast` manner for the sale transaction - Unused gas fee will be return to the user - Refund the unused gas fee if a tx is minted very fast - Refund by deducting the spent gas if a tx is timeout 12. Design the token id to ensure the uniquness by server 13. Not implement the EIP2981 ## Feral File Sale Flow with Smart Contract {%hackmd yGIcakyPSNqxhObASKfmag %} ## Signature Validation Follow the [Ethereum Signing](/PKa3Xsh7QOykUeAvA5BOGQ?view#Ethereum-Signing) to sign and validate signatures. ## ECDSASigner Contract **ECDSASigner** is a contract for validating signatures from the set signer. ### Functions 1. `setSigner` - assign the signer's address 2. `isValidSignature` - validate if a signature is signed by signer. ## FeralFileVault Contract **FeralFileVault** is a vault contract to facilitate the `buyArtworks` if the transaction comes from an address which is not allow to send ETH (for example, ITX) directly to the exhibition contract. This contract maintains an ETH balance for delegating payments from sales. It uses the same signature validating mechanism to ensure payment requests come from the authorized signer. ### Functions - `payForSale` - validate the sale data and send ETH to the caller - `withdrawFund` - withdraw remaining funds ## IFeralfileSaleData IFeralfileSaleData is a contract for defined `SaleData` object. This would be inherited by both `FeralfileExhibitionV4` and `FeralfileVault`. This defined required data for executing the `buyArtworks`. ### Structure ```solidity struct SaleData { uint256 price; // in wei uint256 cost; // in wei uint256 expiryTime; address destination; uint256[] tokenIds; RevenueShare[][] revenueShares; // address and royalty bps (500 means 5%) bool payByVaultContract; // get eth from vault contract, used by credit card pay that proxy by ITX } ``` ## Exhibition Contract **FeralfileExhibitionV4** is the main contract of Feral File's exhibition. ### Simple sale flow ```mermaid flowchart LR A[Deploy Contract] --> X[Mint Artworks] --> B[Start Sale] B --> C[Close Sale And Transfer] B --> D[Close Sale And Burn] ``` ### Variables #### Attributes - `burnable` - indicate if tokens in the contract is allowed to burn for collectors - `bridgeable` - indicate if tokens in this contract is allowed to swap to another blockchain is the future. (it is just a feature attribute for now) #### Sale Status - `mintable` - the mint status. It will be disabled forever when the sale starts. - `_selling` - the sale status. ### Functions #### Sale 1. `mintArtworks` Feral File will mint tokens in advance so that collectors can preview and see which artworks they are interested to collect. 2. `startSale` - stop the minting process and start the sale for the exhibition 3. `buyArtworks` - buy artworks by a sale data signed from Feral File 4. `stopSaleAndTransfer` - stop the sale and transfer all remaining tokens to specific addresses by series. The sale can not resume again once stopped. 5. `stopSaleAndBurn` - stop the sale and burn all remaining tokens. The sale can not resume again once stopped. ##### buyArtworks `buyArtworks` is a key function of the exhibition contract. It follows the [sale data](/GooHL48zTgymKNAqn7t1Lw#Structure) from Feral File to execute the following: - take funds from transaction sender or FeralfileVault - dispatch sale tokens to addresses - dispatch revenue streams and fees to corresponded addresses #### Operation 1. `withdrawFunds` - withdraw funds in the contract if there are any not totally spent. 2. `pauseSale` - temporarily pause the sale 3. `resumeSale` - resume the sale ### Events ```solidity /// @notice Event emitted when new Artwork has been minted event NewArtwork( address indexed owner, uint256 indexed seriesId, uint256 indexed tokenId ); /// @notice Event emitted when Artwork has been burned event BurnArtwork(uint256 indexed tokenId); /// @notice Event emitted when Artwork has been sold event BuyArtwork(address indexed buyer, uint256 indexed tokenId); ``` ## Feral File Server Side Integration - Use [ITX](https://github.com/INFURA/demo-eth-tx/tree/master/infura-transactions) as the ethereum transaction broadcasting solution - ITX is about to stops it services. We need to find another alternative - [Minting Flow](/R61MQj0ETX-PVKJK2aJw3w) - [Purchase / Sale Flow](/0SX3n-5-Scme79l0gZ0n2g) - [Third party marketplaces metadata](/Y5aWIYLcReyxT1V5XfmBXg) ## Notes - Collaboration at the contract level requires a single address. (Could be a contract address or multisig.) We will put collaborators into the metadata as per marketplace spec.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully