Last active
June 27, 2023 13:39
-
-
Save TehilaFavourite/b231edfd2b51dda3ee6dce45e9aee5c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.0; | |
library MathUtils { | |
function add(uint256 a, uint256 b) internal pure returns (uint256) { | |
return a + b; | |
} | |
function multiply(uint256 a, uint256 b) internal pure returns (uint256) { | |
return a * b; | |
} | |
} | |
contract MyContract { | |
function performCalculation( | |
uint256 x, | |
uint256 y | |
) public pure returns (uint256) { | |
uint256 result = MathUtils.add(x, y); // Using the add() function from the MathUtils library | |
result = MathUtils.multiply(result, 2); // Using the multiply() function from the MathUtils library | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment