Snippets

chromawallet Solidity Coding Challenge

Updated by Riccardo Sibani

File task.md Modified

  • Ignore whitespace
  • Hide word diff
 
 - Borrower receives 50% of value of token A into token X 
 
-Idea is that borrower is able to use the token x to invest in other currency and only having to repay the principal at expiration date (when the lock period ends)
+Idea is that borrower is able to use the token x to invest in other currency and only having to repay the principal (and interests) at expiration date (when the lock period ends)
 
 ## 2 outcomes can happen
 
Updated by Riccardo Sibani

File task.md Modified

  • Ignore whitespace
  • Hide word diff
 We want to create a contract that allows people to leverage their token and buy other tokens.
 
 ## Workflow
+
+### Assumption
+
 - People can deposit one (stable) coin (token x) into a pool (token X to token A) [i.e. money can be sent to contract itself.]
+
 - There is a fixed return rate for money borrowed in the pool (say 5% per month) [this can be hard coded]
+
 - there is a fix rate (or upgradable via function or oracle) between token X and token A (this is a simplification)
 
+### Flow
+
 - Borrower can deposits x amount of token A and lock them for a certain period
+
 - Borrower receives 50% of value of token A into token X 
 
 Idea is that borrower is able to use the token x to invest in other currency and only having to repay the principal at expiration date (when the lock period ends)
 - Happy path 
 
 Scenario 2 Borrower can’t pay back the loan
+
 - Borrower doesn’t payback within the deadline
+
 - Lender can decide to take collateral at any time
+
 - Borrower can decide to pay back at “at the time” interest (so 5% over a longer period => lock until period + time of repayment) and unleash the collateral
 
 
Updated by Riccardo Sibani

File task.md Modified

  • Ignore whitespace
  • Hide word diff
 ## 2 outcomes can happen
 
 Scenario 1 Borrower can pay back the loan
+
 - At any time before the expiration the borrower send back amount of token x borrowed plus interests until lock period (10% per month)
+
 - The collateral (token A) is released to him/her
+
 - Happy path 
 
 Scenario 2 Borrower can’t pay back the loan
Updated by Riccardo Sibani

File task.md Modified

  • Ignore whitespace
  • Hide word diff
 
 Now thank to the leverage you not only made 4,5mln, but also got the 2 eth (minus 1k+fees usdt) appreciation!
 
-## Bonus question
+## Bonus questions
 
-What is the maximum period it is advised to issue a loan? I.E. Is there a moment where collateral will be lower than interest? Add this check in the code if you feel like.
+- Assuming that the exchange rate between token A and token X will be the same. What is the maximum period it is advised to issue a loan? I.E. Is there a moment where collateral will be lower than principal+interest?
+- Can we add a check that allows the lender to take the collateral before the end of the lock period in case the previous situation applies?
 
 ## Expected delivary
 
Updated by Riccardo Sibani

File task.md Modified

  • Ignore whitespace
  • Hide word diff
 
 ## Bonus question
 
-What is the maximum period it is advised to take a loan? I.E. Is there a moment where collateral will be lower than interest?
+What is the maximum period it is advised to issue a loan? I.E. Is there a moment where collateral will be lower than interest? Add this check in the code if you feel like.
 
 ## Expected delivary
 
  1. 1
  2. 2
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.