bet-no-loss icon indicating copy to clipboard operation
bet-no-loss copied to clipboard

[Contract] Sport Event Handling

Open ebouchut opened this issue 4 years ago • 0 comments

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 using OracleContract.registerEvent. mapping: eventId => {event_name, event_date, outcome_available_date}
      • [x] tested
  • [ ] 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) onlyBetContract can only be called by the BetContract registered at creation time,
      • [ ] tested
  • [ ] function registerBetContract() ownerOnly only 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
    • _name must be unique and does not exist yet
    • _event_date > now + 1 week
    • _outcome_available_date > _event_date + 1 week

ebouchut avatar Dec 22 '20 17:12 ebouchut