Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Governor, TimelockController, and similar, should be ERC721Holder #3174

Closed
frangio opened this issue Feb 8, 2022 · 8 comments · Fixed by #3230
Closed

Governor, TimelockController, and similar, should be ERC721Holder #3174

frangio opened this issue Feb 8, 2022 · 8 comments · Fixed by #3230

Comments

@frangio
Copy link
Contributor

frangio commented Feb 8, 2022

Contracts that can send arbitrary transactions through some protocol, like Governor and TimelockController, should contain the required hook to receive ERC721 tokens via safeTransfer (which we implement in ERC721Holder).

I think there is a similar hook for ERC1155.

@Amxx
Copy link
Collaborator

Amxx commented Feb 9, 2022

I 100% agree this should be a thing. These contracts should be ERC721Holder and ERC1155Holder

There is an issue however: ERC721HolderUpgradeable contains a gap. If we add ERC721Holder to Governor, the transpilled version will not be storage compatible. This is a mess that won't be fixed until we radically transition to "diamond storage"

@frangio
Copy link
Contributor Author

frangio commented Feb 9, 2022

Good point. We will have to include the logic without using ERC721Holder.

@frangio frangio mentioned this issue Feb 9, 2022
1 task
@ashwinYardi
Copy link
Contributor

Hey guys! @frangio @Amxx Just to confirm, this basically means that , Governor and timelock contracts should have onERC1155Received and onERC721Received hooks, correct?

@Amxx
Copy link
Collaborator

Amxx commented Mar 1, 2022

@ashwinYardi Yes, and also onERC1155BatchReceived

@ashwinYardi
Copy link
Contributor

ashwinYardi commented Mar 1, 2022

Cool. Also I think metatx/MinimalForwarder.sol also needs these hooks. What say? @Amxx @frangio

ashwinYardi added a commit to ashwinYardi/openzeppelin-contracts that referenced this issue Mar 1, 2022
ashwinYardi added a commit to ashwinYardi/openzeppelin-contracts that referenced this issue Mar 1, 2022
@Amxx
Copy link
Collaborator

Amxx commented Mar 1, 2022

No, the MinimalForwarder is completely unrelated. It's only supposed to forward call, not ever receive any assets. If it did receive assets, anyone could likely claim them (unless they are forwarder aware, but that is unlikely).

We should NOT put these functions in the MinimalForwarder, as it might prevent someone from inadvertently sending assets to it.

@ashwinYardi
Copy link
Contributor

Ahh, all right! Will revert the changes I did in MinimalForwarder 😅

@ashwinYardi
Copy link
Contributor

#3230 This is ready. @frangio @Amxx

Amxx added a commit that referenced this issue Mar 24, 2022
* add ERC721 and ERC1155 receiver support in Governor, Timelock and MinimalForwarder (#3174)

* revert the nft receiver hooks from MinimalForwarder and linting updates

* add ERC165 support & simplify test

* add changelog entry

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants