templar_common/vault/
external.rs

1use super::*;
2
3#[near_sdk::ext_contract(ext_vault)]
4pub trait VaultExternalInterface {
5    fn set_curator(&mut self, account: AccountId);
6    fn set_is_allocator(&mut self, account: AccountId, allowed: bool);
7    fn submit_sentinel(&mut self, account: AccountId);
8    fn accept_sentinel(&mut self);
9    fn revoke_pending_sentinel(&mut self);
10    fn set_skim_recipient(&mut self, account: AccountId);
11    fn set_fees(&mut self, fees: Fees<U128>);
12    fn accept_fees(&mut self);
13    fn revoke_pending_fees(&mut self);
14    fn set_restrictions(&mut self, restrictions: Option<Restrictions>);
15    fn accept_restrictions(&mut self);
16    fn revoke_pending_restrictions(&mut self);
17    fn submit_timelock(&mut self, new_timelock_ns: U64, kind: Option<TimelockKind>);
18    fn accept_timelock(&mut self);
19    fn revoke_pending_timelock(&mut self);
20
21    fn submit_cap(&mut self, market: AccountId, new_cap: U128);
22    fn accept_cap(&mut self, market: AccountId);
23    fn revoke_pending_cap(&mut self, market: AccountId);
24    fn submit_cap_group_update(&mut self, update: CapGroupUpdate);
25    fn accept_cap_group_update(&mut self, update: CapGroupUpdateKey);
26    fn revoke_pending_cap_group_update(&mut self, update: CapGroupUpdateKey);
27    fn submit_market_removal(&mut self, market: AccountId);
28    fn revoke_pending_market_removal(&mut self, market: AccountId);
29    fn set_supply_queue(&mut self, markets: Vec<MarketId>);
30
31    fn withdraw(&mut self, amount: U128, receiver: AccountId) -> PromiseOrValue<()>;
32    fn redeem(&mut self, shares: U128, receiver: AccountId) -> PromiseOrValue<()>;
33    fn allocate(&mut self, delta: AllocationDelta) -> PromiseOrValue<()>;
34    fn execute_rebalance_withdrawal(
35        &mut self,
36        market_id: MarketId,
37        batch_limit: Option<u32>,
38    ) -> PromiseOrValue<()>;
39    fn execute_withdrawal(&mut self, route: Vec<MarketId>) -> PromiseOrValue<()>;
40    fn execute_market_withdrawal(
41        &mut self,
42        op_id: U64,
43        market: MarketId,
44        batch_limit: Option<u32>,
45    ) -> PromiseOrValue<()>;
46    fn unbrick(&mut self) -> PromiseOrValue<()>;
47    fn skim(&mut self, token: AccountId) -> Promise;
48    fn refresh_markets(&mut self, markets: Vec<MarketId>) -> PromiseOrValue<RealAssetsReport>;
49
50    fn get_configuration(&self) -> VaultConfiguration;
51    fn get_total_assets(&self) -> U128;
52    fn get_last_total_assets(&self) -> U128;
53    fn get_total_supply(&self) -> U128;
54    fn get_max_deposit(&self) -> U128;
55    fn convert_to_shares(&self, assets: U128) -> U128;
56    fn convert_to_assets(&self, shares: U128) -> U128;
57    fn preview_deposit(&self, assets: U128) -> U128;
58    fn preview_mint(&self, shares: U128) -> U128;
59    fn preview_withdraw(&self, assets: U128) -> U128;
60    fn preview_redeem(&self, shares: U128) -> U128;
61    fn get_cap_groups(&self) -> Vec<(CapGroupId, CapGroupRecord)>;
62    fn get_fee_anchor_timestamp(&self) -> U64;
63    fn get_fees(&self) -> Fees<U128>;
64    fn get_restrictions(&self) -> Option<Restrictions>;
65}
66
67pub trait VaultExt: VaultExternalInterface {}
68impl<T: VaultExternalInterface + ?Sized> VaultExt for T {}