Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update nitka #72

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 19 additions & 63 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ resolver = "2"
[workspace.dependencies]
tokio = "1.28.0"
anyhow = "1.0.75"
async-trait = "0.1.74"

near-units = "0.2.0"
near-workspaces = "0.10.0"

near-sdk = { git = "https://github.com/sweatco/near-sdk-rs", rev = "d5e975e3b224b5758745ab46c25d586a8e0db473" }
near-contract-standards = { git = "https://github.com/sweatco/near-sdk-rs", rev = "d5e975e3b224b5758745ab46c25d586a8e0db473" }

nitka = "0.2.2"
nitka-proc = "0.2.2"
nitka = "0.3.0"
nitka-proc = "0.3.0"

sweat-model = { path = "model" }
1 change: 0 additions & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ name = "integration_tests"

[dev-dependencies]
near-workspaces = { workspace = true }
near-sdk = { workspace = true }
near-contract-standards = { workspace = true }
anyhow = { workspace = true }
tokio = { workspace = true }
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/src/callback_attack.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#![cfg(test)]

use near_sdk::{json_types::U128, serde_json::json};
use nitka::misc::ToNear;
use nitka::{
misc::ToNear,
near_sdk::{json_types::U128, serde_json::json},
};
use sweat_model::FungibleTokenCoreIntegration;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/formula.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use near_sdk::json_types::U64;
use nitka::near_sdk::json_types::U64;
use sweat_model::SweatApiIntegration;

use crate::prepare::{prepare_contract, IntegrationContext};
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/interface/common.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;

use near_sdk::AccountId;
use nitka::near_sdk::AccountId;
use sweat_model::SweatContract;

pub(crate) trait ContractAccount {
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/src/mint.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use near_sdk::json_types::{U128, U64};
use nitka::misc::ToNear;
use nitka::{
misc::ToNear,
near_sdk::json_types::{U128, U64},
};
use sweat_model::{FungibleTokenCoreIntegration, Payout, SweatApiIntegration};

use crate::prepare::{prepare_contract, IntegrationContext};
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/src/prepare.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use anyhow::Result;
use async_trait::async_trait;
use near_sdk::serde_json::json;
use near_workspaces::{Account, Contract};
use nitka::misc::ToNear;
use nitka::{misc::ToNear, near_sdk::serde_json::json};
use sweat_model::{StorageManagementIntegration, SweatApiIntegration, SweatContract};

const CLAIM_CONTRACT: &str = "sweat_claim";
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/src/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use near_sdk::json_types::U128;
use nitka::misc::ToNear;
use nitka::{misc::ToNear, near_sdk::json_types::U128};
use sweat_model::{FungibleTokenCoreIntegration, StorageManagementIntegration, SweatApiIntegration};

use crate::prepare::{prepare_contract, IntegrationContext};
Expand Down
16 changes: 9 additions & 7 deletions model/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#![allow(clippy::new_ret_no_self, clippy::wrong_self_convention)]

use near_contract_standards::storage_management::{StorageBalance, StorageBalanceBounds};
#[cfg(feature = "release-api")]
use near_sdk::AccountId;
use near_sdk::{
json_types::{U128, U64},
NearToken, PromiseOrValue,
AccountId, NearToken,
};
#[cfg(feature = "integration-api")]
use nitka::AccountId;
use nitka::near_sdk;
use nitka_proc::make_integration_version;

#[cfg(feature = "integration-api")]
Expand All @@ -32,7 +30,11 @@ pub trait SweatApi {

#[make_integration_version]
pub trait SweatDefer {
fn defer_batch(&mut self, steps_batch: Vec<(AccountId, u32)>, holding_account_id: AccountId) -> PromiseOrValue<()>;
fn defer_batch(
&mut self,
steps_batch: Vec<(AccountId, u32)>,
holding_account_id: AccountId,
) -> ::near_sdk::PromiseOrValue<()>;
}

/// Copy of near_sdk trait to use in integration tests
Expand All @@ -46,7 +48,7 @@ pub trait FungibleTokenCore {
amount: U128,
memo: Option<String>,
msg: String,
) -> PromiseOrValue<U128>;
) -> ::near_sdk::PromiseOrValue<U128>;
fn ft_total_supply(&self) -> U128;
fn ft_balance_of(&self, account_id: AccountId) -> U128;
}
Expand All @@ -56,7 +58,7 @@ pub trait FungibleTokenCore {
pub trait StorageManagement {
// if `registration_only=true` MUST refund above the minimum balance if the account didn't exist and
// refund full deposit if the account exists.
#[deposit_yocto = near_sdk::env::storage_byte_cost().checked_mul(125).unwrap().as_yoctonear()]
#[deposit_yocto = ::near_sdk::env::storage_byte_cost().checked_mul(125).unwrap().as_yoctonear()]
fn storage_deposit(&mut self, account_id: Option<AccountId>, registration_only: Option<bool>) -> StorageBalance;

/// Withdraw specified amount of available Ⓝ for predecessor account.
Expand Down
Binary file modified res/sweat.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.75"
channel = "1.77"
Loading