https://github.com/raineorshine/sol-decimal
A Solidity Decimal type.
https://github.com/raineorshine/sol-decimal
Last synced: 3 months ago
JSON representation
A Solidity Decimal type.
- Host: GitHub
- URL: https://github.com/raineorshine/sol-decimal
- Owner: raineorshine
- Created: 2018-01-17T00:47:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-17T00:48:21.000Z (over 7 years ago)
- Last Synced: 2025-07-30T10:19:14.178Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A Solidity Decimal type.
## Usage
```js
import "./Decimal.sol";contract A {
using Decimal for Decimal.Data;function foo() public constant returns(uint) {
Decimal.Data memory a = Decimal.fromUint(5);
Decimal.Data memory b = Decimal.Data({
num: 12,
den: 3
});return a.add(b).toUint(); // 9
}
}
```## Build
```
testrpc
truffle compile
truffle migrate --reset
truffle test
```