forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AptosFramework] add mint/transfer smoke test
- Loading branch information
Showing
5 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use diem_transaction_builder::aptos_stdlib; | ||
use forge::{AptosContext, AptosTest, Result, Test}; | ||
|
||
pub struct MintTransfer; | ||
|
||
impl Test for MintTransfer { | ||
fn name(&self) -> &'static str { | ||
"smoke-test::aptos::mint-transfer" | ||
} | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl AptosTest for MintTransfer { | ||
async fn run<'t>(&self, ctx: &mut AptosContext<'t>) -> Result<()> { | ||
let mut account1 = ctx.random_account(); | ||
ctx.create_user_account(account1.public_key()).await?; | ||
let account2 = ctx.random_account(); | ||
ctx.create_user_account(account2.public_key()).await?; | ||
|
||
ctx.mint(account1.address(), 1000).await?; | ||
|
||
let transfer_txn = | ||
account1.sign_with_transaction_builder(ctx.transaction_factory().payload( | ||
aptos_stdlib::encode_transfer_script_function(account2.address(), 400), | ||
)); | ||
ctx.client().submit_and_wait(&transfer_txn).await?; | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
|
||
mod account_creation; | ||
pub use account_creation::*; | ||
mod mint_transfer; | ||
pub use mint_transfer::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters