hats-finance / hats-contracts

MIT License
37 stars 47 forks source link

Add token wrapper #526

Open ben-kaufman opened 1 year ago

ben-kaufman commented 1 year ago

Add token wrapper of ERC4626 for rebasing tokens to use the Hats vaults

Update OZ to 4.9.3

Summary by CodeRabbit

New Features:

Refactor:

Documentation:

๐ŸŽ‰ Code refined, features aligned, ๐Ÿš€ With each line, our vision defined. ๐ŸŒŸ Rebasing tokens now find a home, ๐Ÿ  In Hats vaults, they freely roam. ๐ŸŽฉ Short strings packed in a single word, ๐Ÿงต Efficiency leaps like a bird. ๐Ÿฆ… Celebrate this code's new lease, ๐Ÿฅณ As we release... the Golden Fleece! ๐Ÿ‘๐ŸŒŸ

github-actions[bot] commented 1 year ago

Image description CodeRabbit

Walkthrough

This update introduces a token wrapper contract HATTokenWrapper for rebasing tokens, updates OpenZeppelin to version 4.9.3, modifies several functions, and adds new events and errors. It also includes changes to the comments in various contracts and documentation files. The diffs enhance string handling and optimization with a new library "ShortStrings" and introduce changes related to EIP 712.

Changes

Files Summary
contracts/HATTokenWrapper.sol, contracts/HATVault.sol, contracts/interfaces/IHATToken.sol, test/hattokenwrapper.js Added a token wrapper contract HATTokenWrapper that extends ERC4626. The contract sets a constant MINIMAL_AMOUNT_OF_SHARES and overrides the _afterTokenTransfer function. Also, removed the import statement for draft-IERC20Permit.sol and updated the IHATToken interface.
docs/dodoc/HATToken.md, docs/dodoc/interfaces/IHATToken.md, docs/dodoc/elin/contracts/interfaces/IERC5267.md, docs/dodoc/elin/contracts/interfaces/IERC5805.md, docs/dodoc/elin/contracts/interfaces/IERC6372.md Updated several documents to reflect changes in the codebase, including modifications to existing functions, addition of new functions, and introduction of new events and errors.
docs/dodoc/HATGovernanceArbitrator.md, docs/dodoc/HATHackersNFT.md, docs/dodoc/HATVaultsRegistry.md, docs/dodoc/RewardController.md, docs/dodoc/elin/contracts-upgradeable/access/OwnableUpgradeable.md, docs/dodoc/elin/contracts/access/Ownable.md, docs/dodoc/elin/contracts-upgradeable/proxy/utils/Initializable.md, docs/dodoc/elin/contracts/access/AccessControl.md Modified comments in several contracts and documentation files to provide additional information or clarify existing content.
docs/dodoc/HATTimelockController.md, docs/dodoc/HATVault.md, docs/dodoc/elin/contracts/governance/TimelockController.md, docs/dodoc/elin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.md, docs/dodoc/elin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.md, docs/dodoc/elin/contracts/token/ERC20/ERC20.md, docs/dodoc/elin/contracts/token/ERC20/extensions/ERC20Capped.md, docs/dodoc/elin/contracts/token/ERC20/extensions/ERC20Permit.md, docs/dodoc/mocks/ERC20Mock.md, docs/dodoc/mocks/ERC20MockNFT.md, docs/dodoc/mocks/HATTokenMock.md, docs/dodoc/mocks/HATVaultV2Mock.md Changed the return types of several exported functions to remove explicit variable names. Updated comments and documentation in several files.
docs/dodoc/elin/contracts/utils/ShortStrings.md, docs/dodoc/elin/contracts/utils/cryptography/EIP712.md Added a new library "ShortStrings" for optimized handling of short strings. Introduced changes related to EIP 712, including a new method eip712Domain and new events and errors.