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

Calculating borrow amount #664

Open
djeck1432 opened this issue Feb 26, 2025 · 4 comments
Open

Calculating borrow amount #664

djeck1432 opened this issue Feb 26, 2025 · 4 comments

Comments

@djeck1432
Copy link
Owner

You need to calculate how much of the specified token user needs to borrow from our pools to open desired position.
For example, user comes with 1 ETH with a price of 1000 USD (Obtained through Pragma oracle). They want to leverage it to x5 amount through our STRK pool(let be 1 STRK 2 USDC).
In that case, we need to give him 4 more ETH. We calculate required amount in USD, in our case user will need 2000 * 10**18 STRK(4000 USD * 10**8 / 2 USD * 10**8).

  • Add a get_borrow_amount(self, initial_token, debt_token, amount, multiplier) internal function.
  • Calculate USD equivalent amount of initial_token.
  • Calculate how much in USD user needs to borrow from us.
  • Calculate amount of debt token.
  • Write tests for internal contract state and docstring
@enyinnaya1234
Copy link
Contributor

Hi, gm gm, my name is wisdom and i am a smart contract developer. may i handle this task. i will deliver in less than 48hrs
i like pineapple
telegram handle: Enyinnaya wisdom

@jaygupta18
Copy link

Can I take this issue?

@anushkasomani
Copy link

hi, @djeck1432 . Its Anushka here and I like Pineapple. I'm an experienced DApp developer. I also have recently won at Agentic ethereum where my work also involved writing and testing smart contracts. I would love to give this issue a go.
telegram : any0138
ETA: 7 hours

@Daveside9
Copy link

I will implement the get_borrow_amount internal function to calculate the required debt token amount based on USD value, ensuring accurate leverage computation. I will also write tests and documentation.

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

No branches or pull requests

5 participants