pub struct CoreParams {
pub base_pfs_id: ID,
pub collateral_pfs_id: ID,
pub base_pfs_source_id: ID,
pub collateral_pfs_source_id: ID,
pub base_pfs_tolerance: u64,
pub collateral_pfs_tolerance: u64,
pub lot_size: u64,
pub tick_size: u64,
pub scaling_factor: IFixed,
pub collateral_haircut: IFixed,
pub margin_ratio_initial: IFixed,
pub margin_ratio_maintenance: IFixed,
}Fields§
§base_pfs_id: IDIdentifier of the base asset’s price feed storage.
collateral_pfs_id: IDIdentifier of the collateral asset’s price feed storage.
base_pfs_source_id: IDIdentifier of the base asset’s price feed storage source id (pyth, stork, etc…).
collateral_pfs_source_id: IDIdentifier of the collateral asset’s price feed storage source id (pyth, stork, etc…).
base_pfs_tolerance: u64Timestamp tolerance for base oracle price
collateral_pfs_tolerance: u64Timestamp tolerance for collateral oracle price
lot_size: u64Number of base units exchanged per lot
tick_size: u64Number of quote units exchanged per tick
scaling_factor: IFixedScaling factor to use to convert collateral units to ifixed values and viceversa
collateral_haircut: IFixedValue haircut applied to collateral allocated in the position. Example: 98%
margin_ratio_initial: IFixedMinimum margin ratio for opening a new position.
margin_ratio_maintenance: IFixedMargin ratio below which full liquidations can occur.
Implementations§
Source§impl CoreParams
impl CoreParams
Sourcepub fn new(
base_pfs_id: ID,
collateral_pfs_id: ID,
base_pfs_source_id: ID,
collateral_pfs_source_id: ID,
base_pfs_tolerance: u64,
collateral_pfs_tolerance: u64,
lot_size: u64,
tick_size: u64,
scaling_factor: IFixed,
collateral_haircut: IFixed,
margin_ratio_initial: IFixed,
margin_ratio_maintenance: IFixed,
) -> Self
pub fn new( base_pfs_id: ID, collateral_pfs_id: ID, base_pfs_source_id: ID, collateral_pfs_source_id: ID, base_pfs_tolerance: u64, collateral_pfs_tolerance: u64, lot_size: u64, tick_size: u64, scaling_factor: IFixed, collateral_haircut: IFixed, margin_ratio_initial: IFixed, margin_ratio_maintenance: IFixed, ) -> Self
Constructs a new CoreParams.
Source§impl CoreParams
impl CoreParams
pub fn move_instance(self, address: Address) -> MoveInstance<Self>
pub fn type_(address: Address) -> CoreParamsTypeTag
Trait Implementations§
Source§impl Clone for CoreParams
impl Clone for CoreParams
Source§fn clone(&self) -> CoreParams
fn clone(&self) -> CoreParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CoreParams
impl Debug for CoreParams
Source§impl<'de> Deserialize<'de> for CoreParams
impl<'de> Deserialize<'de> for CoreParams
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for CoreParams
impl Display for CoreParams
Source§impl Hash for CoreParams
impl Hash for CoreParams
Source§impl MoveStruct for CoreParams
impl MoveStruct for CoreParams
Source§impl MoveType for CoreParams
impl MoveType for CoreParams
Source§impl PartialEq for CoreParams
impl PartialEq for CoreParams
Source§impl Serialize for CoreParams
impl Serialize for CoreParams
Source§impl StaticModule for CoreParams
impl StaticModule for CoreParams
fn module() -> Identifier
Source§impl StaticName for CoreParams
impl StaticName for CoreParams
fn name() -> Identifier
Source§impl StaticTypeParams for CoreParams
impl StaticTypeParams for CoreParams
fn type_params() -> Vec<TypeTag>
Source§impl Tabled for CoreParams
impl Tabled for CoreParams
impl Eq for CoreParams
impl StructuralPartialEq for CoreParams
Auto Trait Implementations§
impl Freeze for CoreParams
impl RefUnwindSafe for CoreParams
impl Send for CoreParams
impl Sync for CoreParams
impl Unpin for CoreParams
impl UnwindSafe for CoreParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<'de, T> FromBcs for Twhere
T: Deserialize<'de>,
impl<'de, T> FromBcs for Twhere
T: Deserialize<'de>,
fn from_bcs<'de>(bytes: &'de [u8]) -> Result<Self, Error>where
Self: Deserialize<'de>,
fn from_bcs_base64(base64: &str) -> Result<Self, Error>where
Self: DeserializeOwned,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.