Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IReferralRegistry

Git Source

Author: luoyhang003

Defines the referral binding system used across staking and expedition modules.

This registry maintains:

  • One-to-one mapping between referee -> referrer
  • Keeper-controlled binding operations
  • View helpers for reading referral relationships Keeper contracts are expected to be staking contracts or other protocol-approved callers.

Functions

getReferrerOf

Returns the referrer associated with a given referee.

Returns:

  • address(0) if no referrer is set
  • DEAD_ADDRESS if referrer is invalid or self-referred
function getReferrerOf(address _referee) external view returns (address referrer_);

Parameters

NameTypeDescription
_refereeaddressThe address whose referrer is queried.

Returns

NameTypeDescription
referrer_addressThe resulting referrer address.

bindReferral

Binds a referral relationship between a referee and a referrer.

  • Only callable by keeper contracts.
  • Binding occurs only if referee has no existing referrer.
  • Invalid referrers (zero address or self-reference) map to DEAD_ADDRESS.
function bindReferral(address _referee, address _referrer) external returns (bool binded_);

Parameters

NameTypeDescription
_refereeaddressThe user being referred.
_referreraddressThe user who referred the referee.

Returns

NameTypeDescription
binded_boolTrue if a valid referral was recorded, false otherwise.

Events

ReferralBinded

Emitted when a referral relationship is successfully established.

event ReferralBinded(address indexed referee, address indexed referrer);

Parameters

NameTypeDescription
refereeaddressThe user who was referred.
referreraddressThe user who referred the referee.

SetKeepers

Emitted when keeper permissions change.

event SetKeepers(address indexed keeper, bool flag);

Parameters

NameTypeDescription
keeperaddressAddress of the keeper contract.
flagboolTrue to enable, false to disable.