Skip to content

Commit

Permalink
added: max option in deposit, repay, workflow readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Salmandabbakuti committed Oct 21, 2024
1 parent 7161ebf commit e3e02db
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,27 +182,27 @@ https://github.com/user-attachments/assets/82e21e79-a70e-4f86-a24e-f793ef0cdada

#### Workflow Example

1. User deposits 0.004 AVAX as collateral on the origin chain(Avalanche).
1. User deposits 0.0004 AVAX as collateral on the origin chain(Avalanche).

https://snowtrace.io/tx/0xdf283239f64a65a9fe79c6ae3616b009c7a879c424347dc44a738300cf57c5c0

2. Reactive Contract listens for the `CollateralDeposited` event on the origin chain(Avalanche) and triggers a callback to the destination chain(Sepolia)

https://kopli.reactscan.net/rvm/0xc7203561ef179333005a9b81215092413ab86ae9/45

3. User receives a loan of 0.004 ETH on the destination chain(Sepolia).
3. User receives a loan of 0.0004 ETH on the destination chain(Sepolia).

https://sepolia.etherscan.io/tx/0xa64aceff981f2a89f8533cce34baad1fd742712ad941c780af13b52f3f025d4b

4. User repays the partial loan amount of 0.002 ETH on the destination chain(Sepolia).
4. User repays the partial loan amount of 0.0002 ETH on the destination chain(Sepolia).

https://sepolia.etherscan.io/tx/0x47f31d40b36e932ea07df3fb36d31f816d34c8c935df53629c5dd76e7215bfb3

5. Reactive Contract listens for the `LoanRepaid` event on the destination chain(Sepolia) and triggers a callback to the origin chain(Avalanche) to release the collateral to the user's address on the origin chain(Avalanche).

https://kopli.reactscan.net/rvm/0xc7203561ef179333005a9b81215092413ab86ae9/46

6. User receives the collateral of 0.002 AVAX on the origin chain(Avalanche).
6. User receives the collateral of 0.0002 AVAX on the origin chain(Avalanche).

https://snowtrace.io/tx/0x601f804645eeb465f9aae3921c46c41d383f5278f12181975e5d0870585fca7c

Expand Down
22 changes: 22 additions & 0 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@ export default function App() {
value={collateralAmountInput}
onChange={(e) => setCollateralAmountInput(e.target.value)}
style={{ margin: "10px 0" }}
suffix={
<Button
type="link"
size="small"
onClick={() =>
setCollateralAmountInput(
avalancheBalance?.displayValue || ""
)
}
>
Max
</Button>
}
addonAfter={"AVAX"}
/>
{/* note text */}
Expand Down Expand Up @@ -312,6 +325,15 @@ export default function App() {
value={repayAmountInput}
onChange={(e) => setRepayAmountInput(e.target.value)}
style={{ margin: "27px 0" }}
suffix={
<Button
type="link"
size="small"
onClick={() => setRepayAmountInput(toEther(loanAmount || 0n))}
>
Max
</Button>
}
addonAfter={"ETH"}
/>
<Button
Expand Down
8 changes: 4 additions & 4 deletions src/crosschain-lending/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,26 +160,26 @@ This should trigger a callback to the destination chain(Sepolia) to issue loan a

#### Workflow Example

1. User deposits 0.004 AVAX as collateral on the origin chain(Avalanche).
1. User deposits 0.0004 AVAX as collateral on the origin chain(Avalanche).

https://snowtrace.io/tx/0xdf283239f64a65a9fe79c6ae3616b009c7a879c424347dc44a738300cf57c5c0

2. Reactive Contract listens for the `CollateralDeposited` event on the origin chain(Avalanche) and triggers a callback to the destination chain(Sepolia)

https://kopli.reactscan.net/rvm/0xc7203561ef179333005a9b81215092413ab86ae9/45

3. User receives a loan of 0.004 ETH on the destination chain(Sepolia).
3. User receives a loan of 0.0004 ETH on the destination chain(Sepolia).

https://sepolia.etherscan.io/tx/0xa64aceff981f2a89f8533cce34baad1fd742712ad941c780af13b52f3f025d4b

4. User repays the partial loan amount of 0.002 ETH on the destination chain(Sepolia).
4. User repays the partial loan amount of 0.0002 ETH on the destination chain(Sepolia).

https://sepolia.etherscan.io/tx/0x47f31d40b36e932ea07df3fb36d31f816d34c8c935df53629c5dd76e7215bfb3

5. Reactive Contract listens for the `LoanRepaid` event on the destination chain(Sepolia) and triggers a callback to the origin chain(Avalanche) to release the collateral to the user's address on the origin chain(Avalanche).

https://kopli.reactscan.net/rvm/0xc7203561ef179333005a9b81215092413ab86ae9/46

6. User receives the collateral of 0.002 AVAX on the origin chain(Avalanche).
6. User receives the collateral of 0.0002 AVAX on the origin chain(Avalanche).

https://snowtrace.io/tx/0x601f804645eeb465f9aae3921c46c41d383f5278f12181975e5d0870585fca7c

0 comments on commit e3e02db

Please sign in to comment.