-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
blockchain_integration/pi_network/contracts/PI-bank/utils/PIBankUtils.sol
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
library PIBankUtils { | ||
function calculateInterestRate(uint256 _balance, uint256 _interestRate) internal pure returns (uint256) { | ||
return _balance * _interestRate / 100; | ||
} | ||
|
||
function generateRandomNumber(uint256 _seed) internal view returns (uint256) { | ||
return uint256(keccak256(abi.encodePacked(_seed, block.timestamp))); | ||
} | ||
|
||
function encodeData(string memory _data) internal pure returns (bytes memory) { | ||
return abi.encodePacked(_data); | ||
} | ||
} |