Skip to content

Commit

Permalink
Merge pull request #228 from rsksmart/bugfix/GBI-1813
Browse files Browse the repository at this point in the history
fix: remove initializeV2 function
  • Loading branch information
Luisfc68 committed Apr 17, 2024
2 parents da2c521 + 35559e9 commit aa08a8b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
8 changes: 0 additions & 8 deletions contracts/LiquidityBridgeContractV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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() ||
Expand Down
14 changes: 0 additions & 14 deletions migrations/3_upgrade_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
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);
};
12 changes: 4 additions & 8 deletions test/basic.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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");
});

Expand Down

0 comments on commit aa08a8b

Please sign in to comment.