diff --git a/contracts/facets/FeeCalculatorFacet.sol b/contracts/facets/FeeCalculatorFacet.sol index cdd1a49..0fe1b81 100644 --- a/contracts/facets/FeeCalculatorFacet.sol +++ b/contracts/facets/FeeCalculatorFacet.sol @@ -12,7 +12,8 @@ contract FeeCalculatorFacet is IFeeCalculator { /// @notice Construct a new FeeCalculator contract /// @param _precision The precision for every fee calculator - function initFeeCalculator(uint256 _precision, uint256 _validatorRewardsPercentage, uint256 _treasuryRewardsPercentage) external override { + /// @param _validatorRewardsPercentage The percentage for the validator rewards + function initFeeCalculator(uint256 _precision, uint256 _validatorRewardsPercentage) external override { LibFeeCalculator.Storage storage fcs = LibFeeCalculator .feeCalculatorStorage(); require(!fcs.initialized, "FeeCalculatorFacet: already initialized"); @@ -21,13 +22,12 @@ contract FeeCalculatorFacet is IFeeCalculator { "FeeCalculatorFacet: precision must not be single-digit" ); require( - _validatorRewardsPercentage < _precision && _treasuryRewardsPercentage < _precision, + _validatorRewardsPercentage < _precision, "FeeCalculatorFacet: percentages must be less than precision" ); fcs.initialized = true; fcs.precision = _precision; fcs.validatorRewardsPercentage = _validatorRewardsPercentage; - fcs.treasuryRewardsPercentage = _treasuryRewardsPercentage; } /// @return The current precision for service fee calculations of tokens @@ -47,6 +47,17 @@ contract FeeCalculatorFacet is IFeeCalculator { emit ServiceFeeSet(msg.sender, _token, _serviceFeePercentage); } + /// @notice updates the validator rewards percentage + /// @param _validatorRewardsPercentage The validator rewards percentage + function updateValidatorRewardsPercentage(uint256 _validatorRewardsPercentage) + external + override + { + LibDiamond.enforceIsContractOwner(); + LibFeeCalculator.updateValidatorRewardsPercentage(_validatorRewardsPercentage); + emit UpdateValidatorRewardsPercentage(msg.sender, _validatorRewardsPercentage); + } + /// @param _account The address of a validator /// @param _token The token address /// @return The total amount of claimed tokens by the provided validator address @@ -109,14 +120,14 @@ contract FeeCalculatorFacet is IFeeCalculator { .feeCalculatorStorage(); uint256 validatorRewardsPercentage = fcs.validatorRewardsPercentage; - uint256 treasuryRewardsPercentage = fcs.treasuryRewardsPercentage; uint256 precision = fcs.precision; uint256 claimableAmount = LibFeeCalculator.claimReward(_member, _token); address memberAdmin = LibGovernance.memberAdmin(_member); address treasury = LibGovernance.treasury(); + uint256 validatorClaimableAmount = (claimableAmount * validatorRewardsPercentage) / precision; - IERC20(_token).safeTransfer(memberAdmin, (claimableAmount * validatorRewardsPercentage) / precision); - IERC20(_token).safeTransfer(treasury, (claimableAmount * treasuryRewardsPercentage) / precision); + IERC20(_token).safeTransfer(memberAdmin, validatorClaimableAmount); + IERC20(_token).safeTransfer(treasury, claimableAmount - validatorClaimableAmount); emit Claim(_member, memberAdmin, _token, claimableAmount); } diff --git a/contracts/facets/GovernanceV2Facet.sol b/contracts/facets/GovernanceV2Facet.sol index d3b3571..51d5633 100644 --- a/contracts/facets/GovernanceV2Facet.sol +++ b/contracts/facets/GovernanceV2Facet.sol @@ -40,7 +40,12 @@ contract GovernanceV2Facet is IGovernanceV2 { LibFeeCalculator.addNewMember(_account, LibPayment.tokenAt(i)); } } else { + LibFeeCalculator.Storage storage fcs = LibFeeCalculator + .feeCalculatorStorage(); + uint256 validatorRewardsPercentage = fcs.validatorRewardsPercentage; + uint256 precision = fcs.precision; address accountAdmin = LibGovernance.memberAdmin(_account); + address governanceTreasury = LibGovernance.treasury(); for (uint256 i = 0; i < LibRouter.nativeTokensCount(); i++) { address token = LibRouter.nativeTokenAt(i); @@ -48,7 +53,10 @@ contract GovernanceV2Facet is IGovernanceV2 { _account, token ); - IERC20(token).safeTransfer(accountAdmin, claimableFees); + uint256 validatorClaimableAmount = (claimableFees * validatorRewardsPercentage) / precision; + + IERC20(token).safeTransfer(accountAdmin, validatorClaimableAmount); + IERC20(token).safeTransfer(governanceTreasury, claimableFees - validatorClaimableAmount); } for (uint256 i = 0; i < LibPayment.tokensCount(); i++) { @@ -57,7 +65,10 @@ contract GovernanceV2Facet is IGovernanceV2 { _account, token ); - IERC20(token).safeTransfer(accountAdmin, claimableFees); + uint256 validatorClaimableAmount = (claimableFees * validatorRewardsPercentage) / precision; + + IERC20(token).safeTransfer(accountAdmin, validatorClaimableAmount); + IERC20(token).safeTransfer(governanceTreasury, claimableFees - validatorClaimableAmount); } _accountAdmin = address(0); diff --git a/contracts/interfaces/IFeeCalculator.sol b/contracts/interfaces/IFeeCalculator.sol index b5a5a26..debc6bf 100644 --- a/contracts/interfaces/IFeeCalculator.sol +++ b/contracts/interfaces/IFeeCalculator.sol @@ -12,9 +12,12 @@ interface IFeeCalculator { uint256 amount ); + /// @notice An event emitted once the validator rewards percentage is modified + event UpdateValidatorRewardsPercentage(address account, uint256 _validatorRewardsPercentage); + /// @notice Construct a new FeeCalculator contract /// @param _precision The precision for every fee calculator - function initFeeCalculator(uint256 _precision, uint256 _validatorRewardsPercentage, uint256 __treasuryRewardsPercentage) external; + function initFeeCalculator(uint256 _precision, uint256 _validatorRewardsPercentage) external; /// @return The current precision for service fee calculations of tokens function serviceFeePrecision() external view returns (uint256); @@ -56,4 +59,8 @@ interface IFeeCalculator { /// @notice Sends out the reward accumulated by the members for the specified tokens /// to the members admin and treasury function claimMultiple(address[] calldata _tokens, address[] calldata _members) external; + + /// @notice updates the validator rewards percentage + /// @param _validatorRewardsPercentage The validator rewards percentage + function updateValidatorRewardsPercentage(uint256 _validatorRewardsPercentage) external; } diff --git a/contracts/libraries/LibFeeCalculator.sol b/contracts/libraries/LibFeeCalculator.sol index f0a2e89..aa00d05 100644 --- a/contracts/libraries/LibFeeCalculator.sol +++ b/contracts/libraries/LibFeeCalculator.sol @@ -24,12 +24,10 @@ library LibFeeCalculator { bool initialized; // Precision for every calculator's fee percentage. uint256 precision; - // Precentage for the validator rewards - uint256 validatorRewardsPercentage; - // Precentage for the treasury rewards - uint256 treasuryRewardsPercentage; // A mapping consisting of all token fee calculators mapping(address => FeeCalculator) nativeTokenFeeCalculators; + // Precentage for the validator rewards + uint256 validatorRewardsPercentage; } function feeCalculatorStorage() internal pure returns (Storage storage ds) { @@ -109,6 +107,20 @@ library LibFeeCalculator { ntfc.serviceFeePercentage = _serviceFeePercentage; } + /// @notice Updates the validator rewards percentage + /// @param _validatorRewardsPercentage The validator rewards precentage + function updateValidatorRewardsPercentage(uint256 _validatorRewardsPercentage) + internal + { + LibFeeCalculator.Storage storage fcs = feeCalculatorStorage(); + require( + _validatorRewardsPercentage < fcs.precision, + "LibFeeCalculator: validator rewards percentage percentage exceeds or equal to precision" + ); + + fcs.validatorRewardsPercentage = _validatorRewardsPercentage; + } + /// @notice Accrues fees to a fee calculator /// @param _fc The fee calculator /// @return The updated accumulator diff --git a/contracts/libraries/LibGovernance.sol b/contracts/libraries/LibGovernance.sol index 67065a0..91c688b 100644 --- a/contracts/libraries/LibGovernance.sol +++ b/contracts/libraries/LibGovernance.sol @@ -20,10 +20,10 @@ library LibGovernance { uint256 percentage; // Admin of the contract address admin; - // Treasury of the contract - address treasury; // used to restrict certain functionality in case of an emergency stop bool paused; + // Treasury of the contract + address treasury; } function governanceStorage() internal pure returns (Storage storage gs) { diff --git a/hardhat.config.js b/hardhat.config.js index ebed355..e7644aa 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -20,7 +20,6 @@ task('deploy-router', 'Deploys Router contract will all the necessary facets') .addParam('membersAdmins', 'The addresses of the members\' admins') .addParam('treasury', 'The address of the treasury') .addParam('validatorRewardsPercentage', 'The Validator Reward Precentage Split', 60_000, types.int) - .addParam('treasuryRewardsPercentage', 'The Treasury Reward Precentage Split', 40_000, types.int) .setAction(async (taskArgs) => { const deployRouter = require('./scripts/deploy-router'); const membersArray = taskArgs.members.split(','); @@ -30,7 +29,6 @@ task('deploy-router', 'Deploys Router contract will all the necessary facets') taskArgs.treasury, taskArgs.governancePercentage, taskArgs.validatorRewardsPercentage, - taskArgs.treasuryRewardsPercentage, taskArgs.governancePrecision, taskArgs.feeCalculatorPrecision, membersArray, @@ -281,6 +279,8 @@ task('updateFacet', 'Deploys ERC721PortalFacet') .addParam("facetName", "The addres of the router") .addParam("facetAddress", "The addres of the router") .addParam("routerAddress", "The addres of the router") + .addParam("actions", "The diamond cut action(Add=0, Replace=1, Remove=2)", 0, types.int) + .addParam("functionSignatures", "The function signatures divided by coma") .setAction(async (taskArgs) => { console.log(taskArgs); const updateFacet = require('./scripts/update-facet'); diff --git a/scripts/deploy-router.js b/scripts/deploy-router.js index b7a73e7..cd5baa6 100644 --- a/scripts/deploy-router.js +++ b/scripts/deploy-router.js @@ -5,7 +5,7 @@ const { getSelectors } = require('../util'); const { performUpgradeErc721Support } = require('./upgrade-erc721-support'); -async function deployRouter(owner,treasury, governancePercentage,validatorRewardsPercentage,treasuryRewardsPercentage, governancePrecision, feeCalculatorPrecision, members, membersAdmins) { +async function deployRouter(owner,treasury, governancePercentage,validatorRewardsPercentage, governancePrecision, feeCalculatorPrecision, members, membersAdmins) { await hardhat.run('compile'); const routerFacetFactory = await ethers.getContractFactory('RouterFacet'); @@ -77,7 +77,7 @@ async function deployRouter(owner,treasury, governancePercentage,validatorReward const initRouterTx = await (await router.initRouter()); await initRouterTx.wait(); console.log(`Initializing Fee Calculator with precision [${feeCalculatorPrecision}], please wait...`); - const initFeeCalculatorTx = await (await router.initFeeCalculator(feeCalculatorPrecision, validatorRewardsPercentage, treasuryRewardsPercentage)); + const initFeeCalculatorTx = await (await router.initFeeCalculator(feeCalculatorPrecision, validatorRewardsPercentage)); await initFeeCalculatorTx.wait(); console.log('Router address: ', diamond.address); diff --git a/scripts/update-facet.js b/scripts/update-facet.js index 89dfc8d..f525271 100644 --- a/scripts/update-facet.js +++ b/scripts/update-facet.js @@ -1,15 +1,17 @@ const hardhat = require("hardhat"); const ethers = hardhat.ethers; -const { getSelectors } = require("../util"); +const { getSelector } = require("../util"); -async function updateFacet(facetName, facetAddress, routerAddress) { +async function updateFacet(facetName, facetAddress, routerAddress, action, functionSignatures) { const facetContract = await ethers.getContractAt(facetName, facetAddress); + let signatures = functionSignatures.split(','); + const diamondAddCutReplace = [ { facetAddress: facetContract.address, - action: 1, // Replace - functionSelectors: getSelectors(facetContract), + action, // Replace + functionSelectors: signatures.map(signature => getSelector(signature)), }, ]; diff --git a/test/router.js b/test/router.js index 5c88abb..c35eb98 100644 --- a/test/router.js +++ b/test/router.js @@ -30,7 +30,6 @@ describe('Router', async () => { const GOVERNANCE_PRECISION = 100; const GOVERNANCE_PERCENTAGE = 50; const VALIDATOR_REWARDS_PERCENTAGE = 40_000; - const TRESURRY_REWARDS_PERCENTAGE = 60_000; const FEE_CALCULATOR_TOKEN_SERVICE_FEE = 10_000; const FEE_CALCULATOR_PRECISION = 100_000; @@ -101,7 +100,7 @@ describe('Router', async () => { await router.initGovernance([alice.address], [aliceAdmin.address], treasury.address, GOVERNANCE_PERCENTAGE, GOVERNANCE_PRECISION); await router.initRouter(); - await router.initFeeCalculator(FEE_CALCULATOR_PRECISION, VALIDATOR_REWARDS_PERCENTAGE, TRESURRY_REWARDS_PERCENTAGE); + await router.initFeeCalculator(FEE_CALCULATOR_PRECISION, VALIDATOR_REWARDS_PERCENTAGE); }); beforeEach(async function () { @@ -246,7 +245,7 @@ describe('Router', async () => { it('should not initialize FeeCalculatorFacet twice', async () => { const expectedRevertMessage = 'FeeCalculatorFacet: already initialized'; - await expect(router.initFeeCalculator(FEE_CALCULATOR_PRECISION, VALIDATOR_REWARDS_PERCENTAGE, TRESURRY_REWARDS_PERCENTAGE)).to.be.revertedWith(expectedRevertMessage); + await expect(router.initFeeCalculator(FEE_CALCULATOR_PRECISION, VALIDATOR_REWARDS_PERCENTAGE)).to.be.revertedWith(expectedRevertMessage); }); it('should revert FeeCalculatorFacet init if rewards percentage not set correctly', async () => { @@ -254,7 +253,7 @@ describe('Router', async () => { const feeCalculatorFacetFactory = await ethers.getContractFactory('FeeCalculatorFacet'); const testFacet = await feeCalculatorFacetFactory.deploy(); await testFacet.deployed(); - await expect(testFacet.initFeeCalculator(10, 30, 40)).to.be.revertedWith(expectedRevertMessage); + await expect(testFacet.initFeeCalculator(10, 30)).to.be.revertedWith(expectedRevertMessage); }); it('should revert governance init if precision is below 10', async () => { @@ -262,8 +261,8 @@ describe('Router', async () => { const feeCalculatorFacetFactory = await ethers.getContractFactory('FeeCalculatorFacet'); const testFacet = await feeCalculatorFacetFactory.deploy(); await testFacet.deployed(); - await expect(testFacet.initFeeCalculator(0, VALIDATOR_REWARDS_PERCENTAGE, TRESURRY_REWARDS_PERCENTAGE)).to.be.revertedWith(expectedRevertMessage); - await expect(testFacet.initFeeCalculator(9, VALIDATOR_REWARDS_PERCENTAGE, TRESURRY_REWARDS_PERCENTAGE)).to.be.revertedWith(expectedRevertMessage); + await expect(testFacet.initFeeCalculator(0, VALIDATOR_REWARDS_PERCENTAGE)).to.be.revertedWith(expectedRevertMessage); + await expect(testFacet.initFeeCalculator(9, VALIDATOR_REWARDS_PERCENTAGE)).to.be.revertedWith(expectedRevertMessage); }); }); @@ -1312,7 +1311,7 @@ describe('Router', async () => { serviceFee = amount.mul(FEE_CALCULATOR_TOKEN_SERVICE_FEE).div(FEE_CALCULATOR_PRECISION); expectedMemberFeeRewardAfterClaim = serviceFee.div(3).mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); - expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).mul(TRESURRY_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); + expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).sub(expectedMemberFeeRewardAfterClaim); expectedPrevAccruedAfterClaim = serviceFee.div(3).mul(3); }); @@ -1374,7 +1373,7 @@ describe('Router', async () => { serviceFee = serviceFee.mul(2); expectedMemberFeeRewardAfterClaim = serviceFee.div(3).mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); - expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).mul(TRESURRY_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); + expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).sub(expectedMemberFeeRewardAfterClaim); expectedPrevAccruedAfterClaim = serviceFee.div(3).mul(3); // when @@ -1439,7 +1438,7 @@ describe('Router', async () => { const totalLockedAmount = amount.add(secondAmount); serviceFee = totalLockedAmount.mul(FEE_CALCULATOR_TOKEN_SERVICE_FEE).div(FEE_CALCULATOR_PRECISION); expectedMemberFeeRewardAfterClaim = serviceFee.div(3).mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); - expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).mul(TRESURRY_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); + expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).sub(expectedMemberFeeRewardAfterClaim); expectedPrevAccruedAfterClaim = serviceFee.div(3).mul(3); // when @@ -1485,13 +1484,14 @@ describe('Router', async () => { it('should emit event with args', async () => { const claimAmount = serviceFee.div(3); + const validatorClaimAmout = claimAmount.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); await expect(router.claim(nativeToken.address, alice.address)) .to.emit(router, 'Claim') .withArgs(alice.address, aliceAdmin.address, nativeToken.address, claimAmount) .to.emit(nativeToken, 'Transfer') .withArgs(router.address, aliceAdmin.address, claimAmount.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION)) .to.emit(nativeToken, 'Transfer') - .withArgs(router.address, treasury.address, claimAmount.mul(TRESURRY_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION)); + .withArgs(router.address, treasury.address, claimAmount.sub(validatorClaimAmout)); }); it('should revert when claimed address is not a member', async () => { @@ -1561,7 +1561,7 @@ describe('Router', async () => { serviceFee = amount.mul(FEE_CALCULATOR_TOKEN_SERVICE_FEE).div(FEE_CALCULATOR_PRECISION); expectedMemberFeeRewardAfterClaim = serviceFee.div(3).mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); - expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).mul(TRESURRY_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); + expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).sub(expectedMemberFeeRewardAfterClaim); expectedPrevAccruedAfterClaim = serviceFee.div(3).mul(3); }); @@ -1577,7 +1577,7 @@ describe('Router', async () => { serviceFee = serviceFee.mul(2); expectedMemberFeeRewardAfterClaim = serviceFee.div(3).mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); - expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).mul(TRESURRY_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION); + expectedTreasuryFeeRewardAfterClaim = serviceFee.div(3).sub(expectedMemberFeeRewardAfterClaim); expectedPrevAccruedAfterClaim = serviceFee.div(3).mul(3); // when @@ -2014,7 +2014,9 @@ describe('Router', async () => { .to.emit(router, 'MemberAdminUpdated') .withArgs(alice.address, ethers.constants.AddressZero) .to.emit(nativeToken, 'Transfer') - .withArgs(router.address, aliceAdmin.address, rewardPerMember); + .withArgs(router.address, aliceAdmin.address, rewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION)) + .to.emit(nativeToken, 'Transfer') + .withArgs(router.address, treasury.address, serviceFee.div(2).sub(rewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION))); const afterMemberUpdateTokenFeeData = await router.tokenFeeData(nativeToken.address); expect(afterMemberUpdateTokenFeeData.feesAccrued).to.equal(serviceFee); @@ -2170,9 +2172,13 @@ describe('Router', async () => { .to.emit(router, 'MemberAdminUpdated') .withArgs(alice.address, ethers.constants.AddressZero) .to.emit(nativeToken, 'Transfer') - .withArgs(router.address, aliceAdmin.address, rewardPerMember) + .withArgs(router.address, aliceAdmin.address, rewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION)) + .to.emit(nativeToken, 'Transfer') + .withArgs(router.address, treasury.address, rewardPerMember.sub(rewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION))) + .to.emit(nativeToken, 'Transfer') + .withArgs(router.address, aliceAdmin.address, 0) .to.emit(nativeToken, 'Transfer') - .withArgs(router.address, aliceAdmin.address, 0); + .withArgs(router.address, treasury.address, 0); const afterMemberUpdateTokenFeeData = await router.tokenFeeData(nativeToken.address); expect(afterMemberUpdateTokenFeeData.feesAccrued).to.equal(totalAccrued); @@ -2313,9 +2319,13 @@ describe('Router', async () => { .to.emit(router, 'MemberAdminUpdated') .withArgs(alice.address, ethers.constants.AddressZero) .to.emit(nativeToken, 'Transfer') - .withArgs(router.address, aliceAdmin.address, serviceFeeRewardPerMember) + .withArgs(router.address, aliceAdmin.address, serviceFeeRewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION)) + .to.emit(paymentToken, 'Transfer') + .withArgs(router.address, aliceAdmin.address, paymentTokenRewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION)) + .to.emit(nativeToken, 'Transfer') + .withArgs(router.address, treasury.address, serviceFeeRewardPerMember.sub(serviceFeeRewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION))) .to.emit(paymentToken, 'Transfer') - .withArgs(router.address, aliceAdmin.address, paymentTokenRewardPerMember); + .withArgs(router.address, treasury.address, paymentTokenRewardPerMember.sub(paymentTokenRewardPerMember.mul(VALIDATOR_REWARDS_PERCENTAGE).div(FEE_CALCULATOR_PRECISION))); const afterMemberUpdateNativeTokenFeeData = await router.tokenFeeData(nativeToken.address); expect(afterMemberUpdateNativeTokenFeeData.feesAccrued).to.equal(serviceFee); diff --git a/util/index.js b/util/index.js index ac5447c..e86ea37 100644 --- a/util/index.js +++ b/util/index.js @@ -22,6 +22,16 @@ function getSelectors(contract) { }, []); } +function getSelector(contract, functionSignature) { + const signature = functionSignature; + + if (signature !== 'init(bytes)') { + return contract.interface.getSighash(signature); + } + + return undefined; +} + async function createPermit(owner, spenderAddress, amount, deadline, tokenContract) { const Permit = [ { name: 'owner', type: 'address' }, @@ -62,5 +72,6 @@ module.exports = { createPermit, diamondAsFacet, getInterfaceId, - getSelectors + getSelectors, + getSelector }; \ No newline at end of file