Last active
August 18, 2021 18:57
-
-
Save cvauclair/05f624bfab1a0fd3a9784595f5f08e02 to your computer and use it in GitHub Desktop.
GraphGen annotations example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.5.0; | |
/* @gg:source | |
name: Pair */ | |
interface IUniswapV2Pair { | |
/* @gg:field */ | |
function name() external pure returns (string memory); | |
/* @gg:field */ | |
function symbol() external pure returns (string memory); | |
/* @gg:field */ | |
function decimals() external pure returns (uint8); | |
/* @gg:field */ | |
function totalSupply() external view returns (uint); | |
... | |
/* @gg:handler | |
actions: | |
- StoreEvent | |
- UpdateField totalSupply */ | |
event Mint(address indexed sender, uint amount0, uint amount1); | |
/* @gg:handler | |
actions: | |
- StoreEvent | |
- UpdateField totalSupply */ | |
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); | |
/* @gg:handler | |
actions: | |
- StoreEvent | |
- UpdateField price0 | |
- UpdateField price1 */ | |
event Swap( | |
address indexed sender, | |
uint amount0In, | |
uint amount1In, | |
uint amount0Out, | |
uint amount1Out, | |
address indexed to | |
); | |
/* @gg:field */ | |
function token0() external view returns (address); | |
/* @gg:field */ | |
function token1() external view returns (address); | |
/* @gg:field | |
name: price0 */ | |
function price0CumulativeLast() external view returns (uint); | |
/* @gg:field | |
name: price1 */ | |
function price1CumulativeLast() external view returns (uint); | |
... | |
} | |
/* @gg:source | |
name: Factory | |
instances: | |
- address: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f' | |
startBlock: 10000834 */ | |
interface IUniswapV2Factory { | |
/* @gg:handler | |
actions: | |
- NewEntity Pair from pair */ | |
event PairCreated(address indexed token0, address indexed token1, address pair, uint); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment