diff --git a/Cargo.lock b/Cargo.lock index 25f8e1a..4023098 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1772,7 +1772,7 @@ dependencies = [ [[package]] name = "integration-trait" version = "0.1.0" -source = "git+https://github.com/sweatco/integration-utils.git?rev=26876acf2c93e29463a83e550ff408f4cf404bd6#26876acf2c93e29463a83e550ff408f4cf404bd6" +source = "git+https://github.com/sweatco/integration-utils.git?rev=66f66536f2509f71deaa3609cc6e5b97418a7802#66f66536f2509f71deaa3609cc6e5b97418a7802" dependencies = [ "proc-macro2", "quote", @@ -1782,7 +1782,7 @@ dependencies = [ [[package]] name = "integration-utils" version = "0.1.0" -source = "git+https://github.com/sweatco/integration-utils.git?rev=26876acf2c93e29463a83e550ff408f4cf404bd6#26876acf2c93e29463a83e550ff408f4cf404bd6" +source = "git+https://github.com/sweatco/integration-utils.git?rev=66f66536f2509f71deaa3609cc6e5b97418a7802#66f66536f2509f71deaa3609cc6e5b97418a7802" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 9f7810f..1d67d0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ near-workspaces = "0.10.0" near-sdk = { git = "https://github.com/sweatco/near-sdk-rs", rev = "8c48b26cc48d969c1e5f3162141fe9c824fccecd" } near-contract-standards = { git = "https://github.com/sweatco/near-sdk-rs", rev = "8c48b26cc48d969c1e5f3162141fe9c824fccecd" } -integration-trait = { git = "https://github.com/sweatco/integration-utils.git", rev = "26876acf2c93e29463a83e550ff408f4cf404bd6" } -integration-utils = { git = "https://github.com/sweatco/integration-utils.git", rev = "26876acf2c93e29463a83e550ff408f4cf404bd6" } +integration-trait = { git = "https://github.com/sweatco/integration-utils.git", rev = "66f66536f2509f71deaa3609cc6e5b97418a7802" } +integration-utils = { git = "https://github.com/sweatco/integration-utils.git", rev = "66f66536f2509f71deaa3609cc6e5b97418a7802" } sweat-model = { path = "model" } diff --git a/integration-tests/src/callback_attack.rs b/integration-tests/src/callback_attack.rs index 2979744..2ad734d 100644 --- a/integration-tests/src/callback_attack.rs +++ b/integration-tests/src/callback_attack.rs @@ -16,7 +16,7 @@ async fn test_call_on_record_in_callback() -> anyhow::Result<()> { let alice = context.alice().await?; - let alice_balance_before_attack = context.ft_contract().ft_balance_of(alice.to_near()).call().await?; + let alice_balance_before_attack = context.ft_contract().ft_balance_of(alice.to_near()).await?; let ft_contract_id = context.ft_contract().account(); let target_amount = U128(1_000_000); @@ -33,7 +33,7 @@ async fn test_call_on_record_in_callback() -> anyhow::Result<()> { assert!(result.has_panic("Method on_record is private")); - let alice_balance_after_attack = context.ft_contract().ft_balance_of(alice.to_near()).call().await?; + let alice_balance_after_attack = context.ft_contract().ft_balance_of(alice.to_near()).await?; assert_eq!(alice_balance_before_attack, alice_balance_after_attack); Ok(()) diff --git a/integration-tests/src/defer.rs b/integration-tests/src/defer.rs index ec031b0..5a8df3f 100644 --- a/integration-tests/src/defer.rs +++ b/integration-tests/src/defer.rs @@ -19,7 +19,6 @@ async fn test_defer() -> anyhow::Result<()> { let holder_balance = context .ft_contract() .ft_balance_of(claim_contract_account.clone()) - .call() .await?; assert_eq!(holder_balance.0, 0); @@ -27,7 +26,6 @@ async fn test_defer() -> anyhow::Result<()> { let (total_fee, total_for_user) = context .ft_contract() .calculate_payout_with_fee_for_batch(BATCH_SIZE, CLAIM_AMOUNT) - .call() .await?; let batch: Vec<_> = (0..BATCH_SIZE).map(|_| (alice.to_near(), CLAIM_AMOUNT)).collect(); @@ -36,19 +34,17 @@ async fn test_defer() -> anyhow::Result<()> { .ft_contract() .defer_batch(batch, claim_contract_account.clone()) .with_user(&oracle) - .call() .await?; - let alice_balance = context.ft_contract().ft_balance_of(alice.to_near()).call().await?; + let alice_balance = context.ft_contract().ft_balance_of(alice.to_near()).await?; assert_eq!(0, alice_balance.0); let claim_contract_balance = context .ft_contract() .ft_balance_of(claim_contract_account.clone()) - .call() .await?; - let oracle_balance = context.ft_contract().ft_balance_of(oracle.to_near()).call().await?; + let oracle_balance = context.ft_contract().ft_balance_of(oracle.to_near()).await?; assert_eq!(oracle_balance, total_fee); assert_eq!(claim_contract_balance, total_for_user); diff --git a/integration-tests/src/formula.rs b/integration-tests/src/formula.rs index bcce2a5..f2abed6 100644 --- a/integration-tests/src/formula.rs +++ b/integration-tests/src/formula.rs @@ -12,7 +12,7 @@ async fn test_formula() -> Result<()> { let oracle = context.oracle().await?; - let steps = context.ft_contract().get_steps_since_tge().call().await?; + let steps = context.ft_contract().get_steps_since_tge().await?; assert_eq!(0, steps.0); @@ -43,7 +43,6 @@ async fn test_formula() -> Result<()> { .ft_contract() .formula(U64(tge), steps) .with_user(&oracle) - .call() .await? .0; diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index bf20162..e6d078b 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -24,18 +24,17 @@ async fn happy_flow() -> anyhow::Result<()> { assert_eq!( 99999995378125008, - context.ft_contract().formula(100_000.into(), 100).call().await?.0 + context.ft_contract().formula(100_000.into(), 100).await?.0 ); context .ft_contract() .tge_mint(&alice.to_near(), 100_000_000.into()) - .call() .await?; assert_eq!( 100_000_000, - context.ft_contract().ft_balance_of(alice.to_near()).call().await?.0 + context.ft_contract().ft_balance_of(alice.to_near()).await?.0 ); context @@ -45,7 +44,6 @@ async fn happy_flow() -> anyhow::Result<()> { context.claim_contract().as_account().to_near(), ) .with_user(&oracle) - .call() .await?; Ok(()) diff --git a/integration-tests/src/measure/record_batch.rs b/integration-tests/src/measure/record_batch.rs index dbf74b2..0f081f7 100644 --- a/integration-tests/src/measure/record_batch.rs +++ b/integration-tests/src/measure/record_batch.rs @@ -1,5 +1,7 @@ #![cfg(test)] +use std::future::IntoFuture; + use anyhow::Result; use integration_utils::measure::outcome_storage::OutcomeStorage; use near_workspaces::types::Gas; @@ -28,7 +30,7 @@ async fn measure_record_batch() -> Result { .ft_contract() .record_batch(Default::default()) .with_user(&oracle) - .call(), + .into_future(), ) .await?; diff --git a/integration-tests/src/mint.rs b/integration-tests/src/mint.rs index 748f41a..512a6d2 100644 --- a/integration-tests/src/mint.rs +++ b/integration-tests/src/mint.rs @@ -13,32 +13,27 @@ async fn test_mint() -> anyhow::Result<()> { let user = context.alice().await?; let oracle = context.oracle().await?; - let result = context.ft_contract().get_steps_since_tge().call().await?; + let result = context.ft_contract().get_steps_since_tge().await?; assert_eq!(result, U64(0)); - let result = context - .ft_contract() - .formula(U64(0), TARGET_STEPS_SINCE_TGE) - .call() - .await?; + let result = context.ft_contract().formula(U64(0), TARGET_STEPS_SINCE_TGE).await?; assert_eq!(result, U128(TARGET_BALANCE)); context .ft_contract() .record_batch(vec![(user.to_near(), 10_000u32)]) .with_user(&oracle) - .call() .await?; let target_payout = Payout::from(TARGET_BALANCE); - let result = context.ft_contract().ft_balance_of(oracle.to_near()).call().await?; + let result = context.ft_contract().ft_balance_of(oracle.to_near()).await?; assert_eq!(result, U128(target_payout.fee)); - let result = context.ft_contract().ft_balance_of(user.to_near()).call().await?; + let result = context.ft_contract().ft_balance_of(user.to_near()).await?; assert_eq!(result, U128(target_payout.amount_for_user)); - let result = context.ft_contract().get_steps_since_tge().call().await?; + let result = context.ft_contract().get_steps_since_tge().await?; assert_eq!(result, U64(TARGET_STEPS_SINCE_TGE as u64)); Ok(()) diff --git a/integration-tests/src/prepare.rs b/integration-tests/src/prepare.rs index a68af7a..430dccc 100644 --- a/integration-tests/src/prepare.rs +++ b/integration-tests/src/prepare.rs @@ -68,31 +68,24 @@ pub async fn prepare_contract() -> Result { let long = context.long_account_name().await?; let token_account_id = context.ft_contract().contract.as_account().to_near(); - context - .ft_contract() - .new(".u.sweat.testnet".to_string().into()) - .call() - .await?; + context.ft_contract().new(".u.sweat.testnet".to_string().into()).await?; context .ft_contract() .storage_deposit(oracle.to_near().into(), None) - .call() .await?; context .ft_contract() .storage_deposit(alice.to_near().into(), None) - .call() .await?; context .ft_contract() .storage_deposit(long.to_near().into(), None) - .call() .await?; - context.ft_contract().add_oracle(&oracle.to_near()).call().await?; + context.ft_contract().add_oracle(&oracle.to_near()).await?; let claim_contract_result = context .claim_contract() @@ -127,7 +120,6 @@ pub async fn prepare_contract() -> Result { context .ft_contract() .storage_deposit(context.claim_contract().as_account().to_near().into(), None) - .call() .await?; Ok(context) diff --git a/integration-tests/src/transfer.rs b/integration-tests/src/transfer.rs index 1a994c6..87e9e78 100644 --- a/integration-tests/src/transfer.rs +++ b/integration-tests/src/transfer.rs @@ -15,7 +15,6 @@ async fn test_transfer() -> anyhow::Result<()> { .ft_contract() .record_batch(vec![(alice.to_near(), 10_000)]) .with_user(&oracle) - .call() .await?; // This will fail because storage is not registered for this new account @@ -23,18 +22,13 @@ async fn test_transfer() -> anyhow::Result<()> { .ft_contract() .ft_transfer(bob.to_near(), U128(9499999991723028480), None) .with_user(&alice) - .call() .await; assert!(res.is_err()); - let res = context - .ft_contract() - .storage_deposit(Some(bob.to_near()), None) - .call() - .await; + let res = context.ft_contract().storage_deposit(Some(bob.to_near()), None).await; assert!(res.is_ok()); - let alice_balance = context.ft_contract().ft_balance_of(alice.to_near()).call().await?; + let alice_balance = context.ft_contract().ft_balance_of(alice.to_near()).await?; assert_ne!(U128(0), alice_balance); // Transfer all tokens from alice to new account @@ -42,13 +36,12 @@ async fn test_transfer() -> anyhow::Result<()> { .ft_contract() .ft_transfer(bob.to_near(), alice_balance, None) .with_user(&alice) - .call() .await?; - let alice_balance_updated = context.ft_contract().ft_balance_of(alice.to_near()).call().await?; + let alice_balance_updated = context.ft_contract().ft_balance_of(alice.to_near()).await?; assert_eq!(U128(0), alice_balance_updated); - let bob_balance = context.ft_contract().ft_balance_of(bob.to_near()).call().await?; + let bob_balance = context.ft_contract().ft_balance_of(bob.to_near()).await?; assert_eq!(alice_balance, bob_balance); Ok(()) diff --git a/res/sweat.wasm b/res/sweat.wasm index 2c9a9c4..a3a5f1e 100755 Binary files a/res/sweat.wasm and b/res/sweat.wasm differ