Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
allow input amount tranche diff
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Mar 7, 2024
1 parent 488917f commit 746f886
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tranche-space.rain
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@
tranche-space-before
_
tranche-total-size: call<'calculate-tranche>(),
tranche-space-diff: decimal18-div(decimal18-scale-18-dynamic(output-token-decimals() output-vault-balance-decrease()) tranche-total-size),
tranche-amount-diff: if(
amount-is-output
decimal18-scale-18-dynamic(output-token-decimals() output-vault-balance-decrease())
decimal18-scale-18-dynamic(input-token-decimals() input-vault-balance-increase())),
tranche-space-diff: decimal18-div(tranche-amount-diff tranche-total-size),
tranche-space-after: decimal18-add(tranche-space-before tranche-space-diff),
/* Snap tranche space to the nearest tranche to avoid dust issues at the edges */
tranche-space-after-snapped: decimal18-snap-to-unit(tranche-space-snap-threshold tranche-space-after),
Expand Down

0 comments on commit 746f886

Please sign in to comment.