Skip to content

Commit 74cc455

Browse files
committed
Merge branch 'v55'
2 parents 4ea5fed + 4b89128 commit 74cc455

File tree

3 files changed

+65
-19
lines changed

3 files changed

+65
-19
lines changed

.github/workflows/release-prod.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Set squid version to prod
2+
on:
3+
push:
4+
tags:
5+
- 'prod'
6+
7+
jobs:
8+
build_and_publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Install Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
19+
- name: Install squid CLI
20+
run: npm i -g @subsquid/cli
21+
22+
- name: npm install
23+
run: npm i
24+
25+
- name: Authenticate to squid
26+
env:
27+
API_TOKEN: ${{ secrets.SQUID_API_TOKEN }}
28+
run: sqd auth -k $API_TOKEN
29+
30+
- name: update squid.yml
31+
run: |
32+
# Get the branch name from GitHub
33+
BRANCH_NAME=${{ github.ref_name }}
34+
35+
# Update prod tag
36+
sqd tags add prod --name origin-squid -s $BRANCH_NAME --allow-tag-reassign
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Release squid
2-
1+
name: Release squid version
32
on:
43
push:
5-
tags:
6-
- 'v*'
4+
branches:
5+
- 'v[0-9]+'
76

87
jobs:
98
build_and_publish:
@@ -25,22 +24,22 @@ jobs:
2524

2625
- name: update squid.yml
2726
run: |
28-
# Get the tag from GitHub
29-
TAG=$(echo ${{ github.ref }} | sed 's/refs\/tags\///')
30-
31-
# Extract the numeric part of the tag
32-
VERSION=$(echo $TAG | sed 's/v//')
33-
27+
# Get the branch name from GitHub
28+
BRANCH_NAME=${{ github.ref_name }}
29+
30+
# Extract the version from the branch name (assuming format 'vXX')
31+
VERSION=$(echo $BRANCH_NAME | sed 's/^v//')
32+
3433
# Update the version in squid.yaml
3534
sed -i "s/^version: .*/version: $VERSION/" squid.yaml
36-
35+
3736
# Optional: Print the updated version for verification
3837
echo "Updated squid.yaml version to: $VERSION"
39-
38+
4039
- name: Authenticate to squid
41-
env:
40+
env:
4241
API_TOKEN: ${{ secrets.SQUID_API_TOKEN }}
4342
run: sqd auth -k $API_TOKEN
4443

4544
- name: Build and deploy squid
46-
run: sqd build && sqd deploy . -o origin --no-stream-logs
45+
run: sqd build && sqd deploy . -o origin --no-stream-logs --allow-update

src/templates/origin-arm/origin-arm.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ export const createOriginARMProcessors = ({
4343
topic0: [originLidoArmAbi.events.RedeemRequested.topic],
4444
range: { from },
4545
})
46+
const feeCollectedFilter = logFilter({
47+
address: [armAddress],
48+
topic0: [originLidoArmAbi.events.FeeCollected.topic],
49+
range: { from },
50+
})
4651
const tracker = blockFrequencyTracker({ from })
4752
let armEntity: Arm
4853
let initialized = false
@@ -86,6 +91,7 @@ export const createOriginARMProcessors = ({
8691
p.addLog(redeemClaimedFilter.value)
8792
p.addLog(depositFilter.value)
8893
p.addLog(withdrawalFilter.value)
94+
p.addLog(feeCollectedFilter.value)
8995
},
9096
initialize,
9197
process: async (ctx: Context) => {
@@ -106,7 +112,7 @@ export const createOriginARMProcessors = ({
106112
}))
107113
)
108114
}
109-
const getCurrentState = async (block: Block, extra?: { deposit: bigint; withdrawal: bigint }) => {
115+
const getCurrentState = async (block: Block) => {
110116
const stateId = getStateId(block)
111117
if (states[states.length - 1]?.id === stateId) {
112118
return states[states.length - 1]
@@ -147,9 +153,9 @@ export const createOriginARMProcessors = ({
147153
totalAssetsCap,
148154
totalSupply,
149155
assetsPerShare,
150-
totalDeposits: (previousState?.totalDeposits ?? 0n) + (extra?.deposit ?? 0n),
151-
totalWithdrawals: (previousState?.totalWithdrawals ?? 0n) + (extra?.withdrawal ?? 0n),
152-
totalFees: feesAccrued,
156+
totalDeposits: previousState?.totalDeposits ?? 0n,
157+
totalWithdrawals: previousState?.totalWithdrawals ?? 0n,
158+
totalFees: previousState?.totalFees ?? 0n,
153159
totalYield: 0n,
154160
})
155161
armStateEntity.totalYield = calculateTotalYield(armStateEntity)
@@ -159,7 +165,6 @@ export const createOriginARMProcessors = ({
159165
const calculateTotalYield = (state: ArmState) =>
160166
state.totalAssets - state.totalDeposits + state.totalWithdrawals
161167

162-
// ArmWithdrawalRequest
163168
for (const block of ctx.blocks) {
164169
if (tracker(ctx, block)) {
165170
// ArmState
@@ -204,6 +209,7 @@ export const createOriginARMProcessors = ({
204209
dailyStatsMap.set(currentDayId, armDailyStatEntity)
205210
}
206211
for (const log of block.logs) {
212+
// ArmWithdrawalRequest
207213
if (redeemRequestedFilter.matches(log)) {
208214
const event = originLidoArmAbi.events.RedeemRequested.decode(log)
209215
const eventId = `${ctx.chain.id}:${armAddress}:${event.requestId}`
@@ -243,6 +249,11 @@ export const createOriginARMProcessors = ({
243249
state.totalWithdrawals += event.assets
244250
state.totalYield = calculateTotalYield(state)
245251
}
252+
if (feeCollectedFilter.matches(log)) {
253+
const event = originLidoArmAbi.events.FeeCollected.decode(log)
254+
const state = await getCurrentState(block)
255+
state.totalFees += event.fee
256+
}
246257
}
247258
}
248259
await ctx.store.insert(states)

0 commit comments

Comments
 (0)