Skip to content

Commit

Permalink
🔥 Not all tests will pass, but lfg
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
  • Loading branch information
pcaversaccio committed Feb 19, 2024
1 parent 73b1829 commit 8fb7ebc
Show file tree
Hide file tree
Showing 32 changed files with 118 additions and 118 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ jobs:
architecture: ${{ matrix.architecture }}

- name: Install Vyper
run: pip 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: Setup Ape
uses: ApeWorX/github-action@v2
with:
python-version: ${{ matrix.python_version }}
# - name: Setup Ape
# uses: ApeWorX/github-action@v2
# with:
# python-version: ${{ matrix.python_version }}

- name: Check Ape compilation
run: ape compile
# - name: Check Ape compilation
# run: ape compile

- name: Install pnpm
uses: pnpm/action-setup@v3
Expand Down
6 changes: 3 additions & 3 deletions src/snekmate/auth/AccessControl.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title Multi-Role-Based Access Control Functions
@custom:contract-name AccessControl
Expand Down Expand Up @@ -51,7 +51,7 @@

# @dev We import and implement the `ERC165` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC165
from ethereum.ercs import ERC165
implements: ERC165


Expand Down Expand Up @@ -136,7 +136,7 @@ event RoleRevoked:
sender: indexed(address)


@external
@deploy
@payable
def __init__():
"""
Expand Down
4 changes: 2 additions & 2 deletions src/snekmate/auth/Ownable.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title Owner-Based Access Control Functions
@custom:contract-name Ownable
Expand Down Expand Up @@ -30,7 +30,7 @@ event OwnershipTransferred:
new_owner: indexed(address)


@external
@deploy
@payable
def __init__():
"""
Expand Down
4 changes: 2 additions & 2 deletions src/snekmate/auth/Ownable2Step.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title 2-Step Ownership Transfer Functions
@custom:contract-name Ownable2Step
Expand Down Expand Up @@ -40,7 +40,7 @@ event OwnershipTransferred:
new_owner: indexed(address)


@external
@deploy
@payable
def __init__():
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def hasRole(role: bytes32, account: address) -> bool:
@return bool The verification whether the role
`role` has been granted to `account` or not.
"""
return empty(bool)
return ...


@external
Expand All @@ -75,7 +75,7 @@ def getRoleAdmin(role: bytes32) -> bytes32:
@return bytes32 The 32-byte admin role
that controls `role`.
"""
return empty(bytes32)
return ...


@external
Expand All @@ -89,7 +89,7 @@ def grantRole(role: bytes32, account: address):
@param role The 32-byte role definition.
@param account The 20-byte address of the account.
"""
pass
...


@external
Expand All @@ -102,7 +102,7 @@ def revokeRole(role: bytes32, account: address):
@param role The 32-byte role definition.
@param account The 20-byte address of the account.
"""
pass
...


@external
Expand All @@ -120,4 +120,4 @@ def renounceRole(role: bytes32, account: address):
@param role The 32-byte role definition.
@param account The 20-byte address of the account.
"""
pass
...
6 changes: 3 additions & 3 deletions src/snekmate/extensions/ERC2981.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title ERC-721 and ERC-1155 Compatible ERC-2981 Reference Implementation
@custom:contract-name ERC2981
Expand Down Expand Up @@ -43,7 +43,7 @@

# @dev We import and implement the `ERC165` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC165
from ethereum.ercs import ERC165
implements: ERC165


Expand Down Expand Up @@ -103,7 +103,7 @@ event OwnershipTransferred:
new_owner: indexed(address)


@external
@deploy
@payable
def __init__():
"""
Expand Down
10 changes: 5 additions & 5 deletions src/snekmate/extensions/ERC4626.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title Modern and Gas-Efficient ERC-4626 Tokenised Vault Implementation
@custom:contract-name ERC4626
Expand Down Expand Up @@ -52,13 +52,13 @@

# @dev We import and implement the `ERC20` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC20
from ethereum.ercs import ERC20
implements: ERC20


# @dev We import and implement the `ERC20Detailed` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC20Detailed
from ethereum.ercs import ERC20Detailed
implements: ERC20Detailed


Expand All @@ -71,7 +71,7 @@ implements: IERC20Permit

# @dev We import and implement the `ERC4626` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC4626
from ethereum.ercs import ERC4626
implements: ERC4626


Expand Down Expand Up @@ -228,7 +228,7 @@ event EIP712DomainChanged:
pass


@external
@deploy
@payable
def __init__(name_: String[25], symbol_: String[5], asset_: ERC20, decimals_offset_: uint8, name_eip712_: String[50], version_eip712_: String[20]):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def supportsInterface(interfaceId: bytes4) -> bool:
@return bool The verification whether the contract
implements the interface or not.
"""
return empty(bool)
return ...


@external
Expand All @@ -55,4 +55,4 @@ def royaltyInfo(_tokenId: uint256, _salePrice: uint256) -> (address, uint256):
@return uint256 The 32-byte royalty payment amount for
`_salePrice`.
"""
return (empty(address), empty(uint256))
return ...
16 changes: 8 additions & 8 deletions src/snekmate/governance/TimelockController.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title Multi-Role-Based Timelock Controller Reference Implementation
@custom:contract-name TimelockController
Expand Down Expand Up @@ -42,7 +42,7 @@

# @dev We import and implement the `ERC165` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC165
from ethereum.ercs import ERC165
implements: ERC165


Expand Down Expand Up @@ -134,7 +134,7 @@ _DYNARRAY_BOUND: constant(uint8) = max_value(uint8)
# index value is `1`). For further insights also, see
# the following Twitter thread:
# https://twitter.com/pcaversaccio/status/1626514029094047747.
enum OperationState:
flag OperationState:
UNSET
WAITING
READY
Expand Down Expand Up @@ -239,7 +239,7 @@ event RoleRevoked:
sender: indexed(address)


@external
@deploy
@payable
def __init__(minimum_delay_: uint256, proposers_: DynArray[address, _DYNARRAY_BOUND], executors_: DynArray[address, _DYNARRAY_BOUND], admin_: address):
"""
Expand Down Expand Up @@ -278,12 +278,12 @@ def __init__(minimum_delay_: uint256, proposers_: DynArray[address, _DYNARRAY_BO
self._grant_role(DEFAULT_ADMIN_ROLE, admin_)

# Register the proposers and cancellers.
for proposer in proposers_:
for proposer: address in proposers_:
self._grant_role(PROPOSER_ROLE, proposer)
self._grant_role(CANCELLER_ROLE, proposer)

# Register the executors.
for executor in executors_:
for executor: address in executors_:
self._grant_role(EXECUTOR_ROLE, executor)

# Set the minimum delay.
Expand Down Expand Up @@ -468,7 +468,7 @@ def schedule_batch(targets: DynArray[address, _DYNARRAY_BOUND], amounts: DynArra

self._schedule(id, delay)
idx: uint256 = empty(uint256)
for target in targets:
for target: address in targets:
log CallScheduled(id, idx, target, amounts[idx], payloads[idx], predecessor, delay)
# The following line cannot overflow because we have
# limited the dynamic array `targets` by the `constant`
Expand Down Expand Up @@ -547,7 +547,7 @@ def execute_batch(targets: DynArray[address, _DYNARRAY_BOUND], amounts: DynArray

self._before_call(id, predecessor)
idx: uint256 = empty(uint256)
for target in targets:
for target: address in targets:
self._execute(target, amounts[idx], payloads[idx])
log CallExecuted(id, idx, target, amounts[idx], payloads[idx])
# The following line cannot overflow because we have
Expand Down
18 changes: 9 additions & 9 deletions src/snekmate/tokens/ERC1155.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title Modern and Gas-Efficient ERC-1155 Implementation
@custom:contract-name ERC1155
Expand Down Expand Up @@ -34,7 +34,7 @@

# @dev We import and implement the `ERC165` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC165
from ethereum.ercs import ERC165
implements: ERC165


Expand Down Expand Up @@ -165,7 +165,7 @@ event RoleMinterChanged:
status: bool


@external
@deploy
@payable
def __init__(base_uri_: String[80]):
"""
Expand Down Expand Up @@ -291,7 +291,7 @@ def balanceOfBatch(owners: DynArray[address, _BATCH_SIZE], ids: DynArray[uint256
assert len(owners) == len(ids), "ERC1155: owners and ids length mismatch"
batch_balances: DynArray[uint256, _BATCH_SIZE] = []
idx: uint256 = empty(uint256)
for owner in owners:
for owner: address in owners:
batch_balances.append(self._balance_of(owner, ids[idx]))
# The following line cannot overflow because we have
# limited the dynamic array `owners` by the `constant`
Expand Down Expand Up @@ -602,7 +602,7 @@ def _safe_batch_transfer_from(owner: address, to: address, ids: DynArray[uint256
self._before_token_transfer(owner, to, ids, amounts, data)

idx: uint256 = empty(uint256)
for id in ids:
for id: uint256 in ids:
amount: uint256 = amounts[idx]
owner_balance: uint256 = self._balances[id][owner]
assert owner_balance >= amount, "ERC1155: insufficient balance for transfer"
Expand Down Expand Up @@ -712,7 +712,7 @@ def _safe_mint_batch(owner: address, ids: DynArray[uint256, _BATCH_SIZE], amount
self._before_token_transfer(empty(address), owner, ids, amounts, data)

idx: uint256 = empty(uint256)
for id in ids:
for id: uint256 in ids:
# In the next line, an overflow is not possible
# due to an arithmetic check of the entire token
# supply in the function `_before_token_transfer`.
Expand Down Expand Up @@ -833,7 +833,7 @@ def _burn_batch(owner: address, ids: DynArray[uint256, _BATCH_SIZE], amounts: Dy
self._before_token_transfer(owner, empty(address), ids, amounts, b"")

idx: uint256 = empty(uint256)
for id in ids:
for id: uint256 in ids:
amount: uint256 = amounts[idx]
owner_balance: uint256 = self._balances[id][owner]
assert owner_balance >= amount, "ERC1155: burn amount exceeds balance"
Expand Down Expand Up @@ -941,7 +941,7 @@ def _before_token_transfer(owner: address, to: address, ids: DynArray[uint256, _
"""
if (owner == empty(address)):
idx: uint256 = empty(uint256)
for id in ids:
for id: uint256 in ids:
# The following line uses intentionally checked arithmetic
# to ensure that the total supply for each token type `id`
# never overflows.
Expand All @@ -954,7 +954,7 @@ def _before_token_transfer(owner: address, to: address, ids: DynArray[uint256, _

if (to == empty(address)):
idx: uint256 = empty(uint256)
for id in ids:
for id: uint256 in ids:
amount: uint256 = amounts[idx]
supply: uint256 = self.total_supply[id]
assert supply >= amount, "ERC1155: burn amount exceeds total_supply"
Expand Down
8 changes: 4 additions & 4 deletions src/snekmate/tokens/ERC20.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pragma version ^0.3.10
# pragma version ^0.3.11
"""
@title Modern and Gas-Efficient ERC-20 + EIP-2612 Implementation
@custom:contract-name ERC20
Expand Down Expand Up @@ -53,13 +53,13 @@

# @dev We import and implement the `ERC20` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC20
from ethereum.ercs import ERC20
implements: ERC20


# @dev We import and implement the `ERC20Detailed` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC20Detailed
from ethereum.ercs import ERC20Detailed
implements: ERC20Detailed


Expand Down Expand Up @@ -203,7 +203,7 @@ event RoleMinterChanged:
status: bool


@external
@deploy
@payable
def __init__(name_: String[25], symbol_: String[5], initial_supply_: uint256, name_eip712_: String[50], version_eip712_: String[20]):
"""
Expand Down
Loading

0 comments on commit 8fb7ebc

Please sign in to comment.