class AssetManager(Contract): protocol = ContractProxyField() under_management = WadField() def get_interest_rate(self, etoken, kind): "Returns the interest rate for a given kind of asset" return _R("0.05") class AssetManager(Contract): protocol = ContractProxyField() under_management = WadField() liquidity_min = WadField() liquidity_middle = WadField() liquidity_max = WadField() # Any time balance_of(Protocol) < liquidity_min we refill up to liquidity_middle # Any time balance_of(Protocol) > liquidity_max take liquidity up liquidity_middle def get_interest_rate(self, etoken, kind): "Returns the interest rate for a given kind of asset" return _R("0.05") def total_assets(self): return self.protocol.active_premiums Known Problem: for_lps part of the premiums is counted two times: 1. In etoken accrued interest (partial) 2. In active_premiums Solution: Track in eToken separatelly the accrued interest of on-going policies and the for_lps of ended policies. When the policy ends, remove the accrued from on-going policies and add it to ended policies.