You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I reviewed the Insurance.sol contract and found the following issues within the issueInsurance function.
The insurance amount was not checked to reject 0 amounts. I ran a test, and the issueInsurance function will pass if the amount is zero, thereby creating a dud policy. You don't want this outcome, as it is unhandled.
To avoid collision I added the block.timestamp, you can ALSO use a universal nonce or block number. policyId = keccak256(abi.encode(insuredEvent, payoutAddress, block.timestamp));
Note that we intentionally kept the insurance issuance logic bare-bones so that this could focus on OptiimisticOracleV3 interaction patterns, e.g. assertion in payout request and settlement in resolved assertion callback.
The quickstart contracts in this repo are only intended as demonstration referenced in UMA OO docs in quick walk-through, thus, it is a requirement to keep as low line count as possible.
We are, however, encouraging integrations to build on top of these examples in their forked repositories, and would be happy to assist on any issues people encounter. I would be closing this issue and PR in the meantime.
Hi! I reviewed the Insurance.sol contract and found the following issues within the
issueInsurance
function.policyId = keccak256(abi.encode(insuredEvent, payoutAddress, block.timestamp));
I made a PR that addresses both issues here: #14
The text was updated successfully, but these errors were encountered: