From a2e56f2a7d2622d74262d0e7f676af9097cdf6af Mon Sep 17 00:00:00 2001 From: Xabi Losada Date: Sun, 3 Nov 2024 12:53:44 +0100 Subject: [PATCH] refactor: custom types for blockchain --- contracts/proxy-lib/src/mutate.rs | 1 - contracts/proxy-lib/tests/sandbox.rs | 4 +--- crates/context/config/src/lib.rs | 11 ++++++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/contracts/proxy-lib/src/mutate.rs b/contracts/proxy-lib/src/mutate.rs index 25cbd678d..761edfcda 100644 --- a/contracts/proxy-lib/src/mutate.rs +++ b/contracts/proxy-lib/src/mutate.rs @@ -1,4 +1,3 @@ - use std::collections::HashSet; use std::str::FromStr; diff --git a/contracts/proxy-lib/tests/sandbox.rs b/contracts/proxy-lib/tests/sandbox.rs index 827f42601..929d6f8a4 100644 --- a/contracts/proxy-lib/tests/sandbox.rs +++ b/contracts/proxy-lib/tests/sandbox.rs @@ -6,11 +6,9 @@ use common::create_account_with_balance; use common::proxy_lib_helper::ProxyContractHelper; use ed25519_dalek::SigningKey; use eyre::Result; -use near_sdk::json_types::Base64VecU8; -use near_sdk::{Gas, NearToken}; +use near_sdk::NearToken; use near_workspaces::network::Sandbox; use near_workspaces::{Account, Worker}; -use serde_json::json; mod common; diff --git a/crates/context/config/src/lib.rs b/crates/context/config/src/lib.rs index 02491d6e4..aff7fd507 100644 --- a/crates/context/config/src/lib.rs +++ b/crates/context/config/src/lib.rs @@ -102,7 +102,12 @@ pub enum ContextRequestKind<'a> { }, } + +/// Proxy contract +/// todo: refactor pub type ProposalId = u32; +pub type Gas = u64; +pub type NativeToken = u128; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, BorshDeserialize, BorshSerialize)] #[serde(tag = "scope", content = "params")] @@ -113,12 +118,12 @@ pub enum ProposalAction { receiver_id: String, method_name: String, args: String, - deposit: u128, - gas: u64, + deposit: NativeToken, + gas: Gas, }, Transfer { receiver_id: String, - amount: u128, + amount: NativeToken, }, SetNumApprovals { num_approvals: u32,