Skip to content

Commit

Permalink
♻️ Make ERC4626 Module-Friendly (#236)
Browse files Browse the repository at this point in the history
### 🕓 Changelog

This PR refactors the `ERC4626` contract to make it module-friendly and
ready for the breaking `0.4.0` release. Please note that due to an open
issue (see vyperlang/vyper#3954) on how to
handle public getters of interface types in conjunction with
`implements`, we fix this issue by storing the interface object as an
`immutable` variable called `_ASSET` and assigning `asset` a `public`
`immutable` `address` type, which gets assigned at contract creation
time via the `.address` member of `_ASSET`:

```vy
asset: public(immutable(address))
_ASSET: immutable(IERC20)

@Deploy
@payable
def __init__(..., asset_: IERC20, ...):
    _ASSET = asset_
    asset = _ASSET.address

    ....
```

---------

Signed-off-by: Pascal Marco Caversaccio <[email protected]>
  • Loading branch information
pcaversaccio authored May 8, 2024
1 parent a08f934 commit a32ee24
Show file tree
Hide file tree
Showing 7 changed files with 435 additions and 785 deletions.
504 changes: 252 additions & 252 deletions .gas-snapshot

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [`AccessControl`](https://github.com/pcaversaccio/snekmate/blob/v0.1.0/src/snekmate/auth/AccessControl.vy): Make `AccessControl` module-friendly. ([#216](https://github.com/pcaversaccio/snekmate/pull/216))
- **Extensions**
- [`ERC2981`](https://github.com/pcaversaccio/snekmate/blob/v0.1.0/src/snekmate/extensions/ERC2981.vy): Make `ERC2981` module-friendly. ([#233](https://github.com/pcaversaccio/snekmate/pull/233))
- [`ERC4626`](https://github.com/pcaversaccio/snekmate/blob/v0.1.0/src/snekmate/extensions/ERC4626.vy): Make `ERC4626` module-friendly. ([#236](https://github.com/pcaversaccio/snekmate/pull/236))
- **Governance**
- [`TimelockController`](https://github.com/pcaversaccio/snekmate/blob/v0.1.0/src/snekmate/governance/TimelockController.vy): Make `TimelockController` module-friendly. ([#220](https://github.com/pcaversaccio/snekmate/pull/220))
- **Tokens**
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ src
│ ├── interfaces
│ │ └── IERC2981 — "EIP-2981 Interface Definition"
│ └── mocks
│ └── ERC2981Mock — "ERC2981 Module Reference Implementation"
│ ├── ERC2981Mock — "ERC2981 Module Reference Implementation"
│ └── ERC4626Mock — "ERC4626 Module Reference Implementation"
├── governance
│ ├── TimelockController — "Multi-Role-Based Timelock Controller Reference Implementation"
│ └── mocks
Expand Down
Loading

0 comments on commit a32ee24

Please sign in to comment.