GNSReferrals

Facet #2: Referral system

constructor

constructor() public

initializeReferrals

function initializeReferrals(uint256 _allyFeeP, uint256 _startReferrerFeeP, uint256 _targetVolumeUsd) external

Parameters

Name
Type
Description

_allyFeeP

uint256

% of total referral fee going to ally

_startReferrerFeeP

uint256

initial % of total referral fee earned when zero volume referred

_targetVolumeUsd

uint256

usd opening volume to refer to reach 100% of referral fee

updateAllyFeeP

function updateAllyFeeP(uint256 _value) external

Updates allyFeeP

Parameters

Name
Type
Description

_value

uint256

new ally fee %

updateStartReferrerFeeP

function updateStartReferrerFeeP(uint256 _value) external

Updates startReferrerFeeP

Parameters

Name
Type
Description

_value

uint256

new start referrer fee %

updateReferralsTargetVolumeUsd

function updateReferralsTargetVolumeUsd(uint256 _value) external

Updates targetVolumeUsd

Parameters

Name
Type
Description

_value

uint256

new target volume in usd

whitelistAllies

function whitelistAllies(address[] _allies) external

Whitelists ally addresses

Parameters

Name
Type
Description

_allies

address[]

array of ally addresses

unwhitelistAllies

function unwhitelistAllies(address[] _allies) external

Unwhitelists ally addresses

Parameters

Name
Type
Description

_allies

address[]

array of ally addresses

whitelistReferrers

function whitelistReferrers(address[] _referrers, address[] _allies) external

Whitelists referrer addresses

Parameters

Name
Type
Description

_referrers

address[]

array of referrer addresses

_allies

address[]

array of corresponding ally addresses

unwhitelistReferrers

function unwhitelistReferrers(address[] _referrers) external

Unwhitelists referrer addresses

Parameters

Name
Type
Description

_referrers

address[]

array of referrer addresses

registerPotentialReferrer

function registerPotentialReferrer(address _trader, address _referrer) external virtual

Registers potential referrer for trader (only works if trader wasn't referred yet by someone else)

Parameters

Name
Type
Description

_trader

address

trader address

_referrer

address

distributeReferralReward

function distributeReferralReward(address _trader, uint256 _volumeUsd, uint256 _referrerFeeUsd, uint256 _gnsPriceUsd) external virtual

Distributes ally and referrer rewards

Parameters

Name
Type
Description

_trader

address

trader address

_volumeUsd

uint256

trading volume in usd (1e18 precision)

_referrerFeeUsd

uint256

referrer fee in USD (1e18 precision)

_gnsPriceUsd

uint256

token price in usd (1e10 precision)

claimAllyRewards

function claimAllyRewards() external

Claims pending GNS ally rewards of caller

claimReferrerRewards

function claimReferrerRewards() external

Claims pending GNS referrer rewards of caller

getReferrerFeeProgressP

function getReferrerFeeProgressP(address _referrer) external view returns (uint256)

Returns referrer fee % progress towards earning 100% based on his volume referred (1e10)

Parameters

Name
Type
Description

_referrer

address

referrer address

getTraderLastReferrer

function getTraderLastReferrer(address _trader) external view returns (address)

Returns last referrer of trader (whether referrer active or not)

Parameters

Name
Type
Description

_trader

address

address of trader

getTraderActiveReferrer

function getTraderActiveReferrer(address _trader) external view returns (address)

Returns active referrer of trader

Parameters

Name
Type
Description

_trader

address

address of trader

getReferrersReferred

function getReferrersReferred(address _ally) external view returns (address[])

Returns referrers referred by ally

Parameters

Name
Type
Description

_ally

address

address of ally

getTradersReferred

function getTradersReferred(address _referrer) external view returns (address[])

Returns traders referred by referrer

Parameters

Name
Type
Description

_referrer

address

address of referrer

getReferralsAllyFeeP

function getReferralsAllyFeeP() external view returns (uint256)

Returns ally fee % of total referral fee

getReferralsStartReferrerFeeP

function getReferralsStartReferrerFeeP() external view returns (uint256)

Returns start referrer fee % of total referral fee when zero volume was referred

getReferralsTargetVolumeUsd

function getReferralsTargetVolumeUsd() external view returns (uint256)

Returns target volume in usd to reach 100% of referral fee

getAllyDetails

function getAllyDetails(address _ally) external view returns (struct IReferrals.AllyDetails)

Returns ally details

Parameters

Name
Type
Description

_ally

address

address of ally

getReferrerDetails

function getReferrerDetails(address _referrer) external view returns (struct IReferrals.ReferrerDetails)

Returns referrer details

Parameters

Name
Type
Description

_referrer

address

address of referrer