val
May 21, 2025, 8:32pm
1
App Description
App description doesn’t apply.
Team Background
BURNT IS A WEB3 FOUNDRY.
It is our mission to advance society’s financial and creative freedom, by any means necessary.
We work with blockchain technology and Web3 as tools central to achieving this vision.
Burnt integrates & partners with likeminded entities to build the infrastructure, products and tools needed to remove the cultural and functional barriers that hinder crypto from resonating with society at large.
Contract Source Code
main
← fix/contract-upgrade
opened 08:36PM - 09 Apr 25 UTC
This pull request introduces a migration mechanism for the treasury contract, en… hances parameter validation, and updates the contract's state and messaging structure to support these changes. These updates improve the contract's flexibility, maintainability, and robustness.
### Migration Mechanism
* Added a `Migrate` variant to `ExecuteMsg` and a new `MigrateMsg` struct to enable contract migration. (`contracts/treasury/src/msg.rs`, [[1]](diffhunk://#diff-572261434468dc227e1125bf22329142684d8a502594bfe8434d315a09338825R45-R48) [[2]](diffhunk://#diff-572261434468dc227e1125bf22329142684d8a502594bfe8434d315a09338825R73-R75)
* Implemented a `migrate` entry point and an `execute::migrate` function to handle migration logic, allowing the contract to upgrade to a new code ID. (`contracts/treasury/src/contract.rs`, [[1]](diffhunk://#diff-47f81b268390b3b3923ac30751a03b8c1792e31054e80e6a5f96a3885f3406a7R84-R89); `contracts/treasury/src/execute.rs`, [[2]](diffhunk://#diff-e2c1e51ef034044ab1604f08d5bbe228659575e9879b75a1df10f47e35b9e191R120-R149)
### Parameter Enhancements
* Updated the `Params` struct to include `metadata` and changed `redirect_url` to `redirect_urls` (a list of URLs). (`contracts/treasury/src/state.rs`, [contracts/treasury/src/state.rsL18-R20](diffhunk://#diff-e4cf9a6e33262ae8c7753ba7031966e50cbe8524e5e58f38145c54ee2d8200e1L18-R20))
* Added `validate_params` function to ensure all URLs in `Params` are valid and `metadata` is valid JSON. (`contracts/treasury/src/execute.rs`, [contracts/treasury/src/execute.rsR215-R233](diffhunk://#diff-e2c1e51ef034044ab1604f08d5bbe228659575e9879b75a1df10f47e35b9e191R215-R233))
### Messaging and Initialization Updates
* Modified `InstantiateMsg` to include `params` and updated the `init` function to save and validate these parameters during instantiation. (`contracts/treasury/src/msg.rs`, [[1]](diffhunk://#diff-572261434468dc227e1125bf22329142684d8a502594bfe8434d315a09338825R12); `contracts/treasury/src/execute.rs`, [[2]](diffhunk://#diff-e2c1e51ef034044ab1604f08d5bbe228659575e9879b75a1df10f47e35b9e191R28) [[3]](diffhunk://#diff-e2c1e51ef034044ab1604f08d5bbe228659575e9879b75a1df10f47e35b9e191R46-R48)
* Updated `ExecuteMsg` and `instantiate` function to support the new `params` field. (`contracts/treasury/src/msg.rs`, [[1]](diffhunk://#diff-572261434468dc227e1125bf22329142684d8a502594bfe8434d315a09338825R45-R48); `contracts/treasury/src/contract.rs`, [[2]](diffhunk://#diff-47f81b268390b3b3923ac30751a03b8c1792e31054e80e6a5f96a3885f3406a7R30)
### Error Handling Improvements
* Added a `JsonError` variant to `ContractError` to handle JSON parsing errors during parameter validation. (`contracts/treasury/src/error.rs`, [contracts/treasury/src/error.rsR38-R40](diffhunk://#diff-dfba96d17994e17969e11a35c6e0ec6b790af82ee7f77aa06813007688db793fR38-R40))
These changes collectively enhance the treasury contract's capabilities while ensuring backward compatibility and robust error handling.
Contract(s) Description(s)
The treasury contract is responsible for storing DAPP fee and authz grants required from their users.
Audit
An additional audit for these changes was not necessary
testnet code_id
1142