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.
...
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 anderror
: “Not allowed for this referralCode.”
Ignore
domainRegistrations
andaddressRegistrations
are not validated against wallet profile, meaning this call will work even if domain sale or address sale is disabled.
Once request is received:Compute Order Amounts
FIO Tokens required Order Amount is computed based on sum of:
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
domainRegistrations
andaddressRegistrations
are recorded in order
Once payment is received:
FIO Tokens required is re-computed (see above)
If Create Coinbase Commerce Order and record details
Record FIO Tokens Order Amount and USDC Order Amount
Record
domainRegistrations
andaddressRegistrations
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 numberPublic Key’s Balance is reduced to 0
Status is
set toSuccess
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