From c98e271892f700a0a074a287684547f57754381a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Costin=20Caraba=C8=99?= Date: Wed, 13 Mar 2024 22:00:32 +0200 Subject: [PATCH] Fix tests --- ..._multiversx_to_ethereum_tx_batch.scen.json | 22 +-- ..._to_multiversx_tx_batch_rejected.scen.json | 4 +- ..._multiversx_to_ethereum_tx_batch.scen.json | 16 +- ..._multiversx_to_ethereum_tx_batch.scen.json | 24 +-- price-aggregator/scenarios/deploy.scen.json | 29 +++- .../scenarios/get_latest_price_feed.scen.json | 7 +- ...acle_gwei_in_eth_and_egld_submit.scen.json | 4 +- .../scenarios/oracle_submit.scen.json | 152 +++++++++++++++++- 8 files changed, 214 insertions(+), 44 deletions(-) diff --git a/multisig/scenarios/create_multiversx_to_ethereum_tx_batch.scen.json b/multisig/scenarios/create_multiversx_to_ethereum_tx_batch.scen.json index 405d8d55..91d282f4 100644 --- a/multisig/scenarios/create_multiversx_to_ethereum_tx_batch.scen.json +++ b/multisig/scenarios/create_multiversx_to_ethereum_tx_batch.scen.json @@ -50,7 +50,7 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "85,000,000,000", + "balance": "1,500,000", "roles": [ "ESDTRoleLocalMint", "ESDTRoleLocalBurn" @@ -71,12 +71,12 @@ "3-from": "u32:32|address:user", "4-to": "u32:20|0x0102030405060708091011121314151617181920", "5-token_identifier": "nested:str:WEGLD-123456", - "6-amount": "biguint:10,000,000,000", + "6-amount": "biguint:84,998,500,000", "7-is_refund_tx": "u8:0" }, "str:firstBatchId": "1", "str:lastBatchId": "1", - "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "75,000,000,000", + "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "1,500,000", "+": "" }, "code": "*" @@ -128,14 +128,14 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "85,000,000,000", + "balance": "1,500,000", "roles": [ "ESDTRoleLocalMint", "ESDTRoleLocalBurn" ] }, "str:ETH-123456": { - "balance": "95,000,000,000", + "balance": "1,500,000", "roles": [ "ESDTRoleLocalMint", "ESDTRoleLocalBurn" @@ -149,7 +149,7 @@ "3-from": "u32:32|address:user", "4-to": "u32:20|0x0102030405060708091011121314151617181920", "5-token_identifier": "nested:str:WEGLD-123456", - "6-amount": "biguint:10,000,000,000", + "6-amount": "biguint:84,998,500,000", "7-is_refund_tx": "u8:0" }, "str:pendingBatches|u64:1|str:.item|u32:2": { @@ -158,13 +158,13 @@ "3-from": "u32:32|address:user", "4-to": "u32:20|0x0102030405060708091011121314151617181920", "5-token_identifier": "nested:str:ETH-123456", - "6-amount": "biguint:20,000,000,000", + "6-amount": "biguint:94,998,500,000", "7-is_refund_tx": "u8:0" }, "str:firstBatchId": "1", "str:lastBatchId": "1", - "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "75,000,000,000", - "str:accumulatedTransactionFees|nested:str:ETH-123456": "75,000,000,000", + "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "1,500,000", + "str:accumulatedTransactionFees|nested:str:ETH-123456": "1,500,000", "+": "" }, "code": "*" @@ -194,13 +194,13 @@ "address:user", "0x0102030405060708091011121314151617181920", "str:WEGLD-123456", - "10,000,000,000", + "84,998,500,000", "0", "2", "address:user", "0x0102030405060708091011121314151617181920", "str:ETH-123456", - "20,000,000,000" + "94,998,500,000" ] } } diff --git a/multisig/scenarios/ethereum_to_multiversx_tx_batch_rejected.scen.json b/multisig/scenarios/ethereum_to_multiversx_tx_batch_rejected.scen.json index 742b3511..c861f5f0 100644 --- a/multisig/scenarios/ethereum_to_multiversx_tx_batch_rejected.scen.json +++ b/multisig/scenarios/ethereum_to_multiversx_tx_batch_rejected.scen.json @@ -278,7 +278,7 @@ "3-from": "u32:32|sc:egld_esdt_swap", "4-to": "u32:20|0x0102030405060708091011121314151617181920", "5-token_identifier": "nested:str:WEGLD-123456", - "6-amount": "biguint:1,000,000,000", + "6-amount": "biguint:75,998,500,000", "7-is_refund_tx": "u8:1" }, "str:pendingBatches|u64:1|str:.item|u32:2": { @@ -287,7 +287,7 @@ "3-from": "u32:32|sc:egld_esdt_swap", "4-to": "u32:20|0x0102030405060708091011121314151617181920", "5-token_identifier": "nested:str:ETH-123456", - "6-amount": "biguint:1,000,000,000", + "6-amount": "biguint:75,998,500,000", "7-is_refund_tx": "u8:1" }, "str:firstBatchId": "1", diff --git a/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json b/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json index acffeca5..c965c992 100644 --- a/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json +++ b/multisig/scenarios/execute_multiversx_to_ethereum_tx_batch.scen.json @@ -146,14 +146,14 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "75,000,000,000", + "balance": "1,500,000", "roles": [ "ESDTRoleLocalMint", "ESDTRoleLocalBurn" ] }, "str:ETH-123456": { - "balance": "75,000,000,000", + "balance": "1,500,000", "roles": [ "ESDTRoleLocalMint", "ESDTRoleLocalBurn" @@ -165,8 +165,8 @@ "str:transactionsByNonce|address:user|str:.item|u32:1": "", "str:transactionStatus|address:user|u32:2": "", "str:transactionsByNonce|address:user|str:.item|u32:2": "", - "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "75,000,000,000", - "str:accumulatedTransactionFees|nested:str:ETH-123456": "75,000,000,000", + "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "1,500,000", + "str:accumulatedTransactionFees|nested:str:ETH-123456": "1,500,000", "+": "" }, "code": "*" @@ -206,10 +206,10 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "30,000,000,000" + "balance": "600,000" }, "str:ETH-123456": { - "balance": "30,000,000,000" + "balance": "600,000" } }, "storage": {} @@ -219,10 +219,10 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "45,000,000,000" + "balance": "900,000" }, "str:ETH-123456": { - "balance": "45,000,000,000" + "balance": "900,000" } }, "storage": {} diff --git a/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json b/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json index bea7cd56..122fabab 100644 --- a/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json +++ b/multisig/scenarios/reject_multiversx_to_ethereum_tx_batch.scen.json @@ -107,9 +107,9 @@ "expect": { "out": [ "str:WEGLD-123456", - "10,000,000,000", + "84,998,500,000", "str:ETH-123456", - "20,000,000,000" + "94,998,500,000" ] } }, @@ -165,8 +165,8 @@ "nonce": "*", "balance": "0", "esdt": { - "str:WEGLD-123456": "25,000,000,000", - "str:ETH-123456": "125,000,000,000" + "str:WEGLD-123456": "99,998,500,000", + "str:ETH-123456": "199,998,500,000" }, "storage": {} }, @@ -175,14 +175,14 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "75,000,000,000", + "balance": "1,500,000", "roles": [ "ESDTRoleLocalMint", "ESDTRoleLocalBurn" ] }, "str:ETH-123456": { - "balance": "75,000,000,000", + "balance": "1,500,000", "roles": [ "ESDTRoleLocalMint", "ESDTRoleLocalBurn" @@ -194,8 +194,8 @@ "str:transactionsByNonce|address:user|str:.item|u32:1": "", "str:transactionStatus|address:user|u32:2": "", "str:transactionsByNonce|address:user|str:.item|u32:2": "", - "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "75,000,000,000", - "str:accumulatedTransactionFees|nested:str:ETH-123456": "75,000,000,000", + "str:accumulatedTransactionFees|nested:str:WEGLD-123456": "1,500,000", + "str:accumulatedTransactionFees|nested:str:ETH-123456": "1,500,000", "+": "" }, "code": "*" @@ -235,10 +235,10 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "30,000,000,000" + "balance": "600,000" }, "str:ETH-123456": { - "balance": "30,000,000,000" + "balance": "600,000" } }, "storage": {} @@ -248,10 +248,10 @@ "balance": "0", "esdt": { "str:WEGLD-123456": { - "balance": "45,000,000,000" + "balance": "900,000" }, "str:ETH-123456": { - "balance": "45,000,000,000" + "balance": "900,000" } }, "storage": {} diff --git a/price-aggregator/scenarios/deploy.scen.json b/price-aggregator/scenarios/deploy.scen.json index 78d381a0..4a08a873 100644 --- a/price-aggregator/scenarios/deploy.scen.json +++ b/price-aggregator/scenarios/deploy.scen.json @@ -105,8 +105,31 @@ "function": "setPairDecimals", "arguments": [ "str:GWEI", - "str:WEGLD-123456", - "u8:6" + "str:WEGLD", + "u8:9" + ], + "gasLimit": "40,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "oracle-set-pair", + "tx": { + "from": "address:aggregator-owner", + "to": "sc:price_aggregator", + "value": "0", + "function": "setPairDecimals", + "arguments": [ + "str:GWEI", + "str:ETH", + "u8:9" ], "gasLimit": "40,000,000", "gasPrice": "0" @@ -142,7 +165,7 @@ "step": "checkState", "accounts": { "address:aggregator-owner": { - "nonce": "4", + "nonce": "5", "balance": "0", "storage": {} }, diff --git a/price-aggregator/scenarios/get_latest_price_feed.scen.json b/price-aggregator/scenarios/get_latest_price_feed.scen.json index 3b616063..1bf5063b 100644 --- a/price-aggregator/scenarios/get_latest_price_feed.scen.json +++ b/price-aggregator/scenarios/get_latest_price_feed.scen.json @@ -74,11 +74,8 @@ "gasPrice": "0" }, "expect": { - "out": [], - "status": "0", - "message": "", - "gas": "*", - "refund": "*" + "status": "4", + "message": "str:token pair not found" } } ] diff --git a/price-aggregator/scenarios/oracle_gwei_in_eth_and_egld_submit.scen.json b/price-aggregator/scenarios/oracle_gwei_in_eth_and_egld_submit.scen.json index 9c8c3599..f5dc37e0 100644 --- a/price-aggregator/scenarios/oracle_gwei_in_eth_and_egld_submit.scen.json +++ b/price-aggregator/scenarios/oracle_gwei_in_eth_and_egld_submit.scen.json @@ -40,10 +40,10 @@ "function": "submit", "arguments": [ "str:GWEI", - "str:WEGLD-123456", + "str:WEGLD", "u64:0", "10", - "6" + "9" ], "gasLimit": "40,000,000", "gasPrice": "0" diff --git a/price-aggregator/scenarios/oracle_submit.scen.json b/price-aggregator/scenarios/oracle_submit.scen.json index 53d53c45..fe326610 100644 --- a/price-aggregator/scenarios/oracle_submit.scen.json +++ b/price-aggregator/scenarios/oracle_submit.scen.json @@ -79,6 +79,156 @@ "gas": "*", "refund": "*" } + }, + { + "step": "scCall", + "txId": "oracle-submit", + "tx": { + "from": "address:oracle", + "to": "sc:price_aggregator", + "value": "0", + "function": "submit", + "arguments": [ + "str:GWEI", + "str:WEGLD", + "u64:0", + "10", + "9" + ], + "gasLimit": "40,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "oracle-submit", + "tx": { + "from": "address:oracle2", + "to": "sc:price_aggregator", + "value": "0", + "function": "submit", + "arguments": [ + "str:GWEI", + "str:WEGLD", + "u64:0", + "10", + "9" + ], + "gasLimit": "40,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "oracle-submit", + "tx": { + "from": "address:oracle3", + "to": "sc:price_aggregator", + "value": "0", + "function": "submit", + "arguments": [ + "str:GWEI", + "str:WEGLD", + "u64:0", + "10", + "9" + ], + "gasLimit": "40,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "oracle-submit", + "tx": { + "from": "address:oracle", + "to": "sc:price_aggregator", + "value": "0", + "function": "submit", + "arguments": [ + "str:GWEI", + "str:ETH", + "u64:0", + "10", + "9" + ], + "gasLimit": "40,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "oracle-submit", + "tx": { + "from": "address:oracle2", + "to": "sc:price_aggregator", + "value": "0", + "function": "submit", + "arguments": [ + "str:GWEI", + "str:ETH", + "u64:0", + "10", + "9" + ], + "gasLimit": "40,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "txId": "oracle-submit", + "tx": { + "from": "address:oracle3", + "to": "sc:price_aggregator", + "value": "0", + "function": "submit", + "arguments": [ + "str:GWEI", + "str:ETH", + "u64:0", + "10", + "9" + ], + "gasLimit": "40,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "0", + "message": "", + "gas": "*", + "refund": "*" + } } ] -} +} \ No newline at end of file