Skip to content

Commit

Permalink
Undo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
karim-en committed Dec 19, 2023
1 parent 6026179 commit 9e17af2
Showing 1 changed file with 41 additions and 39 deletions.
80 changes: 41 additions & 39 deletions eth-connector-tests/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ use aurora_eth_connector::log_entry;
use aurora_workspace_eth_connector::types::{Proof, WithdrawResult};
use aurora_workspace_utils::ContractId;
use byte_slice_cast::AsByteSlice;
use near_sdk::{json_types::U128, ONE_YOCTO};
use near_sdk::json_types::U128;
use near_workspaces::types::NearToken;
use near_workspaces::AccountId;

const ONE_YOCTO: NearToken = NearToken::from_yoctonear(near_sdk::ONE_YOCTO);

#[tokio::test]
async fn test_ft_transfer() {
let contract = TestContract::new().await.unwrap();
Expand All @@ -26,7 +28,7 @@ async fn test_ft_transfer() {
.contract
.ft_transfer(&receiver_id, transfer_amount, memo)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -67,7 +69,7 @@ async fn test_ft_transfer_user() {
let res = user_acc
.ft_transfer(contract.contract.id(), transfer_amount, memo)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -103,7 +105,7 @@ async fn test_withdraw_eth_from_near() {
.contract
.withdraw(recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -137,7 +139,7 @@ async fn test_withdraw_eth_from_near_user() {
let res = user_acc
.withdraw(recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -175,7 +177,7 @@ async fn test_withdraw_eth_from_near_engine() {
let res = user_acc
.engine_withdraw(user_acc.id(), recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap_err();
Expand All @@ -187,7 +189,7 @@ async fn test_withdraw_eth_from_near_engine() {
.contract
.engine_withdraw(user_acc.id(), recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -288,7 +290,7 @@ async fn test_ft_transfer_call_eth() {
.contract
.ft_transfer_call(&receiver_id, transfer_amount, memo, message)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -342,7 +344,7 @@ async fn test_ft_transfer_call_without_message() {
message.to_string(),
)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand All @@ -365,7 +367,7 @@ async fn test_ft_transfer_call_without_message() {
.contract
.ft_transfer_call(&some_acc, transfer_amount, memo, message.to_string())
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -419,7 +421,7 @@ async fn test_ft_transfer_call_user_message() {
message.to_string(),
)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -451,7 +453,7 @@ async fn test_ft_transfer_call_user_message() {
let res = user_acc
.ft_transfer_call(&receiver_id, transfer_amount, memo, message.to_string())
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand Down Expand Up @@ -621,7 +623,7 @@ async fn test_ft_transfer_call_without_relayer() {
.contract
.ft_transfer_call(contract.contract.id(), transfer_amount, memo, message)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -691,7 +693,7 @@ async fn test_admin_controlled_admin_can_perform_actions_when_paused() {
.contract
.engine_withdraw(&sender_id, recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -737,7 +739,7 @@ async fn test_admin_controlled_admin_can_perform_actions_when_paused() {
.contract
.engine_withdraw(&sender_id, recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand All @@ -752,7 +754,7 @@ async fn test_admin_controlled_admin_can_perform_actions_when_paused() {
let res = user_acc
.engine_withdraw(&sender_id, recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap_err();
Expand All @@ -761,7 +763,7 @@ async fn test_admin_controlled_admin_can_perform_actions_when_paused() {
let res = owner_acc
.engine_withdraw(&sender_id, recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -862,7 +864,7 @@ async fn test_withdraw_from_near_pausability() {
let res = user_acc
.withdraw(recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand All @@ -888,7 +890,7 @@ async fn test_withdraw_from_near_pausability() {
let res = user_acc
.withdraw(recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap_err();
Expand All @@ -907,7 +909,7 @@ async fn test_withdraw_from_near_pausability() {
let res = user_acc
.withdraw(recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -1082,7 +1084,7 @@ async fn test_ft_transfer_max_value() {
.contract
.ft_transfer(&receiver_id, transfer_amount, memo)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap_err();
Expand Down Expand Up @@ -1114,7 +1116,7 @@ async fn test_ft_transfer_empty_value() {
.near_call(&"ft_transfer")
.args_json((receiver_id, transfer_amount, memo))
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand All @@ -1135,7 +1137,7 @@ async fn test_ft_transfer_wrong_u128_json_type() {
.near_call(&"ft_transfer")
.args_json((receiver_id, transfer_amount, memo))
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand All @@ -1156,7 +1158,7 @@ async fn test_access_rights() {
.contract
.ft_transfer(user_acc.id(), transfer_amount1, memo)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -1192,7 +1194,7 @@ async fn test_access_rights() {
let res = user_acc
.engine_withdraw(contract.contract.id(), recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap_err();
Expand Down Expand Up @@ -1232,7 +1234,7 @@ async fn test_access_rights() {
.contract
.engine_withdraw(contract.contract.id(), recipient_addr, withdraw_amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -1289,7 +1291,7 @@ async fn test_storage_withdraw() {
.contract
.storage_withdraw(amount)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand All @@ -1313,7 +1315,7 @@ async fn test_engine_ft_transfer() {
let res = user_acc
.engine_ft_transfer(user_acc.id(), &receiver_id, transfer_amount, memo.clone())
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap_err();
Expand Down Expand Up @@ -1345,7 +1347,7 @@ async fn test_engine_ft_transfer() {
let res = user_acc
.engine_ft_transfer(user_acc.id(), &&receiver_id, transfer_amount, memo)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -1391,7 +1393,7 @@ async fn test_engine_ft_transfer_call() {
message.clone(),
)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand All @@ -1416,7 +1418,7 @@ async fn test_engine_ft_transfer_call() {
let res = user_acc
.engine_ft_transfer_call(user_acc.id(), &receiver_id, transfer_amount, memo, message)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand Down Expand Up @@ -1507,7 +1509,7 @@ async fn test_engine_storage_withdraw() {
let res = user_acc
.engine_storage_withdraw(user_acc.id(), Some(amount))
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand All @@ -1533,7 +1535,7 @@ async fn test_engine_storage_withdraw() {
let res = user_acc
.engine_storage_withdraw(user_acc.id(), Some(amount))
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand All @@ -1559,7 +1561,7 @@ async fn test_engine_storage_unregister() {
let res = user_acc
.engine_storage_unregister(user_acc.id(), None)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap_err();
Expand All @@ -1584,7 +1586,7 @@ async fn test_engine_storage_unregister() {
let res = user_acc
.engine_storage_withdraw(user_acc.id(), Some(amount))
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand All @@ -1597,7 +1599,7 @@ async fn test_engine_storage_unregister() {
let res = user_acc
.engine_storage_unregister(user_acc.id(), None)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await
.unwrap();
Expand All @@ -1606,7 +1608,7 @@ async fn test_engine_storage_unregister() {
let res = user_acc
.engine_storage_withdraw(user_acc.id(), Some(amount))
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand Down Expand Up @@ -1689,7 +1691,7 @@ async fn test_ft_transfer_call_insufficient_sender_balance() {
message.clone(),
)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand All @@ -1706,7 +1708,7 @@ async fn test_ft_transfer_call_insufficient_sender_balance() {
.contract
.ft_transfer_call(contract.contract.id(), transfer_amount, memo, message)
.max_gas()
.deposit(NearToken::from_yoctonear(ONE_YOCTO))
.deposit(ONE_YOCTO)
.transact()
.await;
if let Err(err) = res {
Expand Down

0 comments on commit 9e17af2

Please sign in to comment.