Skip to content

Commit

Permalink
Merge branch 'QA-Test' into feature/GBI-1735
Browse files Browse the repository at this point in the history
  • Loading branch information
Luisfc68 committed Apr 25, 2024
2 parents 2cab01b + aa08a8b commit a99aebd
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

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' || 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);
};
9 changes: 3 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 a99aebd

Please sign in to comment.