SwapOrderStatus.startTime
This commit is contained in:
@@ -85,7 +85,8 @@ class SwapStatus:
|
||||
# this is an elaborated version of the on-chain status
|
||||
fillFeeHalfBps: int
|
||||
state: SwapOrderState
|
||||
start: int
|
||||
startTime: int
|
||||
startPrice: int
|
||||
ocoGroup: Optional[int]
|
||||
filledIn: 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])
|
||||
fillFeeHalfBps = int(obj[1])
|
||||
state = SwapOrderState(obj[2])
|
||||
start = obj[3]
|
||||
ocoGroup = None if obj[4] == NO_OCO else obj[4]
|
||||
filledIn = int(obj[5])
|
||||
filledOut = int(obj[6])
|
||||
trancheFilledIn = [int(f) for f in obj[7]]
|
||||
trancheFilledOut = [int(f) for f in obj[8]]
|
||||
trancheActivationTime = [int(f) for f in obj[9]]
|
||||
return SwapOrderStatus(order, fillFeeHalfBps, state, start, ocoGroup,
|
||||
startTime = obj[3]
|
||||
startPrice = obj[4]
|
||||
ocoGroup = None if obj[5] == NO_OCO else obj[5]
|
||||
filledIn = int(obj[6])
|
||||
filledOut = int(obj[7])
|
||||
trancheFilledIn = [int(f) for f in obj[8]]
|
||||
trancheFilledOut = [int(f) for f in obj[9]]
|
||||
trancheActivationTime = [int(f) for f in obj[10]]
|
||||
return SwapOrderStatus(order, fillFeeHalfBps, state, startTime, startPrice, ocoGroup,
|
||||
filledIn, filledOut, trancheFilledIn, trancheFilledOut, trancheActivationTime)
|
||||
|
||||
@staticmethod
|
||||
@@ -123,29 +125,31 @@ class SwapOrderStatus(SwapStatus):
|
||||
# 0 SwapOrder order;
|
||||
# 1 int fillFeeHalfBps
|
||||
# 2 bool canceled;
|
||||
# 3 uint32 start;
|
||||
# 4 uint64 ocoGroup;
|
||||
# 5 uint256 filled; // total
|
||||
# 6 uint256[] trancheFilled; // sum(trancheFilled) == filled
|
||||
# 7 uint32[] trancheActivationTime;
|
||||
# 3 uint32 startTime;
|
||||
# 4 uint32 startPrice;
|
||||
# 5 uint64 ocoGroup;
|
||||
# 6 uint256 filled; // total
|
||||
# 7 uint256[] trancheFilled; // sum(trancheFilled) == filled
|
||||
# 8 uint32[] trancheActivationTime;
|
||||
|
||||
order = SwapOrder.load(obj[0])
|
||||
fillFeeHalfBps = obj[1]
|
||||
state = SwapOrderState.Canceled if obj[2] else SwapOrderState.Open
|
||||
start = obj[3]
|
||||
ocoGroup = None if obj[4] == NO_OCO else obj[4]
|
||||
startTime = obj[3]
|
||||
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
|
||||
filledIn = 0
|
||||
filledOut = 0
|
||||
trancheFilledIn = [0 for _ in range(len(obj[6]))]
|
||||
trancheFilledOut = [0 for _ in range(len(obj[6]))]
|
||||
trancheActivationTime = [int(i) for i in obj[7]]
|
||||
return SwapOrderStatus(order, fillFeeHalfBps, state, start, ocoGroup,
|
||||
trancheFilledIn = [0 for _ in range(len(obj[7]))]
|
||||
trancheFilledOut = [0 for _ in range(len(obj[7]))]
|
||||
trancheActivationTime = [int(i) for i in obj[8]]
|
||||
return SwapOrderStatus(order, fillFeeHalfBps, state, startTime, startPrice, ocoGroup,
|
||||
filledIn, filledOut, trancheFilledIn, trancheFilledOut, trancheActivationTime)
|
||||
|
||||
def dump(self):
|
||||
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(f) for f in self.trancheFilledIn], [str(f) for f in self.trancheFilledOut],
|
||||
[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'
|
||||
return msg
|
||||
|
||||
|
||||
@dataclass
|
||||
class PriceProof:
|
||||
proof: int
|
||||
|
||||
Reference in New Issue
Block a user