Skip to content

Commit

Permalink
handle add order for tranche
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Aug 26, 2024
1 parent ec72e2c commit e8ab67c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/tranche/tranche-space-symmetric.rain
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ deployments:

#amount-is-output !Whether the amount is an output or input amount. Non-zero means output (i.e. normal orderbook behaviour), zero means input.

#init-key "init"
#tranche-space-key "tranche-space"
#update-time-key "update-time"

Expand All @@ -422,18 +421,13 @@ deployments:
amount
io-ratio:;

#handle-add-order
:set(hash(order-hash() tranche-space-key) initial-tranche-space),
:set(hash(order-hash() update-time-key) now());

#get-last-tranche-prod
is-initialized: get(hash(order-hash() init-key)),
tranche-space-before: if(
is-initialized
get(hash(order-hash() tranche-space-key))
initial-tranche-space
),
last-update-time: if(
is-initialized
get(hash(order-hash() update-time-key))
now()
),
tranche-space-before: get(hash(order-hash() tranche-space-key)),
last-update-time: get(hash(order-hash() update-time-key)),
current-time: now();

#tranche-space-shyness !The shyness of the liquidity in tranches. E.g. 0.9 is 90% shy.
Expand All @@ -443,7 +437,6 @@ deployments:
is-zero(frac(tranche-space))
add(tranche-space tranche-space-shyness)
tranche-space),
:set(hash(order-hash() init-key) 1),
:set(hash(order-hash() tranche-space-key) shy-tranche-space),
:set(hash(order-hash() update-time-key) current-time);

Expand Down

0 comments on commit e8ab67c

Please sign in to comment.