Changes to Registration Site Functional Specification

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 Dashboard.

API

Get pricing

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

GET /get-pricing/{referralCode}

Request

Parameter

Format

Required

Description

Parameter

Format

Required

Description

referralCode

String

Yes

Wallet profile referral code

Response

Group

Parameter

Format

Required

Description

Group

Parameter

Format

Required

Description

 

success

boolean

Yes

true if successful

pricing->fio

domain

Int

No

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

No

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

No

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

pricing->usdt

address

Double

No

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

Example

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

Buy FIO Tokens

If a wallet wants to implement it’s own registration of FIO Domains and Addresses, e.g. to accommodate shopping cart or registrations on a private domain, they will be able to purchase enough FIO Tokens to purchase specific number of FIO Addresses or FIO Domains. Using this method, as opposed to purchasing a specific amount of FIO Tokens is preferred as the Registration site will adjust the amount of tokens to be sufficient for the fees, in case there is a fee change between a quote and processing of crypto payment.

Upon payment, the Registration site will transfer FIO Tokens to publicKey and notify webhook

POST /buy-fio-tokens

Request

Parameter

Format

Required

Description

Parameter

Format

Required

Description

referralCode

String

Yes

Wallet profile referral code

domainRegistrations

Int

Yes

Number of FIO Domain registrations

addressRegistrations

Int

Yes

Number of FIO Address registrations

publicKey

String

Yes

FIO public key for the ownership of the FIO Tokens

redirectUrl

String

No

This url will be shown to users upon redirection from Coinbase payment screen. Irrelevant if you are showing payment screens inside app.

apiToken

String

Yes

API Token configured in Wallet Profile

webHook

String

No

Webhook which needs to be notified when payment is processed

Example

{ "referralCode": "fio", "domainRegistrations": 0, "addressRegistrations": 5, "publicKey": "FIO86zM5iJAdsEgF3ggWJDM4SGgTFBVpx63cuBM4SxBEvBFewNyrv", "apiToken": "", "webHook": "https://www/example.com/webhook" }

Response

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

Processing

  • 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

    • 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

      • Public Key’s Balance is reduced to 0

      • Status is Success

    • ELSE

      • 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

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