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

deleted unnecessary arguments on ERC1155 #3263

Merged
merged 7 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
Empty file added .build/__local__.json
Empty file.
Empty file added .gitattributes
Empty file.
Empty file added ape-config.yaml
Empty file.
4 changes: 2 additions & 2 deletions examples/tokens/ERC1155ownable.vy
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def balanceOfBatch(accounts: DynArray[address, BATCH_SIZE], ids: DynArray[uint25

## mint ##
@external
def mint(receiver: address, id: uint256, amount:uint256, data:bytes32):
def mint(receiver: address, id: uint256, amount:uint256):
"""
@dev mint one new token with a certain ID
@dev this can be a new token or "topping up" the balance of a non-fungible token ID
Expand All @@ -225,7 +225,7 @@ def mint(receiver: address, id: uint256, amount:uint256, data:bytes32):


@external
def mintBatch(receiver: address, ids: DynArray[uint256, BATCH_SIZE], amounts: DynArray[uint256, BATCH_SIZE], data: bytes32):
def mintBatch(receiver: address, ids: DynArray[uint256, BATCH_SIZE], amounts: DynArray[uint256, BATCH_SIZE]):
"""
@dev mint a batch of new tokens with the passed IDs
@dev this can be new tokens or "topping up" the balance of existing non-fungible token IDs in the contract
Expand Down
28 changes: 14 additions & 14 deletions tests/examples/tokens/test_erc1155.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ def erc1155(get_contract, w3, assert_tx_failed):
code = f.read()
c = get_contract(code, *[CONTRACT_NAME, CONTRACT_SYMBOL, CONTRACT_URI, CONTRACT_METADATA_URI])
assert c.owner() == owner
c.mintBatch(a1, mintBatch, minBatchSetOf10, "", transact={"from": owner})
c.mintBatch(a3, mintBatch2, minBatchSetOf10, "", transact={"from": owner})
c.mintBatch(a1, mintBatch, minBatchSetOf10, transact={"from": owner})
c.mintBatch(a3, mintBatch2, minBatchSetOf10, transact={"from": owner})

assert c.balanceOf(a1, 1) == 1
assert c.balanceOf(a1, 2) == 1
assert c.balanceOf(a1, 3) == 1
assert_tx_failed(
lambda: c.mintBatch(ZERO_ADDRESS, mintBatch, minBatchSetOf10, "", transact={"from": owner})
lambda: c.mintBatch(ZERO_ADDRESS, mintBatch, minBatchSetOf10, transact={"from": owner})
)
assert_tx_failed(lambda: c.mintBatch(a1, [1, 2, 3], [1, 1], "", transact={"from": owner}))
assert_tx_failed(lambda: c.mintBatch(a1, [1, 2, 3], [1, 1], transact={"from": owner}))

c.mint(a1, 21, 1, "", transact={"from": owner})
c.mint(a1, 22, 1, "", transact={"from": owner})
c.mint(a1, 23, 1, "", transact={"from": owner})
c.mint(a1, 24, 1, "", transact={"from": owner})
c.mint(a1, 21, 1, transact={"from": owner})
c.mint(a1, 22, 1, transact={"from": owner})
c.mint(a1, 23, 1, transact={"from": owner})
c.mint(a1, 24, 1, transact={"from": owner})

assert_tx_failed(lambda: c.mint(a1, 24, 1, "", transact={"from": a3}))
assert_tx_failed(lambda: c.mint(ZERO_ADDRESS, 24, 1, "", transact={"from": owner}))
assert_tx_failed(lambda: c.mint(a1, 24, 1, transact={"from": a3}))
assert_tx_failed(lambda: c.mint(ZERO_ADDRESS, 24, 1, transact={"from": owner}))

assert c.balanceOf(a1, 21) == 1
assert c.balanceOf(a1, 22) == 1
Expand Down Expand Up @@ -103,9 +103,9 @@ def test_pause(erc1155, w3, assert_tx_failed):
assert_tx_failed(lambda: erc1155.burnBatch([21, 22], [1, 1]))

# check mint and mintbatch
assert_tx_failed(lambda: erc1155.mint(a1, 21, 1, "", transact={"from": owner}))
assert_tx_failed(lambda: erc1155.mint(a1, 21, 1, transact={"from": owner}))
assert_tx_failed(
lambda: erc1155.mintBatch(a1, mintBatch, minBatchSetOf10, "", transact={"from": owner})
lambda: erc1155.mintBatch(a1, mintBatch, minBatchSetOf10, transact={"from": owner})
)

# check safetransferfrom and safebatchtransferfrom
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_mint_one_burn_one(erc1155, w3, assert_tx_failed):
owner, a1, a2, a3, a4, a5 = w3.eth.accounts[0:6]

# check the balance from an owner and non-owner account
erc1155.mint(owner, 25, 1, "", transact={"from": owner})
erc1155.mint(owner, 25, 1, transact={"from": owner})

assert erc1155.balanceOf(owner, 25) == 1
assert erc1155.balanceOf(owner, 25) == 1
Expand Down Expand Up @@ -354,7 +354,7 @@ def test_max_batch_size_violation(erc1155, w3, assert_tx_failed):
ids.append(i)
amounts.append(1)

assert_tx_failed(lambda: erc1155.mintBatch(a1, ids, amounts, "", transact={"from": owner}))
assert_tx_failed(lambda: erc1155.mintBatch(a1, ids, amounts, transact={"from": owner}))


# Transferring back and forth
Expand Down