hats-finance / hats-contracts

MIT License
37 stars 47 forks source link

Separate vault and claims manager #502

Closed ben-kaufman closed 1 year ago

ben-kaufman commented 1 year ago

Summary by CodeRabbit

github-actions[bot] commented 1 year ago

Image description CodeRabbit

Walkthrough

This update separates the vault and claims manager functionality in the HATFinance contracts, introducing more flexibility. It also adds a new contract, HATKlerosV2Connector, to bridge HatsFinance and Kleros court V2, enabling dispute management and arbitration cost calculation.

Changes

File(s) Summary
contracts/HATGovernanceArbitrator.sol, contracts/HATTimelockController.sol, contracts/HATVaultsRegistry.sol The diff modifies these contracts to separate the vault and claims manager functionalities. It changes the _vault parameter type in approveClaim and dismissClaim functions from HATVault to IHATClaimsManager. A new variable hatClaimsManagerImplementation is added to HATVaultsRegistry contract, and its constructor and setVaultImplementations function are updated accordingly.
contracts/HATKlerosV2Connector.sol This new contract acts as a connector between HatsFinance and Kleros court V2. It includes functions for challenging claims, notifying the arbitrator, giving a ruling for a dispute, and getting the arbitration cost. It stores disputes, tracks challenged claims, and maps external dispute IDs to local dispute IDs.

🐰 "In the land of code, where logic intertwines,

Changes come forth, like sun that brightly shines.

Separation of concerns, a principle we adore,

Now vaults and claims, are together no more.

And a new bridge is built, with Kleros it aligns,

For disputes and costs, it cleverly defines.

So let's hop and cheer, for this update so fine,

In the world of contracts, it's a golden sign!" 🎉


Uplevel your code reviews with CodeRabbit Pro ### CodeRabbit Pro If you like this project, please support us by purchasing the [Pro version](https://coderabbit.ai). The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.
openzeppelin-code[bot] commented 1 year ago

Separate vault and claims manager

Generated at commit: d79402b1a7157ab616f7d7a0f20c1a511b51303d

🚨 Vulnerabilities Summary

Process Issues Results
Contract Inspector note
low
critical
Total
21
9
1
31
Dependency Checker Total 0

For more details view the full report in OpenZeppelin Code

jellegerbrandy commented 1 year ago

Closing this PR as it is messed up