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

feat: add modius configs #567

Merged
merged 4 commits into from
Dec 11, 2024
Merged

Conversation

Tanya-atatakai
Copy link
Collaborator

@Tanya-atatakai Tanya-atatakai commented Dec 11, 2024

Proposed changes

Add configs for modius.
Sources used for finding addresses:
https://govern.olas.network/contracts/0x000000000000000000000000534c0a05b6d4d28d5f3630d6d74857b253cf8332
https://github.com/valory-xyz/autonolas-registries/blob/main/docs/configuration.json#L380
https://github.com/valory-xyz/autonolas-governance/blob/main/docs/olas_bridging.md

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)

@@ -19,6 +19,7 @@ const safeChainPrefix = {
[EvmChainId.Base]: 'base',
[EvmChainId.Optimism]: 'oeth',
[EvmChainId.Gnosis]: 'gno',
[EvmChainId.Mode]: 'mode', // TODO: Modius - the above link doesn't have Mode, so the prefix is a guess
Copy link
Collaborator

Choose a reason for hiding this comment

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

bit of a worry that safe.global doesn't support mode..

Comment on lines +133 to +141
const multicallResponse = await multicallProvider.all(contractCalls);
const [rewardsPerSecond, livenessPeriod, tsCheckpoint] = multicallResponse;
const nowInSeconds = Math.floor(Date.now() / 1000);

return Math.max(
rewardsPerSecond * livenessPeriod, // expected rewards
rewardsPerSecond * (nowInSeconds - tsCheckpoint), // incase of late checkpoint
);
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems repetitive now (also few other logics). How about creating a reusable function within the StakedAgentService class that takes arguments and performs the calculation for us?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will update or not based on our discussion on slack

frontend/service/agents/Modius.ts Outdated Show resolved Hide resolved
// Rewards per work period
const rewardsPerWorkPeriod =
Number(formatEther(rewardsPerSecond as bigint)) *
livenessPeriod.toNumber();
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

@Tanya-atatakai Tanya-atatakai merged commit 34ccce4 into feature/modius Dec 11, 2024
3 of 4 checks passed
@Tanya-atatakai Tanya-atatakai deleted the tanya/modius-configs branch December 11, 2024 11:47
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