Skip to content

Commit

Permalink
finite supply supra_coin e2e move tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoshisupra committed May 16, 2024
1 parent bc68049 commit 11897a4
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ retries = 3
status-level = "skip"
failure-output = "immediate-final"
junit = { path = "junit.xml" }


Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ impl<'a> AptosTestAdapter<'a> {
let txn = RawTransaction::new(
aptos_test_root_address(),
parameters.sequence_number + 1,
aptos_cached_packages::aptos_stdlib::aptos_coin_mint(account_addr, amount),
aptos_cached_packages::aptos_stdlib::supra_coin_mint(account_addr, amount),
parameters.max_gas_amount,
parameters.gas_unit_price,
parameters.expiration_timestamp_secs,
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/e2e-testsuite/src/tests/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn mint_to_new_account() {
let mint_amount = 1_000_000;
let txn = root
.transaction()
.payload(aptos_stdlib::aptos_coin_mint(
.payload(aptos_stdlib::supra_coin_mint(
*new_account.address(),
mint_amount,
))
Expand Down
4 changes: 2 additions & 2 deletions aptos-move/framework/supra-framework/doc/supra_coin.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Account does not have mint capability
Max supply of Supra Coin to be 100 billion with 8 decimal places fraction


<pre><code><b>const</b> <a href="supra_coin.md#0x1_supra_coin_MAX_SUPRA_COIN_SUPPLY">MAX_SUPRA_COIN_SUPPLY</a>: u128 = 340282366920938463463374607431768211455;
<pre><code><b>const</b> <a href="supra_coin.md#0x1_supra_coin_MAX_SUPRA_COIN_SUPPLY">MAX_SUPRA_COIN_SUPPLY</a>: u128 = 10000000000000000000;
</code></pre>


Expand Down Expand Up @@ -316,7 +316,7 @@ accounts.
// Mint the core resource <a href="account.md#0x1_account">account</a> <a href="supra_coin.md#0x1_supra_coin_SupraCoin">SupraCoin</a> for gas so it can execute system transactions.
<a href="coin.md#0x1_coin_register">coin::register</a>&lt;<a href="supra_coin.md#0x1_supra_coin_SupraCoin">SupraCoin</a>&gt;(core_resources);
<b>let</b> coins = <a href="coin.md#0x1_coin_mint">coin::mint</a>&lt;<a href="supra_coin.md#0x1_supra_coin_SupraCoin">SupraCoin</a>&gt;(
18446744073709551615,
((<a href="supra_coin.md#0x1_supra_coin_MAX_SUPRA_COIN_SUPPLY">MAX_SUPRA_COIN_SUPPLY</a>)/10 <b>as</b> u64),
&mint_cap,
);
<a href="coin.md#0x1_coin_deposit">coin::deposit</a>&lt;<a href="supra_coin.md#0x1_supra_coin_SupraCoin">SupraCoin</a>&gt;(<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of">signer::address_of</a>(core_resources), coins);
Expand Down
6 changes: 3 additions & 3 deletions aptos-move/framework/supra-framework/sources/supra_coin.move
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module supra_framework::supra_coin {


/// Max supply of Supra Coin to be 100 billion with 8 decimal places fraction
//const MAX_SUPRA_COIN_SUPPLY: u128 = 100_000_000_000_00_000_000u128;
const MAX_SUPRA_COIN_SUPPLY: u128 = 340282366920938463463374607431768211455u128;
const MAX_SUPRA_COIN_SUPPLY: u128 = 100_000_000_000_00_000_000u128;
//const MAX_SUPRA_COIN_SUPPLY: u128 = 340282366920938463463374607431768211455u128;
/// Account does not have mint capability
const ENO_CAPABILITIES: u64 = 1;
/// Mint capability has already been delegated to this specified address
Expand Down Expand Up @@ -85,7 +85,7 @@ module supra_framework::supra_coin {
// Mint the core resource account SupraCoin for gas so it can execute system transactions.
coin::register<SupraCoin>(core_resources);
let coins = coin::mint<SupraCoin>(
18446744073709551615,
((MAX_SUPRA_COIN_SUPPLY)/10 as u64),
&mint_cap,
);
coin::deposit<SupraCoin>(signer::address_of(core_resources), coins);
Expand Down
8 changes: 4 additions & 4 deletions aptos-move/vm-genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub fn encode_aptos_mainnet_genesis_transaction(
&gas_schedule,
);
initialize_features(&mut session);
initialize_aptos_coin(&mut session);
initialize_supra_coin(&mut session);
initialize_on_chain_governance(&mut session, genesis_config);
create_accounts(&mut session, accounts);
create_employee_validators(&mut session, employees, genesis_config);
Expand Down Expand Up @@ -248,7 +248,7 @@ pub fn encode_genesis_change_set(
if genesis_config.is_test {
initialize_core_resources_and_supra_coin(&mut session, core_resources_key);
} else {
initialize_aptos_coin(&mut session);
initialize_supra_coin(&mut session);
}
initialize_on_chain_governance(&mut session, genesis_config);
create_and_initialize_validators(&mut session, validators);
Expand Down Expand Up @@ -482,11 +482,11 @@ fn initialize_features(session: &mut SessionExt) {
);
}

fn initialize_aptos_coin(session: &mut SessionExt) {
fn initialize_supra_coin(session: &mut SessionExt) {
exec_function(
session,
GENESIS_MODULE_NAME,
"initialize_aptos_coin",
"initialize_supra_coin",
vec![],
serialize_values(&vec![MoveValue::Signer(CORE_CODE_ADDRESS)]),
);
Expand Down
4 changes: 2 additions & 2 deletions crates/aptos-faucet/core/src/funder/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl MintFunder {
let faucet_account = self.faucet_account.write().await;
client
.submit_and_wait(&faucet_account.sign_with_transaction_builder(
transaction_factory.payload(aptos_stdlib::aptos_coin_delegate_mint_capability(
transaction_factory.payload(aptos_stdlib::supra_coin_delegate_mint_capability(
delegated_account.address(),
)),
))
Expand All @@ -184,7 +184,7 @@ impl MintFunder {
// Claim the capability!
client
.submit_and_wait(&delegated_account.sign_with_transaction_builder(
transaction_factory.payload(aptos_stdlib::aptos_coin_claim_mint_capability()),
transaction_factory.payload(aptos_stdlib::supra_coin_claim_mint_capability()),
))
.await
.context("Failed to claim the minting capability")?;
Expand Down
2 changes: 1 addition & 1 deletion crates/indexer/src/models/coin_models/coin_activities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use aptos_api_types::{
Event as APIEvent, Transaction as APITransaction, TransactionInfo as APITransactionInfo,
TransactionPayload, UserTransactionRequest, WriteSetChange as APIWriteSetChange,
};
use aptos_types::APTOS_COIN_TYPE;
use aptos_types::SUPRA_COIN_TYPE;
use bigdecimal::BigDecimal;
use field_count::FieldCount;
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion crates/indexer/src/processors/coin_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{
schema,
};
use aptos_api_types::Transaction as APITransaction;
use aptos_types::APTOS_COIN_TYPE;
use aptos_types::SUPRA_COIN_TYPE;
use async_trait::async_trait;
use diesel::{pg::upsert::excluded, result::Error, ExpressionMethods, PgConnection};
use field_count::FieldCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl<'t> AccountMinter<'t> {
let txn = self
.source_account
.sign_with_transaction_builder(self.txn_factory.payload(
aptos_stdlib::aptos_coin_mint(self.source_account.address(), amount),
aptos_stdlib::supra_coin_mint(self.source_account.address(), amount),
));

if let Err(e) = txn_executor.execute_transactions(&[txn]).await {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl TransactionFactory {
}

pub fn mint(&self, to: AccountAddress, amount: u64) -> TransactionBuilder {
self.payload(aptos_stdlib::aptos_coin_mint(to, amount))
self.payload(aptos_stdlib::supra_coin_mint(to, amount))
}

//
Expand Down

0 comments on commit 11897a4

Please sign in to comment.