diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5a262c..dd636e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,9 +29,6 @@ jobs: with: node-version: '19.6.0' - - name: NPM Login - run: npm config set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }} - - name: Install truffle run: npm install -g truffle diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 4a3fad8..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -@rsksmart:registry=https://npm.pkg.github.com diff --git a/contracts/LiquidityBridgeContractV2.sol b/contracts/LiquidityBridgeContractV2.sol index 32a8f86..521900f 100644 --- a/contracts/LiquidityBridgeContractV2.sol +++ b/contracts/LiquidityBridgeContractV2.sol @@ -125,14 +125,6 @@ contract LiquidityBridgeContractV2 is Initializable, OwnableUpgradeable, Reentra _; } - function initializeV2( - uint256 _productFeePercentage, - address _daoFeeCollectorAddress - ) public { - productFeePercentage = _productFeePercentage; - daoFeeCollectorAddress = _daoFeeCollectorAddress; - } - modifier onlyOwnerAndProvider(uint _providerId) { require( msg.sender == owner() || diff --git a/migrations/3_upgrade_contracts.js b/migrations/3_upgrade_contracts.js index 8808957..a28a109 100644 --- a/migrations/3_upgrade_contracts.js +++ b/migrations/3_upgrade_contracts.js @@ -39,19 +39,5 @@ module.exports = async function (deployer, network, accounts) { { deployer, unsafeAllowLinkedLibraries: true } ); - let daoFeeCollectorAddress = ''; - - if(network === 'ganache' || network === 'rskRegtest' || network === 'test') { - daoFeeCollectorAddress = accounts[8]; - } else if(network === 'rskTestnet' || network === 'rskDevelopment') { - daoFeeCollectorAddress = FEE_COLLECTOR_TESTNET_ADDRESS; - } else if(network === 'rskMainnet'){ - daoFeeCollectorAddress = FEE_COLLECTOR_MAINNET_ADDRESS; - } else { - throw new Error('Unknown network'); - } - - await response.initializeV2(DAO_FEE_PERCENTAGE, daoFeeCollectorAddress); - console.log("Upgraded", response.address); }; diff --git a/package-lock.json b/package-lock.json index 24a57b1..64e1dd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3073,9 +3073,8 @@ }, "node_modules/@rsksmart/btc-transaction-solidity-helper": { "version": "0.0.3", - "resolved": "https://npm.pkg.github.com/download/@rsksmart/btc-transaction-solidity-helper/0.0.3/3016563d1170bb6a4efbd8d56ee9994434527cff", - "integrity": "sha512-x4SzwxhyMWZGwj6ycUZvM/2uVcIQ4hhWZ3DJeJ1LHcza1nA9ghPH7dDGQYeuWAmJwgz9P4mW+f/9Wahe0KQ3Ew==", - "license": "ISC" + "resolved": "https://registry.npmjs.org/@rsksmart/btc-transaction-solidity-helper/-/btc-transaction-solidity-helper-0.0.3.tgz", + "integrity": "sha512-x4SzwxhyMWZGwj6ycUZvM/2uVcIQ4hhWZ3DJeJ1LHcza1nA9ghPH7dDGQYeuWAmJwgz9P4mW+f/9Wahe0KQ3Ew==" }, "node_modules/@rsksmart/pmt-builder": { "version": "3.0.0", @@ -10155,7 +10154,6 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, - "hasInstallScript": true, "optional": true, "peer": true, "dependencies": { @@ -10541,7 +10539,6 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", "dev": true, - "hasInstallScript": true, "optional": true, "peer": true, "dependencies": { @@ -21760,7 +21757,7 @@ }, "@rsksmart/btc-transaction-solidity-helper": { "version": "0.0.3", - "resolved": "https://npm.pkg.github.com/download/@rsksmart/btc-transaction-solidity-helper/0.0.3/3016563d1170bb6a4efbd8d56ee9994434527cff", + "resolved": "https://registry.npmjs.org/@rsksmart/btc-transaction-solidity-helper/-/btc-transaction-solidity-helper-0.0.3.tgz", "integrity": "sha512-x4SzwxhyMWZGwj6ycUZvM/2uVcIQ4hhWZ3DJeJ1LHcza1nA9ghPH7dDGQYeuWAmJwgz9P4mW+f/9Wahe0KQ3Ew==" }, "@rsksmart/pmt-builder": { diff --git a/test/basic.tests.js b/test/basic.tests.js index f872669..84fffd8 100644 --- a/test/basic.tests.js +++ b/test/basic.tests.js @@ -616,7 +616,6 @@ contract("LiquidityBridgeContractV2.sol", async (accounts) => { it("should transfer value for user", async () => { let rskRefundAddress = accounts[2]; - const daoFeeCollectorInitialBalance = await web3.eth.getBalance(accounts[8]); let destAddr = accounts[1]; let lbcAddress = instance.address; let quote = utils.getTestQuote( @@ -714,14 +713,11 @@ contract("LiquidityBridgeContractV2.sol", async (accounts) => { success: true, quoteHash: quoteHash, }); - const daoFeeCollectorFinalBalance = await web3.eth.getBalance(accounts[8]); expect(peginAmount).to.be.a.bignumber.eq(amount); expect(usrBal).to.be.a.bignumber.eq(quote.val); expect(lbcBal).to.be.a.bignumber.eq(peginAmount.sub(quote.productFeeAmount)); expect(lpBal).to.be.a.bignumber.eq(peginAmount.sub(quote.productFeeAmount)); expect(finalLPDeposit).to.be.a.bignumber.eq(initialLPDeposit); - expect(daoFeeCollectorFinalBalance).to.be.a.bignumber.eq( - web3.utils.toBN(daoFeeCollectorInitialBalance).add(quote.productFeeAmount)); }); it("Should not generate transaction to DAO when product fee is 0 in registerPegIn", async () => { @@ -849,7 +845,6 @@ contract("LiquidityBridgeContractV2.sol", async (accounts) => { value: web3.utils.toWei("30000", "wei"), from: liquidityProviderRskAddress, }); - const daoFeeCollectorBefore = await web3.eth.getBalance(accounts[8]); const blockHeaderHash = "0x02327049330a25d4d17e53e79f478cbb79c53a509679b1d8a1505c5697afb326"; const partialMerkleTree = @@ -915,12 +910,13 @@ contract("LiquidityBridgeContractV2.sol", async (accounts) => { ); const usedInGas = refund.receipt.gasUsed * refund.receipt.effectiveGasPrice; const refundedAmount = quote.value.add(quote.callFee); - const daoFeeCollectorAfter = await web3.eth.getBalance(accounts[8]); - + truffleAssertions.eventEmitted(refund, "DaoFeeSent", { + quoteHash: quoteHash, + amount: quote.productFeeAmount + }); expect(lpBalanceAfter).to.be.a.bignumber.eq( web3.utils.toBN(lpBalanceBefore).add(refundedAmount).sub(web3.utils.toBN(usedInGas)) ); - expect(web3.utils.toBN(daoFeeCollectorBefore).add(quote.productFeeAmount)).to.be.a.bignumber.eq(web3.utils.toBN(daoFeeCollectorAfter)) truffleAssertions.eventEmitted(refund, "PegOutRefunded"); });