Skip to content

Commit

Permalink
Merge branch 'develop' into SOD-12
Browse files Browse the repository at this point in the history
  • Loading branch information
Robsonsjre committed Aug 4, 2021
2 parents 87a7932 + 0ef28a1 commit 12193b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion abi/FeePool.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
},
{
"internalType": "uint8",
"name": "decimals",
"name": "feeDecimals",
"type": "uint8"
}
],
Expand Down
7 changes: 4 additions & 3 deletions contracts/amm/FeePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ contract FeePool is IFeePool, Ownable {
* @notice Sets fee and the decimals
*
* @param feeBaseValue Fee value
* @param decimals Fee decimals
* @param feeDecimals Fee decimals
*/
function setFee(uint256 feeBaseValue, uint8 decimals) external override onlyOwner {
function setFee(uint256 feeBaseValue, uint8 feeDecimals) external override onlyOwner {
require(feeDecimals <= 77 && feeBaseValue <= uint256(10)**feeDecimals, "FeePool: Invalid Fee data");
_feeBaseValue = feeBaseValue;
_feeDecimals = decimals;
_feeDecimals = feeDecimals;
emit FeeUpdated(_token, _feeBaseValue, _feeDecimals);
}

Expand Down
7 changes: 6 additions & 1 deletion test/amm/FeePool.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,15 @@ describe('FeePool', () => {
.to.emit(pool, 'FeeUpdated')
.withArgs(usdc.address, newBaseFeeValue, newFeeDecimals)

const feeValue = await pool.feeValue()
expect(await pool.feeValue()).to.equal(newBaseFeeValue)
expect(await pool.feeDecimals()).to.equal(newFeeDecimals)
})

it('cannot charge more than 100% base fees', async () => {
const decimals = await usdc.decimals()
const tx = pool.setFee(10 ** decimals + 1, decimals)
await expect(tx).to.be.revertedWith('FeePool: Invalid Fee data')
})
})

describe('Fee collection', () => {
Expand Down

0 comments on commit 12193b8

Please sign in to comment.