Giter Site home page Giter Site logo

Comments (4)

MoMannn avatar MoMannn commented on August 25, 2024

_transfer is a private function so it cannot be overridden or called if a contracts inherits from NFToken contract... If anyone is modifying NFToken as it is he can change anything anyway..

from erc721.

lknix avatar lknix commented on August 25, 2024

Here is my reasoning and possible bug scenarios (all of them dealing with user doing something wrong):

  1. User inherits and overrides safeTransferFrom w/o adding modifiers -> open acess.
  2. User inherits and adds its own specialTransfer which uses _transfer. Here he has to explicitly check for state change permissions which happen in _transfer. If he fails to do it, then we have open access again.
  3. User modifies our existing implementation and does some stupid things like changing _transfer to external or other weird things.

I'm not saying this would "guard" against all stupidity but I think it's a good design if you keep permission checks coupled with the code that does states changes. Wdyt? I don't see any drawbacks but potentially we shrink surface for introducing some bugs.

from erc721.

MoMannn avatar MoMannn commented on August 25, 2024

If a user overriders safeTransferFrom he cannot call _transfer from it because it is private.. So neither 1 or 2 can happen and there is no protection for 3.

from erc721.

lknix avatar lknix commented on August 25, 2024

You're right. Just checked the docs and private functions aren't visible to derived contracts - my bad. OK, this invalidates the 1 and 2 which were the most significant ones. Closing this issue.

from erc721.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.