order placement doesnt crash
This commit is contained in:
@@ -29,12 +29,12 @@ export function newOrder(tokenIn, tokenOut, exchange, fee, amount, amountIsInput
|
||||
}
|
||||
|
||||
// struct Tranche {
|
||||
// uint64 fraction; // 18-decimal fraction of the order amount which is available to this tranche. must be <= 1
|
||||
// uint64 fraction;
|
||||
// Constraint[] constraints;
|
||||
// }
|
||||
export function newTranche(amountRatio, constraints) {
|
||||
return [
|
||||
BigInt(Math.ceil(amountRatio * 10**18)), // we use ceil to make sure the sum of tranche fractions doesn't round below 1
|
||||
BigInt(Math.min(65535, Math.ceil(amountRatio * 65535))), // we use ceil to make sure the sum of tranche fractions doesn't round below 1
|
||||
constraints
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user