Methods
Reads
| Method | Returns | Description |
|---|---|---|
getRaisedAmount() | bigint | Current raised amount |
getLifetimeRaisedAmount() | bigint | Total ever raised |
getRefundedAmount() | bigint | Total refunded amount |
getAvailableRaisedAmount() | bigint | Available raised (raised minus refunded) |
getReward(rewardName) | TieredReward | Reward details by name |
getPlatformHash() | Hex | Platform hash |
getPlatformFeePercent() | bigint | Platform fee in basis points |
getWithdrawalApprovalStatus() | boolean | Whether withdrawal is approved |
getLaunchTime() | bigint | Campaign launch timestamp |
getDeadline() | bigint | Campaign deadline timestamp |
getGoalAmount() | bigint | Funding goal amount |
getPaymentGatewayFee(pledgeId) | bigint | Payment gateway fee for a pledge |
getFeeValue(feeKey) | bigint | Fee value for a registry key |
paused() | boolean | Whether the treasury is paused |
cancelled() | boolean | Whether the treasury is cancelled |
| Method | Returns | Description |
|---|---|---|
balanceOf(owner) | bigint | NFT balance of an address |
ownerOf(tokenId) | Address | Owner of a pledge NFT |
tokenURI(tokenId) | string | Metadata URI for a pledge NFT |
name() | string | NFT collection name |
symbol() | string | NFT collection symbol |
getApproved(tokenId) | Address | Approved operator for a token |
isApprovedForAll(owner, operator) | boolean | Whether operator is approved for all |
supportsInterface(interfaceId) | boolean | ERC-165 interface check |
Writes
All write methods returnPromise<Hex> (transaction hash).
Treasury management:
| Method | Description |
|---|---|
configureTreasury(config, campaignData, feeKeys, feeValues) | Configure the treasury |
pauseTreasury(message) | Pause the treasury |
unpauseTreasury(message) | Unpause the treasury |
cancelTreasury(message) | Cancel the treasury |
updateDeadline(deadline) | Update campaign deadline |
updateGoalAmount(goalAmount) | Update funding goal |
| Method | Description |
|---|---|
addRewards(rewardNames, rewards) | Register reward tiers |
removeReward(rewardName) | Remove a reward tier |
pledgeForAReward(pledgeId, backer, pledgeToken, tip, rewardNames) | Pledge with reward selection and optional tip |
pledgeWithoutAReward(pledgeId, backer, pledgeToken, pledgeAmount, tip) | Pledge without a reward |
setFeeAndPledge(pledgeId, backer, pledgeToken, pledgeAmount, tip, fee, reward, isPledgeForAReward) | Set fee and pledge in one call |
setPaymentGatewayFee(pledgeId, fee) | Set payment gateway fee |
| Method | Description |
|---|---|
approveWithdrawal() | Approve fund withdrawal |
claimFund() | Claim raised funds |
claimTip() | Claim accumulated tips |
claimRefund(tokenId) | Claim a refund using a pledge NFT |
disburseFees() | Disburse accumulated fees |
withdraw(token, amount) | Withdraw a specific token amount |
| Method | Description |
|---|---|
approve(to, tokenId) | Approve an operator for a token |
setApprovalForAll(operator, approved) | Approve/revoke operator for all |
safeTransferFrom(from, to, tokenId) | Transfer a pledge NFT |
transferFrom(from, to, tokenId) | Transfer a pledge NFT (unsafe) |
Configuration types
KeepWhatsRaisedConfig
KeepWhatsRaisedFeeKeys / FeeValues
Usage examples
Configure the treasury
Pledge with a reward
Withdraw funds
Disburse and withdraw specific tokens
Related
- AllOrNothing — alternative treasury where funds are only released if goal is met
- CampaignInfo — campaign this treasury serves
- TreasuryFactory — deploying treasury contracts