Skip to content

Commit 5612051

Browse files
authored
Create README.md
1 parent 682d787 commit 5612051

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

7-defi-devpost/AlkyneFi/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# AlkyneFi
2+
3+
- Detailed "How to run on local" guide at "scrypto-challenges/7-defi-devpost/AlkyneFi/scryptoDemo/README.md".
4+
5+
- To run the frontend, run this command on the root of Frontend `yarn && yarn run dev`
6+
7+
# The WHAT ?
8+
The protocol is defined simply by
9+
*Invest through our Joint Contract and earn double the profit you were supposed to earn individually.*
10+
We achieve this by using *Equally Collateralised Trade*.
11+
let's see how 👇
12+
13+
## The HOW ?
14+
Let's better understand this with a 5 simple step example,
15+
Lisa is a trader who is looking for a $100 investment.
16+
1 ) She creates a joint account on our website and locks in $100.
17+
2 ) The protocol backs her collateral by equivalent amount summing it to be $200.
18+
3 ) Lisa governs the investment onto any of the given trade options.
19+
4 ) Upon profitable investment Lisa withdraws the total amount.
20+
5 ) Lisa receives *2x* returns than what show could have if she were an individual investor.
21+
22+
Maths for Nerds :
23+
Principal = $200 -> $100 (Lisa) + $100 (Protocol)
24+
Return percentage = 40%
25+
Return Amount = $40 (Lisa's investment) + $40 (Protocol's investment)
26+
Total Protocol fees = $1.6 (Protocol fees )
27+
28+
Total Return Amount Lisa Receives = *$178.4*
29+
($100 Principal + $80 profit - $1.6 [2% Protocol fees])
30+
Total Return Amount Lisa would have received if there were no AlkyneFi = *$140*
31+
($100 Principal + $40 profit)
32+
33+
AlkyneFi helped Lisa Double her returns = *78.4 / 40 ~= 2x return*
34+
35+
# AlkyneFi
36+
37+
## Steps to test app
38+
39+
0. Deploy the radiswap app from <https://github.com/devmrfitz/scrypto-examples/tree/main/defi/radiswap>. Save pool address in $radiswapPool1. Put any 2 token addresses in $xrd and $secondToken. Put your account address in $account.
40+
1. Publish AlkyneFi using `resim publish .`. Save the package address in $package and the owner badge obtained in $tradeXOwnerBadge.
41+
2. `resim run rtm/instantiate.rtm`. Save the component address in $component.
42+
3. `resim run rtm/fund_vault.rtm`
43+
4. `resim run rtm/add_standard_radiswap_pool.rtm`
44+
5. `resim run rtm/add_approved_pool.rtm`
45+
46+
### AlkyneFi is deployed now. Let's see how a user can create account, deposit funds and perform trades
47+
48+
6. `resim run rtm/trader/create_and_fund_wallet.rtm`
49+
7. `resim run rtm/trader/fund_existing_wallet.rtm` (if needed)
50+
8. `resim run rtm/trader/trade.rtm`
51+
9. `resim run rtm/trader/withdraw_payment.rtm`
52+
53+
At any point `resim run rtm/trader/show_lending_balance.rtm` and `resim run rtm/trader/check_wallets.rtm` can be used to monitor the balance.
54+
55+
A regular cronjob of `resim run rtm/poll_all_traders_health.rtm` ensures noone's investment goes below threshold.
56+
57+
## Deployed addresses on testnet
58+
59+
```
60+
account=account_tdx_b_1pr253944sttq4axp958u8xxy6m52j9yr5nd8y7nju3csyxl7y5
61+
package=package_tdx_b_1q9xsqncvnxkd0vtqu7j8xvm8sprwdl9xzzzwl0kglvgszhfknm
62+
63+
64+
component=component_tdx_b_1q2h4tzz6gap02vfne5q7xa7h2g0ak62lulgxlv4kd0nsncakph
65+
tradeXOwnerBadge=resource_tdx_b_1qzh4tzz6gap02vfne5q7xa7h2g0ak62lulgxlv4kd0nsee0cyv
66+
67+
xrd=resource_tdx_b_1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8z96qp
68+
secondToken=resource_tdx_b_1qzdqwhlkmsxlw5qmpdz95rv7ve74e48v44ha4f53puzq5wv38h
69+
radiswapPool1=component_tdx_b_1qfkudyf9uwxs9fd7j37qla0k99zug7q5ryxkrlglc6usjjr8z2
70+
radiSwapPackage=package_tdx_b_1q8ga7qqs2kgyg9hqd6upr72zexhzy522zwrtc85lfs0scdjwdh
71+
```

0 commit comments

Comments
 (0)