|
@@ -8,6 +8,7 @@ mod test {
|
|
|
use motsu::prelude::*;
|
|
use motsu::prelude::*;
|
|
|
use pythnet_sdk::wire::v1::{AccumulatorUpdateData, Proof};
|
|
use pythnet_sdk::wire::v1::{AccumulatorUpdateData, Proof};
|
|
|
use std::time::Duration;
|
|
use std::time::Duration;
|
|
|
|
|
+ use stylus_sdk::types::AddressVM;
|
|
|
use wormhole_contract::WormholeContract;
|
|
use wormhole_contract::WormholeContract;
|
|
|
|
|
|
|
|
const PYTHNET_CHAIN_ID: u16 = 26;
|
|
const PYTHNET_CHAIN_ID: u16 = 26;
|
|
@@ -118,8 +119,12 @@ mod test {
|
|
|
let result = pyth_contract
|
|
let result = pyth_contract
|
|
|
.sender_and_value(alice, update_fee)
|
|
.sender_and_value(alice, update_fee)
|
|
|
.update_price_feeds(update_data);
|
|
.update_price_feeds(update_data);
|
|
|
|
|
+
|
|
|
assert!(result.is_ok());
|
|
assert!(result.is_ok());
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee);
|
|
|
|
|
+
|
|
|
let price_result = pyth_contract
|
|
let price_result = pyth_contract
|
|
|
.sender(alice)
|
|
.sender(alice)
|
|
|
.get_price_unsafe(ban_usd_feed_id());
|
|
.get_price_unsafe(ban_usd_feed_id());
|
|
@@ -169,11 +174,17 @@ mod test {
|
|
|
.update_price_feeds(update_data1);
|
|
.update_price_feeds(update_data1);
|
|
|
assert!(result1.is_ok());
|
|
assert!(result1.is_ok());
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), update_fee2);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee1);
|
|
|
|
|
+
|
|
|
let result2 = pyth_contract
|
|
let result2 = pyth_contract
|
|
|
.sender_and_value(alice, update_fee2)
|
|
.sender_and_value(alice, update_fee2)
|
|
|
.update_price_feeds(update_data2);
|
|
.update_price_feeds(update_data2);
|
|
|
assert!(result2.is_ok());
|
|
assert!(result2.is_ok());
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee1 + update_fee2);
|
|
|
|
|
+
|
|
|
let price_result = pyth_contract
|
|
let price_result = pyth_contract
|
|
|
.sender(alice)
|
|
.sender(alice)
|
|
|
.get_price_unsafe(ban_usd_feed_id());
|
|
.get_price_unsafe(ban_usd_feed_id());
|
|
@@ -243,6 +254,9 @@ mod test {
|
|
|
.update_price_feeds(update_data);
|
|
.update_price_feeds(update_data);
|
|
|
assert!(result.is_ok());
|
|
assert!(result.is_ok());
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee);
|
|
|
|
|
+
|
|
|
let price_result = pyth_contract
|
|
let price_result = pyth_contract
|
|
|
.sender(alice)
|
|
.sender(alice)
|
|
|
.get_price_no_older_than(btc_usd_feed_id(), u64::MAX);
|
|
.get_price_no_older_than(btc_usd_feed_id(), u64::MAX);
|
|
@@ -269,6 +283,9 @@ mod test {
|
|
|
.update_price_feeds(update_data);
|
|
.update_price_feeds(update_data);
|
|
|
assert!(result.is_ok());
|
|
assert!(result.is_ok());
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee);
|
|
|
|
|
+
|
|
|
let price_result = pyth_contract
|
|
let price_result = pyth_contract
|
|
|
.sender(alice)
|
|
.sender(alice)
|
|
|
.get_price_no_older_than(btc_usd_feed_id(), 1);
|
|
.get_price_no_older_than(btc_usd_feed_id(), 1);
|
|
@@ -298,6 +315,9 @@ mod test {
|
|
|
.update_price_feeds(update_data);
|
|
.update_price_feeds(update_data);
|
|
|
assert!(result.is_ok());
|
|
assert!(result.is_ok());
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee);
|
|
|
|
|
+
|
|
|
let first_price_result = pyth_contract
|
|
let first_price_result = pyth_contract
|
|
|
.sender(alice)
|
|
.sender(alice)
|
|
|
.get_price_unsafe(ban_usd_feed_id());
|
|
.get_price_unsafe(ban_usd_feed_id());
|
|
@@ -339,6 +359,9 @@ mod test {
|
|
|
.update_price_feeds(update_data);
|
|
.update_price_feeds(update_data);
|
|
|
assert!(result.is_ok());
|
|
assert!(result.is_ok());
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee);
|
|
|
|
|
+
|
|
|
assert!(pyth_contract
|
|
assert!(pyth_contract
|
|
|
.sender(alice)
|
|
.sender(alice)
|
|
|
.price_feed_exists(ban_usd_feed_id()));
|
|
.price_feed_exists(ban_usd_feed_id()));
|
|
@@ -380,6 +403,9 @@ mod test {
|
|
|
.sender_and_value(alice, update_fee)
|
|
.sender_and_value(alice, update_fee)
|
|
|
.update_price_feeds(update_data);
|
|
.update_price_feeds(update_data);
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee);
|
|
|
|
|
+
|
|
|
assert!(result.is_ok());
|
|
assert!(result.is_ok());
|
|
|
|
|
|
|
|
let price_result = pyth_contract
|
|
let price_result = pyth_contract
|
|
@@ -407,6 +433,9 @@ mod test {
|
|
|
.sender_and_value(alice, update_fee)
|
|
.sender_and_value(alice, update_fee)
|
|
|
.update_price_feeds(update_data);
|
|
.update_price_feeds(update_data);
|
|
|
|
|
|
|
|
|
|
+ assert_eq!(alice.balance(), U256::ZERO);
|
|
|
|
|
+ assert_eq!(pyth_contract.balance(), update_fee);
|
|
|
|
|
+
|
|
|
assert!(result.is_ok());
|
|
assert!(result.is_ok());
|
|
|
|
|
|
|
|
let price_result1 = pyth_contract
|
|
let price_result1 = pyth_contract
|