-
Couldn't load subscription status.
- Fork 12
Add treasury pallet #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
COnfig treasury pallet and collect fees in the treasury
…accountid from pallet id, funding no hardcoded
|
How did you check the treasury balance change? That the fee is paid to the treasury? I could verify that it isn't burned, which is a good sign. But js/apps doesn't give me all digits to verify the treasury balance. I played with a python script but couldn't get treasury balance yet |
|
keep it simple: set initial treasury balance to zero and watch it rising when extrinsics are included. this can be done with js/apps manually. for an automated approach see: JAMdotTech/py-polkadot-sdk#130 |
|
ok. treasury balance can't be below ED, which here is 1mTEER. But that's low enough to see that fees are sent to treasury. After one extrinsic, the treasury holds 1.2mTEER, what corresponds well enough with the fees paid: 271_000_000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will need to change the allocations and will need to burn all fees at the beginning, according to our burning mechanism.
But I approve as this first step behaves as expected
|
treasury balance test script (will commit this to repo/scripts. maybe useful for CI): #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 16 20:41:13 2021
@author: brenzi
"""
from substrateinterface import SubstrateInterface, Keypair
from substrateinterface.utils.ss58 import ss58_encode
def get_balance(who):
return substrate.query('System', 'Account', params=[who]).value['data']['free']
substrate = SubstrateInterface(
url="ws://127.0.0.1:9944",
type_registry_preset='kusama'
)
alice = Keypair.create_from_uri('//Alice')
dave = Keypair.create_from_uri('//Dave')
treasury = ss58_encode('0x' + b'modlpy/trsry'.hex() + '0000000000000000000000000000000000000000')
alicebefore = get_balance(alice.ss58_address)
treasurybefore = get_balance(treasury)
totalissuancebefore = substrate.query('Balances', 'TotalIssuance')
print('total issuance', totalissuancebefore)
amount = 10 * 10**9 #milli
call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_params={
'dest': dave.ss58_address,
'value': amount
}
)
payment_info = substrate.get_payment_info(call=call, keypair=alice)
print("Payment info: ", payment_info)
extrinsic = substrate.create_signed_extrinsic(
call=call,
keypair=alice,
era={'period': 64}
)
receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
print('extrinsic sent')
totalissuanceafter = substrate.query('Balances', 'TotalIssuance')
print('difference in total issuance: ', totalissuancebefore.value - totalissuanceafter.value)
aliceafter = get_balance(alice.ss58_address)
paidfee = alicebefore - aliceafter - amount
print('fee paid : ', paidfee)
treasuryafter = get_balance(treasury)
print('treasury balance is ', treasuryafter, ' and has increased by', treasuryafter-treasurybefore) |
For #33 I assumed:
|
I added in the worker client a command to request the treasury balance. I also add a script for CI. But I haven't push it, as we need to merge first the node, to make the worker compatible with this version |
I don't understand it |
To be improved as issue #33 is not clear.
Config with no burn and impossibility to approve a proposal.