Type Alias altair_runtime::PoolSystem

source ·
pub type PoolSystem = Pallet<Runtime>;

Aliased Type§

struct PoolSystem(/* private fields */);

Implementations

§

impl<T> Pallet<T>
where T: Config,

pub fn set_max_reserve( origin: <T as Config>::RuntimeOrigin, pool_id: <T as Config>::PoolId, max_reserve: <T as Config>::Balance ) -> Result<(), DispatchError>

Sets the maximum reserve for a pool

The caller must have the LiquidityAdmin role in order to invoke this extrinsic. This role is not given to the pool creator by default, and must be added with the Permissions pallet before this extrinsic can be called.

pub fn close_epoch( origin: <T as Config>::RuntimeOrigin, pool_id: <T as Config>::PoolId ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Close the current epoch

Closing an epoch locks in all invest and redeem orders placed during the epoch, and causes all further invest and redeem orders to be set for the next epoch.

If all orders can be executed without violating any pool constraints - which include maximum reserve and the tranche risk buffers - the execution will also be done. See execute_epoch for details on epoch execution.

If pool constraints would be violated by executing all orders, the pool enters a submission period. During a submission period, partial executions can be submitted to be scored, and the best-scoring solution will eventually be executed. See submit_solution.

pub fn submit_solution( origin: <T as Config>::RuntimeOrigin, pool_id: <T as Config>::PoolId, solution: Vec<TrancheSolution> ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Submit a partial execution solution for a closed epoch

If the submitted solution is “better” than the previous best solution, it will replace it. Solutions are ordered such that solutions which do not violate constraints are better than those that do.

Once a valid solution has been submitted, the challenge time begins. The pool can be executed once the challenge time has expired.

pub fn execute_epoch( origin: <T as Config>::RuntimeOrigin, pool_id: <T as Config>::PoolId ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>

Execute an epoch for which a valid solution has been submitted.

  • Mints or burns tranche tokens based on investments and redemptions
  • Updates the portion of the reserve and loan balance assigned to each tranche, based on the investments and redemptions to those tranches.
§

impl<T> Pallet<T>
where T: Config,

pub fn score_solution( pool_id: &PoolDetails<<T as Config>::CurrencyId, <T as Config>::TrancheCurrency, <T as Config>::EpochId, <T as Config>::Balance, <T as Config>::Rate, <T as Config>::TrancheWeight, <T as Config>::TrancheId, <T as Config>::PoolId, <T as Config>::MaxTranches>, epoch: &EpochExecutionInfo<<T as Config>::Balance, <T as Config>::BalanceRatio, <T as Config>::EpochId, <T as Config>::TrancheWeight, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, <T as Config>::TrancheCurrency, <T as Config>::MaxTranches>, solution: &[TrancheSolution] ) -> Result<EpochSolution<<T as Config>::Balance, <T as Config>::MaxTranches>, DispatchError>

Scores a solution.

This function checks the state a pool would be in when applying a solution to an epoch. Depending on the state, the correct scoring function is chosen.

pub fn is_valid_tranche_change( old_tranches: Option<&Tranches<<T as Config>::Balance, <T as Config>::Rate, <T as Config>::TrancheWeight, <T as Config>::TrancheCurrency, <T as Config>::TrancheId, <T as Config>::PoolId, <T as Config>::MaxTranches>>, new_tranches: &[TrancheUpdate<<T as Config>::Rate>] ) -> Result<(), DispatchError>

§

impl<T> Pallet<T>
where T: Config,

pub fn pool<KArg>( k: KArg ) -> Option<PoolDetails<<T as Config>::CurrencyId, <T as Config>::TrancheCurrency, <T as Config>::EpochId, <T as Config>::Balance, <T as Config>::Rate, <T as Config>::TrancheWeight, <T as Config>::TrancheId, <T as Config>::PoolId, <T as Config>::MaxTranches>>
where KArg: EncodeLike<<T as Config>::PoolId>,

An auto-generated getter for [Pool].

§

impl<T> Pallet<T>
where T: Config,

pub fn scheduled_update<KArg>( k: KArg ) -> Option<ScheduledUpdateDetails<<T as Config>::Rate, <T as Config>::StringLimit, <T as Config>::MaxTranches>>
where KArg: EncodeLike<<T as Config>::PoolId>,

An auto-generated getter for [ScheduledUpdate].

§

impl<T> Pallet<T>
where T: Config,

pub fn epoch_targets<KArg>( k: KArg ) -> Option<EpochExecutionInfo<<T as Config>::Balance, <T as Config>::BalanceRatio, <T as Config>::EpochId, <T as Config>::TrancheWeight, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, <T as Config>::TrancheCurrency, <T as Config>::MaxTranches>>
where KArg: EncodeLike<<T as Config>::PoolId>,

An auto-generated getter for [EpochExecution].

§

impl<T> Pallet<T>
where T: Config,

pub fn account_deposits<KArg>(k: KArg) -> <T as Config>::Balance
where KArg: EncodeLike<<T as Config>::AccountId>,

An auto-generated getter for [AccountDeposit].

§

impl<T> Pallet<T>
where T: Config,

pub fn pool_deposits<KArg>( k: KArg ) -> Option<PoolDepositInfo<<T as Config>::AccountId, <T as Config>::Balance>>
where KArg: EncodeLike<<T as Config>::PoolId>,

An auto-generated getter for [PoolDeposit].

Trait Implementations

§

impl<T> IntegrityTest for Pallet<T>
where T: Config,

§

fn integrity_test()

See [Hooks::integrity_test].
§

impl<T> InvestmentAccountant<<T as Config>::AccountId> for Pallet<T>
where T: Config,

§

type Amount = <T as Config>::Balance

§

type Error = DispatchError

§

type InvestmentId = <T as Config>::TrancheCurrency

§

type InvestmentInfo = InvestmentInfo<<T as Config>::AccountId, <T as Config>::CurrencyId, <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::InvestmentId>

§

fn info( id: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::InvestmentId ) -> Result<<Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::InvestmentInfo, <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Error>

Information about an asset. Must allow to derive owner, payment and denomination currency
§

fn balance( id: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::InvestmentId, who: &<T as Config>::AccountId ) -> <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Amount

Return the balance of a given user for the given investmnet
§

fn transfer( id: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::InvestmentId, source: &<T as Config>::AccountId, dest: &<T as Config>::AccountId, amount: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Amount ) -> Result<(), <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Error>

Transfer a given investment from source, to destination
§

fn deposit( buyer: &<T as Config>::AccountId, id: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::InvestmentId, amount: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Amount ) -> Result<(), <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Error>

Increases the existence of
§

fn withdraw( seller: &<T as Config>::AccountId, id: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::InvestmentId, amount: <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Amount ) -> Result<(), <Pallet<T> as InvestmentAccountant<<T as Config>::AccountId>>::Error>

Reduce the existence of an asset
§

impl<T> GetStorageVersion for Pallet<T>
where T: Config,

§

type CurrentStorageVersion = StorageVersion

This will be filled out by the pallet macro. Read more
§

fn current_storage_version( ) -> <Pallet<T> as GetStorageVersion>::CurrentStorageVersion

Returns the current storage version as supported by the pallet.
§

fn on_chain_storage_version() -> StorageVersion

Returns the on-chain storage version of the pallet as stored in the storage.
§

impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number ) -> Weight

See [Hooks::on_initialize].
§

impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_idle( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, remaining_weight: Weight ) -> Weight

See [Hooks::on_idle].
§

impl<T> ChangeGuard for Pallet<T>
where T: Config,

§

type Change = <T as Config>::RuntimeChange

Kind of change.
§

type ChangeId = <T as Config>::Hash

Identification of a change.
§

type PoolId = <T as Config>::PoolId

Associated pool where evaluate the change.
§

fn note( pool_id: <Pallet<T> as ChangeGuard>::PoolId, change: <Pallet<T> as ChangeGuard>::Change ) -> Result<<Pallet<T> as ChangeGuard>::ChangeId, DispatchError>

Notify a change related to a pool_id. The caller to this method ask for feedback for the implementation of this trait in order be able to semantically proceed successful with that change. The change intention will be noted by this method and identified by the returned ChangeId.
§

fn released( pool_id: <Pallet<T> as ChangeGuard>::PoolId, change_id: <Pallet<T> as ChangeGuard>::ChangeId ) -> Result<<Pallet<T> as ChangeGuard>::Change, DispatchError>

Ask for a change_id if it’s ready to proceed. An error will be returned if: Read more
§

impl<T> Debug for Pallet<T>

§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> OnRuntimeUpgrade for Pallet<T>
where T: Config,

§

fn on_runtime_upgrade() -> Weight

See [Hooks::on_runtime_upgrade].
§

impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_initialize(_n: BlockNumber) -> Weight

Block initialization hook. This is called at the very beginning of block execution. Read more
§

fn on_finalize(_n: BlockNumber)

Block finalization hook. This is called at the very end of block execution. Read more
§

fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight

Hook to consume a block’s idle time. This will run when the block is being finalized (before [Hooks::on_finalize]). Read more
§

fn on_runtime_upgrade() -> Weight

Hook executed when a code change (aka. a “runtime upgrade”) is detected by FRAME. Read more
§

fn offchain_worker(_n: BlockNumber)

Implementing this function on a pallet allows you to perform long-running tasks that are dispatched as separate threads, and entirely independent of the main wasm runtime. Read more
§

fn integrity_test()

Check the integrity of this pallet’s configuration. Read more
§

impl<T> PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId> for Pallet<T>
where T: Config,

§

type Moment = u64

§

type PoolId = <T as Config>::PoolId

§

type TrancheId = <T as Config>::TrancheId

§

fn pool_exists( pool_id: <Pallet<T> as PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId>>::PoolId ) -> bool

Check if the pool exists
§

fn tranche_exists( pool_id: <Pallet<T> as PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId>>::PoolId, tranche_id: <Pallet<T> as PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId>>::TrancheId ) -> bool

Check if the tranche exists for the given pool
§

fn account_for( pool_id: <Pallet<T> as PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId>>::PoolId ) -> <T as Config>::AccountId

Get the account used for the given pool_id.
§

fn currency_for( pool_id: <Pallet<T> as PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId>>::PoolId ) -> Option<<T as Config>::CurrencyId>

Get the currency used for the given pool_id.
§

impl<T> PoolReserve<<T as Config>::AccountId, <T as Config>::CurrencyId> for Pallet<T>
where T: Config,

§

type Balance = <T as Config>::Balance

§

fn withdraw( pool_id: <Pallet<T> as PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId>>::PoolId, to: <T as Config>::AccountId, amount: <Pallet<T> as PoolReserve<<T as Config>::AccountId, <T as Config>::CurrencyId>>::Balance ) -> Result<(), DispatchError>

Withdraw amount from the reserve to the to account.
§

fn deposit( pool_id: <Pallet<T> as PoolInspect<<T as Config>::AccountId, <T as Config>::CurrencyId>>::PoolId, from: <T as Config>::AccountId, amount: <Pallet<T> as PoolReserve<<T as Config>::AccountId, <T as Config>::CurrencyId>>::Balance ) -> Result<(), DispatchError>

Deposit amount from the from account into the reserve.
§

impl<T> PoolMutate<<T as Config>::AccountId, <T as Config>::PoolId> for Pallet<T>
where T: Config,

§

type Balance = <T as Config>::Balance

§

type CurrencyId = <T as Config>::CurrencyId

§

type PoolChanges = PoolChanges<<T as Config>::Rate, <T as Config>::StringLimit, <T as Config>::MaxTranches>

§

type PoolFeeInput = (PoolFeeBucket, PoolFeeInfo<<T as Config>::AccountId, <T as Config>::Balance, <T as Config>::Rate>)

§

type TrancheInput = TrancheInput<<T as Config>::Rate, <T as Config>::StringLimit>

§

fn create( admin: <T as Config>::AccountId, depositor: <T as Config>::AccountId, pool_id: <T as Config>::PoolId, tranche_inputs: Vec<TrancheInput<<T as Config>::Rate, <T as Config>::StringLimit>>, currency: <T as Config>::CurrencyId, max_reserve: <T as Config>::Balance, pool_fees: Vec<<Pallet<T> as PoolMutate<<T as Config>::AccountId, <T as Config>::PoolId>>::PoolFeeInput> ) -> Result<(), DispatchError>

§

fn update( pool_id: <T as Config>::PoolId, changes: PoolChanges<<T as Config>::Rate, <T as Config>::StringLimit, <T as Config>::MaxTranches> ) -> Result<UpdateState, DispatchError>

§

fn execute_update(pool_id: <T as Config>::PoolId) -> Result<u32, DispatchError>

§

impl<T> PalletsInfoAccess for Pallet<T>
where T: Config,

§

fn count() -> usize

The number of pallets’ information that this type represents. Read more
§

fn infos() -> Vec<PalletInfoData>

All of the pallets’ information that this type represents.
§

impl<T> OnGenesis for Pallet<T>
where T: Config,

§

fn on_genesis()

Something that should happen at genesis.
§

impl<T> PalletInfoAccess for Pallet<T>
where T: Config,

§

fn index() -> usize

Index of the pallet as configured in the runtime.
§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
§

fn name_hash() -> [u8; 16]

Two128 hash of name.
§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
§

impl<T> BeforeAllRuntimeMigrations for Pallet<T>
where T: Config,

§

fn before_all_runtime_migrations() -> Weight

Something that should happen before runtime migrations are executed.
§

impl<T> TrancheTokenPrice<<T as Config>::AccountId, <T as Config>::CurrencyId> for Pallet<T>
where T: Config,

§

type BalanceRatio = <T as Config>::BalanceRatio

§

type Moment = u64

§

type PoolId = <T as Config>::PoolId

§

type TrancheId = <T as Config>::TrancheId

§

fn get_price( pool_id: <Pallet<T> as TrancheTokenPrice<<T as Config>::AccountId, <T as Config>::CurrencyId>>::PoolId, tranche_id: <Pallet<T> as TrancheTokenPrice<<T as Config>::AccountId, <T as Config>::CurrencyId>>::TrancheId ) -> Option<(<T as Config>::BalanceRatio, u64)>

§

impl<T> PartialEq for Pallet<T>

§

fn eq(&self, other: &Pallet<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T> Eq for Pallet<T>

§

impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn offchain_worker( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )

This function is being called after every block import (when fully synced). Read more
§

impl<T> WhitelistedStorageKeys for Pallet<T>
where T: Config,

§

fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>

Returns a Vec<TrackedStorageKey> indicating the storage keys that should be whitelisted during benchmarking. This means that those keys will be excluded from the benchmarking performance calculation.
§

impl<T> StorageInfoTrait for Pallet<T>
where T: Config,

§

fn storage_info() -> Vec<StorageInfo>

§

impl<T> Clone for Pallet<T>

§

fn clone(&self) -> Pallet<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Callable<T> for Pallet<T>
where T: Config,

§

type RuntimeCall = Call<T>

§

impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

§

fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )

See [Hooks::on_finalize].