Transactions

update-crowdloan-min-contribution

Update the minimum contribution of a non-finalized crowdloan (creator only).

View as Markdown

Changes the smallest contribution the crowdloan will accept from that point on; contributions already made are unaffected. Only the creator may change it, and only while the loan has not been finalized.

SignerOriginPalletWraps
coldkeysigned account (pallet role may apply)CrowdloanCrowdloan.update_min_contribution

Parameters

ParameterTypeRequiredDescription
crowdloan_idintegeryesIdentifier of the crowdloan, assigned when it was created.
new_min_contribution_taonumber | "all"yesNew smallest contribution the crowdloan will accept.

Address parameters (--hotkey, --coldkey, --dest, ...) accept a raw ss58 address, an address-book or proxy-book name, or a local wallet/hotkey name.

CLI

Preview with --dry-run (shows fee, effects, and policy result without submitting), then submit:

btcli tx update-crowdloan-min-contribution \
  --crowdloan-id <int> \
  --new-min-contribution-tao <amount|all> --dry-run
btcli tx update-crowdloan-min-contribution \
  --crowdloan-id <int> \
  --new-min-contribution-tao <amount|all> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.UpdateCrowdloanMinContribution(crowdloan_id=0, new_min_contribution_tao=1.0)

sub = bt.Subtensor()
plan = sub.plan(intent, wallet)   # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
    print(result.error.code, result.error.remediation)

(bt.Subtensor is also the async client — async with bt.Subtensor() as client: — see The client.) Or build the intent by op name, as an agent would:

result = sub.execute_tool("update_crowdloan_min_contribution", {...}, wallet)

On-chain implementation

Crowdloan.update_min_contributionpallets/crowdloan/src/lib.rs#L819:

#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::update_min_contribution())]
pub fn update_min_contribution(
    origin: OriginFor<T>,
    #[pallet::compact] crowdloan_id: CrowdloanId,
    #[pallet::compact] new_min_contribution: BalanceOf<T>,
) -> DispatchResult {
    let who = ensure_signed(origin)?;

    let mut crowdloan = Self::ensure_crowdloan_exists(crowdloan_id)?;
    ensure!(!crowdloan.finalized, Error::<T>::AlreadyFinalized);

    // Only the creator can update the min contribution.
    ensure!(who == crowdloan.creator, Error::<T>::InvalidOrigin);

    // The new min contribution should be greater than absolute minimum contribution.
    ensure!(
        new_min_contribution >= T::AbsoluteMinimumContribution::get(),
        Error::<T>::MinimumContributionTooLow
    );
    if let Some(max_contribution) = MaxContributions::<T>::get(crowdloan_id) {
        ensure!(
            new_min_contribution <= max_contribution,
            Error::<T>::MinimumContributionTooHigh
        );
    }

    crowdloan.min_contribution = new_min_contribution;
    Crowdloans::<T>::insert(crowdloan_id, &crowdloan);

    Self::deposit_event(Event::<T>::MinContributionUpdated {
        crowdloan_id,
        new_min_contribution,
    });
    Ok(())
}

Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).