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

tokenURI is pointing at a Loom domain. Make it abstract #10

Closed
mattkanwisher opened this issue Sep 16, 2018 · 3 comments
Closed

tokenURI is pointing at a Loom domain. Make it abstract #10

mattkanwisher opened this issue Sep 16, 2018 · 3 comments

Comments

@mattkanwisher
Copy link

mattkanwisher commented Sep 16, 2018

    function tokenURI(uint256 _tokenId) public view returns (string tokenUri) {
        require(exists(_tokenId), "Token doesn't exist");
        tokenUri = "https://loom.games/erc721/zmb/000000.json";

        bytes memory _uriBytes = bytes(tokenUri);
        _uriBytes[39] = byte(48+(_tokenId / 10000) % 10);
        _uriBytes[40] = byte(48+(_tokenId / 1000) % 10);
        _uriBytes[41] = byte(48+(_tokenId / 100) % 10);
        _uriBytes[42] = byte(48+(_tokenId / 10) % 10);
        _uriBytes[43] = byte(48+(_tokenId / 1) % 10);

        return tokenUri;
    }

would be nice to give this as an example but make the function abstract to override it

@ankitrk
Copy link

ankitrk commented Sep 19, 2018

why does this fuction return tokenuri and not uribytes?

@IncentiveLoop
Copy link

Rather than constructing each tokenURI on chain it might be worth exploring something like a baseTokenURI property that can be used to construct individual token uris off chain.

e.g. if the baseTokenURI is https://loom.games/erc721/zmb and we want the details of the 1st token then we know we can look it up at https://loom.games/erc721/zmb/1.json.

@gakonst
Copy link
Contributor

gakonst commented Mar 24, 2019

Fixed in db5928a, now the URI is passed via the constructor

@gakonst gakonst closed this as completed Mar 24, 2019
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

No branches or pull requests

4 participants