Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix balance related blockers for migration #612

Merged
merged 10 commits into from
Dec 24, 2024

Conversation

truemiller
Copy link
Collaborator

Proposed changes

  • Fix balance related blockers for migration

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@truemiller truemiller changed the base branch from main to fix/meme-staging December 18, 2024 15:35
Comment on lines 38 to +45
const displayedBalance = useMemo(() => {
// olas across master wallets, safes and eoa
// olas across master wallet -- safes and eoa -- on relevant chains for agent
const masterWalletOlasBalance = masterWalletBalances?.reduce(
(acc, { symbol, balance }) => {
if (symbol === TokenSymbol.OLAS) {
(acc, { symbol, balance, evmChainId }) => {
if (
symbol === TokenSymbol.OLAS &&
selectedAgentConfig.requiresAgentSafesOn.includes(evmChainId)
) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine to aggregate olas across potential chains for display balance

Comment on lines +53 to +59
// olas across all wallets owned by selected service
const serviceWalletOlasBalance = serviceWalletBalances?.reduce(
(acc, { symbol, balance }) => {
if (symbol === TokenSymbol.OLAS) {
(acc, { symbol, balance, evmChainId }) => {
if (
symbol === TokenSymbol.OLAS &&
selectedAgentConfig.requiresAgentSafesOn.includes(evmChainId)
) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensuring we don't calculate funds not on chains irrelevant to the agent

Comment on lines +66 to +71
const requiredOlasDeposit =
requiredStakedOlas -
sum([
masterSafeBalanceOnHomeChain[TokenSymbol.OLAS],
totalStakedOlasBalanceOnHomeChain,
]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this condition, may be breaking due to suspension or eviction
sum allows for null/undefined so don't need to guard here
middleware will migrate funds from the current contract if migration required

Comment on lines 76 to 84
const masterSafeOlasBalance = masterWalletBalances
?.filter((walletBalance) => walletBalance.symbol === TokenSymbol.OLAS)
?.filter(
(walletBalance) =>
walletBalance.symbol === TokenSymbol.OLAS &&
selectedAgentConfig.requiresMasterSafesOn.includes(
walletBalance.evmChainId,
),
)
.reduce((acc, balance) => acc + balance.balance, 0);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found this confusing as funds from base where shown here while on predict

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, fixed in a different PR, please feel free to keep your change in the conflicts.

Comment on lines 76 to 84
const masterSafeOlasBalance = masterWalletBalances
?.filter((walletBalance) => walletBalance.symbol === TokenSymbol.OLAS)
?.filter(
(walletBalance) =>
walletBalance.symbol === TokenSymbol.OLAS &&
selectedAgentConfig.requiresMasterSafesOn.includes(
walletBalance.evmChainId,
),
)
.reduce((acc, balance) => acc + balance.balance, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, fixed in a different PR, please feel free to keep your change in the conflicts.

@truemiller truemiller merged commit 32e7dee into fix/meme-staging Dec 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants