Skip to content

Commit

Permalink
fix nft Cover pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
danoctavian committed Sep 29, 2021
1 parent 2494697 commit 7237982
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
1 change: 1 addition & 0 deletions contracts/modules/cover/Cover.sol
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ contract Cover is ICover, MasterAwareV2 {
uint activeCover,
uint capacity
) public pure returns (uint) {

return (calculatePriceIntegralAtPoint(
basePrice,
activeCover + amount,
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/cover/CoverNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ contract CoverNFT is ERC721 {

ICover cover;
constructor(string memory name_, string memory symbol_, address _cover) ERC721(name_, symbol_) {
cover = ICover(cover);
cover = ICover(_cover);
}

function safeMint(address to, uint tokenId) external {
Expand Down
17 changes: 2 additions & 15 deletions test/unit/Cover/buyCover.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { toBN } = web3.utils;

describe('buyCover', function () {

it('should purchase new cover', async function () {
it.only('should purchase new cover', async function () {
const { cover } = this;

const productId = 1;
Expand Down Expand Up @@ -52,27 +52,14 @@ describe('buyCover', function () {
);
const expectedPrice = expectedPricePercentage.mul(amount).div(ether('100'));

console.log({
expectedPrice: expectedPrice.toString(),
});
/*
address owner,
uint24 productId,
uint8 payoutAsset,
uint96 amount,
uint32 period,
uint maxPrice,
StakingPool[] memory stakingPools
*/

await cover.buyCover(
coverBuyer1,
productId,
payoutAsset,
amount,
period,
expectedPrice,
[{ poolAddress: stakingPool.address, coverAmountInAsset: '0' }],
[{ poolAddress: stakingPool.address, coverAmountInAsset: amount.toString() }],
{
from: member1,
value: expectedPrice,
Expand Down

0 comments on commit 7237982

Please sign in to comment.