Treasury¶
Calls¶
approve_proposal¶
Approve a proposal. At a later time, the proposal will be allocated to the beneficiary and the original deposit will be returned.
May only be called from T::ApproveOrigin
.
## Complexity - O(1).
Attributes¶
Name | Type |
---|---|
proposal_id | ProposalIndex |
Python¶
call = substrate.compose_call(
'Treasury', 'approve_proposal', {'proposal_id': 'u32'}
)
propose_spend¶
Put forward a suggestion for spending. A deposit proportional to the value is reserved and slashed if the proposal is rejected. It is returned once the proposal is awarded.
## Complexity - O(1)
Attributes¶
Name | Type |
---|---|
value | BalanceOf<T, I> |
beneficiary | AccountIdLookupOf<T> |
Python¶
call = substrate.compose_call(
'Treasury', 'propose_spend', {
'beneficiary': {
'Address20': '[u8; 20]',
'Address32': '[u8; 32]',
'Id': 'AccountId',
'Index': 'u32',
'Raw': 'Bytes',
},
'value': 'u128',
}
)
reject_proposal¶
Reject a proposed spend. The original deposit will be slashed.
May only be called from T::RejectOrigin
.
## Complexity - O(1)
Attributes¶
Name | Type |
---|---|
proposal_id | ProposalIndex |
Python¶
call = substrate.compose_call(
'Treasury', 'reject_proposal', {'proposal_id': 'u32'}
)
remove_approval¶
Force a previously approved proposal to be removed from the approval queue. The original deposit will no longer be returned.
May only be called from T::RejectOrigin
.
- proposal_id
: The index of a proposal
## Complexity
- O(A) where A
is the number of approvals
Errors:
- ProposalNotApproved
: The proposal_id
supplied was not found in the approval queue,
i.e., the proposal has not been approved. This could also mean the proposal does not
exist altogether, thus there is no way it would have been approved in the first place.
Attributes¶
Name | Type |
---|---|
proposal_id | ProposalIndex |
Python¶
call = substrate.compose_call(
'Treasury', 'remove_approval', {'proposal_id': 'u32'}
)
spend¶
Propose and approve a spend of treasury funds.
origin
: Must beSpendOrigin
with theSuccess
value being at leastamount
.amount
: The amount to be transferred from the treasury to thebeneficiary
.beneficiary
: The destination account for the transfer.
NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the beneficiary.
Attributes¶
Name | Type |
---|---|
amount | BalanceOf<T, I> |
beneficiary | AccountIdLookupOf<T> |
Python¶
call = substrate.compose_call(
'Treasury', 'spend', {
'amount': 'u128',
'beneficiary': {
'Address20': '[u8; 20]',
'Address32': '[u8; 32]',
'Id': 'AccountId',
'Index': 'u32',
'Raw': 'Bytes',
},
}
)
Events¶
Awarded¶
Some funds have been allocated.
Attributes¶
Name | Type | Composition |
---|---|---|
proposal_index | ProposalIndex |
u32 |
award | BalanceOf<T, I> |
u128 |
account | T::AccountId |
AccountId |
Burnt¶
Some of our funds have been burnt.
Attributes¶
Name | Type | Composition |
---|---|---|
burnt_funds | BalanceOf<T, I> |
u128 |
Deposit¶
Some funds have been deposited.
Attributes¶
Name | Type | Composition |
---|---|---|
value | BalanceOf<T, I> |
u128 |
Proposed¶
New proposal.
Attributes¶
Name | Type | Composition |
---|---|---|
proposal_index | ProposalIndex |
u32 |
Rejected¶
A proposal was rejected; funds were slashed.
Attributes¶
Name | Type | Composition |
---|---|---|
proposal_index | ProposalIndex |
u32 |
slashed | BalanceOf<T, I> |
u128 |
Rollover¶
Spending has finished; this is the amount that rolls over until next spend.
Attributes¶
Name | Type | Composition |
---|---|---|
rollover_balance | BalanceOf<T, I> |
u128 |
SpendApproved¶
A new spend proposal has been approved.
Attributes¶
Name | Type | Composition |
---|---|---|
proposal_index | ProposalIndex |
u32 |
amount | BalanceOf<T, I> |
u128 |
beneficiary | T::AccountId |
AccountId |
Spending¶
We have ended a spend period and will now allocate funds.
Attributes¶
Name | Type | Composition |
---|---|---|
budget_remaining | BalanceOf<T, I> |
u128 |
UpdatedInactive¶
The inactive funds of the pallet have been updated.
Attributes¶
Name | Type | Composition |
---|---|---|
reactivated | BalanceOf<T, I> |
u128 |
deactivated | BalanceOf<T, I> |
u128 |
Storage functions¶
Approvals¶
Proposal indices that have been approved but not yet awarded.
Python¶
result = substrate.query(
'Treasury', 'Approvals', []
)
Return value¶
['u32']
Deactivated¶
The amount which has been reported as inactive to Currency.
Python¶
result = substrate.query(
'Treasury', 'Deactivated', []
)
Return value¶
'u128'
ProposalCount¶
Number of proposals that have been made.
Python¶
result = substrate.query(
'Treasury', 'ProposalCount', []
)
Return value¶
'u32'
Proposals¶
Proposals that have been made.
Python¶
result = substrate.query(
'Treasury', 'Proposals', ['u32']
)
Return value¶
{
'beneficiary': 'AccountId',
'bond': 'u128',
'proposer': 'AccountId',
'value': 'u128',
}
Constants¶
Burn¶
Percentage of spare funds (if any) that are burnt per spend period.
Value¶
0
Python¶
constant = substrate.get_constant('Treasury', 'Burn')
MaxApprovals¶
The maximum number of approvals that can wait in the spending queue.
NOTE: This parameter is also used within the Bounties Pallet extension if enabled.
Value¶
30
Python¶
constant = substrate.get_constant('Treasury', 'MaxApprovals')
PalletId¶
The treasury's pallet id, used for deriving its sovereign account ID.
Value¶
'0x6c79617274727379'
Python¶
constant = substrate.get_constant('Treasury', 'PalletId')
ProposalBond¶
Fraction of a proposal's value that should be bonded in order to place the proposal. An accepted proposal gets these back. A rejected proposal does not.
Value¶
50000
Python¶
constant = substrate.get_constant('Treasury', 'ProposalBond')
ProposalBondMaximum¶
Maximum amount of funds that should be placed in a deposit for making a proposal.
Value¶
10000000000000000
Python¶
constant = substrate.get_constant('Treasury', 'ProposalBondMaximum')
ProposalBondMinimum¶
Minimum amount of funds that should be placed in a deposit for making a proposal.
Value¶
5000000000000000
Python¶
constant = substrate.get_constant('Treasury', 'ProposalBondMinimum')
SpendPeriod¶
Period between successive spends.
Value¶
50400
Python¶
constant = substrate.get_constant('Treasury', 'SpendPeriod')
Errors¶
InsufficientPermission¶
The spend origin is valid but the amount it is allowed to spend is lower than the amount to be spent.
InsufficientProposersBalance¶
Proposer's balance is too low.
InvalidIndex¶
No proposal or bounty at that index.
ProposalNotApproved¶
Proposal has not been approved.
TooManyApprovals¶
Too many approvals in the queue.