-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fetch rune address to avoid keccak hashed rune address issue fro…
…m logs
- Loading branch information
1 parent
fcf283e
commit 49107c4
Showing
5 changed files
with
58 additions
and
36 deletions.
There are no files selected for viewing
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
24 changes: 0 additions & 24 deletions
24
scripts/rewards-distribution/getLatestRuneAddressByAccount.ts
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Address, PublicClient } from "viem"; | ||
import { stakingV1Abi } from "./generated/abi-types"; | ||
import { ARBITRUM_RFOX_PROXY_CONTRACT_ADDRESS } from "./constants"; | ||
import { StakingInfo } from "./types"; | ||
|
||
export const getStakingInfoByAccount = async ( | ||
publicClient: PublicClient, | ||
accounts: Address[], | ||
blockNumber: bigint, | ||
) => { | ||
const runeAddressByAccount: Record<Address, StakingInfo> = {}; | ||
|
||
// Note we need to query these sequentially until we have higher rate limits | ||
// TODO: Promise.all when we have higher rate limits | ||
for (const account of accounts) { | ||
const [ | ||
stakingBalance, | ||
unstakingBalance, | ||
earnedRewards, | ||
rewardPerTokenStored, | ||
runeAddress, | ||
] = await publicClient.readContract({ | ||
// TODO: dotenv or similar for contract addresses | ||
address: ARBITRUM_RFOX_PROXY_CONTRACT_ADDRESS, | ||
abi: stakingV1Abi, | ||
functionName: "stakingInfo", | ||
args: [account], | ||
blockNumber, | ||
}); | ||
|
||
runeAddressByAccount[account] = { | ||
stakingBalance, | ||
unstakingBalance, | ||
earnedRewards, | ||
rewardPerTokenStored, | ||
runeAddress, | ||
}; | ||
} | ||
|
||
return runeAddressByAccount; | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export type StakingInfo = { | ||
stakingBalance: bigint; | ||
unstakingBalance: bigint; | ||
earnedRewards: bigint; | ||
rewardPerTokenStored: bigint; | ||
runeAddress: string; | ||
}; |