Skip to content

Instantly share code, notes, and snippets.

Created May 11, 2021
What would you like to do?
Using calldata when not needed

In StakingTokenProvider, we have two method using calldata for passing string that do not call external contracts. Calldata should be used just when the argument will be used to call an external contract

    function setPairedTokenForVaultToken(
        address _vaultToken,
        address _newPairedToken,
        string calldata _newPrefix
    ) external onlyOwner {
        emit NewPairedTokenForVault(
        pairedToken[_vaultToken] = _newPairedToken;
        pairedPrefix[_vaultToken] = _newPrefix;

    function setDefaultPairedToken(
        address _newDefaultPaired,
        //FIXME: Calldata ??
        string calldata _newDefaultPrefix
    ) external onlyOwner {
        emit NewDefaultPaired(defaultPairedToken, _newDefaultPaired);
        defaultPairedToken = _newDefaultPaired;
        defaultPrefix = _newDefaultPrefix;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment