Skip to content
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

Introduced Treasury Funding Pallet with Runtime Integration and Tests #906

Merged
merged 47 commits into from
Dec 13, 2024

Conversation

asiniscalchi
Copy link
Member

@asiniscalchi asiniscalchi commented Dec 10, 2024

PR Type

Enhancement, Tests, Documentation


Description

  • Introduced a new pallet_treasury_funding with functionality to transfer funds from a vault to the treasury.
  • Added benchmarking and weight calculations for the fund_treasury function.
  • Integrated the new pallet into the runtime, including configurations and dependencies.
  • Added unit tests and mock runtime for comprehensive testing of the treasury funding functionality.
  • Updated genesis configuration to include a predefined treasury account.
  • Provided autogenerated weights and runtime benchmarks for the new pallet.

Changes walkthrough 📝

Relevant files
Configuration changes
6 files
laos.rs
Updated genesis configuration to include treasury account.

node/src/chain_spec/laos.rs

  • Adjusted initial balances for predefined accounts.
  • Added a new predefined account TREASURY with an initial balance.
  • +2/-1     
    predefined_accounts.rs
    Added predefined treasury account.                                             

    node/src/chain_spec/predefined_accounts.rs

    • Added a new predefined account TREASURY.
    +1/-0     
    benchmarks.rs
    Added treasury funding pallet to runtime benchmarks.         

    runtime/laos/src/benchmarks.rs

    • Integrated pallet_treasury_funding into runtime benchmarks.
    +1/-0     
    mod.rs
    Integrated treasury funding configuration into runtime.   

    runtime/laos/src/configs/mod.rs

    • Added configuration module for pallet_treasury_funding.
    +1/-0     
    treasury_funding.rs
    Added configuration for treasury funding pallet.                 

    runtime/laos/src/configs/treasury_funding.rs

  • Defined parameters and configuration for pallet_treasury_funding.
  • Added test for treasury funding account address.
  • +27/-0   
    mod.rs
    Integrated treasury funding weights into runtime.               

    runtime/laos/src/weights/mod.rs

    • Added weight module for pallet_treasury_funding.
    +1/-0     
    Tests
    3 files
    benchmarking.rs
    Introduced benchmarking for treasury funding pallet.         

    pallets/treasury-funding/src/benchmarking.rs

  • Added benchmarking setup for the fund_treasury function.
  • Included test suite for benchmarking.
  • +67/-0   
    mock.rs
    Added mock runtime for treasury funding pallet tests.       

    pallets/treasury-funding/src/mock.rs

  • Created a mock runtime for testing the treasury funding pallet.
  • Configured dependencies and parameters for the mock runtime.
  • +121/-0 
    tests.rs
    Added unit tests for treasury funding functionality.         

    pallets/treasury-funding/src/tests.rs

  • Added unit tests for the fund_treasury function.
  • Covered scenarios with and without vesting schedules.
  • +94/-0   
    Enhancement
    4 files
    lib.rs
    Added treasury funding pallet with core functionality.     

    pallets/treasury-funding/src/lib.rs

  • Implemented the pallet_treasury_funding with a fund_treasury function.
  • Added event emission for successful treasury funding.
  • Integrated vesting and balance transfer logic.
  • +107/-0 
    weights.rs
    Added weights for treasury funding pallet.                             

    pallets/treasury-funding/src/weights.rs

  • Added autogenerated weights for the fund_treasury function.
  • Included weight calculation logic for storage reads and writes.
  • +67/-0   
    lib.rs
    Integrated treasury funding pallet into runtime.                 

    runtime/laos/src/lib.rs

    • Registered pallet_treasury_funding in the runtime.
    +1/-0     
    pallet_treasury_funding.rs
    Added weights for treasury funding runtime integration.   

    runtime/laos/src/weights/pallet_treasury_funding.rs

    • Added autogenerated weights for pallet_treasury_funding.
    +51/-0   
    Dependencies
    2 files
    Cargo.toml
    Updated dependencies to include treasury funding pallet. 

    Cargo.toml

    • Added pallet-treasury-funding as a dependency.
    +1/-0     
    Cargo.toml
    Added Cargo configuration for treasury funding pallet.     

    pallets/treasury-funding/Cargo.toml

  • Created a new Cargo.toml for pallet-treasury-funding.
  • Defined dependencies and features for the pallet.
  • +58/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @asiniscalchi
    Copy link
    Member Author

    /describe

    @github-actions github-actions bot changed the title Feature/pallet treasury funding Introduced treasury-funding pallet for fund management and runtime integration. Dec 10, 2024
    Copy link

    PR Description updated to latest commit (18f7a83)

    @asiniscalchi
    Copy link
    Member Author

    /describe

    @github-actions github-actions bot changed the title Introduced treasury-funding pallet for fund management and runtime integration. Introduced treasury-funding pallet for treasury management and runtime integration. Dec 11, 2024
    Copy link

    PR Description updated to latest commit (a3c23ab)

    @asiniscalchi
    Copy link
    Member Author

    /describe

    @asiniscalchi
    Copy link
    Member Author

    /describe

    @asiniscalchi asiniscalchi marked this pull request as ready for review December 12, 2024 22:31
    @github-actions github-actions bot changed the title Introduced treasury-funding pallet and integrated it into the runtime. Introduced Treasury Funding Pallet with Runtime Integration and Tests Dec 12, 2024
    Copy link

    PR Description updated to latest commit (c6657a4)

    @asiniscalchi asiniscalchi linked an issue Dec 13, 2024 that may be closed by this pull request
    pallets/treasury-funding/src/lib.rs Outdated Show resolved Hide resolved
    pallets/treasury-funding/src/lib.rs Show resolved Hide resolved
    pallets/treasury-funding/src/benchmarking.rs Outdated Show resolved Hide resolved
    pallets/treasury-funding/src/mock.rs Show resolved Hide resolved
    pallets/treasury-funding/src/tests.rs Show resolved Hide resolved
    pallets/treasury-funding/src/tests.rs Outdated Show resolved Hide resolved
    pallets/treasury-funding/src/tests.rs Outdated Show resolved Hide resolved
    runtime/laos/src/configs/treasury_funding.rs Outdated Show resolved Hide resolved
    runtime/laos/Cargo.toml Show resolved Hide resolved
    asiniscalchi and others added 9 commits December 13, 2024 11:57
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    pallets/treasury-funding/src/lib.rs Outdated Show resolved Hide resolved
    asiniscalchi and others added 2 commits December 13, 2024 12:25
    Co-authored-by: Tomás Senovilla Polo  <117524919+tsenovilla@users.noreply.github.com>
    @asiniscalchi asiniscalchi merged commit bbad2ed into main Dec 13, 2024
    10 checks passed
    @asiniscalchi asiniscalchi deleted the feature/pallet_treasury_funding branch December 13, 2024 11:44
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Treasury can be used with vesting
    3 participants