bet-no-loss
bet-no-loss copied to clipboard
[Contract] Sport Event Handling
Description
Handle event creation Register event in the OracleContract OracleContract to inform BetContract of the event outcome
- Related to Epic? #14
Action
- [ ] In BetContract
- [x] function
createEvent(string _name, uint256 _event_date, uint256 _outcome_available_date)will generate and associate a new id to this new event and register it on OracleContract usingOracleContract.registerEvent. mapping: eventId => {event_name, event_date, outcome_available_date}- [x] tested
- [x] function
- [ ] function
registerEventOutcome(uint256 _event_id, uint8 outcome)(where the outcome value can be 0 = draw, 1 = teamA, 2 = teamB) - [ ] tested - [ ] In OracleContract
- [ ]
constructor(address _bet_contract) - [ ] function
registerEvent(uint256 _event_id, uint _outcome_available_date) onlyBetContractcan only be called by the BetContract registered at creation time,- [ ] tested
- [ ]
- [ ] function
registerBetContract() ownerOnlyonly the one who created this contract can call this function
After outcome_available_date OracleContract checks what the outcome of the event is and notifies the BetContract calling the registerEventOutcome method.
Acceptance Criteria
- Function
createEvent:- Only the contract owner can call this function
_namemust be unique and does not exist yet_event_date> now + 1 week_outcome_available_date>_event_date+ 1 week