Function: registerReferralCode(uint32 _referralCode, uint64 _referralFee, address _beneficiary)
This unpermissioned function allows to register a new referral code. Referral codes can have a referral fee, capped at max 2%.
Inputs
_referralCode
Control: Arbitrary.
Constraints: Must not be an existing referral code.
Impact: Integer identifying the referrer.
_referralFee
Control: Arbitrary.
Constraints: Must represent a fee of at most 2%; must be zero if
_referralCode <= REFERRAL_WITH_FEE_THRESHOLD
.Impact: Determines the referral fee.
_beneficiary
Control: Arbitrary.
Constraints: Must not be the null address.
Impact: Address of the referrer — receives the fees generated by the referral code.
Branches and code coverage (including function calls)
Intended branches
Registers the new referral code.
Negative behavior
Reverts if the fee is > 2%.
Reverts if the fee is > 0% and
_referralCode <= REFERRAL_WITH_FEE_THRESHOLD
.Reverts if the fee is 0% and
_referralCode > REFERRAL_WITH_FEE_THRESHOLD
.Reverts if the referral code is already registered.
Reverts if the beneficiary address is the null address.