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

[BOOST-5224] feat(evm): add topup functionality to core #367

Open
wants to merge 11 commits into
base: kevin/boost-5204-add-topup-functionality-to-budgets
Choose a base branch
from

Conversation

Quazia
Copy link
Member

@Quazia Quazia commented Jan 15, 2025

Description

This PR introduces a new top-up flow in BoostCore that routes additional tokens into existing incentives, adding topupIncentiveFromBudget (for budget-based tokens) and topupIncentiveFromSender (for user-supplied tokens). Both flows gather all tokens in BoostCore , compute and record protocol fees, and temporarily approve the incentive contract to pull the remainder via its topup function. We remove approval after the transfers. Two things to watch out for in review are that funds can't be pulled out of core if there was a malicious incentive and that all permissions on the budget are respected. Basically we want to avoid loss of funds.

Assumptions:

  • If sending directly the user has already approved BoostCore for ERC20 tokens or setApprovalForAll for ERC1155 tokens .
  • If sending from a budget the user must be permissioned on the budget. Approval isn't needed based on how we handle disbursals.
  • The bytes data_ argument decodes based on the incentives InitPayload struct an example of which is shown below.
  • Protocol fees are only reserved in BoostCore, and may be transferred or settled at a later time.

New Function Signatures

function topupIncentiveFromBudget(
    uint256 boostId,
    uint256 incentiveId,
    bytes calldata data_,
    address budget
) external nonReentrant;

function topupIncentiveFromSender(
    uint256 boostId,
    uint256 incentiveId,
    bytes calldata data_
) external nonReentrant;

Example of Relevant Struct for _data payload

struct InitPayload {
        address asset;
        Strategy strategy;
        uint256 reward;
        uint256 limit;
        address manager;
    }

This param (_data) should be the InitPayload for the incentive being topped up.

Copy link

changeset-bot bot commented Jan 15, 2025

⚠️ No Changeset found

Latest commit: 795b315

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Quazia Quazia changed the base branch from main to kevin/boost-5204-add-topup-functionality-to-budgets January 15, 2025 04:08
@github-actions github-actions bot added the EVM label Jan 15, 2025
@sammccord
Copy link
Contributor

Warnings
⚠️

Are you sure you want to be submitting a change without including a changeset? If you're just changing docs or tests, you probably don't need to. See the publishing section of the README for more info.

Generated by 🚫 dangerJS against 73177a0

1 similar comment
@sammccord
Copy link
Contributor

Warnings
⚠️

Are you sure you want to be submitting a change without including a changeset? If you're just changing docs or tests, you probably don't need to. See the publishing section of the README for more info.

Generated by 🚫 dangerJS against 73177a0

Copy link
Contributor

@topocount topocount left a comment

Choose a reason for hiding this comment

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

@Quazia are there any tests for this one?

@sammccord
Copy link
Contributor

Warnings
⚠️

Are you sure you want to be submitting a change without including a changeset? If you're just changing docs or tests, you probably don't need to. See the publishing section of the README for more info.

Generated by 🚫 dangerJS against 93adba2

@topocount topocount force-pushed the arthur/boost-5224-add-topup-functionality-to-core branch from 93adba2 to 8d0633b Compare January 15, 2025 20:45
@sammccord
Copy link
Contributor

Warnings
⚠️

Are you sure you want to be submitting a change without including a changeset? If you're just changing docs or tests, you probably don't need to. See the publishing section of the README for more info.

Generated by 🚫 dangerJS against 8d0633b

@topocount topocount force-pushed the arthur/boost-5224-add-topup-functionality-to-core branch from 8d0633b to b5ee7b5 Compare January 15, 2025 20:47
@sammccord
Copy link
Contributor

Warnings
⚠️

Are you sure you want to be submitting a change without including a changeset? If you're just changing docs or tests, you probably don't need to. See the publishing section of the README for more info.

Generated by 🚫 dangerJS against b5ee7b5

@sammccord
Copy link
Contributor

Warnings
⚠️

Are you sure you want to be submitting a change without including a changeset? If you're just changing docs or tests, you probably don't need to. See the publishing section of the README for more info.

Generated by 🚫 dangerJS against 795b315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants