Closed ethanfrey closed 2 years ago
@ethanfrey regarding
Note: if common_token == base_asset, then price is defined as 1.0. No need to query a price oracle for this case (and validation could allow an empty string there? or just store something and ignore it?)
Can't it be just Option<String>
? Unless we want to keep all logic in market, then this field could be just ignored.
Sure, I guess Option<String>
is more expressive than "String, but ignore it, if it is some special value"
Depends on #19 and #20
For the credit agency to make global calculations, it needs to get info from the Market contracts.
Add to the Market constructor (and the credit agency factory) three more items:
Common Token comes from the Credit Agency constructor (same for all markets). The collateral ratio and Price Oracle can be set individually for each Market.
Note: if common_token == base_asset, then price is defined as 1.0. No need to query a price oracle for this case (and validation could allow an empty string there? or just store something and ignore it?)
The Market has one more query:
The calculation is basically: