@@ -1342,6 +1342,10 @@ Create a vesting schedule with the given schedule of distributions, a vesting st
13421342 sum != 0,
13431343 <a href =" ../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument " >error::invalid_argument</a >(<a href =" vesting_without_staking.md#0x1_vesting_without_staking_EINVALID_VESTING_SCHEDULE " >EINVALID_VESTING_SCHEDULE</a >),
13441344 );
1345+ <b >assert</b >!(
1346+ sum < ; = denominator,
1347+ <a href =" ../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument " >error::invalid_argument</a >(<a href =" vesting_without_staking.md#0x1_vesting_without_staking_EINVALID_VESTING_SCHEDULE " >EINVALID_VESTING_SCHEDULE</a >)
1348+ );
13451349 <b >assert</b >!(
13461350 denominator != 0,
13471351 <a href =" ../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument " >error::invalid_argument</a >(<a href =" vesting_without_staking.md#0x1_vesting_without_staking_EINVALID_VESTING_SCHEDULE " >EINVALID_VESTING_SCHEDULE</a >),
@@ -1717,9 +1721,6 @@ Unlock any vested portion of the grant.
17171721
17181722 <b >if</b > (last_completed_period > ; = next_period_to_vest && vesting_record.left_amount != 0) {
17191723 <b >let</b > final_fraction = *<a href =" ../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_borrow " >vector::borrow</a >(schedule, <a href =" ../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length " >vector::length</a >(schedule) - 1);
1720- <b >let</b > final_fraction_amount = <a href =" ../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_multiply_u64 " >fixed_point32::multiply_u64</a >(
1721- vesting_record.init_amount, final_fraction
1722- );
17231724 // Determine how many periods is needed based on the left_amount
17241725 periods_fast_forward = last_completed_period - next_period_to_vest + 1;
17251726 <b >let</b > added_fraction = <a href =" ../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_multiply_u64_return_fixpoint32 " >fixed_point32::multiply_u64_return_fixpoint32</a >(
@@ -1731,10 +1732,6 @@ Unlock any vested portion of the grant.
17311732 );
17321733
17331734 };
1734- <b >let</b > total_vesting_fraction_amount = <a href =" ../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_multiply_u64 " >fixed_point32::multiply_u64</a >(
1735- vesting_record.init_amount,
1736- total_vesting_fraction,
1737- );
17381735 // We don't need <b >to</b > check vesting_record.left_amount > ; 0 because vest_transfer will handle that.
17391736 <b >let</b > transfer_happened = <a href =" vesting_without_staking.md#0x1_vesting_without_staking_vest_transfer " >vest_transfer</a >(
17401737 vesting_record, signer_cap, beneficiary, total_vesting_fraction
@@ -1794,14 +1791,12 @@ Unlock any vested portion of the grant.
17941791 vesting_record.left_amount,
17951792 <a href =" ../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_multiply_u64 " >fixed_point32::multiply_u64</a >(vesting_record.init_amount, vesting_fraction),
17961793 );
1797- <b >let</b > result =
17981794 <b >if</b > (amount > ; 0) {
17991795 //<b >update</b > left_amount for the shareholder
18001796 vesting_record.left_amount = vesting_record.left_amount - amount;
18011797 <a href =" coin.md#0x1_coin_transfer " >coin::transfer</a >< ; SupraCoin> ; (&vesting_signer, beneficiary, amount);
18021798 <b >true</b >
1803- } <b >else</b > { <b >false</b > };
1804- result
1799+ } <b >else</b > { <b >false</b > }
18051800}
18061801</code ></pre >
18071802
@@ -1841,9 +1836,7 @@ Unlock any vested portion of the grant.
18411836 <b >let</b > schedule = <a href =" ../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_map_ref " >vector::map_ref</a >(
18421837 &vesting_numerators,
18431838 |numerator| {
1844- <b >let</b > e =
1845- <a href =" ../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_create_from_rational " >fixed_point32::create_from_rational</a >(*numerator, vesting_denominator);
1846- e
1839+ <a href =" ../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_create_from_rational " >fixed_point32::create_from_rational</a >(*numerator, vesting_denominator)
18471840 },
18481841 );
18491842
@@ -1859,7 +1852,6 @@ Unlock any vested portion of the grant.
18591852 msrecord.last_vested_period * old_period_duration
18601853 ) / period_duration;
18611854 msrecord.last_vested_period = new_last_vested_period;
1862- msrecord.last_vested_period = new_last_vested_period;
18631855 },
18641856 );
18651857 vesting_contract.shareholders = <a href =" ../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_new_from " >simple_map::new_from</a >(keys, values);
0 commit comments