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 all 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
290 changes: 145 additions & 145 deletions .gas-snapshot

Large diffs are not rendered by default.

16 changes: 1 addition & 15 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
- ubuntu-latest
architecture:
- x64
python_version:
- 3.11
node_version:
- 20

Expand Down Expand Up @@ -54,18 +52,6 @@ jobs:
- name: Prettier and lint
run: pnpm lint:check

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.architecture }}

- name: Check formatting with Black
uses: psf/black@stable
with:
options: "--check --verbose"
src: "./scripts"

codespell:
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -108,6 +94,6 @@ jobs:
- name: Validate URLs
run: |
awesome_bot ./*.md src/snekmate/**/*.vy src/snekmate/**/mocks/*.vy src/snekmate/**/interfaces/*.vyi \
test/**/*.sol test/**/interfaces/*.sol test/**/mocks/*.sol test/**/scripts/*.js scripts/*.py \
test/**/*.sol test/**/interfaces/*.sol test/**/mocks/*.sol test/**/scripts/*.js \
--allow-dupe --allow-redirect --request-delay 0.4 \
--white-list https://www.wagmi.xyz,https://github.com/pcaversaccio/snekmate.git@,https://github.com/pcaversaccio/snekmate/releases/tag/v0.1.0,https://github.com/pcaversaccio/snekmate/blob/v0.1.0,https://github.com/pcaversaccio/snekmate/compare/v0.0.5...v0.1.0
1 change: 0 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- ubuntu-latest
language:
- javascript-typescript
- python

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- name: Install Vyper
run: pip install git+https://github.com/vyperlang/vyper.git@master

- name: Check userdoc and devdoc compilation
run: python scripts/compile.py
- name: Show the Vyper version
run: vyper --version

# - name: Setup Ape
# uses: ApeWorX/github-action@v2
Expand Down
9 changes: 0 additions & 9 deletions scripts/compile.py

This file was deleted.

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
20 changes: 9 additions & 11 deletions src/snekmate/auth/mocks/AccessControlMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,19 @@ initializes: ac
# @dev We export (i.e. the runtime bytecode exposes these
# functions externally, allowing them to be called using
# the ABI encoding specification) all `external` functions
# from the `AccessControl` module.
# from the `AccessControl` module. The built-in dunder method
# `__interface__` allows you to export all functions of a
# module without specifying the individual functions (see
# https://github.com/vyperlang/vyper/pull/3919). Please take
# note that if you do not know the full interface of a module
# contract, you can get the `.vyi` interface in Vyper by using
# `vyper -f interface yourFileName.vy` or the external interface
# by using `vyper -f external_interface yourFileName.vy`.
# @notice Please note that you must always also export (if
# 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
17 changes: 9 additions & 8 deletions src/snekmate/auth/mocks/Ownable2StepMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ initializes: o2[ownable := ow]
# @dev We export (i.e. the runtime bytecode exposes these
# functions externally, allowing them to be called using
# the ABI encoding specification) all `external` functions
# from the `Ownable2Step` module.
# from the `Ownable2Step` module. The built-in dunder method
# `__interface__` allows you to export all functions of a
# module without specifying the individual functions (see
# https://github.com/vyperlang/vyper/pull/3919). Please take
# note that if you do not know the full interface of a module
# contract, you can get the `.vyi` interface in Vyper by using
# `vyper -f interface yourFileName.vy` or the external interface
# by using `vyper -f external_interface yourFileName.vy`.
# @notice Please note that you must always also export (if
# 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
15 changes: 9 additions & 6 deletions src/snekmate/auth/mocks/OwnableMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ initializes: ow
# @dev We export (i.e. the runtime bytecode exposes these
# functions externally, allowing them to be called using
# the ABI encoding specification) all `external` functions
# from the `Ownable` module.
# from the `Ownable` module. The built-in dunder method
# `__interface__` allows you to export all functions of a
# module without specifying the individual functions (see
# https://github.com/vyperlang/vyper/pull/3919). Please take
# note that if you do not know the full interface of a module
# contract, you can get the `.vyi` interface in Vyper by using
# `vyper -f interface yourFileName.vy` or the external interface
# by using `vyper -f external_interface yourFileName.vy`.
# @notice Please note that you must always also export (if
# 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
45 changes: 9 additions & 36 deletions src/snekmate/governance/mocks/TimelockControllerMock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -47,46 +47,19 @@ initializes: tc[access_control := ac]
# @dev We export (i.e. the runtime bytecode exposes these
# functions externally, allowing them to be called using
# the ABI encoding specification) all `external` functions
# from the `TimelockController` module.
# from the `TimelockController` module. The built-in dunder
# method `__interface__` allows you to export all functions
# of a module without specifying the individual functions (see
# https://github.com/vyperlang/vyper/pull/3919). Please take
# note that if you do not know the full interface of a module
# contract, you can get the `.vyi` interface in Vyper by using
# `vyper -f interface yourFileName.vy` or the external interface
# by using `vyper -f external_interface yourFileName.vy`.
# @notice Please note that you must always also export (if
# 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
33 changes: 9 additions & 24 deletions src/snekmate/tokens/mocks/ERC20Mock.vy
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,19 @@ initializes: erc20[ownable := ow]
# @dev We export (i.e. the runtime bytecode exposes these
# functions externally, allowing them to be called using
# the ABI encoding specification) all `external` functions
# from the `ERC20` module.
# from the `ERC20` module. The built-in dunder method
# `__interface__` allows you to export all functions of a
# module without specifying the individual functions (see
# https://github.com/vyperlang/vyper/pull/3919). Please take
# note that if you do not know the full interface of a module
# contract, you can get the `.vyi` interface in Vyper by using
# `vyper -f interface yourFileName.vy` or the external interface
# by using `vyper -f external_interface yourFileName.vy`.
# @notice Please note that you must always also export (if
# 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: (
erc20.owner,
erc20.transfer_ownership,
erc20.renounce_ownership,
erc20.totalSupply,
erc20.balanceOf,
erc20.transfer,
erc20.allowance,
erc20.approve,
erc20.transferFrom,
erc20.name,
erc20.symbol,
erc20.decimals,
erc20.permit,
erc20.nonces,
erc20.DOMAIN_SEPARATOR,
erc20.eip712Domain,
erc20.burn,
erc20.burn_from,
erc20.is_minter,
erc20.mint,
erc20.set_minter,
)
exports: erc20.__interface__


@deploy
Expand Down