Skip to content

Commit

Permalink
change submit intent trait
Browse files Browse the repository at this point in the history
  • Loading branch information
enthusiastmartin committed Jan 14, 2025
1 parent ad20c56 commit 3524107
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
29 changes: 25 additions & 4 deletions traits/src/ice.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
pub trait SubmitIntent<IntentId, Intent>{
type Error;
fn submit_intent(intent: Intent) -> Result<IntentId, Self::Error>;
}
use codec::{Decode, Encode};
use frame_support::pallet_prelude::{ConstU32, TypeInfo};
use frame_support::BoundedVec;

#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo, Default)]
pub struct AssetAmount<AssetId> {
pub asset_id: AssetId,
pub amount: u128,
}

pub const MAX_DATA_SIZE: u32 = 4 * 1024 * 1024;
pub type CallData = BoundedVec<u8, ConstU32<MAX_DATA_SIZE>>;

pub trait SubmitIntent<AccountId, AssetId> {
type Error;
fn submit_intent(
who: &AccountId,
asset_in: AssetAmount<AssetId>,
asset_out: AssetAmount<AssetId>,
deadline: u64,
partial: bool,
on_success: Option<CallData>,
on_failure: Option<CallData>,
) -> Result<u128, Self::Error>;
}
2 changes: 1 addition & 1 deletion traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

pub mod evm;
pub mod fee;
pub mod ice;
pub mod liquidity_mining;
pub mod nft;
pub mod oracle;
Expand All @@ -28,7 +29,6 @@ pub mod price;
pub mod registry;
pub mod router;
pub mod stableswap;
pub mod ice;

pub use oracle::*;
pub use registry::*;
Expand Down

0 comments on commit 3524107

Please sign in to comment.