Skip to main content

CommunityRewards

CommunityRewards

Deployment on Ethereum mainnet:

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

GoldfinchConfigUpdated

event GoldfinchConfigUpdated(address who, address configAddress)

OWNER_ROLE

bytes32 OWNER_ROLE

DISTRIBUTOR_ROLE

bytes32 DISTRIBUTOR_ROLE

config

contract GoldfinchConfig config

rewardsAvailable

uint256 rewardsAvailable

Total rewards available for granting, denominated in rewardsToken()

tokenLaunchTimeInSeconds

uint256 tokenLaunchTimeInSeconds

Token launch time in seconds. This is used in vesting.

grants

mapping(uint256 => struct CommunityRewardsVesting.Rewards) grants

NFT tokenId => rewards grant

initialize

function __initialize__(address owner, contract GoldfinchConfig _config, uint256 _tokenLaunchTimeInSeconds) external

rewardsToken

function rewardsToken() public view returns (contract IERC20withDec)

The token being disbursed as rewards

claimableRewards

function claimableRewards(uint256 tokenId) public view returns (uint256 rewards)

Returns the rewards claimable by a given grant token, taking into account vesting schedule.

Return Values

NameTypeDescription
rewardsuint256Amount of rewards denominated in rewardsToken()

totalVestedAt

function totalVestedAt(uint256 start, uint256 end, uint256 granted, uint256 cliffLength, uint256 vestingInterval, uint256 revokedAt, uint256 time) external pure returns (uint256 rewards)

Returns the rewards that will have vested for some grant with the given params.

Return Values

NameTypeDescription
rewardsuint256Amount of rewards denominated in rewardsToken()

loadRewards

function loadRewards(uint256 rewards) external

Transfer rewards from msg.sender, to be used for reward distribution

revokeGrant

function revokeGrant(uint256 tokenId) external

Revokes rewards that have not yet vested, for a grant. The unvested rewards are now considered available for allocation in another grant.

Parameters

NameTypeDescription
tokenIduint256The tokenId corresponding to the grant whose unvested rewards to revoke.

setTokenLaunchTimeInSeconds

function setTokenLaunchTimeInSeconds(uint256 _tokenLaunchTimeInSeconds) external

grant

function grant(address recipient, uint256 amount, uint256 vestingLength, uint256 cliffLength, uint256 vestingInterval) external returns (uint256 tokenId)

Grant rewards to a recipient. The recipient address receives an an NFT representing their rewards grant. They can present the NFT to getReward() to claim their rewards. Rewards vest over a schedule. If the given vestingInterval is 0, then vestingInterval will be equal to vestingLength.

Parameters

NameTypeDescription
recipientaddressThe recipient of the grant.
amountuint256The amount of rewardsToken() to grant.
vestingLengthuint256The duration (in seconds) over which the grant vests.
cliffLengthuint256The duration (in seconds) from the start of the grant, before which has elapsed the vested amount remains 0.
vestingIntervaluint256The interval (in seconds) at which vesting occurs.

_grant

function _grant(address recipient, uint256 amount, uint256 vestingLength, uint256 cliffLength, uint256 vestingInterval) internal returns (uint256 tokenId)

getReward

function getReward(uint256 tokenId) external

Claim rewards for a given grant

Parameters

NameTypeDescription
tokenIduint256A grant token ID

totalUnclaimed

function totalUnclaimed(address owner) external view returns (uint256)

unclaimed

function unclaimed(uint256 tokenId) external view returns (uint256)

_unclaimed

function _unclaimed(uint256 tokenId) internal view returns (uint256)

isAdmin

function isAdmin() public view returns (bool)

onlyAdmin

modifier onlyAdmin()

isDistributor

function isDistributor() public view returns (bool)

onlyDistributor

modifier onlyDistributor()