Skip to main content

TokenDistributor

Escrow contract for making deposited tokens claimable by members of Parties in proportion to their voting power in the Party.

Code

TokenDistributor.sol

Functions

createNativeDistribution

Create a new distribution for an outstanding native token balance governed by a Party.

Native tokens should be transferred directly into this contract immediately prior (same tx) to calling createDistribution() or attached to the call itself.

function createNativeDistribution(Party party, address payable feeRecipient, uint16 feeBps)
external
payable
returns (DistributionInfo memory info);

Parameters

NameTypeDescription
partyPartyThe Party whose members can claim the distribution.
feeRecipientaddress payableWho can claim fee.
feeBpsuint16Percentage (in bps) of the distribution feeRecipient receives.

Returns

NameTypeDescription
infoDistributionInfoInformation on the created distribution.

createErc20Distribution

Create a new distribution for an outstanding ERC20 token balance governed by a Party.

ERC20 tokens should be transferred directly into this contract immediately prior (same tx) to calling createDistribution() or attached to the call itself.

function createErc20Distribution(IERC20 token, Party party, address payable feeRecipient, uint16 feeBps)
external
returns (DistributionInfo memory info);

Parameters

NameTypeDescription
tokenIERC20The ERC20 token to distribute.
partyPartyThe Party whose members can claim the distribution.
feeRecipientaddress payableWho can claim fee.
feeBpsuint16Percentage (in bps) of the distribution feeRecipient receives.

Returns

NameTypeDescription
infoDistributionInfoInformation on the created distribution.

claim

Claim a portion of a distribution owed to a partyTokenId belonging to the Party that created the distribution. The caller must own this token.

function claim(DistributionInfo calldata info, uint256 partyTokenId) public returns (uint128 amountClaimed);

Parameters

NameTypeDescription
infoDistributionInfoInformation on the distribution being claimed.
partyTokenIduint256The ID of the Party token to claim for.

Returns

NameTypeDescription
amountClaimeduint128The amount of the distribution claimed.

claimFee

Claim the fee for a distribution. Only a distribution's feeRecipient can call this.

function claimFee(DistributionInfo calldata info, address payable recipient) public;

Parameters

NameTypeDescription
infoDistributionInfoInformation on the distribution being claimed.
recipientaddress payableThe address to send the fee to.

batchClaim

Batch version of claim().

function batchClaim(DistributionInfo[] calldata infos, uint256[] calldata partyTokenIds)
external
returns (uint128[] memory amountsClaimed);

Parameters

NameTypeDescription
infosDistributionInfo[]Information on the distributions being claimed.
partyTokenIdsuint256[]The ID of the Party tokens to claim for.

Returns

NameTypeDescription
amountsClaimeduint128[]The amount of the distributions claimed.

batchClaimFee

Batch version of claimFee().

function batchClaimFee(DistributionInfo[] calldata infos, address payable[] calldata recipients) external;

Parameters

NameTypeDescription
infosDistributionInfo[]Information on the distributions to claim fees for.
recipientsaddress payable[]The addresses to send the fees to.

getClaimAmount

Compute the amount of a distribution's token are owed to a Party member, identified by the partyTokenId.

function getClaimAmount(DistributionInfo calldata info, uint256 partyTokenId) public view returns (uint128);

Parameters

NameTypeDescription
infoDistributionInfoInformation on the distribution being claimed.
partyTokenIduint256The ID of the Party token to claim for.

Returns

NameTypeDescription
uint128claimAmount The amount of the distribution owed to the Party member.

wasFeeClaimed

Check whether the fee has been claimed for a distribution.

function wasFeeClaimed(Party party, uint256 distributionId) external view returns (bool);

Parameters

NameTypeDescription
partyPartyThe Party to use for checking whether the fee has been claimed.
distributionIduint256The ID of the distribution to check.

Returns

NameTypeDescription
boolfeeClaimed Whether the fee has been claimed.

hasPartyTokenIdClaimed

Check whether a partyTokenId has claimed their share of a distribution.

function hasPartyTokenIdClaimed(Party party, uint256 partyTokenId, uint256 distributionId)
external
view
returns (bool);

Parameters

NameTypeDescription
partyPartyThe Party to use for checking whether the partyTokenId has claimed.
partyTokenIduint256The ID of the Party token to check.
distributionIduint256The ID of the distribution to check.

Returns

NameTypeDescription
boolhasClaimed Whether the partyTokenId has claimed.

getRemainingMemberSupply

Get how much unclaimed member tokens are left in a distribution.

function getRemainingMemberSupply(Party party, uint256 distributionId) external view returns (uint128);

Parameters

NameTypeDescription
partyPartyThe party to use for checking the unclaimed member tokens.
distributionIduint256The ID of the distribution to check.

Returns

NameTypeDescription
uint128remainingMemberSupply The amount of distribution supply remaining.