Transactions
update-crowdloan-cap
Update the cap of a non-finalized crowdloan (creator only).
Raises or lowers the total the crowdloan can collect. Only the creator may change it, and only while the loan has not been finalized. Reaching the (new) cap is what allows the creator to finalize.
| Signer | Origin | Pallet | Wraps |
|---|---|---|---|
coldkey | signed account (pallet role may apply) | Crowdloan | Crowdloan.update_cap |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
crowdloan_id | integer | yes | Identifier of the crowdloan, assigned when it was created. |
new_cap_tao | number | "all" | yes | New maximum total the crowdloan can raise. |
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-cap \
--crowdloan-id <int> \
--new-cap-tao <amount|all> --dry-run
btcli tx update-crowdloan-cap \
--crowdloan-id <int> \
--new-cap-tao <amount|all> -w my_coldkeyPython
import bittensor as bt
from bittensor.wallet import Wallet
wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.UpdateCrowdloanCap(crowdloan_id=0, new_cap_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_cap", {...}, wallet)On-chain implementation
Crowdloan.update_cap — pallets/crowdloan/src/lib.rs#L898:
#[pallet::call_index(8)]
#[pallet::weight(T::WeightInfo::update_cap())]
pub fn update_cap(
origin: OriginFor<T>,
#[pallet::compact] crowdloan_id: CrowdloanId,
#[pallet::compact] new_cap: BalanceOf<T>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
// The cap can only be updated if the crowdloan has not been finalized.
let mut crowdloan = Self::ensure_crowdloan_exists(crowdloan_id)?;
ensure!(!crowdloan.finalized, Error::<T>::AlreadyFinalized);
// Only the creator can update the cap.
ensure!(who == crowdloan.creator, Error::<T>::InvalidOrigin);
// The new cap should be greater than the actual raised amount.
ensure!(new_cap >= crowdloan.raised, Error::<T>::CapTooLow);
crowdloan.cap = new_cap;
Crowdloans::<T>::insert(crowdloan_id, &crowdloan);
Self::deposit_event(Event::<T>::CapUpdated {
crowdloan_id,
new_cap,
});
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).