Skip to content

Pull Request: Delegated Voting Rights Transfer within Vault (#105, #52)#156

Merged
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom
elizabetheonoja-art:feature/delegated-voting-rights-105-52
Mar 23, 2026
Merged

Pull Request: Delegated Voting Rights Transfer within Vault (#105, #52)#156
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom
elizabetheonoja-art:feature/delegated-voting-rights-105-52

Conversation

@elizabetheonoja-art
Copy link
Copy Markdown

📝 Description
This PR introduces a Delegated Voting mechanism to the Vesting Vault. It allows beneficiaries to decouple their economic interest (the locked tokens) from their governance power (the voting rights).

By implementing delegate_voting_power, users can empower a representative to vote on their behalf in associated DAOs without requiring the tokens to be unlocked or moved, maintaining the integrity of the vesting schedule.

🎯 Key Changes
Storage Mapping: Created a persistent Mapping<Address, Address> (Beneficiary -> Representative) to track delegations.

Delegation Logic: Added the delegate_voting_power(e: Env, representative: Address) function with signature verification for the beneficiary.

DAO Integration Hook: Added a get_voting_power(e: Env, address: Address) helper. This function checks if any beneficiaries have delegated to the queried address and returns the cumulative balance.

Event Emission: Added a DelegateChanged event to allow off-chain indexers to track governance shifts in real-time.

💻 Implementation Logic
The core logic ensures that the representative is credited with the voting weight while the beneficiary retains ownership of the underlying assets:

Rust
pub fn delegate_voting_power(e: Env, beneficiary: Address, representative: Address) {
beneficiary.require_auth();

// Update the delegation mapping
e.storage().instance().set(&DataKey::Delegate(beneficiary.clone()), &representative);

// Emit event for transparency
e.events().publish(
    (symbol_short!("GOV"), symbol_short!("DELEGATE")),
    (beneficiary, representative)
);

}
✅ Acceptance Criteria Checklist
[x] Mapping Implementation: Successfully stores and retrieves Representative addresses.

[x] Query Logic: The vault correctly reports cumulative balances to representatives when queried by DAO contracts.

[x] Security: Only the beneficiary can change their own delegate.

[x] Standard Alignment: Follows industry standards for non-custodial voting delegation.

🚀 How to Verify
Test Delegation: Call delegate_voting_power from Account A to Account B.

Verify Weight: Call get_voting_power for Account B; it should reflect Account A’s locked balance.

Run Suite: cargo test to ensure no regressions in the core vesting logic.

🔗 Linked Issues
Closes #105
Closes #52

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 23, 2026

@elizabetheonoja-art Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@elizabetheonoja-art elizabetheonoja-art force-pushed the feature/delegated-voting-rights-105-52 branch from c98e8f2 to accc5bc Compare March 23, 2026 18:11
@JerryIdoko JerryIdoko merged commit 0beb3e7 into Vesting-Vault:main Mar 23, 2026
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.

#52. Add Delegated_Voting_Rights_Transfer within Vault

3 participants