open-web3-stack/open-runtime-module-library

Overall Design

Closed this issue · 1 comments

xlc commented
  • utilities
  • 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
        • fn update_balance(who: AccountId, currency_id: CurrencyId, amount: Amount)
      • 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)>)
  • tokens
    • Trait
      • CurrencyId
    • Call
      • transfer(origin, currency_id: CurrencyId, to: AccountId, value: Balance)
    • Module: MultiCurrencyExtended
  • currencies
    • Trait
      • NativeCurrency: BasicCurrency
      • NativeCurrencyId: Get<CurrencyId>
      • MultiCurrency: MultiCurrencyExtended<CurrencyId = Self::MultiCurrencyId>
    • Call
      • transfer(origin, currency_id: CurrencyId, to: AccountId, value: Balance)
    • Module: MultiCurrencyExtended
  • oracle (see #1)
    • Trait
      • Key
      • Value
      • OperatorOrigin: EnsureOrigin
      • OnNewData: OnNewData<Key, Value>
    • Call
      • feed_data(origin, key: Key, value: Value)
    • Module: DataProvider<Key, Value>
  • prices
    • Trait
      • CurrencyId
      • Source: DataProvider<CurrencyId, Price>
    • Module: PriceProvider<CurrencyId, Price>
  • auction
    • Trait
      • Balance
      • Handler: AuctionHandler
    • Call
      • bid(origin, id: AuctionId, value: Balance)
    • Module: Auction
xlc commented

done