diff --git a/README.md b/README.md index a7d718e..b96b07d 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Check config.js for actual values. With `salt` = `0x0000000000000000000000000000000000000000000000000000000047941987` address must be: 1. `MultipleInstanceFactory` - `0x49Be4c1dF49268066f97eD15fe4b4B90cc68d1A6` -2. `InstanceFactoryWithRegistry` - `0x19231EBeD3F2228e7894F4cc20161e39e031F07C` +2. `InstanceFactoryWithRegistry` - `0x7D4a76AF4b2d765D1D62Ac87Cc2aea0b7ECF6102` Check addresses with current config: diff --git a/contracts/InstanceFactoryWithRegistry.sol b/contracts/InstanceFactoryWithRegistry.sol index 7d157a7..967b46d 100644 --- a/contracts/InstanceFactoryWithRegistry.sol +++ b/contracts/InstanceFactoryWithRegistry.sol @@ -121,6 +121,7 @@ contract InstanceFactoryWithRegistry is InstanceFactory { // check Uniswap Pool for (uint8 i = 0; i < _protocolFees.length; i++) { if (_protocolFees[i] > 0) { + require(_protocolFees[i] <= 10000, "Protocol fee is more than 100%"); // pool exists address poolAddr = UniswapV3Factory.getPool(_token, WETH, _uniswapPoolSwappingFee); require(poolAddr != address(0), "Uniswap pool is not exist"); diff --git a/test/factory.with.registry.test.js b/test/factory.with.registry.test.js index 6fce033..cf14716 100644 --- a/test/factory.with.registry.test.js +++ b/test/factory.with.registry.test.js @@ -493,4 +493,18 @@ describe('Instance Factory With Registry Tests', () => { .createProposalApprove(config.COMP, 10000, [ethers.utils.parseEther('100')], [30]), ).to.be.revertedWith('Uniswap pool TWAP slots number is low') }) + + it('Should not deploy proposal with incorrect protocol fee', async function () { + let { sender, instanceFactory, tornWhale, tornToken } = await loadFixture(fixture) + + // deploy proposal ---------------------------------------------- + await tornToken.connect(tornWhale).transfer(sender.address, config.creationFee) + await tornToken.approve(instanceFactory.address, config.creationFee) + + await expect( + instanceFactory + .connect(sender) + .createProposalApprove(config.COMP, 3000, [ethers.utils.parseEther('100')], [10300]), + ).to.be.revertedWith('Protocol fee is more than 100%') + }) })