Skip to content

Commit

Permalink
fabien/evm-poster
Browse files Browse the repository at this point in the history
  • Loading branch information
bonustrack committed Nov 23, 2023
1 parent 078361b commit 361f941
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 7 deletions.
45 changes: 45 additions & 0 deletions src/abis/Poster.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "content",
"type": "string"
},
{
"indexed": true,
"internalType": "string",
"name": "tag",
"type": "string"
}
],
"name": "NewPost",
"type": "event"
},
{
"inputs": [
{
"internalType": "string",
"name": "content",
"type": "string"
},
{
"internalType": "string",
"name": "tag",
"type": "string"
}
],
"name": "post",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
12 changes: 6 additions & 6 deletions src/config.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"network_node_url": "https://sepolia.infura.io/v3/46a5dd9727bf48d4a132672d3f376146",
"network_node_url": "https://rpc.brovider.xyz/5",
"sources": [
{
"contract": "0x4b4f7f64be813ccc66aefc3bfce2baa01188631c",
"start": 3962130,
"abi": "ProxyFactory",
"contract": "0x000000000000cd17345801aa8147b8D3950260FF",
"start": 6102403,
"abi": "Poster",
"events": [
{
"name": "ProxyDeployed(address,address)",
"fn": "handleProxyDeployed"
"name": "NewPost(address,string,string)",
"fn": "handleNewPost"
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Checkpoint, { LogLevel, evm } from '@snapshot-labs/checkpoint';
import config from './config.json';
import * as writers from './writers';
import ProxyFactory from './abis/ProxyFactory.json';
import Poster from './abis/Poster.json';

const dir = __dirname.endsWith('dist/src') ? '../' : '';
const schemaFile = path.join(__dirname, `${dir}../src/schema.gql`);
Expand All @@ -19,7 +20,8 @@ const checkpoint = new Checkpoint(config, indexer, schema, {
logLevel: LogLevel.Info,
resetOnConfigChange: true,
abis: {
ProxyFactory
ProxyFactory,
Poster
}
// prettifyLogs: true, // uncomment in local dev
});
Expand Down
6 changes: 6 additions & 0 deletions src/writers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ export const handleProxyDeployed: evm.Writer = async ({ block, event }) => {

console.log('deployed', event.args.implementation, event.args.proxy);
};

export const handleNewPost: evm.Writer = async ({ block, event }) => {
if (!block || !event) return;

console.log('new post', event.args);
};

0 comments on commit 361f941

Please sign in to comment.