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

♻️ Implement Dunder __interface__ Method and Remove userdoc and devdoc Sanity Check #235

Merged
merged 7 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/snekmate/auth/AccessControl.vy
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@
from snekmate.auth import AccessControl as access_control
initializes: access_control

exports: (
access_control.DEFAULT_ADMIN_ROLE,
access_control.supportsInterface,
access_control.hasRole,
access_control.getRoleAdmin,
access_control.grantRole,
access_control.revokeRole,
access_control.renounceRole,
access_control.set_role_admin,
)
exports: access_control.__interface__

...

Expand Down
11 changes: 1 addition & 10 deletions src/snekmate/auth/mocks/AccessControlMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@ initializes: ac
# required by the contract logic) `public` declared `constant`,
# `immutable`, and state variables, for which Vyper automatically
# generates an `external` getter function for the variable.
exports: (
ac.DEFAULT_ADMIN_ROLE,
ac.supportsInterface,
ac.hasRole,
ac.getRoleAdmin,
ac.grantRole,
ac.revokeRole,
ac.renounceRole,
ac.set_role_admin,
)
exports: ac.__interface__


# @dev The 32-byte minter role.
Expand Down
8 changes: 1 addition & 7 deletions src/snekmate/auth/mocks/Ownable2StepMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ initializes: o2[ownable := ow]
# required by the contract logic) `public` declared `constant`,
# `immutable`, and state variables, for which Vyper automatically
# generates an `external` getter function for the variable.
exports: (
o2.owner,
o2.pending_owner,
o2.transfer_ownership,
o2.accept_ownership,
o2.renounce_ownership,
)
exports: o2.__interface__


@deploy
Expand Down
6 changes: 1 addition & 5 deletions src/snekmate/auth/mocks/OwnableMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ initializes: ow
# required by the contract logic) `public` declared `constant`,
# `immutable`, and state variables, for which Vyper automatically
# generates an `external` getter function for the variable.
exports: (
ow.owner,
ow.transfer_ownership,
ow.renounce_ownership,
)
exports: ow.__interface__


@deploy
Expand Down
26 changes: 11 additions & 15 deletions src/snekmate/extensions/ERC2981.vy
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,17 @@ uses: ownable
# required by the contract logic) `public` declared `constant`,
# `immutable`, and state variables, for which Vyper automatically
# generates an `external` getter function for the variable.
exports: (
ownable.owner,
# @notice If you integrate the function `transfer_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role is also removed and the minter role is assigned to the
# `new_owner` accordingly.
ownable.transfer_ownership,
# @notice If you integrate the function `renounce_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role as well as all non-owner minter addresses are also
# removed before calling `renounce_ownership`.
ownable.renounce_ownership,
)
# @notice If you integrate the function `transfer_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role is also removed and the minter role is assigned to the
# `new_owner` accordingly.
# @notice If you integrate the function `renounce_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role as well as all non-owner minter addresses are also
# removed before calling `renounce_ownership`.
exports: ownable.__interface__


# @dev Stores the ERC-165 interface identifier for each
Expand Down
58 changes: 24 additions & 34 deletions src/snekmate/extensions/mocks/ERC2981Mock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,30 @@ initializes: erc2981[ownable := ow]
# required by the contract logic) `public` declared `constant`,
# `immutable`, and state variables, for which Vyper automatically
# generates an `external` getter function for the variable.
exports: (
# @notice If you are integrating this contract with an
# ERC-721 or ERC-1155 contract, please ensure you include
# the additional ERC-165 interface identifiers into the
# function `supportsInterface`. One way to achieve this
# would be to not export the `supportsInterface` function
# from {ERC2981} in the main contract and implement the
# following function in the main contract instead:
# ```vy
# @external
# @view
# def supportsInterface(interface_id: bytes4) -> bool:
# return (interface_id in erc2981._SUPPORTED_INTERFACES) or (interface_id in [0x..., ...])
# ```
erc2981.supportsInterface,
erc2981.owner,
# @notice If you integrate the function `transfer_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role is also removed and the minter role is assigned to the
# `new_owner` accordingly.
erc2981.transfer_ownership,
# @notice If you integrate the function `renounce_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role as well as all non-owner minter addresses are also
# removed before calling `renounce_ownership`.
erc2981.renounce_ownership,
erc2981.royaltyInfo,
erc2981.set_default_royalty,
erc2981.delete_default_royalty,
erc2981.set_token_royalty,
erc2981.reset_token_royalty,
)
# @notice If you are integrating this contract with an
# ERC-721 or ERC-1155 contract, please ensure you include
# the additional ERC-165 interface identifiers into the
# function `supportsInterface`. One way to achieve this
# would be to not export the `supportsInterface` function
# from {ERC2981} in the main contract and implement the
# following function in the main contract instead:
# ```vy
# @external
# @view
# def supportsInterface(interface_id: bytes4) -> bool:
# return (interface_id in erc2981._SUPPORTED_INTERFACES) or (interface_id in [0x..., ...])
# ```
# @notice If you integrate the function `transfer_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role is also removed and the minter role is assigned to the
# `new_owner` accordingly.
# @notice If you integrate the function `renounce_ownership`
# into an ERC-721 or ERC-1155 contract that implements an
# `is_minter` role, ensure that the previous owner's minter
# role as well as all non-owner minter addresses are also
# removed before calling `renounce_ownership`.
exports: erc2981.__interface__


@deploy
Expand Down
10 changes: 1 addition & 9 deletions src/snekmate/governance/TimelockController.vy
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,7 @@ uses: access_control
# required by the contract logic) `public` declared `constant`,
# `immutable`, and state variables, for which Vyper automatically
# generates an `external` getter function for the variable.
exports: (
access_control.DEFAULT_ADMIN_ROLE,
access_control.hasRole,
access_control.getRoleAdmin,
access_control.grantRole,
access_control.revokeRole,
access_control.renounceRole,
access_control.set_role_admin,
)
exports: access_control.__interface__
pcaversaccio marked this conversation as resolved.
Show resolved Hide resolved


# @dev The 32-byte proposer role.
Expand Down
36 changes: 1 addition & 35 deletions src/snekmate/governance/mocks/TimelockControllerMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,7 @@ initializes: tc[access_control := ac]
# required by the contract logic) `public` declared `constant`,
# `immutable`, and state variables, for which Vyper automatically
# generates an `external` getter function for the variable.
exports: (
tc.DEFAULT_ADMIN_ROLE,
tc.PROPOSER_ROLE,
tc.EXECUTOR_ROLE,
tc.CANCELLER_ROLE,
tc.IERC721_TOKENRECEIVER_SELECTOR,
tc.IERC1155_TOKENRECEIVER_SINGLE_SELECTOR,
tc.IERC1155_TOKENRECEIVER_BATCH_SELECTOR,
tc.__default__,
tc.supportsInterface,
tc.onERC721Received,
tc.onERC1155Received,
tc.onERC1155BatchReceived,
tc.hasRole,
tc.getRoleAdmin,
tc.grantRole,
tc.revokeRole,
tc.renounceRole,
tc.set_role_admin,
tc.get_timestamp,
tc.get_minimum_delay,
tc.is_operation,
tc.is_operation_pending,
tc.is_operation_ready,
tc.is_operation_done,
tc.get_operation_state,
tc.hash_operation,
tc.hash_operation_batch,
tc.schedule,
tc.schedule_batch,
tc.cancel,
tc.execute,
tc.execute_batch,
tc.update_delay,
)
exports: tc.__interface__


@deploy
Expand Down
Loading