An open API service indexing awesome lists of open source software.

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.

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
```