Skip to content

Commit ab04322

Browse files
committed
Fix EVM transfer Docker runtime config
1 parent dd12096 commit ab04322

3 files changed

Lines changed: 82 additions & 2 deletions

File tree

packages/acala-evm-transfer/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,16 @@ WORKDIR /app
4242
COPY --from=builder /app/package.json /app/
4343
COPY --from=builder /app/schema.graphql /app/
4444
COPY --from=builder /app/dist /app/dist
45-
COPY --from=builder /app/project.yaml /app/
45+
COPY --from=builder /app/project.yaml.template /app/
46+
COPY --from=builder /app/project.yaml.template /app/project.yaml
47+
COPY --from=builder /app/docker/entrypoint.sh /app/entrypoint.sh
4648
COPY --from=builder /app/abis /app/abis
4749

48-
RUN chown -R 1000:1000 /app
50+
RUN chmod +x /app/entrypoint.sh && chown -R 1000:1000 /app
4951

5052
USER 1000
5153

5254
EXPOSE 3000
55+
56+
ENTRYPOINT ["/sbin/tini", "--", "/app/entrypoint.sh"]
57+
CMD ["-f=/app"]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
require_env() {
5+
name="$1"
6+
eval "value=\${$name:-}"
7+
if [ -z "$value" ]; then
8+
echo "$name is required to render /app/project.yaml" >&2
9+
exit 1
10+
fi
11+
}
12+
13+
escape_sed_replacement() {
14+
printf '%s' "$1" | sed 's/[\/&]/\\&/g'
15+
}
16+
17+
case "${1:-}" in
18+
--help | -h | help | --version | -v | version)
19+
exec subql-node-ethereum "$@"
20+
;;
21+
esac
22+
23+
require_env CHAIN_ID
24+
require_env ENDPOINT
25+
26+
chain_id="$(escape_sed_replacement "$CHAIN_ID")"
27+
endpoint="$(escape_sed_replacement "$ENDPOINT")"
28+
29+
sed \
30+
-e "s/__CHAIN_ID__/$chain_id/g" \
31+
-e "s/__ENDPOINT__/$endpoint/g" \
32+
/app/project.yaml.template > /app/project.yaml
33+
34+
exec subql-node-ethereum "$@"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
specVersion: 1.0.0
2+
version: 0.0.1
3+
name: acala-evm-transfer
4+
description: Acala EVM Transfer
5+
runner:
6+
node:
7+
name: '@subql/node-ethereum'
8+
version: 6.5.0
9+
query:
10+
name: '@subql/query'
11+
version: 2.25.0
12+
schema:
13+
file: ./schema.graphql
14+
network:
15+
chainId: "__CHAIN_ID__"
16+
endpoint: "__ENDPOINT__"
17+
dataSources:
18+
- kind: ethereum/Runtime
19+
options:
20+
abi: erc20
21+
assets:
22+
erc20:
23+
file: ./abis/erc20.json
24+
startBlock: 6000000
25+
mapping:
26+
file: ./dist/index.js
27+
handlers:
28+
- kind: ethereum/TransactionHandler
29+
handler: handleTransfer
30+
filter:
31+
function: transfer(address to,uint256 value)
32+
- kind: ethereum/TransactionHandler
33+
handler: handleApprove
34+
filter:
35+
function: approve(address spender,uint256 value)
36+
- kind: ethereum/LogHandler
37+
handler: handleTransferEvent
38+
filter:
39+
topics:
40+
- Transfer(address indexed from, address indexed to, uint256 amount)
41+
repository: https://github.com/subquery/ethereum-subql-starter

0 commit comments

Comments
 (0)