Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bond Lending component #56

Closed
werg opened this issue Apr 6, 2021 · 0 comments
Closed

Bond Lending component #56

werg opened this issue Apr 6, 2021 · 0 comments
Assignees

Comments

@werg
Copy link
Contributor

werg commented Apr 6, 2021

BOND LENDING

Some of these will require SDK functions and maybe view functions in the contracts.

columns in table

  1. Coin
  2. Total Supplied
  3. APY -- Let's actually calculate this off-chain. APY = (100 + APR/n)**n - 100, where APR is a percentage and n = 24 * 365,i.e. hours per year.
  4. Maturity (make it hourly, maybe a count down? users can withdraw within 10 minutes at the beginning of every hour) -- for this you need to get the modulohour property from the HourlyBondSubscriptionLending contract. Either by reading the struct directly from this public variable, which would be called as HourlyBondSubscriptionLendingContract.hourlyBondAccounts(token, lenderAddress), which I believe returns a tuple which I'm not sure how `ethersjs parses that out. Alternatively we could write a new view function or add it to an existing view function.
  5. Actions (withdraw and deposit) -- Speak to the relevant functions in Lending, similarly to how crossDeposit works in the margin-account part of the SDK.

The 3 cells on top of the table

  1. Total Bond (in $) -- the sum of all hourly bonds held by the user, converted to the reference currency. You can get the price by calling this function. The PriceAware contract class is deployed at the same address as the CrossMarginTrading contract -- you may need to use the address of CrossMarginTrading, but the .abi of PriceAware when initializing the Contract object in the typescript code.
  2. Average Yield ( 10 %) -- weighted sum of all APY, weighted by the dollar amount of the hourly bond in that token.
  3. Earnings per day (in $) weighted sum of APR / 365

Please delete the BOND RATE table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants