Methods
Reads
| Method | Returns | Description |
|---|---|---|
getRaisedAmount() | bigint | Current raised amount |
getLifetimeRaisedAmount() | bigint | Total ever raised |
getRefundedAmount() | bigint | Total refunded amount |
getReward(rewardName) | TieredReward | Reward details by name |
getPlatformHash() | Hex | Platform hash |
getPlatformFeePercent() | bigint | Platform fee in basis points |
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 tokens |
supportsInterface(interfaceId) | boolean | ERC-165 interface check |
Writes
All write methods returnPromise<Hex> (transaction hash).
| Method | Description |
|---|---|
addRewards(rewardNames, rewards) | Register reward tiers |
removeReward(rewardName) | Remove a reward tier |
pledgeForAReward(backer, pledgeToken, shippingFee, rewardNames) | Pledge with reward selection |
pledgeWithoutAReward(backer, pledgeToken, pledgeAmount) | Pledge without selecting a reward |
claimRefund(tokenId) | Claim a refund using a pledge NFT |
disburseFees() | Disburse accumulated fees |
withdraw() | Withdraw funds (only if goal is met) |
burn(tokenId) | Burn a pledge NFT |
pauseTreasury(message) | Pause the treasury |
unpauseTreasury(message) | Unpause the treasury |
cancelTreasury(message) | Cancel the treasury |
| Method | Description |
|---|---|
approve(to, tokenId) | Approve an operator for a token |
setApprovalForAll(operator, approved) | Approve/revoke operator for all tokens |
safeTransferFrom(from, to, tokenId) | Transfer a pledge NFT |
transferFrom(from, to, tokenId) | Transfer a pledge NFT (unsafe) |
TieredReward type
Usage examples
Add rewards and pledge
Pledge without a reward
Claim a refund
Backers can claim refunds if the goal is not met, using their pledge NFT token ID.Withdraw and disburse (goal met)
Query pledge NFTs
Related
- KeepWhatsRaised — alternative treasury where creator keeps all funds
- CampaignInfo — campaign this treasury serves
- TreasuryFactory — deploying treasury contracts