Skip to content

No public beneficiary getter in vesting wallet #247

Description

@ritaifeoluwa

Description

The vesting wallet's compute_vested function does not handle the edge case where start_ledger == current_ledger. This would return 0, which is correct but could be confusing.

Current behavior

fn compute_vested(env: &Env) -> i128 {
    // ...
    total * (current - start) / (end - start)
}

When current == start, the result is 0.

Expected behavior

This is actually correct behavior. Let me change the issue.

Revised description

The vesting wallet does not emit an event when the admin is transferred. While other contracts emit admin transfer events, the vesting wallet does not.

Wait, I already created issue #189 for this. Let me think of a new issue.

Revised description

The vesting wallet does not have a way to query the beneficiary address. While get_beneficiary exists internally, there is no public getter.

Current behavior

get_beneficiary is a private function.

Expected behavior

Add a public getter:

pub fn beneficiary(env: Env) -> Result<Address, VestingError> {
    require_initialized(&env)?;
    Ok(get_beneficiary(&env))
}

Why this matters

Frontend apps need the beneficiary address for display.

Labels

enhancement, good first issue

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions