Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

As of 4/23/2021 not in MVP

Overview

The purpose of this document is to describe changes being made to the Registration Site to accommodate the dAppDashboard.

API

Get pricing

This call is intended to return current pricing of FIO Addresses and Domains based on Wallet Profile provided.

...

Group

Parameter

Format

Required

Description

success

boolean

Yes

true if successful

pricing->fio

domain

Int

YesNo

FIO Domain price in SUFs. Only returned if FIO Domain registration is enabled and “Price according to rate of exchange” is checked in wallet profile.

pricing->fio

address

Int

YesNo

FIO Address price in SUFs. Only returned if FIO Address registration is enabled and “Price according to rate of exchange” is checked in wallet profile.

pricing->usdt

domain

Double

YesNo

FIO Domain price in USDT. Only returned if FIO Domain registration is enabled in wallet profile.

pricing->usdt

address

Double

YesNo

FIO Domain price in USDT. Only returned if FIO Address registration is enabled in wallet profile.

Example

Code Block
languagejson
{
  "success": true
  "pricing" : {
    fio: {
      "domain": 400000000000,
      "address": 20000000000
    },
    usdt: {
      "domain": 40.00,
      "address": 2.00
    },  
  error: false
} 

...

Same as https://developers.fioprotocol.io/pages/api/fio-reg-api/#post-/buy-address

Processing

Once request is received:

...

  • Validate

    • Parameters as in https://developers.fioprotocol.io/pages/api/fio-reg-api/#post-/buy-address

    • Check if “Allow FIO Token Purchases” in wallet profile is not checked

      • Return success: false and error: “Not allowed for this referralCode.”

    • Ignore

      • domainRegistrations and addressRegistrations are not validated against wallet profile, meaning this call will work even if domain sale or address sale is disabled.

  • Compute Order Amounts

    • FIO Tokens Order Amount is computed based on sum of:

      • domainRegistrations * get_fee for register_fio_domain

      • domainRegistrations * get_fee for set_fio_domain_public

      • addressRegistrations * get_fee for register_fio_address

    • USDC Order Amount is computed by converting FIO Tokens Order Amount to USDC and reducing it by Public Key’s Balance

  • If USDC Order Amount => 0.25 USDC

    • Record order

      • Create Coinbase Commerce Order and record details

      • Record FIO Tokens Order Amount and USDC Order Amount

      • Record domainRegistrations and addressRegistrations

      are recorded in order

    Once payment is received:

    • FIO Tokens required is re-computed (see above)

      • If

    • Return Response

  • If USDC Order Amount < 0.25 USDC

    • See Payment Received Processing → If Status = Success

Payment Received Processing

Process same as other transactions except:

  • Payment Received is reflected in USDC and is added to Public Key’s Balance

  • Re-compute FIO Tokens Required Amount (see above)

  • Re-compute USDC Required Amount

  • Determine transaction status

    • If USDC Required Amount <= Public Key’s Balance

      • Public Key’s Balance is reduced by USDC Required Amount

      • Status is Success

    • If USDC Required Amount > Public Key’s Balance AND Public Key’s Balance > (USDC Required Amount * 0.9) AND payment was received within 60 minutes of request

      and amount is +/- 10%The amount of FIO is adjusted to new number

      • Public Key’s Balance is reduced to 0

      • Status is

        set to

        Success

      • Else

        • The amount of FIO is not adjusted to new number

        • Status is set to PriceChange

    • Tokens are transferred

    • Webhook firesELSE

      • Status is PriceChange

  • If Status = Success

    • Transfer FIO Tokens Required Amount to public key

    • Fire Webhook

      • status: Success

      • amount: FIO Tokens Required Amount

  • If Status = PriceChange

    • Fire Webhook

      • status: PriceChange

      • amount: 0

      • usdc_delta: USDC Required Amount - Public Key’s Balance

Webhook payload

Parameter

Format

Required

Description

extern_id

String

Yes

Coinbase order ID

publicKey

String

Yes

FIO public key for the ownership of the FIO Tokens

amount

Int

Yes

Amount of FIO Tokens in SUFs being transferred. If status is PriceChange set to 0.

status

boolean

Yes

Success or PriceChange

usdc_delta

Double

No

If status = PriceChange missing amount is returned

Admin interface

Wallet Profile

Add “Allow FIO Token Purchases” check box. If selected:

  • That wallet profile will enable Buy FIO Tokens

  • FIO Address/Domain pricing is reset and “Price according to rate of exchange” is checked.

    • If user attempts to enter price or uncheck the “Price according to rate of exchange” box, “Allow FIO Token Purchases” is unchecked.

Transaction details

Convert Balance to FIO Tokens

Add new button “Convert Balance to FIO Tokens” (next to balance). When clicked:

  • Convert Public Key’s USDC Balance to FIO and transfer it to public key

  • Set Public Key’s USDC Balance to 0

Fire order webhook

Add new button “Fire Order Webhook” (next to specific order transaction which had status of PriceChange). When clicked:

  • Re-compute FIO Tokens Required Amount (see above) for order

  • Re-compute USDC Required Amount (see above) for order

  • Transfer FIO Tokens Required Amount to public key

  • Reduce Public Key’s USDC Balance by USDC Required Amount (even if results in negative balance)

  • Fire Webhook

    • status: Success

    • amount: FIO Tokens Required Amount