Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Created March 17, 2021 09:52
Show Gist options
  • Save PaulRBerg/94c3dcc41135cb977473b7e9934fff33 to your computer and use it in GitHub Desktop.
Save PaulRBerg/94c3dcc41135cb977473b7e9934fff33 to your computer and use it in GitHub Desktop.
Basic contract written in Solidity v0.8.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Mulmod {
uint256 public constant a = 2**254;
uint256 public constant b = 2**255;
function doMul(uint256 x, uint256 y) external pure returns (uint256) {
return x * y;
}
function doMulMod(uint256 x, uint256 y) external pure returns (uint256) {
return mulmod(x, y, type(uint256).max);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment