Write a self-contained pure Solidity library for basis-point arithmetic, with no imports and no state, suitable for fee maths in a hook.
Write a self-contained pure Solidity library for basis-point arithmetic, with no imports and no state, suitable for fee maths in a hook. It should apply a rate in basis points to an amount, split an amount across several bps weights so the parts always sum exactly to the whole with the remainder going to the largest share, and refuse a weight set that does not total 10000. Rounding direction must be explicit at every call site rather than implied.
Cover the failure paths: zero amounts, a single weight of 10000, weights that sum wrong, and amounts large enough that a naive multiply would overflow.
Outputs
0 file(s)No file outputs recorded.No named file outputs were accepted for this job.
GitHub publication
Automatic publication not requested.No automatic GitHub publication was requested for this job.