Skip to content

init eco traders veVirt feature#135

Open
koo-virtuals wants to merge 14 commits intomainfrom
feat/vp-1942
Open

init eco traders veVirt feature#135
koo-virtuals wants to merge 14 commits intomainfrom
feat/vp-1942

Conversation

@koo-virtuals
Copy link
Contributor

@koo-virtuals koo-virtuals commented Jan 5, 2026

Note

High Risk
Touches token custody and staking/voting-power accounting by adding a new claim-and-stake contract and a new lock type inside an upgradeable contract; mistakes could misallocate rewards or break balances/governance power.

Overview
Introduces an eco-trader rewards flow: a new CumulativeMerkleDrop contract verifies cumulative-amount Merkle proofs, tracks cumulativeClaimed, and auto-stakes newly-claimable amounts into veVirtual instead of transferring tokens to users.

Extends veVirtual with a per-user ecoLocks position (auto-renewing, max duration) that is included in balanceOfAt/stakedAmountOf, can be increased via stakeEcoLockFor, and is protected from being modified/withdrawn via the existing lock-management methods.

Adds Hardhat scripts for deploying the drop contract, generating Merkle roots/proofs, and upgrading veVirtual, updates the veVirtual deploy script to grant roles post-deploy, adds eco-trader integration tests, and updates dependencies/lockfiles plus .openzeppelin/base-sepolia.json for new deployments/layouts.

Written by Cursor Bugbot for commit c4af9d7. This will update automatically on new commits. Configure here.

IERC20(baseToken).safeTransferFrom(_msgSender(), address(this), amount);

_increaseEcoLockAmount(account, amount);
}
Copy link

Choose a reason for hiding this comment

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

stakeEcoLockFor lacks access control, allowing unauthorized eco locks

Medium Severity

stakeEcoLockFor has no access control, unlike other privileged functions in the contract that use onlyRole(ADMIN_ROLE). Anyone can call it to create permanent, non-withdrawable eco locks for any account, giving that account unwanted voting power. This also bypasses the merkle proof verification that CumulativeMerkleDrop provides. The function likely needs a role restriction so only authorized contracts (like the merkle drop) can create eco locks.

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable autofix in the Cursor dashboard.

const testEcoLock = await veVirtual.getEcoLock(ethers.ZeroAddress);
console.log("✅ getEcoLock function exists");
} catch (error) {
console.warn("⚠️ getEcoLock function check failed:", error);
Copy link

Choose a reason for hiding this comment

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

Upgrade script references non-existent getEcoLock function

Low Severity

The upgrade verification step calls veVirtual.getEcoLock(ethers.ZeroAddress), but no getEcoLock function exists in the veVirtual contract. The public mapping ecoLocks generates an auto-getter named ecoLocks(address), not getEcoLock. This verification always silently fails (caught by try-catch), making it unable to confirm the upgrade actually included eco lock functionality.

Fix in Cursor Fix in Web

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.

2 participants