Skip to main content

MembershipLedger

MembershipLedger

Deployment on Ethereum mainnet:

https://etherscan.io/address/0xe9C893abDCDb0F710C0CEA8c70094f9E751eEe3c

InvalidAlphaGTE1

error InvalidAlphaGTE1()

InvalidAlphaUndefined

error InvalidAlphaUndefined()

InvalidAlphaNumerator

error InvalidAlphaNumerator()

InvalidAlphaDenominator

error InvalidAlphaDenominator()

Fraction

struct Fraction {
uint128 numerator;
uint128 denominator;
}

allocatedRewards

mapping(address => uint256) allocatedRewards

rewards allocated to and not yet claimed by an address

alpha

struct MembershipLedger.Fraction alpha

Alpha param for the cobb douglas function

constructor

constructor(contract Context _context) public

Construct the contract

initialize

function initialize() public

resetRewards

function resetRewards(address addr) external

Set addrs allocated rewards back to 0

Parameters

NameTypeDescription
addraddressaddress to reset rewards on

allocateRewardsTo

function allocateRewardsTo(address addr, uint256 amount) external returns (uint256 rewards)

Allocate amount rewards for addr but do not send them

Parameters

NameTypeDescription
addraddressaddress to distribute rewards to
amountuint256amount of rewards to allocate for addr

Return Values

NameTypeDescription
rewardsuint256total allocated to addr

getPendingRewardsFor

function getPendingRewardsFor(address addr) external view returns (uint256 rewards)

Get the rewards allocated to a certain addr

Parameters

NameTypeDescription
addraddressthe address to check pending rewards for

Return Values

NameTypeDescription
rewardsuint256pending rewards for addr

setAlpha

function setAlpha(uint128 numerator, uint128 denominator) external

Set the alpha parameter used in the membership score formula. Alpha is defined as a fraction in the range (0, 1) and constrained to (0,20) / (0,20], so a minimum of 1/20 and a maximum of 19/20.

Parameters

NameTypeDescription
numeratoruint128the numerator of the fraction, must be in the range (0, 20)
denominatoruint128the denominator of the fraction, must be in the range (0, 20] and greater than the numerator