diff --git a/test/Bounty/BountyCore.test.js b/test/Bounty/BountyCore.test.js index 821351e9..ee31e773 100755 --- a/test/Bounty/BountyCore.test.js +++ b/test/Bounty/BountyCore.test.js @@ -26,7 +26,6 @@ describe('BountyCore.sol', () => { // MOCK ASSETS let mockLink; let mockDai; - let mockNft; // UTILS let abiCoder = new ethers.utils.AbiCoder; @@ -49,7 +48,6 @@ describe('BountyCore.sol', () => { AtomicBountyV1 = await ethers.getContractFactory('AtomicBountyV1'); const MockLink = await ethers.getContractFactory('MockLink'); const MockDai = await ethers.getContractFactory('MockDai'); - const MockNft = await ethers.getContractFactory('MockNft'); [owner, claimManager, depositManager] = await ethers.getSigners(); @@ -60,16 +58,6 @@ describe('BountyCore.sol', () => { mockDai = await MockDai.deploy(); await mockDai.deployed(); - mockNft = await MockNft.deploy(); - await mockNft.deployed(); - - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - // ATOMIC CONTRACT W/ FUNDING GOAL atomicContract = await AtomicBountyV1.deploy(); await atomicContract.deployed(); @@ -78,13 +66,6 @@ describe('BountyCore.sol', () => { initializationTimestamp = await setNextBlockTimestamp(); await atomicContract.initialize(Constants.bountyId, owner.address, Constants.organization, owner.address, claimManager.address, depositManager.address, atomicBountyInitOperation); - await mockNft.approve(atomicContract.address, 0); - await mockNft.approve(atomicContract.address, 1); - await mockNft.approve(atomicContract.address, 2); - await mockNft.approve(atomicContract.address, 3); - await mockNft.approve(atomicContract.address, 4); - await mockNft.approve(atomicContract.address, 5); - // Pre-approve LINK and DAI for transfers during testing await mockLink.approve(atomicContract.address, 10000000); await mockDai.approve(atomicContract.address, 10000000); @@ -145,7 +126,6 @@ describe('BountyCore.sol', () => { expect(await atomicContract.tokenAddress(depositId)).to.equal(mockLink.address); expect(await atomicContract.volume(depositId)).to.equal(Constants.volume); expect(await atomicContract.expiration(depositId)).to.equal(Constants.thirtyDays); - expect(await atomicContract.isNFT(depositId)).to.equal(false); expect(await atomicContract.depositTime(depositId)).to.equal(expectedTimestamp); }); @@ -351,24 +331,6 @@ describe('BountyCore.sol', () => { expect(newFunderMockLinkBalance).to.equal('10000000000000000000000'); expect(newFunderFakeTokenBalance).to.equal('10000000000000000000000'); }); - - it('should transfer NFT from bounty to sender', async () => { - // ASSUME - expect(await mockNft.ownerOf(1)).to.equal(owner.address); - - // ARRANGE - const depositId = generateDepositId(Constants.bountyId, 0); - await atomicContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 1, 1, []); - - // ASSUME - expect(await mockNft.ownerOf(1)).to.equal(atomicContract.address); - - // ACT - await atomicContract.connect(depositManager).refundDeposit(depositId, owner.address, 0); - - // ASSERT - expect(await mockNft.ownerOf(1)).to.equal(owner.address); - }); }); }); @@ -390,39 +352,6 @@ describe('BountyCore.sol', () => { }); }); - describe('claimNft', () => { - describe('require and revert', () => { - it('should revert if not called by Claim Manager contract', async () => { - // ARRANGE - const [, , , , , notClaimManager] = await ethers.getSigners(); - let issueWithNonOwnerAccount = atomicContract.connect(notClaimManager); - - // ASSERT - await expect(issueWithNonOwnerAccount.claimNft(notClaimManager.address, ethers.utils.formatBytes32String('mockDepositId'))).to.be.revertedWith('ClaimManagerOwnable: caller is not the current OpenQ Claim Manager'); - }); - }); - - describe('transfer', () => { - it('should transfer NFT deposit from bounty contract to claimer', async () => { - // ASSUME - expect(await mockNft.ownerOf(1)).to.equal(owner.address); - - // ARRANGE - const depositId = generateDepositId(Constants.bountyId, 0); - await atomicContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 1, 1, []); - - // ASSUME - expect(await mockNft.ownerOf(1)).to.equal(atomicContract.address); - - // ACT - await atomicContract.connect(claimManager).claimNft(owner.address, depositId); - - // ASSERT - expect(await mockNft.ownerOf(1)).to.equal(owner.address); - }); - }); - }); - describe('setFundingGoal', () => { it('should revert if not called by OpenQ contract', async () => { // ARRANGE diff --git a/test/Bounty/TieredBountyCore.test.js b/test/Bounty/TieredBountyCore.test.js index 06038c2d..da70375b 100755 --- a/test/Bounty/TieredBountyCore.test.js +++ b/test/Bounty/TieredBountyCore.test.js @@ -17,7 +17,7 @@ const { tieredFixedBountyInitOperationBuilder_permissionless } = require('../constants'); -describe('TieredBountyCore.sol', () => { +describe.only('TieredBountyCore.sol', () => { // CONTRACT FACTORIES let TieredFixedBountyV1; @@ -29,7 +29,6 @@ describe('TieredBountyCore.sol', () => { // MOCK ASSETS let mockLink; let mockDai; - let mockNft; // UTILS let abiCoder = new ethers.utils.AbiCoder; @@ -51,7 +50,6 @@ describe('TieredBountyCore.sol', () => { TieredFixedBountyV1 = await ethers.getContractFactory('TieredFixedBountyV1'); const MockLink = await ethers.getContractFactory('MockLink'); const MockDai = await ethers.getContractFactory('MockDai'); - const MockNft = await ethers.getContractFactory('MockNft'); [owner, claimManager, depositManager] = await ethers.getSigners(); @@ -62,16 +60,6 @@ describe('TieredBountyCore.sol', () => { mockDai = await MockDai.deploy(); await mockDai.deployed(); - mockNft = await MockNft.deploy(); - await mockNft.deployed(); - - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - await mockNft.safeMint(owner.address); - // TIERED BOUNTY tieredFixedContract = await TieredFixedBountyV1.deploy(); await tieredFixedContract.deployed(); @@ -84,75 +72,6 @@ describe('TieredBountyCore.sol', () => { // Pre-approve LINK and DAI for transfers during testing await mockLink.approve(tieredFixedContract.address, 10000000); await mockDai.approve(tieredFixedContract.address, 10000000); - - await mockNft.approve(tieredFixedContract.address, 0); - await mockNft.approve(tieredFixedContract.address, 1); - await mockNft.approve(tieredFixedContract.address, 2); - await mockNft.approve(tieredFixedContract.address, 3); - await mockNft.approve(tieredFixedContract.address, 4); - }); - - describe('receiveNFT', () => { - let tierData = abiCoder.encode(['uint256'], ['0']); - - describe('REVERTS', () => { - it('should revert if too many NFT deposits', async () => { - // ASSUME - expect(await mockNft.ownerOf(0)).to.equal(owner.address); - expect(await mockNft.ownerOf(1)).to.equal(owner.address); - expect(await mockNft.ownerOf(2)).to.equal(owner.address); - expect(await mockNft.ownerOf(3)).to.equal(owner.address); - expect(await mockNft.ownerOf(4)).to.equal(owner.address); - - // ACT - await tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 0, 1, tierData); - await tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 1, 1, tierData); - await tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 2, 1, tierData); - await tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 3, 1, tierData); - await tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 4, 1, tierData); - - // ASSERT - await expect(tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 5, 1, tierData)).to.be.revertedWith('NFT_DEPOSIT_LIMIT_REACHED'); - }); - - it('should revert if expiration is negative', async () => { - await expect(tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 0, 0, tierData)).to.be.revertedWith('EXPIRATION_NOT_GREATER_THAN_ZERO'); - }); - }); - - describe('DEPOSIT INITIALIZATION', () => { - it(`should initialize nft deposit data with correct metadata`, async () => { - - // ACT - const expectedTimestamp = await setNextBlockTimestamp(); - const depositId = generateDepositId(Constants.bountyId, 0); - await tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 1, Constants.thirtyDays, tierData); - - // ASSERT - expect(await tieredFixedContract.funder(depositId)).to.equal(owner.address); - expect(await tieredFixedContract.tokenAddress(depositId)).to.equal(mockNft.address); - expect(await tieredFixedContract.tokenId(depositId)).to.equal(1); - expect(await tieredFixedContract.expiration(depositId)).to.equal(Constants.thirtyDays); - expect(await tieredFixedContract.isNFT(depositId)).to.equal(true); - - const depositTime = await tieredFixedContract.depositTime(depositId); - expect(depositTime.toString()).to.equal(expectedTimestamp.toString()); - }); - }); - - describe('transfer', () => { - it('should transfer NFT from owner to bounty contract', async () => { - // ASSUME - expect(await mockNft.ownerOf(0)).to.equal(owner.address); - - // ACT - - await tieredFixedContract.connect(depositManager).receiveNft(owner.address, mockNft.address, 0, 1, tierData); - - // ASSERT - expect(await mockNft.ownerOf(0)).to.equal(tieredFixedContract.address); - }); - }); }); describe('setTierWinner', () => {