Skip to content

Conversation

@masonchain
Copy link
Contributor

@masonchain masonchain commented Oct 4, 2023

ISSUES

  • Hit an issue with the Hook objects in the database being overwritten. If token_id 0 had an account bound hook, and token_id 1 is then configured to be account bound as well, then the indexer overwrites that existing Hook object with the new config that contains the token ID.
    • The execute() function in BadgerTransferBound.sol shows how token IDs are packed in the same hook
/**
     * See {ERC1155._beforeTokenTransfer}
     * @dev Enables the ability to have modules such as Account Bound, etc.
     */
    function _beforeTokenTransfer(
        address _operator,
        address _from,
        address _to,
        uint256[] memory _ids,
        uint256[] memory _amounts,
        bytes memory _data
    ) internal virtual override {
        /// @dev Before transferring, process any Organization hooks.
        _hook(
            BEFORE_TRANSFER,
            abi.encode(_operator, _from, _to, _ids, _amounts, _data)
        );

        /// @dev Do not call the super as it is an empty function.
    }

So this fat list of args gets passed to _hook, and then _execute, as the data param.

BadgerTransferBound decodes is as:

    /**
     * See {IBadgerHook-execute}.
     */
    function execute(bytes calldata _data) public virtual override {
        /// @dev Decode the transfer data forwarded from the Organization.
        (
            address _operator,
            address _from,
            address _to,
            uint256[] memory _ids,
            ,

        ) = abi.decode(
                _data,
                (address, address, address, uint256[], uint256[], bytes)
            );

@netlify
Copy link

netlify bot commented Oct 4, 2023

Deploy Preview for badger-frontend ready!

Name Link
🔨 Latest commit 529ab1a
🔍 Latest deploy log https://app.netlify.com/sites/badger-frontend/deploys/651deac6dd9c770008602a8a
😎 Deploy Preview https://deploy-preview-254--badger-frontend.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@masonchain masonchain changed the base branch from main to v6-final-cleanups October 4, 2023 22:44
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.

2 participants