Skip to content

Commit e02ffa0

Browse files
committed
fix deposit
1 parent a5e813f commit e02ffa0

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

crates/near-mpc-contract-interface/src/client.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ use crate::call_args::{
1313
VoteUpdateArgs,
1414
};
1515
use crate::deposits::{
16-
DepositOverflowError, SIGN_DEPOSIT_YOCTONEAR, STORAGE_BYTE_COST_YOCTONEAR,
17-
SUBMIT_PARTICIPANT_INFO_DEPOSIT_MILLINEAR, propose_update_required_deposit_yoctonear,
16+
self, DepositOverflowError, MINIMUM_NODE_MANAGEMENT_DEPOSIT_YOCTONEAR, SIGN_DEPOSIT_YOCTONEAR,
17+
STORAGE_BYTE_COST_YOCTONEAR, SUBMIT_PARTICIPANT_INFO_DEPOSIT_MILLINEAR,
18+
propose_update_required_deposit_yoctonear,
1819
};
1920
use crate::method_names::{
2021
PROPOSE_UPDATE, REGISTER_BACKUP_SERVICE, REGISTER_FOREIGN_CHAIN_SUPPORT,
@@ -207,10 +208,11 @@ impl<C: CallContract> MpcContractHandle<C> {
207208
backup_service_info: BackupServiceInfo,
208209
) -> Result<C::Output, MpcContractHandleError<C::Error>> {
209210
let args = serde_json::to_vec(&RegisterBackupServiceArgs::new(backup_service_info))?;
210-
self.call(FunctionCallArgs::no_deposit(
211+
self.call(FunctionCallArgs::new(
211212
REGISTER_BACKUP_SERVICE,
212213
args,
213214
MAX_GAS,
215+
NearToken::from_yoctonear(MINIMUM_NODE_MANAGEMENT_DEPOSIT_YOCTONEAR),
214216
))
215217
.await
216218
}
@@ -220,10 +222,11 @@ impl<C: CallContract> MpcContractHandle<C> {
220222
destination_node_info: DestinationNodeInfo,
221223
) -> Result<C::Output, MpcContractHandleError<C::Error>> {
222224
let args = serde_json::to_vec(&StartNodeMigrationArgs::new(destination_node_info))?;
223-
self.call(FunctionCallArgs::no_deposit(
225+
self.call(FunctionCallArgs::new(
224226
START_NODE_MIGRATION,
225227
args,
226228
MAX_GAS,
229+
NearToken::from_yoctonear(MINIMUM_NODE_MANAGEMENT_DEPOSIT_YOCTONEAR),
227230
))
228231
.await
229232
}

crates/near-mpc-contract-interface/src/deposits.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ pub const STORAGE_BYTE_COST_YOCTONEAR: u128 = 10_000_000_000_000_000_000;
1111

1212
pub const PROPOSE_UPDATE_ENTRY_OVERHEAD_BYTES: u128 = 32_768;
1313

14+
pub const MINIMUM_NODE_MANAGEMENT_DEPOSIT_YOCTONEAR: u128 = 1;
15+
1416
#[derive(Debug, PartialEq, Eq, thiserror::Error)]
1517
#[error("the required deposit exceeds u128::MAX yoctoNEAR")]
1618
pub struct DepositOverflowError;

0 commit comments

Comments
 (0)