Referral program and widget

This is an additional piece of logic on eosdtcntract that allows for integrating EOSDT generation into your own web application or dApp — 50% of all NUT-based fees will be paid by stablecoin users.

Users must pay an admin fee in Equilibrium’s NUT in order to close an EOSDT position, and the referral program simply splits this fee in half — 50% of NUT tokens get burned, 50% goes to the referral partner.

Those who want to participate need to register on EOSDT’s smart contracts in order to make sure they can get paid. This only requires a separate NUT transfer to our smart contracts, granting partners a referral ID.

**There are new settings related to the referral program:

parameter

type

description

referral_min_stake

asset **

The minimum NUT stake required to register as a referral. This is 2 NUT by default.

referral_ratio

float

The ratio of admin fees that go to referrals as a reward. By default this is 50%.

**New table ctrreferrals**:

This table lists all the referrals with their respective staked amounts of NUT.

parameter

type

description

referral_id

int

referral id

referral

name

referral account name

staked_amount

asset

amount of NUT staked

New table positionrefs: This table connects positions with referrals so the system knows when and where to pay the fees.

parameter

type

description

referral_id

int

referral id

position_id

int

Id of the related position

**New actions related to referral program:

referraladd
referraldel
posandrefadd
referraladd

Action

deposit NUT to the eosdtcntract, specifying referral in memo.

Parameters

NUT amount memo: referral

Rejections

When input < referral_min_stake

**When missing the referral’s signature

Example

cleos transfer ‘{“from”:“testtesttest",“to”:“eosdtcntract”,“quantity”:“2.000000000 NUT”,“memo”:“referral"}’
referraldel

Action

withdraw NUT from the smart contract and delete the referral account name from the table.

Parameters

referral_id

Rejections

When missing the referral’s signature for a given referral_id

**When the referral doesn’t exist in the referrals table (can’t find referral by id)

Example

cleos push action eosdtcntract referraldel '{"referral_id": "2"}' -p user
posandrefadd

Action

Create an empty position entity and set the caller to be the owner.

Parameters

referral_id

Rejections

When missing referral_id

**When the referral doesn’t exist in the referrals table (can’t find referral by id)

Example

cleos push action eosdtcntract posandrefadd '{"referral_id": "2"}' -p user

For frontend integrations you can use our widget, which has configurable color schemes (Check here). The widget comes in different forms and may be installed via npm, CDN, or IFrame. Check the widget repo for additional details.