Skip to main content
edited body
Source Link

You can slideslice the data if it's in the calldata:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract Slice {
    function bytesToBytes32(bytes calldata b) external pure returns (bytes32) {
        return bytes32(b[:32]);
    }
}

You can slide the data if it's in the calldata:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract Slice {
    function bytesToBytes32(bytes calldata b) external pure returns (bytes32) {
        return bytes32(b[:32]);
    }
}

You can slice the data if it's in the calldata:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract Slice {
    function bytesToBytes32(bytes calldata b) external pure returns (bytes32) {
        return bytes32(b[:32]);
    }
}
Source Link

You can slide the data if it's in the calldata:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract Slice {
    function bytesToBytes32(bytes calldata b) external pure returns (bytes32) {
        return bytes32(b[:32]);
    }
}