Skip to content

Commit

Permalink
reward distribution fixer action (#1826)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso authored Nov 11, 2024
1 parent 7b1aa84 commit c5640c3
Show file tree
Hide file tree
Showing 19 changed files with 1,310 additions and 59 deletions.
4 changes: 3 additions & 1 deletion packages/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@
"findCategory": "Find a category...",
"finishedAt": "Finished at",
"finishesAt": "Finishes at",
"fixRewardDistributorDescription": "Fix reward distributor on the old version.",
"followTooltip": "Follow this DAO to show it in your feed and receive proposal notifications according to your settings.",
"forceExecuteTooltip": "Ignore form errors and attempt to execute the transaction anyway. The transaction will still be simulated on-chain as a final verification that the actions are valid.",
"forcePublishTooltip": "Ignore form errors and attempt to publish the proposal anyway. The proposal actions will still be simulated on-chain as a final verification that the actions are valid.",
Expand Down Expand Up @@ -1574,7 +1575,7 @@
"winningOptionTooltip": "This is the winning option.",
"withdrawFromRebalancerDescription": "Withdraw funds from the rebalancer.",
"withdrawRewardDistributionDescription": "Withdraw undistributed funds from an existing reward distribution.",
"withdrawRewardDistributionExplanation": "This action withdraws undistributed funds from an active distribution. Rewards that have already been distributed but not yet claimed can still be claimed and will not be withdrawn.",
"withdrawRewardDistributionExplanation": "This action withdraws undistributed funds from a distribution. Rewards that have already been distributed but not yet claimed can still be claimed and will not be withdrawn.",
"withdrawStakingRewards": "Withdraw staking rewards",
"withdrawTokenSwapDescription": "Withdraw funds from a token swap that has not yet completed.",
"wouldYouLikeToSearchQuestion": "Would you like to search for a DAO?",
Expand Down Expand Up @@ -1844,6 +1845,7 @@
"finishSetup": "Finish setup",
"finished": "Finished",
"fixChildAdmin": "Fix {{child}} admin",
"fixRewardDistributor": "Fix Reward Distributor",
"following": "Following",
"fundAndExecute": "Fund and execute",
"fundRebalancer": "Fund Rebalancer",
Expand Down
25 changes: 16 additions & 9 deletions packages/state/query/queries/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,17 @@ export const fetchBlockTimestamp = async ({
/**
* Fetch the native token balance for a given address.
*/
export const fetchNativeBalance = async ({
export const fetchBalance = async ({
chainId,
address,
denom,
}: {
chainId: string
address: string
denom: string
}): Promise<Coin> => {
const client = await stargateClientRouter.connect(chainId)
return await client.getBalance(
address,
getNativeTokenForChainId(chainId).denomOrAddress
)
return await client.getBalance(address, denom)
}

/**
Expand Down Expand Up @@ -1318,12 +1317,20 @@ export const chainQueries = {
queryFn: () => fetchBlockTimestamp(options),
}),
/**
* Fetch the native token balance for a given address.
* Fetch the balance for a given address and denom.
*/
nativeBalance: (options?: Parameters<typeof fetchNativeBalance>[0]) =>
balance: (options: Parameters<typeof fetchBalance>[0]) =>
queryOptions({
queryKey: ['chain', 'nativeBalance', options],
queryFn: options ? () => fetchNativeBalance(options) : skipToken,
queryKey: ['chain', 'balance', options],
queryFn: () => fetchBalance(options),
}),
/**
* Fetch the native token balance for a given address.
*/
nativeBalance: (options: Omit<Parameters<typeof fetchBalance>[0], 'denom'>) =>
chainQueries.balance({
...options,
denom: getNativeTokenForChainId(options.chainId).denomOrAddress,
}),
/**
* Fetch the sum of native tokens staked across all validators.
Expand Down
Loading

0 comments on commit c5640c3

Please sign in to comment.