Skip to content

Conversation

@BonelessImpl
Copy link
Contributor

Replaces #74

This uses only the Inspector to get this data. This is why this is based on another branch as both have similar changes to the Inspector interface.

mod deadline;
pub mod engine;
mod error;
pub mod error;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error::* is already re-exported below


#[near(serializers = [borsh, json])]
#[autoimpl(Deref using self.0)]
#[autoimpl(DerefMut using self.0)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DerefMut was not implemented here on purpose: all mutations happen on Amounts level to enforce using .checked_...() operations


impl<T> From<T> for Amounts<T> {
fn from(m: T) -> Self {
Amounts(m)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Amounts(m)
Self::new(m)

Comment on lines +58 to +60
pub ft_withdrawals: Option<Vec<FtWithdraw>>,
pub nft_withdrawals: Option<Vec<NftWithdraw>>,
pub mt_withdrawals: Option<Vec<MtWithdraw>>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub ft_withdrawals: Option<Vec<FtWithdraw>>,
pub nft_withdrawals: Option<Vec<NftWithdraw>>,
pub mt_withdrawals: Option<Vec<MtWithdraw>>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub ft_withdrawals: Vec<FtWithdraw>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub nft_withdrawals: Vec<NftWithdraw>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub mt_withdrawals: Vec<MtWithdraw>,

.unwrap();
let sim_res = env.defuse.simulate_intents(signed.clone()).await.unwrap();
assert_eq!(sim_res.balance_diff, into_simulation_diff(accounts.clone()));
println!("Balance diff: {:#?}", sim_res.balance_diff);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe print the whole simulation output?

Suggested change
println!("Balance diff: {:#?}", sim_res.balance_diff);
println!("simulation_output: {}", serde_json::to_string(&sim_res).unwrap());

And do it before asserting?

@BonelessImpl
Copy link
Contributor Author

Closed in favor of #91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants