Comments (6)
Wouldn't hurt to add complementWad
as well:
function complementWad(uint256 x) internal pure returns (uint256 result) {
assembly {
result := mul(lt(x, WAD), sub(WAD, x))
}
}
from solady.
powWad(uint256, uint256)
could also be added to FixedPointMathLib
from solady.
I think let's leave it as powWad(int256 x, int256 y)
.
from solady.
@Vectorized All of this is inspired by Balancer v2 arithmetic:
Complement reference:
https://github.com/balancer/balancer-v2-monorepo/blob/bc3b3fee6e13e01d2efe610ed8118fdb74dfc1f2/pkg/solidity-utils/contracts/math/FixedPoint.sol#L156
Furthermore, for powWad
we only need to ensure that the signed integers (params) are greater than zero. Although my main issue is with the return value, which requires me to check that result > 0
. So tbh its not a huge issue.
from solady.
I think let's leave it as
powWad(int256 x, int256 y)
.
powWad(int256, int256) -> (uint256)
could be a happy median
from solady.
I think I'll let the people who need powWad
and wadComplement
copy paste from balancer.
Licensing issue, and high risk of edge cases unaccounted for.
from solady.
Related Issues (20)
- ✨ RingBufferLib HOT 3
- ⚡️ERC721: Combine _mint() and set _setExtraData() into single SSTORE HOT 9
- ✨ ERC1967Factory should salt by default HOT 4
- `match` used in assembly is a reserved keyword. HOT 5
- ✨ LibClone ERC1967I HOT 1
- ⚠️ Potential Error in _hashTypedData Assembly Code Leading to Incorrect EIP-712 Digest Calculation HOT 1
- ✨ SafeTransferLib Permit2 operations
- 👷♂️ Slither unable to generate IR for LibSort HOT 5
- ⚡ Avoiding balance cold storage reset for tokens HOT 2
- Feature: URL Encoding safe Base64 HOT 3
- ♻️ Convert modifiers to internal functions.
- Error in verifying git while installing HOT 2
- ♻️ More generalized DeploylessPredeployQueryer
- 👷♂️ Change evm_version to `cancun`? HOT 2
- ✨ LibClone minimal ERC1967 beacon proxy functions + UpgradeableBeacon
- Mr
- ✨ ERC6551BeaconProxy
- ✨ isValidERC6492SignatureNow
- $ADE token
- Feature request: utility function to check if a string contains only alphanumeric characters HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solady.