in simulation/decai/simulation/contract/incentive/stakeable.py [0:0]
def handle_refund(self, submitter: str, stored_data: StoredData,
claimable_amount: float, claimed_by_submitter: bool,
prediction) -> float:
result = claimable_amount
# Do not need to check submitter == stored_data.sender because DataHandler already did it.
if claimed_by_submitter:
raise RejectException("Deposit already claimed by submitter.")
if result <= 0:
raise RejectException("There is no reward left to claim.")
current_time_s = int(self._time())
if current_time_s - stored_data.time <= self.refund_time_s:
raise RejectException("Not enough time has passed.")
if callable(prediction):
prediction = prediction()
if prediction != stored_data.classification:
raise RejectException("The model doesn't agree with your contribution.")
self.num_good_data_per_user[submitter] += 1
self.total_num_good_data += 1
return result