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

Multisig unit tests #249

Merged
merged 21 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 18 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
3 changes: 3 additions & 0 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use multiversx_sc::imports::*;
#[multiversx_sc::contract]
pub trait MockBridgeProxy {
#[init]
fn init(&self, _opt_multi_transfer_address: OptionalValue<ManagedAddress>) {}
fn init(&self) {}

#[upgrade]
fn upgrade(&self) {}
Expand Down
26 changes: 19 additions & 7 deletions common/mock-contracts/mock-esdt-safe/src/mock_esdt_safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ pub struct RefundInfo<M: ManagedTypeApi> {
#[multiversx_sc::contract]
pub trait MockEsdtSafe {
#[init]
fn init(
&self,
_fee_estimator_contract_address: ManagedAddress,
_multi_transfer_contract_address: ManagedAddress,
_eth_tx_gas_limit: BigUint,
) {
}
fn init(&self, _eth_tx_gas_limit: BigUint) {}

#[upgrade]
fn upgrade(&self) {}
Expand All @@ -35,4 +29,22 @@ pub trait MockEsdtSafe {
_opt_refund_info: OptionalValue<RefundInfo<Self::Api>>,
) {
}

#[only_owner]
#[endpoint(withdrawTransactionFees)]
fn withdraw_transaction_fees(
&self,
_token_id: TokenIdentifier,
_multisig_owner: ManagedAddress,
) {
}

#[only_owner]
#[endpoint(withdrawRefundFeesForEthereum)]
fn withdraw_refund_fees_for_ethereum(
&self,
_token_id: TokenIdentifier,
_multisig_owner: ManagedAddress,
) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ pub trait MockMultiTransferEsdt {

#[upgrade]
fn upgrade(&self) {}

#[only_owner]
#[endpoint(addUnprocessedRefundTxToBatch)]
fn add_unprocessed_refund_tx_to_batch(&self, _tx_id: u64) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

// Init: 1
// Upgrade: 1
// Endpoints: 0
// Endpoints: 1
// Async Callback (empty): 1
// Total number of exported functions: 3
// Total number of exported functions: 4

#![no_std]

Expand All @@ -20,6 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! {
(
init => init
upgrade => upgrade
addUnprocessedRefundTxToBatch => add_unprocessed_refund_tx_to_batch
)
}

Expand Down
9 changes: 9 additions & 0 deletions multisig/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ path = "../common/tx-batch-module"
[dependencies.max-bridged-amount-module]
path = "../common/max-bridged-amount-module"

[dependencies.mock-multi-transfer-esdt]
path = "../common/mock-contracts/mock-multi-transfer-esdt"

[dependencies.mock-esdt-safe]
path = "../common/mock-contracts/mock-esdt-safe"

[dependencies.mock-price-aggregator]
path = "../common/mock-contracts/mock-price-aggregator"

[dependencies.sc-proxies]
path = "../common/sc-proxies"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@
"status": "0"
}
},
{
"step": "scCall",
"id": "",
"tx": {
"from": "sc:multisig",
"to": "sc:esdt-safe",
"function": "addTokenToWhitelist",
"arguments": [
"0x45474c442d313233343536",
"0x45474c44",
"0x",
"0x01",
"0x",
"0x",
"0x",
"0x0249f0"
],
"gasLimit": "5,000,000"
},
"expect": {
"out": [],
"status": "0"
}
},
{
"step": "scCall",
"id": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@
"status": "0"
}
},
{
"step": "scCall",
"id": "",
"tx": {
"from": "sc:multisig",
"to": "sc:esdt-safe",
"function": "addTokenToWhitelist",
"arguments": [
"0x45474c442d313233343536",
"0x45474c44",
"0x",
"0x01",
"0x",
"0x",
"0x",
"0x0249f0"
],
"gasLimit": "5,000,000"
},
"expect": {
"out": [],
"status": "0"
}
},
{
"step": "scCall",
"id": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@
"status": "0"
}
},
{
"step": "scCall",
"id": "",
"tx": {
"from": "sc:multisig",
"to": "sc:esdt-safe",
"function": "addTokenToWhitelist",
"arguments": [
"0x45474c442d313233343536",
"0x45474c44",
"0x",
"0x01",
"0x",
"0x",
"0x",
"0x0249f0"
],
"gasLimit": "5,000,000"
},
"expect": {
"out": [],
"status": "0"
}
},
{
"step": "scCall",
"id": "",
Expand Down Expand Up @@ -399,7 +423,7 @@
"accounts": {
"address:user1": {
"esdt": {
"str:WEGLD-123456": "76000000000",
"str:WEGLD-123456": "76000100000",
"+": ""
},
"storage": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@
"status": "0"
}
},
{
"step": "scCall",
"id": "",
"tx": {
"from": "sc:multisig",
"to": "sc:esdt-safe",
"function": "addTokenToWhitelist",
"arguments": [
"0x45474c442d313233343536",
"0x45474c44",
"0x",
"0x01",
"0x",
"0x",
"0x",
"0x0249f0"
],
"gasLimit": "5,000,000"
},
"expect": {
"out": [],
"status": "0"
}
},
{
"step": "scCall",
"id": "",
Expand Down Expand Up @@ -359,7 +383,7 @@
"accounts": {
"address:user1": {
"esdt": {
"str:WEGLD-123456": "76000000000",
"str:WEGLD-123456": "76000100000",
"+": ""
},
"storage": "*",
Expand Down
Loading
Loading