redefine fraction as uint16
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# this script requires the jq command $(sudo apt install jq)
|
||||
|
||||
# first-pass build
|
||||
forge build "$@" || exit 1
|
||||
forge build --force "$@" || exit 1
|
||||
|
||||
# calculate the Vault init code hash using the bytecode generated for Vault
|
||||
# shellcheck disable=SC2046
|
||||
|
||||
@@ -109,7 +109,7 @@ library OrderLib {
|
||||
}
|
||||
|
||||
struct Tranche {
|
||||
uint64 fraction; // 18-decimal fraction of the order amount which is available to this tranche. must be <= 1
|
||||
uint16 fraction; // fraction of the order amount is available to this tranche, where type(uint16).max == 100%
|
||||
Constraint[] constraints;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ library OrderLib {
|
||||
return 'NI'; // not implemented
|
||||
// unknown constraint
|
||||
}
|
||||
uint256 amount = status.order.amount * tranche.fraction / 10 ** 18 // the most this tranche could do
|
||||
uint256 amount = status.order.amount * tranche.fraction / type(uint16).max // the most this tranche could do
|
||||
- (status.order.amountIsInput ? status.trancheFilledIn[tranche_index] : status.trancheFilledOut[tranche_index]); // minus tranche fills
|
||||
// order amount remaining
|
||||
uint256 remaining = status.order.amount - (status.order.amountIsInput ? status.filledIn : status.filledOut);
|
||||
|
||||
@@ -10,7 +10,7 @@ library VaultAddress {
|
||||
// keccak-256 hash of the Vault's bytecode (not the deployed bytecode but the initialization bytecode)
|
||||
// can paste into:
|
||||
// https://emn178.github.io/online-tools/keccak_256.html
|
||||
bytes32 internal constant VAULT_INIT_CODE_HASH = 0xe5ccc5781ec7c9aa6e1ca21f73022e0b4606f22aca8dde4e455fd8051007d378;
|
||||
bytes32 internal constant VAULT_INIT_CODE_HASH = 0x304b4fd55dc4ea606dcf1e4085f81f376e30552a319aa43fc3e389a089f2f0ea;
|
||||
|
||||
// the contract being constructed must not have any constructor arguments or the determinism will be broken. instead, use a callback to
|
||||
// get construction arguments
|
||||
|
||||
Reference in New Issue
Block a user