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

add burn function #243

Merged
merged 6 commits into from
Oct 7, 2024
Merged

Conversation

mubarak23
Copy link
Contributor

@mubarak23 mubarak23 commented Sep 29, 2024

PR for issue: #229

Copy link

vercel bot commented Sep 29, 2024

@mubarak23 is attempting to deploy a commit to the Screenshot Team on Vercel.

A member of the Team first needs to authorize it.

@ybensacq
Copy link

@mubarak23 could you keep the original formatting please ?

@mubarak23
Copy link
Contributor Author

mubarak23 commented Sep 29, 2024

@mubarak23 could you keep the original formatting please ?

Am using eslint,

What formatting setup are you using for this project

Copy link
Collaborator

@ptisserand ptisserand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, unit tests are missing.

@mubarak23
Copy link
Contributor Author

Hi, unit tests are missing.

alright, wanted to make sure the implementation is correct, before proceeding to the unit test,

i will push it right away

@ptisserand
Copy link
Collaborator

Hi, unit tests are missing.

alright, wanted to make sure the implementation is correct, before proceeding to the unit test,

i will push it right away

Hi @mubarak23 any update on this ?

@mubarak23
Copy link
Contributor Author

Hi, unit tests are missing.

alright, wanted to make sure the implementation is correct, before proceeding to the unit test,
i will push it right away

Hi @mubarak23 any update on this ?

am having an issue with the test, i will fix it and push very soon

@mubarak23
Copy link
Contributor Author

@ptisserand

this is my test function

    #[test]
fn burn_from_bridge() {
    let BRIDGE = bridge_addr_mock();
    
    let DUO_OWNER = starknet::contract_address_const::<128>();

    let contract_address = deploy_everai_collection();

    let erc721b = IERC721BridgeableDispatcher { contract_address };

    // Mint a token first to be able to burn it later
    start_prank(CheatTarget::One(contract_address), BRIDGE);
    erc721b.mint_from_bridge(DUO_OWNER, 42_u256);
    stop_prank(CheatTarget::One(contract_address));

    // Check that the owner is set correctly after minting
    let erc721 = IERC721Dispatcher { contract_address };
    assert!(erc721.owner_of(42_u256) == DUO_OWNER, "bad owner after mint");

    // Burn the token
    start_prank(CheatTarget::One(contract_address), BRIDGE);
    erc721b.burn(42_u256);
    stop_prank(CheatTarget::One(contract_address));

    // Verify that the token no longer exists
    let burn_result = erc721.owner_of(42_u256);
    assert!(burn_result == DUO_OWNER, "token should be burned, but still exists");
}

i keep getting the following error

Failure data:
    0x4552433732313a20696e76616c696420746f6b656e204944 ('ERC721: invalid token ID')

@mubarak23 mubarak23 requested a review from ptisserand October 2, 2024 09:39
Copy link
Collaborator

@ptisserand ptisserand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a really huge security issue to let anyone burn any token!
Please fix it

@mubarak23 mubarak23 requested a review from ptisserand October 4, 2024 07:28
Copy link
Collaborator

@ptisserand ptisserand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
After tests renaming, it could be merged.

@mubarak23 mubarak23 requested a review from ptisserand October 4, 2024 15:30
Copy link
Collaborator

@ptisserand ptisserand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution

@ptisserand ptisserand added this pull request to the merge queue Oct 7, 2024
Merged via the queue into ArkProjectNFTs:main with commit b78a45d Oct 7, 2024
2 of 4 checks passed
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 this pull request may close these issues.

3 participants