Closed
Conversation
Contributor
|
@aji70 resolve conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement
cancel_market()for creator/adminSummary
Implements the
cancel_market()function so creators or admins can cancel markets before resolution and refund all committed USDC to participants. Closes #64Changes
contracts/contracts/boxmeout/src/market.rsState & storage
STATE_CANCELLED = 3PARTICIPANTS_KEYandADMIN_KEYMarketError::UnauthorizedInitialization
admin: Addresstoinitialize()(breaking change)Participants tracking
commit_prediction()for refunds on cancelcancel_market()RESOLVEDor alreadyCANCELLEDCANCELLEDMarketCancelledeventcontracts/contracts/boxmeout/src/factory.rsget_admin()for future usecontracts/BUILD.mdinitialize()example to includeadmin_addressAcceptance criteria
CANCELLEDMarketCancelledeventTests added
test_cancel_market_creator_refunds_participants– creator cancels and refundstest_cancel_market_admin_refunds_participants– admin can canceltest_cancel_market_unauthorized– non-creator/non-admin failstest_cancel_market_resolved_fails– cannot cancel resolved markettest_cancel_market_refunds_predictions– refunds revealed predictionsBreaking change
initialize()now takesadminas the 4th parameter:// Before
initialize(market_id, creator, factory, usdc_token, oracle, closing_time, resolution_time)
// After
initialize(market_id, creator, factory, admin, usdc_token, oracle, closing_time, resolution_time)