Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insurance.issueInsurance() misses 2 check patterns. #15

Open
saibaneer opened this issue Jan 31, 2024 · 1 comment
Open

Insurance.issueInsurance() misses 2 check patterns. #15

saibaneer opened this issue Jan 31, 2024 · 1 comment

Comments

@saibaneer
Copy link

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));

I made a PR that addresses both issues here: #14

@Reinis-FRP
Copy link
Collaborator

Hi, thanks for the review and PR!

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants