Skip to content

V2 Cover unit tests: buyCover #268

@roxdanila

Description

@roxdanila

buyCover

  • should purchase new cover using 1 staking pool: 1000 ETH for 30 days, pay in ETH

  • should purchase new cover using 2 staking pools: 1000 ETH for 30 days, pay in ETH

  • should purchase new cover using NXM with commission: 1000 ETH for 30 days, pay in NXM

  • should purchase new cover using DAI with commission: 1000 DAI for 30 days, pay in DAI

  • should purchase new cover using USDC with commission: 1M USDC for 30 days, pay in USDC

  • should revert for unavailable product

  • should revert for unsupported payout asset

  • should revert for period shorter than the minimum (28 days)

  • should revert for period longer than the maximum (364 days)

  • should revert for commission rate too high (25%)

  • should revert when cover amount is 0

  • Should revert if system is paused

  • Should revert if caller is not member

  • Should revert if reentrant (Is reentrant protection needed?)

  • Should revert if owner is address zero

  • Should revert if productId is not valid

  • Should revert if product is not initialized

  • Should revert if payout asset is not supported by the product

  • Should revert if amount is 0

  • Should revert if period is not within allowed bounds

  • Should revert if commission ratio is bigger than max value

  • Should revert if paymentAsset is not supported

  • Should revert if paymentAsset is deprecated

  • Should revert if calculated premium is bigger than maxPremiumInAsset

  • Should revert if empty array of allocationRequests?

  • Should revert if pools out of capacity

  • Should retrieve payment in ERC20 paymentAsset from caller

  • Should allow to pay with NXM

  • Should allow to pay with ETH

  • Should allow to pay with DAI

  • Should pay correct commission to commissionDestination

  • Should store cover data

  • Should mint NFT to owner

  • Should emit CoverBought event

  • Should work if owner is not a member

  • Should correctly calculate premium

  • Should correctly allocate capacity to pools

  • Should allow to buy against multiple staking pools (Is there a max amount of pools that should be considered?)

  • Should correctly mint rewards to pools

  • Should correctly create segments

Metadata

Metadata

Assignees

Labels

testUnit/integration/CI tests

Type

No type

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions