Skip to content

Commit 0b7c751

Browse files
committed
feat: bridge subgraph update script
1 parent 69e431f commit 0b7c751

File tree

3 files changed

+57
-140
lines changed

3 files changed

+57
-140
lines changed
Lines changed: 37 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
{
2-
"_format": "hh-sol-artifact-1",
3-
"contractName": "FastBridgeSender",
4-
"sourceName": "src/bridge/FastBridgeSender.sol",
2+
"address": "0x0b9e03455Fed83f209Fa7ce596c93ba6aBAd1f46",
53
"abi": [
64
{
75
"inputs": [
86
{
9-
"internalType": "uint256",
10-
"name": "_epochPeriod",
11-
"type": "uint256"
7+
"internalType": "contract ISafeBridge",
8+
"name": "_safebridge",
9+
"type": "address"
1210
},
1311
{
14-
"internalType": "address",
15-
"name": "_safeBridgeReceiver",
12+
"internalType": "contract IFastBridgeReceiver",
13+
"name": "_fastBridgeReceiver",
1614
"type": "address"
1715
}
1816
],
@@ -24,176 +22,79 @@
2422
"inputs": [
2523
{
2624
"indexed": false,
27-
"internalType": "bytes",
28-
"name": "fastMessage",
29-
"type": "bytes"
30-
},
31-
{
32-
"indexed": false,
33-
"internalType": "bytes32",
34-
"name": "fastMessageHash",
35-
"type": "bytes32"
36-
}
37-
],
38-
"name": "MessageReceived",
39-
"type": "event"
40-
},
41-
{
42-
"anonymous": false,
43-
"inputs": [
44-
{
45-
"indexed": true,
46-
"internalType": "uint256",
47-
"name": "batchID",
48-
"type": "uint256"
49-
},
50-
{
51-
"indexed": false,
52-
"internalType": "uint256",
53-
"name": "batchSize",
54-
"type": "uint256"
55-
},
56-
{
57-
"indexed": false,
58-
"internalType": "uint256",
59-
"name": "epoch",
60-
"type": "uint256"
25+
"internalType": "address",
26+
"name": "target",
27+
"type": "address"
6128
},
6229
{
6330
"indexed": false,
6431
"internalType": "bytes32",
65-
"name": "batchMerkleRoot",
32+
"name": "messageHash",
6633
"type": "bytes32"
67-
}
68-
],
69-
"name": "SendBatch",
70-
"type": "event"
71-
},
72-
{
73-
"anonymous": false,
74-
"inputs": [
75-
{
76-
"indexed": true,
77-
"internalType": "uint256",
78-
"name": "epoch",
79-
"type": "uint256"
8034
},
8135
{
8236
"indexed": false,
83-
"internalType": "bytes32",
84-
"name": "canonicalBridgeMessageID",
85-
"type": "bytes32"
37+
"internalType": "bytes",
38+
"name": "message",
39+
"type": "bytes"
8640
}
8741
],
88-
"name": "SentSafe",
42+
"name": "OutgoingMessage",
8943
"type": "event"
9044
},
9145
{
9246
"inputs": [],
93-
"name": "ARB_SYS",
47+
"name": "fastBridgeReceiver",
9448
"outputs": [
9549
{
96-
"internalType": "contract IArbSys",
50+
"internalType": "contract IFastBridgeReceiver",
9751
"name": "",
9852
"type": "address"
9953
}
10054
],
10155
"stateMutability": "view",
10256
"type": "function"
10357
},
104-
{
105-
"inputs": [
106-
{
107-
"internalType": "uint256",
108-
"name": "",
109-
"type": "uint256"
110-
}
111-
],
112-
"name": "batch",
113-
"outputs": [
114-
{
115-
"internalType": "bytes32",
116-
"name": "",
117-
"type": "bytes32"
118-
}
119-
],
120-
"stateMutability": "view",
121-
"type": "function"
122-
},
12358
{
12459
"inputs": [],
125-
"name": "batchSize",
60+
"name": "fastSender",
12661
"outputs": [
12762
{
128-
"internalType": "uint256",
129-
"name": "",
130-
"type": "uint256"
131-
}
132-
],
133-
"stateMutability": "view",
134-
"type": "function"
135-
},
136-
{
137-
"inputs": [],
138-
"name": "currentBatchID",
139-
"outputs": [
140-
{
141-
"internalType": "uint256",
63+
"internalType": "address",
14264
"name": "",
143-
"type": "uint256"
65+
"type": "address"
14466
}
14567
],
14668
"stateMutability": "view",
14769
"type": "function"
14870
},
14971
{
15072
"inputs": [],
151-
"name": "epochPeriod",
73+
"name": "safebridge",
15274
"outputs": [
15375
{
154-
"internalType": "uint256",
76+
"internalType": "contract ISafeBridge",
15577
"name": "",
156-
"type": "uint256"
78+
"type": "address"
15779
}
15880
],
15981
"stateMutability": "view",
16082
"type": "function"
16183
},
16284
{
16385
"inputs": [
164-
{
165-
"internalType": "uint256",
166-
"name": "",
167-
"type": "uint256"
168-
}
169-
],
170-
"name": "fastOutbox",
171-
"outputs": [
172-
{
173-
"internalType": "bytes32",
174-
"name": "",
175-
"type": "bytes32"
176-
}
177-
],
178-
"stateMutability": "view",
179-
"type": "function"
180-
},
181-
{
182-
"inputs": [],
183-
"name": "safeBridgeReceiver",
184-
"outputs": [
18586
{
18687
"internalType": "address",
187-
"name": "",
88+
"name": "_receiver",
18889
"type": "address"
90+
},
91+
{
92+
"internalType": "bytes",
93+
"name": "_calldata",
94+
"type": "bytes"
18995
}
19096
],
191-
"stateMutability": "view",
192-
"type": "function"
193-
},
194-
{
195-
"inputs": [],
196-
"name": "sendBatch",
97+
"name": "sendFast",
19798
"outputs": [],
19899
"stateMutability": "nonpayable",
199100
"type": "function"
@@ -211,25 +112,23 @@
211112
"type": "bytes"
212113
}
213114
],
214-
"name": "sendFast",
115+
"name": "sendSafe",
215116
"outputs": [],
216-
"stateMutability": "nonpayable",
117+
"stateMutability": "payable",
217118
"type": "function"
218119
},
219120
{
220121
"inputs": [
221122
{
222-
"internalType": "uint256",
223-
"name": "_epoch",
224-
"type": "uint256"
123+
"internalType": "address",
124+
"name": "_fastSender",
125+
"type": "address"
225126
}
226127
],
227-
"name": "sendSafeFallback",
128+
"name": "setFastSender",
228129
"outputs": [],
229-
"stateMutability": "payable",
130+
"stateMutability": "nonpayable",
230131
"type": "function"
231132
}
232-
],
233-
"linkReferences": {},
234-
"deployedLinkReferences": {}
133+
]
235134
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
function update() #file #dataSourceIndex
6+
{
7+
local f="$1"
8+
local dataSourceIndex="$2"
9+
cat $f | jq '. | {address: .address, abi: .abi}' > abis/$(basename $f)
10+
11+
address=$(cat abis/$(basename $f) | jq '.address')
12+
yq -i ".dataSources[$dataSourceIndex].source.address=$address" $SCRIPT_DIR/../subgraph.yaml
13+
14+
blockNumber="$(cat $f | jq '.receipt.blockNumber')"
15+
yq -i ".dataSources[$dataSourceIndex].source.startBlock=$blockNumber" $SCRIPT_DIR/../subgraph.yaml
16+
}
17+
18+
update "$SCRIPT_DIR/../../contracts/deployments/arbitrumRinkeby/FastBridgeSender.json" 0

subgraph-fastbridge/subgraph.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ dataSources:
66
name: FastBridgeSender
77
network: arbitrum-rinkeby
88
source:
9-
address: "0x1077D69D660c08fB5a1996D4805D9e657f7BA39e"
9+
address: "0x0b9e03455Fed83f209Fa7ce596c93ba6aBAd1f46"
1010
abi: FastBridgeSender
11-
startBlock: 12545049
11+
startBlock: 9610369
1212
mapping:
1313
kind: ethereum/events
1414
apiVersion: 0.0.6

0 commit comments

Comments
 (0)