Closed roxdanila closed 2 years ago
buyCover
[x] should purchase new cover using 1 staking pool: 1000 ETH for 30 days, pay in ETH
[x] should purchase new cover using 2 staking pools: 1000 ETH for 30 days, pay in ETH
[x] should purchase new cover using NXM with commission: 1000 ETH for 30 days, pay in NXM
[x] should purchase new cover using DAI with commission: 1000 DAI for 30 days, pay in DAI
[x] should purchase new cover using USDC with commission: 1M USDC for 30 days, pay in USDC
[x] should revert for unavailable product
[x] should revert for unsupported payout asset
[x] should revert for period shorter than the minimum (28 days)
[x] should revert for period longer than the maximum (364 days)
[x] should revert for commission rate too high (25%)
[x] should revert when cover amount is 0
[x] Should revert if system is paused
[x] Should revert if caller is not member
[x] Should revert if reentrant (Is reentrant protection needed?)
[x] Should revert if owner is address zero
[x] Should revert if productId is not valid
[ ] Should revert if product is not initialized
[x] Should revert if payout asset is not supported by the product
[x] Should revert if amount is 0
[x] Should revert if period is not within allowed bounds
[x] Should revert if commission ratio is bigger than max value
[x] Should revert if paymentAsset is not supported
[x] Should revert if paymentAsset is deprecated
[x] Should revert if calculated premium is bigger than maxPremiumInAsset
[x] Should revert if empty array of allocationRequests?
[x] Should revert if pools out of capacity
[x] Should retrieve payment in ERC20 paymentAsset from caller
[x] Should allow to pay with NXM
[x] Should allow to pay with ETH
[x] Should allow to pay with DAI
[x] Should pay correct commission to commissionDestination
[x] Should store cover data
[x] Should mint NFT to owner
[ ] Should emit CoverBought event
[x] Should work if owner is not a member
[ ] Should correctly calculate premium
[x] Should correctly allocate capacity to pools
[x] Should allow to buy against multiple staking pools (Is there a max amount of pools that should be considered?)
[x] Should correctly mint rewards to pools
[x] Should correctly create segments
buyCover
[x] should purchase new cover using 1 staking pool: 1000 ETH for 30 days, pay in ETH
[x] should purchase new cover using 2 staking pools: 1000 ETH for 30 days, pay in ETH
[x] should purchase new cover using NXM with commission: 1000 ETH for 30 days, pay in NXM
[x] should purchase new cover using DAI with commission: 1000 DAI for 30 days, pay in DAI
[x] should purchase new cover using USDC with commission: 1M USDC for 30 days, pay in USDC
[x] should revert for unavailable product
[x] should revert for unsupported payout asset
[x] should revert for period shorter than the minimum (28 days)
[x] should revert for period longer than the maximum (364 days)
[x] should revert for commission rate too high (25%)
[x] should revert when cover amount is 0
[x] Should revert if system is paused
[x] Should revert if caller is not member
[x] Should revert if reentrant (Is reentrant protection needed?)
[x] Should revert if owner is address zero
[x] Should revert if productId is not valid
[ ] Should revert if product is not initialized
[x] Should revert if payout asset is not supported by the product
[x] Should revert if amount is 0
[x] Should revert if period is not within allowed bounds
[x] Should revert if commission ratio is bigger than max value
[x] Should revert if paymentAsset is not supported
[x] Should revert if paymentAsset is deprecated
[x] Should revert if calculated premium is bigger than maxPremiumInAsset
[x] Should revert if empty array of allocationRequests?
[x] Should revert if pools out of capacity
[x] Should retrieve payment in ERC20 paymentAsset from caller
[x] Should allow to pay with NXM
[x] Should allow to pay with ETH
[x] Should allow to pay with DAI
[x] Should pay correct commission to commissionDestination
[x] Should store cover data
[x] Should mint NFT to owner
[ ] Should emit CoverBought event
[x] Should work if owner is not a member
[ ] Should correctly calculate premium
[x] Should correctly allocate capacity to pools
[x] Should allow to buy against multiple staking pools (Is there a max amount of pools that should be considered?)
[x] Should correctly mint rewards to pools
[x] Should correctly create segments