Skip to content

Commit

Permalink
testing dynamic slippage
Browse files Browse the repository at this point in the history
  • Loading branch information
RonTuretzky committed Mar 17, 2024
1 parent 7f3d3a3 commit cc72271
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ <h2>Bread2Gnosis Token Swap</h2>
</div>
<div>
<label for="amount"><a href="https://breadchain.xyz">BREAD</a> amount to redeem:</label>
<input type="text" id="amount" placeholder="1.0">
<input type="text" id="amount" placeholder="1.0" oninput="calculateMinDy()">
</div>
<div>
<label for="minDy">Minimum accepted GBPe after slippage:</label>
<input type="text" id="minDy" placeholder="0.9">
<input type="text" id="minDy" placeholder="0.97" readonly>
</div>

<script>
function calculateMinDy() {
const amount = document.getElementById('amount').value;
const minDyInput = document.getElementById('minDy');
minDyInput.value = (parseFloat(amount) * 0.97).toFixed(2);
}
</script>
<button id="swapButton">Swap and Transfer</button>

<script>
Expand Down

0 comments on commit cc72271

Please sign in to comment.