Uh oh!
There was an error while loading. Please reload this page.
Add treasury pallet - #41
Conversation
COnfig treasury pallet and collect fees in the treasury
…accountid from pallet id, funding no hardcoded
brenzi
commented
Sep 16, 2021
brenzi
commented
Sep 17, 2021
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 |
brenzi
commented
Sep 17, 2021
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 |
brenzi
commented
Sep 17, 2021
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 |
brenzi
left a comment
There was a problem hiding this comment.
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"""fromsubstrateinterfaceimportSubstrateInterface, Keypairfromsubstrateinterface.utils.ss58importss58_encodedefget_balance(who):
returnsubstrate.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#millicall=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-amountprint('fee paid : ', paidfee)
treasuryafter=get_balance(treasury)
print('treasury balance is ', treasuryafter, ' and has increased by', treasuryafter-treasurybefore) |
echevrier
commented
Sep 20, 2021
For #33 I assumed:
|
echevrier
commented
Sep 20, 2021
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 |
echevrier
commented
Sep 20, 2021
I don't understand it |
To be improved as issue #33 is not clear.
Config with no burn and impossibility to approve a proposal.