Skip to main content

Bounties

Strata Bounties are an easy way to crowdsource funds for an event or task, on chain. They are a wrapper around Bonding Curves.

How it Works

You can visit the marketplace to see bounties in action.

When a bounty is created, anyone may deposit funds on the bounty. Currently, bounties only support one mint. If the token is created for SOL, users donate SOL.

Following a deposit, users will recieve a token in equal quantity to their deposit representing their contribution. For example, if we are creating a bounty to purchase the Constitution of the United States, contributing 2 SOL to the cause would net you 2 CONSTITUTION tokens.

When a bounty is completed, the Approver on the bounty is allowed to disburse the funds. Note that the approver has the ability to do this at any point in time.

A user can burn their tokens to receive their contributions back until the bounty has been disbursed.

Anatomy of a Bounty

The Bonding Curve

Every bounty is a fixed price bonding curve. Put base mint in, get target mint out. Burn target mint, receive base mint. For example, a SOL based bounty would take SOL as the base mint and output a bounty token.

The bonding curve has a Reserve Authority that is allowed to withdraw tokens from the reserves of the bonding curve.

The bonding curve collects all contributions to the bounty. When the bounty is complete, the Approver uses this authority to transfer the tokens and close the bonding curve.

Note that this authority can be a DAO, multisig, or normal wallet.

The Metadata

In order for a bounty to have a name, symbol, description, and other nice attributes we use Metaplex Token Metadata.

This means that a momento of your contribution will show up in collectibles in most wallets.

Marketplace SDK

You can initialize the marketplace sdk using an Anchor Provider as follows:

const marketplaceSdk = await MarketplaceSdk.init(provider)

Creating a Bounty

To create a bounty using SOL, you can run

Loading...

Now to deposit money on that bounty, just use a token bonding buy:

Loading...

To sell,

Loading...

To create a bounty with metadata on the frontend, you can use code like this. Assuming that image is a File from a file picker:

const targetMintKeypair = Keypair.generate();
const uri = await marketplaceSdk.tokenMetadataSdk.createArweaveMetadata({
name: "Test ",
symbol: "test",
description: "Bounty Description",
image: image?.name,
files: [image],
mint: targetMintKeypair.publicKey,
attributes: MarketplaceSdk.bountyAttributes({
mint,
discussion: values.discussion,
contact: values.contact
}),
});
const { targetMint } = await marketplaceSdk.createBounty({
targetMintKeypair,
authority,
metadataUpdateAuthority: marketplaceSdk.provider.wallet.publicKey,
metadata: new DataV2({
// Max name len 32
name: values.name.substring(0, 32),
symbol: values.shortName.substring(0, 10),
uri,
sellerFeeBasisPoints: 0,
creators: null,
collection: null,
uses: null,
}),
baseMint: mint,
});

You can see more on filling out metadata via the UI looking at this code

This will trigger two transactions. One will pay the arweave fee in SOL, then get your URI. The second will create the bounty.

Updating a Bounty

To update the metadata of a bounty, you can run:

Loading...

To update the approver, you can run:

Loading...

Withdrawing Funds

The canonical way to withdraw funds from a bounty is all at once via the disburseBounty command on marketplaceSdk (shown later). We can also transfer funds from the bounty without closing it via transferReserves. The authority param (defaulted to the wallet creating the bounty) is allowed to withdraw the funds from the bounty.

Loading...

To fully disburse and close the bounty:

Loading...

Searching Bounties

If you're using react, you can use the useBounties hook from @strata-foundation/marketplace-ui

Otherwise, you can search by mint:

Loading...

React

See the basic React setup to get your Solana setup with wallets working. Then,

import { MarketplaceSdkProvider } from "@strata-foundation/marketplace-ui";

<MarketplaceSdkProvider>
{ ... your components ... }
</MarketplaceSdkProvider>

This will allow you to use the useMarketplaceSdk hook,

const { marketplaceSdk } = useMarketplaceSdk();

Bounty List

import { BountyCard, useBounties } from "@strata-foundation/marketplace-ui";
Loading...

Bounty Details

import { BountyDetail } from "@strata-foundation/marketplace-ui";
Loading...
Loading...

More Components

The full source of the strata marketplace is open, see https://github.com/StrataFoundation/strata/tree/master/packages/marketplace-ui