This project demonstrates uint512 representation and arithmetic for the solidity language (which is limited to 2**256). It comes with an example implementation, as well as tests.
-
Addition (512 + 512 → 512)
-
Subtraction (512 - 512 → 512),
-
Multiplication (256 × 256 → 512), (512 × 256 → 512)
-
Division (512 / 256 → 256)
-
Square root (256 → 256) and (512 → 256).
NOTE: All functions are gas optimized as far I know. Feel free to contribute if you know more advanced algorithms, spot possibilities for gas improvements or just want to extend the library.
See the official Foundry installation instructions.
Then, install the foundry toolchain installer (foundryup
) with:
curl -L https://foundry.paradigm.xyz | bash
Now that you've installed the foundryup
binary,
anytime you need to get the latest forge
or cast
binaries,
you can run foundryup
.
So, simply execute:
foundryup
🎉 Foundry is installed! 🎉
With Foundry, tests are written in Solidity! 🥳
Create a test file for your contract in the src/tests/
directory.
For example, src/Greeter.sol
has its test file defined in ./src/tests/Greeter.t.sol
.
To learn more about writing tests in Solidity for Foundry and Dapptools, reference Rari Capital's solmate repository largely created by @transmissions11.
Using foundry.toml, Foundry is easily configurable.
For a full list of configuration options, see the Foundry configuration documentation.
Install DappTools using their installation guide.
npx install hardhat --save-dev
npx hardhat accounts
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
node scripts/sample-script.js
npx hardhat help
These smart contracts are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.