feat: introduce operational treasury and admin role for pools #72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main changes.
The operational treasury has been introduced on the liquidity pool smart contract to simplify managing its borrowable balance through special new functions.
The admin role has been reintroduced to the liquidity pool smart contract. Accounts with that roles can execute the new functions to deposit and withdraw tokens using the operation treasury account configured on the contract.
The new role definition
The new pool balance management functions are
depositFromOperationalTreasury()
andwithdrawToOperationalTreasury()
:The definition of new functions
The token flows for the new pool balance management functions:
depositFromOperationalTreasury()
:operationTreasury
=>liquidityPool
;withdrawToOperationalTreasury()
:liquidityPool
=>operationTreasury
;No additional events have been introduced for the new pool balance management functions. The existing
Deposit
andWithdrawal
events are emitted by the new functions.New functions
setOperationalTreasury()
andoperationalTreasury()
have been introduced to set and get the address of the operational treasury on the liquidity pool smart contract:The definition of new functions
The new
OperationalTreasuryChanged
event has been introduced to the liquidity pool smart contract. The new event is emitted when the operational treasury address is changed:The new event definition
Versioning
The smart contracts version has been updated to
v1.13.0
.Migration Steps
After upgrading the
CapybaraFinance
smart-contracts call theLiquidityPool.initAdminRole()
function without parameters once from an account with the owner role. It will initialize the admin role and grant it to the caller.Test Coverage
The new changes have been fully covered by tests.
Test coverage details