Skip to content

Commit

Permalink
add view function for withdrawal address
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoshisupra committed Jan 1, 2025
1 parent 3bec7e4 commit f3c57d0
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ module supra_framework::vesting_without_staking {
borrow_global<VestingContract>(vesting_contract_address).vesting_schedule.period_duration
}

#[view]
// Return the `withdrawal_address` of the contract
public fun get_withdrawal_addr(vesting_contract_addr: address): address acquires VestingContract {
borrow_global<VestingContract>(vesting_contract_addr).withdrawal_address
}

#[view]
// Return the `admin` address of the contract
public fun get_contract_admin(vesting_contract_addr: address): address acquires VestingContract {
Expand Down Expand Up @@ -2337,6 +2343,7 @@ module supra_framework::vesting_without_staking {
let vested_amount = 0;
// Because the time is behind the start time, vest will do nothing.
vest(contract_address);
assert!(get_withdrawal_addr(contract_address)==withdrawal_address,98);
assert!(get_contract_admin(contract_address)==admin_address,99);
assert!(coin::balance<SupraCoin>(contract_address) == 1000, 0);
assert!(coin::balance<SupraCoin>(shareholder_address) == vested_amount, 0);
Expand Down

0 comments on commit f3c57d0

Please sign in to comment.