Skip to content

Instantly share code, notes, and snippets.

@izqui
Created February 7, 2017 20:31
Show Gist options
  • Save izqui/11a85aae6c749eba9841465c8a47ccc6 to your computer and use it in GitHub Desktop.
Save izqui/11a85aae6c749eba9841465c8a47ccc6 to your computer and use it in GitHub Desktop.
library CounterLib {
struct Counter { uint i; }
function incremented(Counter storage self) returns (uint) {
return ++self.i;
}
}
contract CounterContract {
using CounterLib for CounterLib.Counter;
CounterLib.Counter counter;
function increment() returns (uint) {
return counter.incremented();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment