Solidity library and related contracts for debugging contracts
Install using yarn/npm:
$ yarn add debuggable-solidity
Then, in your Solidity file, use the library:
import "debuggable-solidity/contracts/Debuggable.sol";
import "debuggable-solidity/contracts/DebugCounter.sol";
contract MyContract {
using Debuggable for *;
function myFunction() public {
string valueString = "foobar";
bytes32 valueBytes32 = 0x1234;
uint256 valueUint256 = 1234;
address valueAddress = address(0x0);
valueString.debug(); // => emit DebugString(value: "foobar")
valueBytes32.debug(); // => emit DebugBytes32(value: 0x1234)
valueUint256.debug(); // => emit DebugUint256(value: 1234)
valueAddress.debug(); // => emit DebugAddress(value: 0x0)
Debuggable.debugRevert("msg"); // always reverts
Debuggable.debugNoop(); // does nothing
Debuggable.debugNoopConstant(); // does nothing (constant fn)
DebugCounter counter = new DebugCounter("xyz");
counter.increment(); // => emit DebugCount(name: "my counter", count: 1)
counter.increment(); // => emit DebugCount(name: "my counter", count: 2)
counter.increment(); // => emit DebugCount(name: "my counter", count: 3)
}
}
PRs welcome. To install dependencies and start the local development server:
$ yarn install
$ yarn run migrate
$ yarn start
$ yarn test
$ yarn watch
$ npm run gen-docs
Licensed under Apache 2.0.
Alexander Kern alex@kern.io
Debuggable.debugRevert() pure
29b9505f
Reverts when called
Debuggable.debug(value) nonpayable
2f50fbfa
Emits a DebugString event with a string value
Inputs
type | name | description |
---|---|---|
string | value | The string value |
Debuggable.debugNoopConstant() pure
58e8e8db
Does nothing (constant fn)
Debuggable.debug(value) nonpayable
6714a34e
Emits a DebugAddress event with an address value
Inputs
type | name | description |
---|---|---|
address | value | The address value |
Debuggable.debugRevert(message) pure
6a9b418f
Reverts with a message when called
Inputs
type | name | description |
---|---|---|
string | message | The message |
Debuggable.debug(value) nonpayable
815dd951
Emits a DebugUint256 event with a uint256 value
Inputs
type | name | description |
---|---|---|
uint256 | value | The uint256 value |
Debuggable.debug(value) nonpayable
9bb4050e
Emits a DebugBytes32 event with a bytes32 value
Inputs
type | name | description |
---|---|---|
bytes32 | value | The bytes32 value |
Debuggable.debugNoop() nonpayable
eda892c1
Does nothing
Debuggable.DebugString(value) 20670ef4
Arguments
type | name | description |
---|---|---|
string | value | not indexed |
Debuggable.DebugBytes32(value) 110cb96f
Arguments
type | name | description |
---|---|---|
bytes32 | value | not indexed |
Debuggable.DebugUint256(value) 43d4b470
Arguments
type | name | description |
---|---|---|
uint256 | value | not indexed |
Debuggable.DebugAddress(value) e7375f84
Arguments
type | name | description |
---|---|---|
address | value | not indexed |