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

Fixes Issue #138 - Potential token transfer from unrelated account #139

Merged
merged 1 commit into from
Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions contracts/core/lifecycle/CoverReassurance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ contract CoverReassurance is ICoverReassurance, Recoverable {
* @custom:suppress-malicious-erc This ERC-20 `s.getStablecoin()` is a well-known address.
*
* @param coverKey Enter the cover key
* @param account Specify the account from which the reassurance fund will be transferred.
* @param onBehalfOf Enter the account on behalf of which you are adding reassurance.
* @param amount Enter the amount you would like to supply
*
*/
function addReassurance(
bytes32 coverKey,
address account,
address onBehalfOf,
uint256 amount
) external override nonReentrant {
s.mustNotBePaused();
Expand All @@ -63,12 +63,12 @@ contract CoverReassurance is ICoverReassurance, Recoverable {

s.addUintByKey(CoverUtilV1.getReassuranceKey(coverKey), amount);

stablecoin.ensureTransferFrom(account, address(this), amount);
stablecoin.ensureTransferFrom(msg.sender, address(this), amount);

// Do not update state during cover creation
// s.updateStateAndLiquidity(coverKey);

emit ReassuranceAdded(coverKey, amount);
emit ReassuranceAdded(coverKey, onBehalfOf, amount);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions contracts/interfaces/ICoverReassurance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ pragma solidity ^0.8.0;
import "./IMember.sol";

interface ICoverReassurance is IMember {
event ReassuranceAdded(bytes32 indexed coverKey, uint256 amount);
event ReassuranceAdded(bytes32 indexed coverKey, address indexed onBehalfOf, uint256 amount);
event WeightSet(bytes32 indexed coverKey, uint256 weight);
event PoolCapitalized(bytes32 indexed coverKey, bytes32 indexed productKey, uint256 indexed incidentDate, uint256 amount);

/**
* @dev Adds reassurance to the specified cover contract
* @param coverKey Enter the cover key
* @param onBehalfOf Enter the account on behalf of which you are adding reassurance.
* @param amount Enter the amount you would like to supply
*/
function addReassurance(
bytes32 coverKey,
address account,
address onBehalfOf,
uint256 amount
) external;

Expand Down
10 changes: 9 additions & 1 deletion contracts/libraries/CoverLibV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "./RegistryLibV1.sol";
import "./StoreKeyUtil.sol";
import "./RoutineInvokerLibV1.sol";
import "./StrategyLibV1.sol";
import "./NTransferUtilV2.sol";

library CoverLibV1 {
using CoverUtilV1 for IStore;
Expand All @@ -20,6 +21,7 @@ library CoverLibV1 {
using AccessControlLibV1 for IStore;
using ValidationLibV1 for IStore;
using StrategyLibV1 for IStore;
using NTransferUtilV2 for IERC20;

event CoverUserWhitelistUpdated(bytes32 indexed coverKey, bytes32 indexed productKey, address indexed account, bool status);

Expand Down Expand Up @@ -97,7 +99,13 @@ library CoverLibV1 {

// Add cover reassurance
if (values[1] > 0) {
s.getReassuranceContract().addReassurance(coverKey, msg.sender, values[1]);
IERC20 stablecoin = IERC20(s.getStablecoin());
ICoverReassurance reassurance = s.getReassuranceContract();

stablecoin.ensureTransferFrom(msg.sender, address(this), values[1]);
stablecoin.ensureApproval(address(reassurance), values[1]);

reassurance.addReassurance(coverKey, msg.sender, values[1]);
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/examples/distributor/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const deployDependencies = async () => {
const coverLibV1 = await deployer.deployWithLibraries(cache, 'CoverLibV1', {
AccessControlLibV1: accessControlLibV1.address,
CoverUtilV1: coverUtilV1.address,
NTransferUtilV2: transferLib.address,
ProtoUtilV1: protoUtilV1.address,
RegistryLibV1: registryLibV1.address,
RoutineInvokerLibV1: routineInvokerLibV1.address,
Expand Down Expand Up @@ -344,7 +345,7 @@ const deployDependencies = async () => {
cover.updateCoverCreatorWhitelist(owner.address, true)

await npm.approve(stakingContract.address, stakeWithFee)
await dai.approve(reassuranceContract.address, initialReassuranceAmount)
await dai.approve(cover.address, initialReassuranceAmount)

await cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/cx-token-factory/deploy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('cxTokenFactory: Deploy', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, reassuranceAmount)
await deployed.dai.approve(deployed.cover.address, reassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)
})
Expand Down
1 change: 1 addition & 0 deletions test/specs/cx-token-factory/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const deployDependencies = async () => {
const coverLibV1 = await deployer.deployWithLibraries(cache, 'CoverLibV1', {
AccessControlLibV1: accessControlLibV1.address,
CoverUtilV1: coverUtilV1.address,
NTransferUtilV2: transferLib.address,
ProtoUtilV1: protoUtilV1.address,
RegistryLibV1: registryLibV1.address,
RoutineInvokerLibV1: routineInvokerLibV1.address,
Expand Down
2 changes: 1 addition & 1 deletion test/specs/cx-token/before-token-transfer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('cxToken: `_beforeTokenTransfer` function', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/cx-token/burn.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('cxToken: `burn` function', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/cx-token/ctor-vfns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('cxToken: Constructor', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
1 change: 1 addition & 0 deletions test/specs/cx-token/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const deployDependencies = async () => {
const coverLibV1 = await deployer.deployWithLibraries(cache, 'CoverLibV1', {
AccessControlLibV1: accessControlLibV1.address,
CoverUtilV1: coverUtilV1.address,
NTransferUtilV2: transferLib.address,
ProtoUtilV1: protoUtilV1.address,
RegistryLibV1: registryLibV1.address,
RoutineInvokerLibV1: routineInvokerLibV1.address,
Expand Down
2 changes: 1 addition & 1 deletion test/specs/cx-token/get-coverage-starts-from.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('cxToken: `getCoverageStartsFrom` function', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/cx-token/mint.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('cxToken: `mint` function', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/attest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: attest', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
1 change: 1 addition & 0 deletions test/specs/governance/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const deployDependencies = async () => {
const coverLibV1 = await deployer.deployWithLibraries(cache, 'CoverLibV1', {
AccessControlLibV1: accessControlLibV1.address,
CoverUtilV1: coverUtilV1.address,
NTransferUtilV2: transferLib.address,
ProtoUtilV1: protoUtilV1.address,
RegistryLibV1: registryLibV1.address,
RoutineInvokerLibV1: routineInvokerLibV1.address,
Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/dispute.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: dispute', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/emergency-resolve.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: emergencyResolve', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/finalize.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: finalize', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/get-resolution-date.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: getResolutionTimestamp', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/refute.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: refute', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/report.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: report', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Resolution: configureCoolDownPeriod', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
1 change: 1 addition & 0 deletions test/specs/governance/resolution/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const deployDependencies = async () => {
const coverLibV1 = await deployer.deployWithLibraries(cache, 'CoverLibV1', {
AccessControlLibV1: accessControlLibV1.address,
CoverUtilV1: coverUtilV1.address,
NTransferUtilV2: transferLib.address,
ProtoUtilV1: protoUtilV1.address,
RegistryLibV1: registryLibV1.address,
RoutineInvokerLibV1: routineInvokerLibV1.address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Resolution: getCoolDownPeriod', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Resolution: getResolutionDeadline', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Resolution: getUnstakeInfoFor', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
4 changes: 2 additions & 2 deletions test/specs/governance/resolution/unstake-with-claim.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Resolution: unstakeWithClaim (incident occurred)', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down Expand Up @@ -320,7 +320,7 @@ describe('Resolution: unstakeWithClaim (false reporting)', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/resolution/unstake.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Resolution: unstake', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/resolve.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Governance: resolve', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/governance/set-first-reporting-stake.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Governance: `setFirstReportingStake` function', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)
})
Expand Down
2 changes: 1 addition & 1 deletion test/specs/libraries/access-control.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ describe('AccessControlLibV1: _deleteContract', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
2 changes: 1 addition & 1 deletion test/specs/libraries/cover-util.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('CoverUtilV1: getActiveLiquidityUnderProtection', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
1 change: 1 addition & 0 deletions test/specs/libraries/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const deployDependencies = async () => {
const coverLibV1 = await deployer.deployWithLibraries(cache, 'CoverLibV1', {
AccessControlLibV1: accessControlLibV1.address,
CoverUtilV1: coverUtilV1.address,
NTransferUtilV2: transferLib.address,
ProtoUtilV1: protoUtilV1.address,
RegistryLibV1: registryLibV1.address,
RoutineInvokerLibV1: routineInvokerLibV1.address,
Expand Down
2 changes: 1 addition & 1 deletion test/specs/libraries/routine-invoker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('RoutineInvokerLibV1: _executeStrategy', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
4 changes: 2 additions & 2 deletions test/specs/libraries/validation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('ValidationLibV1: mustBeDisputed', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down Expand Up @@ -235,7 +235,7 @@ describe('ValidationLibV1: mustHaveNormalProductStatus', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', true, requiresWhitelist, values)
await deployed.cover.addProduct(coverKey, productKey, info, requiresWhitelist, [1, 10_000])
Expand Down
2 changes: 1 addition & 1 deletion test/specs/libraries/vault.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Vault Library', () => {
deployed.cover.updateCoverCreatorWhitelist(owner.address, true)

await deployed.npm.approve(deployed.stakingContract.address, stakeWithFee)
await deployed.dai.approve(deployed.reassuranceContract.address, initialReassuranceAmount)
await deployed.dai.approve(deployed.cover.address, initialReassuranceAmount)

await deployed.cover.addCover(coverKey, info, 'POD', 'POD', false, requiresWhitelist, values)

Expand Down
Loading