Skip to content

Commit

Permalink
aptos-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
so-kkroy22 committed Oct 24, 2024
1 parent 86ed3d1 commit a76d469
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1121,9 +1121,9 @@ pub enum EntryFunctionCall {

VestingWithoutStakingCreateVestingContractWithAmounts {
shareholders: Vec<AccountAddress>,
amounts: Vec<u64>,
schedule_numerator: Vec<u64>,
schedule_denominator: u64,
shares: Vec<u64>,
vesting_numerators: Vec<u64>,
vesting_denominator: u64,
start_timestamp_secs: u64,
period_duration: u64,
withdrawal_address: AccountAddress,
Expand Down Expand Up @@ -1850,18 +1850,18 @@ impl EntryFunctionCall {
},
VestingWithoutStakingCreateVestingContractWithAmounts {
shareholders,
amounts,
schedule_numerator,
schedule_denominator,
shares,
vesting_numerators,
vesting_denominator,
start_timestamp_secs,
period_duration,
withdrawal_address,
contract_creation_seed,
} => vesting_without_staking_create_vesting_contract_with_amounts(
shareholders,
amounts,
schedule_numerator,
schedule_denominator,
shares,
vesting_numerators,
vesting_denominator,
start_timestamp_secs,
period_duration,
withdrawal_address,
Expand Down Expand Up @@ -5068,9 +5068,9 @@ pub fn vesting_without_staking_admin_withdraw(

pub fn vesting_without_staking_create_vesting_contract_with_amounts(
shareholders: Vec<AccountAddress>,
amounts: Vec<u64>,
schedule_numerator: Vec<u64>,
schedule_denominator: u64,
shares: Vec<u64>,
vesting_numerators: Vec<u64>,
vesting_denominator: u64,
start_timestamp_secs: u64,
period_duration: u64,
withdrawal_address: AccountAddress,
Expand All @@ -5088,9 +5088,9 @@ pub fn vesting_without_staking_create_vesting_contract_with_amounts(
vec![],
vec![
bcs::to_bytes(&shareholders).unwrap(),
bcs::to_bytes(&amounts).unwrap(),
bcs::to_bytes(&schedule_numerator).unwrap(),
bcs::to_bytes(&schedule_denominator).unwrap(),
bcs::to_bytes(&shares).unwrap(),
bcs::to_bytes(&vesting_numerators).unwrap(),
bcs::to_bytes(&vesting_denominator).unwrap(),
bcs::to_bytes(&start_timestamp_secs).unwrap(),
bcs::to_bytes(&period_duration).unwrap(),
bcs::to_bytes(&withdrawal_address).unwrap(),
Expand Down Expand Up @@ -7069,9 +7069,9 @@ mod decoder {
Some(
EntryFunctionCall::VestingWithoutStakingCreateVestingContractWithAmounts {
shareholders: bcs::from_bytes(script.args().get(0)?).ok()?,
amounts: bcs::from_bytes(script.args().get(1)?).ok()?,
schedule_numerator: bcs::from_bytes(script.args().get(2)?).ok()?,
schedule_denominator: bcs::from_bytes(script.args().get(3)?).ok()?,
shares: bcs::from_bytes(script.args().get(1)?).ok()?,
vesting_numerators: bcs::from_bytes(script.args().get(2)?).ok()?,
vesting_denominator: bcs::from_bytes(script.args().get(3)?).ok()?,
start_timestamp_secs: bcs::from_bytes(script.args().get(4)?).ok()?,
period_duration: bcs::from_bytes(script.args().get(5)?).ok()?,
withdrawal_address: bcs::from_bytes(script.args().get(6)?).ok()?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ Create a vesting schedule with the given schedule of distributions, a vesting st



<pre><code><b>public</b> entry <b>fun</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_with_amounts">create_vesting_contract_with_amounts</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, shareholders: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<b>address</b>&gt;, amounts: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, schedule_numerator: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, schedule_denominator: u64, start_timestamp_secs: u64, period_duration: u64, withdrawal_address: <b>address</b>, contract_creation_seed: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;)
<pre><code><b>public</b> entry <b>fun</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_with_amounts">create_vesting_contract_with_amounts</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, shareholders: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<b>address</b>&gt;, shares: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, vesting_numerators: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, vesting_denominator: u64, start_timestamp_secs: u64, period_duration: u64, withdrawal_address: <b>address</b>, contract_creation_seed: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;)
</code></pre>


Expand All @@ -1126,21 +1126,21 @@ Create a vesting schedule with the given schedule of distributions, a vesting st
<pre><code><b>public</b> entry <b>fun</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_with_amounts">create_vesting_contract_with_amounts</a> (
admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>,
shareholders: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<b>address</b>&gt;,
amounts: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
schedule_numerator: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
schedule_denominator: u64,
shares: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
vesting_numerators: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
vesting_denominator: u64,
start_timestamp_secs: u64,
period_duration: u64,
withdrawal_address: <b>address</b>,
contract_creation_seed: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;,
) <b>acquires</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_AdminStore">AdminStore</a> {
<b>assert</b>!(!<a href="system_addresses.md#0x1_system_addresses_is_reserved_address">system_addresses::is_reserved_address</a>(withdrawal_address),
<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_WITHDRAWAL_ADDRESS">EINVALID_WITHDRAWAL_ADDRESS</a>),);
assert_account_is_registered_for_apt(withdrawal_address);
assert_account_is_registered_for_supra(withdrawal_address);
<b>assert</b>!(<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shareholders) &gt; 0,
<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_ENO_SHAREHOLDERS">ENO_SHAREHOLDERS</a>));
<b>assert</b>!(
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shareholders) == <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&amounts),
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shareholders) == <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shares),
<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_ESHARES_LENGTH_MISMATCH">ESHARES_LENGTH_MISMATCH</a>),
);

Expand All @@ -1160,15 +1160,15 @@ Create a vesting schedule with the given schedule of distributions, a vesting st
<b>let</b> (contract_signer, contract_signer_cap) = <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_account">create_vesting_contract_account</a>(admin,
contract_creation_seed);
<b>let</b> contract_signer_address = <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of">signer::address_of</a>(&contract_signer);
<b>let</b> schedule = <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_map_ref">vector::map_ref</a>(&schedule_numerator, |numerator| {
<b>let</b> <a href="event.md#0x1_event">event</a> = <a href="../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_create_from_rational">fixed_point32::create_from_rational</a>(*numerator, schedule_denominator);
<b>let</b> schedule = <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_map_ref">vector::map_ref</a>(&vesting_numerators, |numerator| {
<b>let</b> <a href="event.md#0x1_event">event</a> = <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);
<a href="event.md#0x1_event">event</a>
});

<b>let</b> vesting_schedule = <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_schedule">create_vesting_schedule</a>(schedule, start_timestamp_secs, period_duration);
<b>let</b> shareholders_map = <a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_create">simple_map::create</a>&lt;<b>address</b>, <a href="vesting_without_staking.md#0x1_vesting_without_staking_VestingRecord">VestingRecord</a>&gt;();
<b>let</b> grant_amount = 0;
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_for_each_reverse">vector::for_each_reverse</a>(amounts, |amount| {
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_for_each_reverse">vector::for_each_reverse</a>(shares, |amount| {
<b>let</b> shareholder = <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_pop_back">vector::pop_back</a>(&<b>mut</b> shareholders);
<a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_add">simple_map::add</a>(&<b>mut</b> shareholders_map,
shareholder,
Expand Down

0 comments on commit a76d469

Please sign in to comment.