Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case to reproduce #460 PM black swan issue #2114

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions tests/tests/operation_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,36 @@ BOOST_AUTO_TEST_CASE( prediction_market_resolves_to_0 )
}
}

/**
* Reproduces https://github.com/bitshares/bitshares-core/issues/460 : Prediction market can suffer a black swan
*/
BOOST_AUTO_TEST_CASE( prediction_market_blackswan_test )
{ try {
ACTORS((judge)(dan));

const auto& pmark = create_prediction_market("PMARK", judge_id);

int64_t init_balance(1000000);
transfer(committee_account, judge_id, asset(init_balance));
transfer(committee_account, dan_id, asset(init_balance));

BOOST_TEST_MESSAGE( "Open position with equal collateral" );
borrow( dan, pmark.amount(1000), asset(1000) );

update_feed_producers( pmark, { judge_id });
price_feed feed;
feed.settlement_price = asset( 1, pmark.id ) / asset( 1 );
publish_feed( pmark, judge, feed );

// black swan event occurs
BOOST_CHECK( pmark.bitasset_data(db).has_settlement() );

} catch( const fc::exception& e) {
edump((e.to_detail_string()));
throw;
}
}

BOOST_AUTO_TEST_CASE( create_account_test )
{
try {
Expand Down