SwapOrderStatus.startTime

This commit is contained in:
tim
2024-07-22 13:48:43 -04:00
parent 5f31437ef8
commit 8dd3744dbc

View File

@@ -85,7 +85,8 @@ class SwapStatus:
# this is an elaborated version of the on-chain status # this is an elaborated version of the on-chain status
fillFeeHalfBps: int fillFeeHalfBps: int
state: SwapOrderState state: SwapOrderState
start: int startTime: int
startPrice: int
ocoGroup: Optional[int] ocoGroup: Optional[int]
filledIn: Optional[int] # if None then look in the order_filled blockstate filledIn: Optional[int] # if None then look in the order_filled blockstate
filledOut: Optional[int] # if None then look in the order_filled blockstate filledOut: Optional[int] # if None then look in the order_filled blockstate
@@ -108,14 +109,15 @@ class SwapOrderStatus(SwapStatus):
order = SwapOrder.load(obj[0]) order = SwapOrder.load(obj[0])
fillFeeHalfBps = int(obj[1]) fillFeeHalfBps = int(obj[1])
state = SwapOrderState(obj[2]) state = SwapOrderState(obj[2])
start = obj[3] startTime = obj[3]
ocoGroup = None if obj[4] == NO_OCO else obj[4] startPrice = obj[4]
filledIn = int(obj[5]) ocoGroup = None if obj[5] == NO_OCO else obj[5]
filledOut = int(obj[6]) filledIn = int(obj[6])
trancheFilledIn = [int(f) for f in obj[7]] filledOut = int(obj[7])
trancheFilledOut = [int(f) for f in obj[8]] trancheFilledIn = [int(f) for f in obj[8]]
trancheActivationTime = [int(f) for f in obj[9]] trancheFilledOut = [int(f) for f in obj[9]]
return SwapOrderStatus(order, fillFeeHalfBps, state, start, ocoGroup, trancheActivationTime = [int(f) for f in obj[10]]
return SwapOrderStatus(order, fillFeeHalfBps, state, startTime, startPrice, ocoGroup,
filledIn, filledOut, trancheFilledIn, trancheFilledOut, trancheActivationTime) filledIn, filledOut, trancheFilledIn, trancheFilledOut, trancheActivationTime)
@staticmethod @staticmethod
@@ -123,29 +125,31 @@ class SwapOrderStatus(SwapStatus):
# 0 SwapOrder order; # 0 SwapOrder order;
# 1 int fillFeeHalfBps # 1 int fillFeeHalfBps
# 2 bool canceled; # 2 bool canceled;
# 3 uint32 start; # 3 uint32 startTime;
# 4 uint64 ocoGroup; # 4 uint32 startPrice;
# 5 uint256 filled; // total # 5 uint64 ocoGroup;
# 6 uint256[] trancheFilled; // sum(trancheFilled) == filled # 6 uint256 filled; // total
# 7 uint32[] trancheActivationTime; # 7 uint256[] trancheFilled; // sum(trancheFilled) == filled
# 8 uint32[] trancheActivationTime;
order = SwapOrder.load(obj[0]) order = SwapOrder.load(obj[0])
fillFeeHalfBps = obj[1] fillFeeHalfBps = obj[1]
state = SwapOrderState.Canceled if obj[2] else SwapOrderState.Open state = SwapOrderState.Canceled if obj[2] else SwapOrderState.Open
start = obj[3] startTime = obj[3]
ocoGroup = None if obj[4] == NO_OCO else obj[4] startPrice = obj[4]
ocoGroup = None if obj[5] == NO_OCO else obj[5]
# we ignore any fill values from the on-chain struct, because we will subsequently detect the DexorderSwapFilled events and add them in # we ignore any fill values from the on-chain struct, because we will subsequently detect the DexorderSwapFilled events and add them in
filledIn = 0 filledIn = 0
filledOut = 0 filledOut = 0
trancheFilledIn = [0 for _ in range(len(obj[6]))] trancheFilledIn = [0 for _ in range(len(obj[7]))]
trancheFilledOut = [0 for _ in range(len(obj[6]))] trancheFilledOut = [0 for _ in range(len(obj[7]))]
trancheActivationTime = [int(i) for i in obj[7]] trancheActivationTime = [int(i) for i in obj[8]]
return SwapOrderStatus(order, fillFeeHalfBps, state, start, ocoGroup, return SwapOrderStatus(order, fillFeeHalfBps, state, startTime, startPrice, ocoGroup,
filledIn, filledOut, trancheFilledIn, trancheFilledOut, trancheActivationTime) filledIn, filledOut, trancheFilledIn, trancheFilledOut, trancheActivationTime)
def dump(self): def dump(self):
return ( return (
self.order.dump(), self.fillFeeHalfBps, self.state.value, self.start, self.ocoGroup, self.order.dump(), self.fillFeeHalfBps, self.state.value, self.startTime, self.startPrice, self.ocoGroup,
str(self.filledIn), str(self.filledOut), str(self.filledIn), str(self.filledOut),
[str(f) for f in self.trancheFilledIn], [str(f) for f in self.trancheFilledOut], [str(f) for f in self.trancheFilledIn], [str(f) for f in self.trancheFilledOut],
[int(i) for i in self.trancheActivationTime] [int(i) for i in self.trancheActivationTime]
@@ -249,6 +253,7 @@ class Tranche:
msg += f' {self.rateLimitFraction/MAX_FRACTION:.1%} every {self.rateLimitPeriod/60:.0} minutes' msg += f' {self.rateLimitFraction/MAX_FRACTION:.1%} every {self.rateLimitPeriod/60:.0} minutes'
return msg return msg
@dataclass @dataclass
class PriceProof: class PriceProof:
proof: int proof: int