---
# System prepended metadata

title: Bounties Pallet

---

# Bounties Pallet

### Config

1. `pallet_bounties` uses the following `pallet_treasury` config types:

- `type ApproveOrigin` (`approve_bounty` and `propose_curator`).
- `type RejectOrigin` (`close_bounty` and a special case for `unassign_curator`).
- `type OnSlash` (used when a slash occurs).

On the other hand, `pallet_treasury` points to `pallet_bounties` at:

- `type SpendFunds` (allows `pallet_bounties` to spend treasury funds).

2. `pallet_bounties` also points out to `pallet_child_bounties` at:

- `type ChildBountyManager` (`child_bounties_count` and `children_curator_fees`).

```
impl pallet_bounties::Config for Runtime {
	type Event = Event;
	type BountyDepositBase = BountyDepositBase;
	type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
    type BountyUpdatePeriod = BountyUpdatePeriod;
	type CuratorDepositMultiplier = CuratorDepositMultiplier;
	type CuratorDepositMin = CuratorDepositMin;
	type CuratorDepositMax = CuratorDepositMax;
	type BountyValueMinimum = BountyValueMinimum;
	type DataDepositPerByte = DataDepositPerByte;
	type MaximumReasonLength = MaximumReasonLength;
	type WeightInfo = pallet_bounties::weights::SubstrateWeight<Runtime>;
	type ChildBountyManager = ChildBounties;
}

impl pallet_treasury::Config for Runtime {
	...
	type ApproveOrigin = EitherOfDiverse<
		EnsureRoot<AccountId>,
		EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
	>;
	type RejectOrigin = EitherOfDiverse<
		EnsureRoot<AccountId>,
		EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
	>;
	...
	type SpendFunds = Bounties;
	...
}
```

### Extrinsics

1. [`propose_bounty(origin, value, description)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L336)
    * Propose a new bounty.
        * `origin` ('proposer`) must have funds to be reserved.
        * `value` must be >= `T::BountyValueMinimum`.
        * `description` must fit in a `BoundedVec<u8, u32::MAX>`.
    * `proposer` must reserve deposit an amount.
    * Create a new bounty with `Proposed` and increment the global bounties counter `BountyCount<T>`.

2. [`approve_bounty(origin, bounty_id)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L355)
    * Approve a bounty proposal.
        * `origin` must be a valid `T::ApproveOrigin` (from `pallet_treasury`).
        * `bounty_id` must be valid (<= `BountyCount<T>`).
    * Check if it's possible to append `bounty_id` to `BountyApprovals::<T>`, otherwise it returns `TooManyQueued`.
    * Set status to `Approved`.

3. [`propose_curator(origin, bounty_id, curator, fee)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L383)
    * Assign an account to a bounty as candidate curator.
        * `origin` must be in `T::ApproveOrigin` (from `pallet_treasury`).
        * bounty's status must be `Funded` (otherwise `UnexpectedStatus`).
        * `curator` is the account who will manage this bounty.
        * `fee` is the curator fee, which must be less than the bounty's value.
    * Set status to `CuratorProposed`.

4. [`accept_curator(origin, bounty_id)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L513)
    * Accept a bounty assignment from the Council, setting a curator deposit.
        * `origin` must be the assigned curator of the bounty.
        * A deposit will be reserved from the curator and refund upon successful payout.
    * Set status to `Active`.

5. [`extend_bounty_expiry(origin, bounty_id, _remark)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L756)
    * Extend the expiry block number of the bounty and stay active.
        * `origin`must be the curator of the bounty.
        * `remark`: additional information. (`TODO: Not being used!`).
        * bounty's status must be `Active`.

6. [`award_bounty(origin, bounty_id, beneficiary)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L555)
    * Award bounty to a beneficiary account. The beneficiary will be able to claim the funds after a delay (`T::BountyDepositPayoutDelay`).
        * `origin` must be the curator of the bounty.
        * Ensure that there are no active child bounties (otherwise `HasActiveChildBounty`).
    * Set status to `PendingPayout` with `beneficiary` and `unlock_at` (delay).

7. [`claim_bounty(origin, bounty_id)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L602)
    * Claim the payout from an awarded bounty after payout delay.
        * `origin` must be the beneficiary of the bounty. (`TODO: Wrong, anyone can trigger it.`)
        * bounty's status must be `PendingPayout`.
    * Set `Bounties[bounty_id] = None`.
    * Remove the bounty's description from `BountyDescriptions`.

8. [`unassign_curator(origin, bounty_id)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L428)
    * Unassign an accepted curator from a bounty.
        * `origin` can be:
            * the curator, signaling that they don't want to curate anymore (no slash).
            * `T::RejectOrigin` (from `pallet_treasury`), in that case we slash the curator, considering them malicious or inactive.
            * anybody else, slash if the curator is inactive.
    * Set status to `Funded` (so another curator can be assigned to it).

9. [`close_bounty(origin, bounty_id)`](https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L666)
    * Cancel a proposed or active bounty.
        * `origin` must be in `T::RejectOrigin`.
    * Check for the bounty's status to handle different situations.
    * If the bounty is ready to be closed, set `Bounties[bounty_id] = None`.
    * Remove the bounty's description from `BountyDescriptions`.

---
