Protocol

Contract reference

Every external function, parameter, event and revert.

Deployed at 0xC73f689442B6D61e34ba36199e23855c61b11A0b on Robinhood Chain, chain id 4663. Everything below is the deployed source, not a plan.

State changing

createPot

function createPot(
    string calldata name,
    address asset,
    uint256 target,
    uint64 deadline,
    address beneficiary,
    bool shared
) external returns (uint256 id)
ParameterRule
name1 to 64 bytes, otherwise BadParams.
assetAny ERC-20, not the zero address.
targetAbove zero, at most type(uint128).max.
deadlineStrictly greater than block.timestamp.
beneficiaryZero means the caller. On a solo pot it must equal the caller.
sharedFalse restricts contribute to the creator.

Reverts with BadParams on any rule above. Emits PotCreated and returns the new id, which is also the previous value of potCount.

contribute

function contribute(uint256 id, uint256 amount) external

Pulls amount of the pot asset from the caller with safeTransferFrom and credits whatever actually arrived. Requires an ERC-20 allowance for the Cairn contract first.

RevertWhen
NoPotNo pot at that id.
PotClosedAlready released or cancelled.
PastDeadlineblock.timestamp is past the deadline.
SoloPotPot is solo and the caller is not the creator.
BadParamsamount is zero, or nothing was received.
ReentrantCalled again from inside a token callback.

release

function release(uint256 id) external

Permissionless. Sends the entire pot balance to the beneficiary minus the fee, and the fee to the treasury. Sets released before transferring.

RevertWhen
NoPotNo pot at that id.
PotClosedAlready released or cancelled.
TargetNotMetraised is below target.
ReentrantReentered from a token callback.

refund

function refund(uint256 id) external

Returns the caller's own recorded share and zeroes it. Never touches anybody else's share.

RevertWhen
NoPotNo pot at that id.
PotClosedThe pot was released.
BeforeDeadlineThe deadline has not passed yet.
TargetMetraised is at or above target.
NothingToRefundThe caller has no share left.
ReentrantReentered from a token callback.

cancel

function cancel(uint256 id) external
RevertWhen
NoPotNo pot at that id.
NotCreatorThe caller did not create the pot.
PotClosedAlready released or cancelled.
HasStonesraised or contributors is not zero.

Views

SignatureReturns
owner() view returns (address)Admin address.
treasury() view returns (address)Where fees land.
feeBps() view returns (uint16)Current fee, 50 means 0.50%.
MAX_FEE_BPS() view returns (uint16)Constant 100. The hard ceiling.
feeToken() view returns (address)$CAIRN once armed, zero until then.
feeWaiverBalance() view returns (uint256)Minimum $CAIRN balance for a free release.
potCount() view returns (uint256)Number of pots ever created.
getPot(uint256) view returns (Pot)The full struct.
contributionOf(uint256,address) view returns (uint256)One address's recorded share.
potsOf(address) view returns (uint256[])Ids that address created.
joinedBy(address) view returns (uint256[])Ids that address contributed to.
contributorsOf(uint256) view returns (address[])Every address that ever contributed.
listPots(uint256,uint256) view returns (uint256[],Pot[])A clamped page of pots.
quoteFee(address,uint256) view returns (uint256)Fee a release of that size to that beneficiary would pay now.
feeWaived(address) view returns (bool)Whether that address currently skips the fee.

Admin

Owner is 0xe568F9e89F77D88399817Ec4046fa21Fc675E269. All four functions revert with NotOwnerfor anyone else. None of them can move a contributor's money.

SignatureEffect
setFee(uint16)Sets the fee. Reverts with FeeTooHigh above 100 bps.
setTreasury(address)Changes where fees go. Reverts on the zero address.
setWaiver(address,uint256)Arms or disarms the $CAIRN fee waiver.
transferOwnership(address)Hands over admin. Reverts on the zero address.

Events

event PotCreated(uint256 indexed id, address indexed creator, address indexed asset,
                 address beneficiary, uint256 target, uint64 deadline, bool shared, string name);
event Contributed(uint256 indexed id, address indexed from, uint256 amount, uint256 raised);
event Released(uint256 indexed id, address indexed beneficiary, uint256 amount, uint256 fee);
event Refunded(uint256 indexed id, address indexed to, uint256 amount);
event Cancelled(uint256 indexed id);
event OwnerChanged(address indexed newOwner);
event TreasuryChanged(address indexed newTreasury);
event FeeChanged(uint16 feeBps);
event WaiverChanged(address feeToken, uint256 feeWaiverBalance);

Errors

error NotOwner();        error NotCreator();     error BadParams();
error NoPot();          error PotClosed();      error SoloPot();
error PastDeadline();   error BeforeDeadline(); error TargetNotMet();
error TargetMet();      error NothingToRefund(); error HasStones();
error FeeTooHigh();     error Reentrant();
Robinhood Chainliveexplorerfee 0.50% on release