diff --git a/lib/types/events/9lives.go b/lib/types/events/9lives.go index e4865002..c96fe9c5 100644 --- a/lib/types/events/9lives.go +++ b/lib/types/events/9lives.go @@ -115,6 +115,14 @@ type ( TradingAddr Address `json:"trading_addr"` } + EventDeclared struct { + Event + + TradingAddr Address `json:"trading_addr"` + WinningOutcome Bytes `json:"winning_outcome"` + FeeRecipient Address `json:"fee_recipient"` + } + EventLockedUp struct { Event diff --git a/src/IEvents.sol b/src/IEvents.sol index b59d7d35..ce34a43f 100644 --- a/src/IEvents.sol +++ b/src/IEvents.sol @@ -100,6 +100,7 @@ interface IEvents { event InfraMarketUpdated(address indexed old, address indexed new_); + /// @notice Declare was called on a market in the infra market. event Declared( address indexed trading, bytes8 indexed winningOutcome, diff --git a/src/contract_infra_market.rs b/src/contract_infra_market.rs index c3fc61b6..4276ac27 100644 --- a/src/contract_infra_market.rs +++ b/src/contract_infra_market.rs @@ -334,7 +334,7 @@ impl StorageInfraMarket { } // If the winner was called, but no-one whinged, and we're outside two days, // then we're callable. - _ if time_since_called > TWO_DAYS && !has_whinged => (InfraMarketState::Closable, 0), + _ if time_since_called > TWO_DAYS && !has_whinged && !is_winner_set => (InfraMarketState::Closable, 0), // If the winner was declared, two days has passed, and we're in a state where // no-one whinged, then we need to assume we were closed. _ if time_since_called > TWO_DAYS && !has_whinged => (InfraMarketState::Closed, 0), diff --git a/tests/e2e-infra-market.rs b/tests/e2e-infra-market.rs index a2bb85f5..18895e60 100644 --- a/tests/e2e-infra-market.rs +++ b/tests/e2e-infra-market.rs @@ -85,6 +85,13 @@ proptest! { Error::NotAfterWhinging ); }); + // Add two days. + ts_add_time(block_timestamp() + 24 * 60 * 60 * 2); + c.close(trading_addr, msg_sender()).unwrap(); + assert_eq!( + { let c: u8 = InfraMarketState::Closed.into(); c }, + c.status(trading_addr).unwrap().0, + ); } } }