Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove initializeV2 function #228

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading