Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions phyton library
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract BasicMath {
function adder(uint _a, uint _b) external pure returns (uint sum, bool error) {
unchecked {
uint result = _a + _b;
if (result >= _a && result >= _b) {
return (result, false);
} else {
return (0, true);
}
}
}

function subtractor(uint _a, uint _b) external pure returns (uint difference, bool error) {
unchecked {
if (_b <= _a) {
return (_a - _b, false);
} else {
return (0, true);
}
}
}
}