order state tweak

This commit is contained in:
Tim Olson
2023-10-13 01:48:42 -04:00
parent 1fabd95940
commit f61c318a0b
6 changed files with 8 additions and 19 deletions

View File

@@ -21,9 +21,8 @@ library OrderLib {
event DexorderSwapError (uint64 orderIndex, string reason);
// todo If a tranche fails to fill, an order can stay Open forever without any active tranches. maybe replace state with a simple canceled flag
enum SwapOrderState {
Open, Canceled, Filled, Template
Open, Canceled, Filled, Expired // Expired isn't ever shown on-chain. the Expired state is implied by tranche constraints.
}
enum Exchange {
@@ -297,7 +296,7 @@ library OrderLib {
function _cancelOrder(OrdersInfo storage self, uint64 orderIndex) internal {
SwapOrderState state = self.orders[orderIndex].state;
if( state == SwapOrderState.Open || state == SwapOrderState.Template ) {
if( state == SwapOrderState.Open ) {
self.orders[orderIndex].state = SwapOrderState.Canceled;
emit DexorderSwapCompleted(orderIndex);
}

View File

@@ -1,11 +0,0 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
pragma abicoder v2;
enum OrderStatus {
ACTIVE, // the only status while the order is still executing
CANCELED, // canceled by the owner
FILLED, // full trade amount was filled
EXPIRED // trade ended without completing its fills
}

View File

@@ -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 = 0x40d5f4d1aa2f505a4b156599c452d0e7df5003430246ca5798a932dc031a9127;
bytes32 internal constant VAULT_INIT_CODE_HASH = 0xe5ccc5781ec7c9aa6e1ca21f73022e0b4606f22aca8dde4e455fd8051007d378;
// the contract being constructed must not have any constructor arguments or the determinism will be broken. instead, use a callback to
// get construction arguments