Try   HackMD

Feral File (FF) maintains the sale and is in charge of determining the sale price, sale items and royality amounts based on the sale types (normal sale or auction sale). The contract is only to facilitates payments and tokens distributing according to the sale instrument from FF.

Sale Lock

To ensure both crypto user and credit card user both have the same opportunity to process the sale, we introduce a sale lock into the system. It is a 3 minutes lock that starts counting down when the purchase process begin. Due to the limit of signature revealing, the purchasing lock will persist until the purchase is fulfill or the time count down to zero. That means each user can only perform a purchasing flow at a time.

To ensure the contract function also align with the server lock, there is a expiry time of each sale instrument data. The expiry will set to the end time of the lock for each sale.

Pay in Crypto

In crypto payments, the collectors will get sale instrument data from FF server. The data includes target tokens in a particular sale and the price of the sale. Users use the data to construct payment transactions and submit it to the blockchain to pay and get tokens directly.

BlockchainVaultFF ServerFFUserBlockchainVaultFF ServerFFUserVaultAn address set to signer in contractCollect1Collect API call2Lock edition3Summarize the sale data4Sign the sale data5signature6transaction data  (purchasing instrument)  for buyArtworks7Prompt wallet to sign and broadcast the transaction8Submit buyArtworks TX9verify the signature from FF10check the fund and transfer tokens11TX ID12Watch TX ID13Minted or Timeout14Purchase completed / failed15

Pay by Credit card

In the credit card payment, the lock mechanism is the same. Instead of submit transaction directly to the blockchain, FF server will submit the sale transaction for users. Users using credit card pay will be an addition estimated fee for the blockchain transaction. The remaining fee will refund to users if they are not totally spent.

If the a credit card payment is confirmed after its sale lock expired, FF server will not send to purchasing transaction and will return all funds back to the user.

Vault ContractExhibition ContractITXVaultStripeFF ServerFFUserVault ContractExhibition ContractITXVaultStripeFF ServerFFUserCredit card paymentITX serviceContractCollect1Collect API call2Lock edition3Cacluate the price in USD4Price5Sale page6Pick as gas for the sale tx7Calculate the total price8total price9Credit card form10User pay with credit card11Paid webhook12Sign the sale data13signature14transaction data for buyArtworks15Submit buyArtworks TX with 0 ether16Keep higher gas price until confirmed17pay(sale_price)18Check msg.sender from EC19sale_price ether20buyArtworks logic21ITX TxID22Watch ITX TxID23TxID24Watch TxID25Succeed or Failed26Charge order  (full amount for minted)  (gas amount for timeout)27Webhook28Update the result  (minted / timeout)29Purchase completed / failed30