Overall Design
Closed this issue · 1 comments
xlc commented
- utilities
- Types
- traits
- Types
- trait BasicCurrency
- type Balance
- fn transfer
- fn deposit
- fn withdraw
- trait BasicCurrencyExtended: MultiCurrency
- type Amount: TryInto<Balance> + TryFrom<Balance>
- fn update_balance(who: AccountId, amount: Amount)
- trait MultiCurrency (see #4)
- type CurrencyId
- type Balance
- fn transfer
- fn deposit
- fn withdraw
- trait MultiCurrencyExtended: MultiCurrency
- type Amount: TryInto<Balance>, TryFrom<Balance>
- Signed version of
Balance
- Signed version of
- fn update_balance(who: AccountId, currency_id: CurrencyId, amount: Amount)
- type Amount: TryInto<Balance>, TryFrom<Balance>
- trait OnNewData<Key, Value>
- fn on_new_data(key: Key, value: Value)
- trait DataProvider<Key, Value>
- fn get(key: Key) -> Option<Value>
- trait PriceProvider<CurrencyId, Price>
- fn get_price(base: CurrencyId, quote: CurrencyId): Option<Price>
- struct AuctionInfo
- bid: Option<(AccountId, Balance)>
- end: Option<BlockNumber>
- trait Auction
- type AuctionId
- type Balance
- fn auction_info(id: AuctionId): AuctionInfo
- fn update_auction(id: AuctionId, info: AuctionInfo)
- fn new_auction(start: BlockNumber, end: Option<BlockNumber>): AuctionId
- struct OnNewBidResult
- accept_bid: bool
- auction_end: Optio<Option<BlockNumber>>
- trait AuctionHandler
- fn on_new_bid(now: BlockNumber, id: AuctionId, new_bid: (AccountId, Balance), last_bid: Option<(AccountId, Balance)>): OnNewBidResult
- called when new bid is received
- use return value to determine if the bid should be accepted and update auction end time
- this should reserved current winner money and refund previous winner
- fn on_auction_ended(id: AuctionId, winner: Option<(AccountId, Balance)>)
- fn on_new_bid(now: BlockNumber, id: AuctionId, new_bid: (AccountId, Balance), last_bid: Option<(AccountId, Balance)>): OnNewBidResult
- trait BasicCurrency
- Types
- tokens
- Trait
- CurrencyId
- Call
- transfer(origin, currency_id: CurrencyId, to: AccountId, value: Balance)
- Module: MultiCurrencyExtended
- Trait
- currencies
- Trait
- NativeCurrency: BasicCurrency
- NativeCurrencyId: Get<CurrencyId>
- MultiCurrency: MultiCurrencyExtended<CurrencyId = Self::MultiCurrencyId>
- Call
- transfer(origin, currency_id: CurrencyId, to: AccountId, value: Balance)
- Module: MultiCurrencyExtended
- Trait
- oracle (see #1)
- Trait
- Key
- Value
- OperatorOrigin: EnsureOrigin
- OnNewData: OnNewData<Key, Value>
- Call
- feed_data(origin, key: Key, value: Value)
- Module: DataProvider<Key, Value>
- Trait
- prices
- Trait
- CurrencyId
- Source: DataProvider<CurrencyId, Price>
- Module: PriceProvider<CurrencyId, Price>
- Trait
- auction
- Trait
- Balance
- Handler: AuctionHandler
- Call
- bid(origin, id: AuctionId, value: Balance)
- Module: Auction
- Trait
xlc commented
done