ERC725Alliance / ERC725

Repository for code and discussion around ERC725 and related standards
Apache License 2.0
127 stars 66 forks source link

refactor: create internal `_execute(...)` function in ERC725X #172

Closed CJ42 closed 2 years ago

CJ42 commented 2 years ago

What does this PR introduce?

In ERC725XCore, move all the logic of execute function inside an internal _execute(....) function. This will allow easier overriding of the public function execute(...) for custom logic.

Aside of that, removed the unnecessary override keyword for functions that are directly implementation of the IERC725X and IERC725Y interfaces.

CJ42 commented 2 years ago

@YamenMerhi it's just a loop in the end, and use already the _setData(...) from the internal function. I would leave it as it is.

image

What would be your ideas of having:

function _setData(bytes32[] memory dataKeys, bytes[] memory dataValues) internal {
    for (uint256 i = 0; i < dataKeys.length; i = _uncheckedIncrement(i)) {
            _setData(dataKeys[i], dataValues[i]);
        }
}
YamenMerhi commented 2 years ago

Yes something like this, it's not a big deal (just for inheritance purposes).