From 65b1ce7557ffc6edeadca834c2465c6d9b1b4d1e Mon Sep 17 00:00:00 2001 From: Luisfc68 Date: Tue, 3 Oct 2023 16:17:29 -0300 Subject: [PATCH 1/4] VULN-183: validate initialization arguments --- config.json | 38 ++++++++++++--------------- contracts/LiquidityBridgeContract.sol | 2 ++ errorCodes.json | 4 ++- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/config.json b/config.json index 380ae32..6500d83 100644 --- a/config.json +++ b/config.json @@ -5,7 +5,7 @@ "deployed": false }, "SignatureValidator": { - "address": "0xFe2746b892fFFf26E9a8F45935E7510d72028416", + "address": "0x9ffA71ad9ED6F23900EE8b753F7910Fb80D22CD5", "deployed": true }, "LiquidityBridgeContractAdmin": { @@ -13,7 +13,7 @@ "deployed": false }, "LiquidityBridgeContract": { - "address": "0x890D3AFD0F14D870DE24798329bf36ce8939D0b4", + "address": "0xc2E56a5518B17C5d88eBd67C6ED6e12AB5Ec7fef", "deployed": true }, "LiquidityBridgeContractProxy": { @@ -23,38 +23,34 @@ "Migrations": { "address": "0x9574a4972320d9988C110dAF950c89CC638B3b75", "deployed": true + }, + "Quotes": { + "address": "0x826186c06DA7b106A7aCBcB1E8E6AcbE5fA3Ab5F", + "deployed": true + }, + "BtcUtils": { + "address": "0x1c30E87C717e80A19AD5BEa9AF57b20d98bCcb5B", + "deployed": true } }, "rskRegtest": { "Migrations": { - "address": "0xdac5481925A298B95Bf5b54c35b68FC6fc2eF423", + "address": "0x1Af2844A588759D0DE58abD568ADD96BB8B3B6D8", "deployed": true }, - "SafeMath": { - "address": "", - "deployed": false - }, "SignatureValidator": { - "address": "0xeFb80DB9E2d943A492Bd988f4c619495cA815643", - "deployed": true - }, - "LiquidityBridgeContractAdmin": { - "address": "0x73ec81da0C72DD112e06c09A6ec03B5544d26F05", - "deployed": true - }, - "LiquidityBridgeContract": { - "address": "0xA66939ac57893C2E65425a5D66099Bc20C76D4CD", - "deployed": true - }, - "LiquidityBridgeContractProxy": { - "address": "0x1eD614cd3443EFd9c70F04b6d777aed947A4b0c4", + "address": "0xCd5805d60Bbf9Afe69a394c2BDa10F6Dae2c39AF", "deployed": true }, "Quotes": { - "address": "0x463F29B11503e198f6EbeC9903b4e5AaEddf6D29", + "address": "0xdac5481925A298B95Bf5b54c35b68FC6fc2eF423", "deployed": true }, "BtcUtils": { + "address": "0xfD1dda8C3BC734Bc1C8e71F69F25BFBEe9cE9535", + "deployed": true + }, + "LiquidityBridgeContract": { "address": "0x987c1f13d417F7E04d852B44badc883E4E9782e1", "deployed": true } diff --git a/contracts/LiquidityBridgeContract.sol b/contracts/LiquidityBridgeContract.sol index 6ebcb2e..7fe993b 100644 --- a/contracts/LiquidityBridgeContract.sol +++ b/contracts/LiquidityBridgeContract.sol @@ -156,6 +156,8 @@ contract LiquidityBridgeContract is Initializable, OwnableUpgradeable, Reentranc bool _mainnet ) external initializer { require(_rewardPercentage <= 100, "LBC004"); + require(_minimumCollateral >= 0.6 ether, "LBC072"); + require(_resignDelayBlocks >= 15, "LBC073"); __Ownable_init_unchained(); bridge = Bridge(_bridgeAddress); minCollateral = _minimumCollateral; diff --git a/errorCodes.json b/errorCodes.json index f51eff8..8caf909 100644 --- a/errorCodes.json +++ b/errorCodes.json @@ -64,5 +64,7 @@ "LBC068": "Invalid destination for bitcoin transaction", "LBC069": "Quote is not related to transaction", "LBC070": "Liquidity provider already registered", - "LBC071": "Intentional overflow on quote values" + "LBC071": "Intentional overflow on quote values", + "LBC072": "Minimum collateral for registration can't be lower than 0.6 RBTC", + "LBC073": "Resign delay blocks lower than minimal" } From e60d2965e82f25c47e4ecf1d7717dcf99b5f5a97 Mon Sep 17 00:00:00 2001 From: Luisfc68 Date: Wed, 4 Oct 2023 09:09:09 -0300 Subject: [PATCH 2/4] update tests and initial collateral validation --- contracts/LiquidityBridgeContract.sol | 20 +++++++++----- migrations/2_deploy_contracts.js | 4 +-- scripts/registerProvider.js | 2 +- test/basic.tests.js | 5 ++++ test/miscellaneous.tests.js | 38 ++++++++++++++++++++++----- test/penalization.tests.js | 2 +- test/utils/index.js | 24 +++++++++++++++-- 7 files changed, 76 insertions(+), 19 deletions(-) diff --git a/contracts/LiquidityBridgeContract.sol b/contracts/LiquidityBridgeContract.sol index 7fe993b..3f40d4d 100644 --- a/contracts/LiquidityBridgeContract.sol +++ b/contracts/LiquidityBridgeContract.sol @@ -265,17 +265,25 @@ contract LiquidityBridgeContract is Initializable, OwnableUpgradeable, Reentranc _apiBaseUrl, _providerType ); - // TODO multiplication by 2 is a temporal fix until we define solution with product team + require(collateral[msg.sender] == 0 && pegoutCollateral[msg.sender] == 0, "LBC070"); - require(msg.value >= minCollateral * 2, "LBC008"); require( resignationBlockNum[msg.sender] == 0, "LBC009" ); - // TODO split 50/50 between pegin and pegout is a temporal fix until we define solution with product team - uint halfMsgValue = msg.value / 2; - collateral[msg.sender] = msg.value % 2 == 0 ? halfMsgValue : halfMsgValue + 1; - pegoutCollateral[msg.sender] = halfMsgValue; + + if (keccak256(abi.encodePacked(_providerType)) == keccak256(abi.encodePacked("pegin"))) { + require(msg.value >= minCollateral, "LBC008"); + collateral[msg.sender] = msg.value; + } else if (keccak256(abi.encodePacked(_providerType)) == keccak256(abi.encodePacked("pegout"))) { + require(msg.value >= minCollateral, "LBC008"); + pegoutCollateral[msg.sender] = msg.value; + } else { + require(msg.value >= minCollateral * 2, "LBC008"); + uint halfMsgValue = msg.value / 2; + collateral[msg.sender] = msg.value % 2 == 0 ? halfMsgValue : halfMsgValue + 1; + pegoutCollateral[msg.sender] = halfMsgValue; + } providerId++; liquidityProviders[providerId] = LiquidityProvider({ diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index b7971ad..b270d10 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -24,11 +24,11 @@ const RSK_NETWORKS = [ const RSK_BRIDGE_ADDRESS = "0x0000000000000000000000000000000001000006"; -const MINIMUM_COLLATERAL = "1"; // amount in wei +const MINIMUM_COLLATERAL = "600000000000000000"; // amount in wei const MINIMUM_PEG_IN_DEFAULT = "5000000000000000"; // amount in wei const MINIMUM_PEG_IN_REGTEST = "5000000000000000"; // amount in wei const REWARD_PERCENTAGE = 10; -const RESIGN_DELAY_BLOCKS = 1; +const RESIGN_DELAY_BLOCKS = 15; const DUST_THRESHOLD = 2300 * 65164000; const MAX_QUOTE_VALUE = web3.utils.toBN("1000000000000000000"); // amount in wei const BTC_BLOCK_TIME = 5400; // the 5400 addition is to give 1.5h to the tx to be mined diff --git a/scripts/registerProvider.js b/scripts/registerProvider.js index 43e81db..b6ef566 100644 --- a/scripts/registerProvider.js +++ b/scripts/registerProvider.js @@ -22,7 +22,7 @@ module.exports = function (callback) { ) .call({ // from: accounts[0], - value: 100000000000000000, + value: 1200000000000000000, }) .then((response) => console.log("Success: " + response)) .catch((err) => console.log("Error: " + err)); diff --git a/test/basic.tests.js b/test/basic.tests.js index 609553d..028f169 100644 --- a/test/basic.tests.js +++ b/test/basic.tests.js @@ -375,6 +375,7 @@ contract("LiquidityBridgeContract", async (accounts) => { "LBC021" ); await instance.resign({ from: lpAddress }); + await utils.mineBlocks(utils.RESIGN_DELAY_BLOCKS); await instance.withdrawCollateral({ from: lpAddress }); }); @@ -392,6 +393,7 @@ contract("LiquidityBridgeContract", async (accounts) => { ); await instance.resign({ from: lpAddress }); await truffleAssertions.reverts(instance.resign({ from: lpAddress }), "LBC001"); + await utils.mineBlocks(utils.RESIGN_DELAY_BLOCKS); await instance.withdrawCollateral({ from: lpAddress }); }); @@ -750,6 +752,8 @@ contract("LiquidityBridgeContract", async (accounts) => { expect(initialLPBalance).to.be.a.bignumber.eq(lbcCurrBal); expect(finalLPBalance).to.be.a.bignumber.eq(web3.utils.toBN(0)); + await utils.mineBlocks(utils.RESIGN_DELAY_BLOCKS); + let withdrawCollateralTx = await instance.withdrawCollateral({ from: lpAddress }); let finalLPCol = await instance.getCollateral(lpAddress); @@ -1241,6 +1245,7 @@ contract("LiquidityBridgeContract", async (accounts) => { web3.utils.toBN(3) ); await instance.resign({ from: lpAddress }); + await utils.mineBlocks(utils.RESIGN_DELAY_BLOCKS); await instance.withdrawPegoutCollateral({ from: lpAddress }); const quoteHash = await instance.hashPegoutQuote(quote); const signature = await web3.eth.sign(quoteHash, lpAddress); diff --git a/test/miscellaneous.tests.js b/test/miscellaneous.tests.js index eb5f0f3..e9367af 100644 --- a/test/miscellaneous.tests.js +++ b/test/miscellaneous.tests.js @@ -369,24 +369,48 @@ contract("LiquidityBridgeContract", async (accounts) => { ); }); + it("should validate minimiumCollateral arg in initialize", async () => { + let instance = await LiquidityBridgeContract.new(); + const MAX_QUOTE_VALUE = web3.utils.toBN("1000000000000000000") + const MINIMUM_COLLATERAL = web3.utils.toBN("500000000000000000") + const RESIGN_DELAY_BLOCKS = 15 + await truffleAssert.reverts( + instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 50, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false), + "LBC072" + ); + }); + + it("should validate resignDelayBlocks arg in initialize", async () => { + let instance = await LiquidityBridgeContract.new(); + const MAX_QUOTE_VALUE = web3.utils.toBN("1000000000000000000") + const MINIMUM_COLLATERAL = web3.utils.toBN("600000000000000000") + const RESIGN_DELAY_BLOCKS = 14 + await truffleAssert.reverts( + instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 50, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false), + "LBC073" + ); + }); + it("should validate reward percentage arg in initialize", async () => { let instance = await LiquidityBridgeContract.new(); const MAX_QUOTE_VALUE = web3.utils.toBN("1000000000000000000") - await instance.initialize(bridgeMockInstance.address, 1, 1, 0, 1, 1, MAX_QUOTE_VALUE, 1, false); + const MINIMUM_COLLATERAL = web3.utils.toBN("600000000000000000") + const RESIGN_DELAY_BLOCKS = 15 + await instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 0, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false); instance = await LiquidityBridgeContract.new(); - await instance.initialize(bridgeMockInstance.address, 1, 1, 0, 1, 1, MAX_QUOTE_VALUE, 1, false); + await instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 0, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false); instance = await LiquidityBridgeContract.new(); - await instance.initialize(bridgeMockInstance.address, 1, 1, 1, 1, 1, MAX_QUOTE_VALUE, 1, false); + await instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 1, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false); instance = await LiquidityBridgeContract.new(); - await instance.initialize(bridgeMockInstance.address, 1, 1, 99, 1, 1, MAX_QUOTE_VALUE, 1, false); + await instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 99, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false); instance = await LiquidityBridgeContract.new(); - await instance.initialize(bridgeMockInstance.address, 1, 1, 100, 1, 1, MAX_QUOTE_VALUE, 1, false); + await instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 100, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false); await truffleAssert.fails( - instance.initialize(bridgeMockInstance.address, 1, 1, 100, 1, 1, MAX_QUOTE_VALUE, 1, false) + instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 100, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false) ); instance = await LiquidityBridgeContract.new(); await truffleAssert.fails( - instance.initialize(bridgeMockInstance.address, 1, 1, 101, 1, 1, MAX_QUOTE_VALUE, 1, false) + instance.initialize(bridgeMockInstance.address, MINIMUM_COLLATERAL, 1, 101, RESIGN_DELAY_BLOCKS, 1, MAX_QUOTE_VALUE, 1, false) ); }); diff --git a/test/penalization.tests.js b/test/penalization.tests.js index c7f10d5..1560060 100644 --- a/test/penalization.tests.js +++ b/test/penalization.tests.js @@ -221,7 +221,7 @@ contract('LiquidityBridgeContract', async accounts => { rskRefundAddress, val); quote.callTime = 1; - quote.penaltyFee = web3.utils.toBN(110); + quote.penaltyFee = web3.utils.toBN(utils.LP_COLLATERAL.add(web3.utils.toBN(1))); let btcRawTransaction = '0x101'; let partialMerkleTree = '0x202'; let height = 10; diff --git a/test/utils/index.js b/test/utils/index.js index 1db7a48..d9ef7c0 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -120,8 +120,9 @@ function reverseHexBytes(hexStr) { return arr.join(""); } -const LP_COLLATERAL = web3.utils.toBN(100); +const LP_COLLATERAL = web3.utils.toBN(1500000000000000000); const ONE_COLLATERAL = web3.utils.toBN(1); +const RESIGN_DELAY_BLOCKS = 15; async function generateRawTx(lbc, quote) { const quoteHash = await lbc.hashPegoutQuote(asArray(quote)); @@ -129,6 +130,23 @@ async function generateRawTx(lbc, quote) { return web3.utils.hexToBytes(btcTx) } +async function mineBlocks (blocks) { + for (let i = 0; i < blocks; i++) { + await new Promise((resolve, reject) => { + web3.currentProvider.send({ + jsonrpc: "2.0", + method: "evm_mine", + id: 1 + }, (error, result) => { + if (error) { + return reject(error); + } + return resolve(result); + }); + }); + } +}; + module.exports = { getTestQuote, getTestPegOutQuote, @@ -138,5 +156,7 @@ module.exports = { ONE_COLLATERAL, timeout, reverseHexBytes, - generateRawTx + generateRawTx, + mineBlocks, + RESIGN_DELAY_BLOCKS }; From 890715aacb9b4a4d30742ee0c2c7c52d6057574c Mon Sep 17 00:00:00 2001 From: Luisfc68 Date: Wed, 4 Oct 2023 11:59:58 -0300 Subject: [PATCH 3/4] provide alphanet url using env vars --- .gitignore | 1 + config.json | 14 +++++++------- example.env | 1 + integration-test/pegin.test.js | 2 +- package-lock.json | 19 +++++++++++++++++++ package.json | 1 + readme.MD | 3 +++ truffle-config.js | 3 ++- 8 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 example.env diff --git a/.gitignore b/.gitignore index 35642a7..3ab0005 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ coverage.json .secret .DS_Store integration-test/test.config.json +.env diff --git a/config.json b/config.json index 6500d83..a6ca489 100644 --- a/config.json +++ b/config.json @@ -57,32 +57,32 @@ }, "alphanet": { "Migrations": { - "address": "0x97CF123cFaB0720D4Bff758f3EF441F8867C38B0", + "address": "0x54D5d3e94Fe0542f9de230cf47e544Bbb7C9C1dd", "deployed": true }, "SignatureValidator": { - "address": "0x536Fc3732Edcc90e0970CF3Ba0D8FF25bc91EEeb", + "address": "0x7eAdDF7Aa126027Bd31F4aCADf4D1d0830a14763", "deployed": true }, "Quotes": { - "address": "0xaCF13405051Ab20e13d5F30Fadec46837CFb0065", + "address": "0x1A0898B4Ac6ed5BF1576237A1709cF791083d915", "deployed": true }, "BtcUtils": { - "address": "0xa841Cf63635A86ba39E8Cbaf8795f757d3Ec83B4", + "address": "0x6D69F04179e093C53Bf2DEc8147E15406c0aFdB4", "deployed": true }, "LiquidityBridgeContractAdmin": { "address": "0x5fb9966EF4D07C81E3165FD60adC8563A76B93bD", - "deployed": true + "deployed": false }, "LiquidityBridgeContract": { - "address": "0x4b8763082e70ba997c685C77D8172142D1db40cb", + "address": "0xDFED830702fd9339Ae826Ae0F1DF834163e4bBa6", "deployed": true }, "LiquidityBridgeContractProxy": { "address": "0x0848B16e015A5e8A5c40Bfa0387367Be2fD371cf", - "deployed": true + "deployed": false } } } \ No newline at end of file diff --git a/example.env b/example.env new file mode 100644 index 0000000..3c233cf --- /dev/null +++ b/example.env @@ -0,0 +1 @@ +ALPHANET_RPC_URL=http://127.0.0.1:4444 \ No newline at end of file diff --git a/integration-test/pegin.test.js b/integration-test/pegin.test.js index fb31b64..034b775 100644 --- a/integration-test/pegin.test.js +++ b/integration-test/pegin.test.js @@ -93,7 +93,7 @@ describe('Flyover pegin process should', () => { additionalGasLimit: quote.gasLimit + cfuExtraGas }) const parsedReceipt = decodeLogs({ abi: LiquidityBridgeContract.abi, receipt }) - expect(parsedReceipt.CallForUser.success).to.be.true + expect(parsedReceipt.CallForUser?.success).to.be.true }) it('execute registerPegIn', async () => { diff --git a/package-lock.json b/package-lock.json index 16763c0..205bfdb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@openzeppelin/truffle-upgrades": "^1.17.1", "@rsksmart/pmt-builder": "^3.0.0", "bs58check": "^3.0.1", + "dotenv": "^16.3.1", "prettier": "^2.4.1", "prettier-plugin-solidity": "^1.0.0-beta.18", "solc": "^0.8.3", @@ -8176,6 +8177,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/double-ended-queue": { "version": "2.1.0-0", "resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", @@ -25936,6 +25949,12 @@ "is-obj": "^2.0.0" } }, + "dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true + }, "double-ended-queue": { "version": "2.1.0-0", "resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", diff --git a/package.json b/package.json index b196bc3..e1f374f 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@openzeppelin/truffle-upgrades": "^1.17.1", "@rsksmart/pmt-builder": "^3.0.0", "bs58check": "^3.0.1", + "dotenv": "^16.3.1", "prettier": "^2.4.1", "prettier-plugin-solidity": "^1.0.0-beta.18", "solc": "^0.8.3", diff --git a/readme.MD b/readme.MD index 167afae..fa9fb35 100644 --- a/readme.MD +++ b/readme.MD @@ -219,3 +219,6 @@ Used by the user to deposit the payment of a pegout service After the first dploy we don't have to change anymore the LiquidityBridgeContract.sol instead we need to create a new version like LiquidityBridgeContractV2.sol and uncomment and update the 3_upgrade_contracts.js script with the last version that will upgrade the contract. With that we can easily get back on any mistake and swicth version. + +#### Alphanet support +If you're working in your own alphanet you must have an environment variable called `ALPHANET_RPC_URL` with the RPC server url so truffle can run all the necessary scripts. diff --git a/truffle-config.js b/truffle-config.js index 84ef2b2..ed57124 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -1,3 +1,4 @@ +require('dotenv').config() const HDWalletProvider = require('@truffle/hdwallet-provider'); const fs = require('fs'); @@ -23,7 +24,7 @@ module.exports = { alphanet: { provider: () => new HDWalletProvider({ mnemonic, - providerOrUrl: `http://fullnode-use1-1.alphanet.iovlabs.net:4444`, + providerOrUrl: process.env.ALPHANET_RPC_URL, derivationPath: "m/44'/60'/0'/0/", pollingInterval: 30000, }), From 71c66d6fc95dc8957b9cb8a1215beadd329f47a2 Mon Sep 17 00:00:00 2001 From: Luisfc68 Date: Fri, 6 Oct 2023 19:26:47 -0300 Subject: [PATCH 4/4] set correct indexed fields in events --- contracts/LiquidityBridgeContract.sol | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/contracts/LiquidityBridgeContract.sol b/contracts/LiquidityBridgeContract.sol index 3f40d4d..098a87b 100644 --- a/contracts/LiquidityBridgeContract.sol +++ b/contracts/LiquidityBridgeContract.sol @@ -71,6 +71,7 @@ contract LiquidityBridgeContract is Initializable, OwnableUpgradeable, Reentranc bool success, bytes32 quoteHash ); + event PegInRegistered(bytes32 indexed quoteHash, int256 transferredAmount); event Penalized(address liquidityProvider, uint penalty, bytes32 quoteHash); event BridgeCapExceeded(bytes32 quoteHash, int256 errorCode); event BalanceIncrease(address dest, uint amount); @@ -82,15 +83,15 @@ contract LiquidityBridgeContract is Initializable, OwnableUpgradeable, Reentranc bytes32 quotehash, uint processed ); - event PegOutRefunded(bytes32 quoteHash); + event PegOutRefunded(bytes32 indexed quoteHash); event PegOutDeposit( - bytes32 quoteHash, + bytes32 indexed quoteHash, address indexed sender, - uint256 indexed amount, - uint256 indexed timestamp + uint256 amount, + uint256 timestamp ); event PegOutUserRefunded( - bytes32 quoteHash, + bytes32 indexed quoteHash, uint256 value, address userAddress ); @@ -684,6 +685,7 @@ contract LiquidityBridgeContract is Initializable, OwnableUpgradeable, Reentranc } processedQuotes[quoteHash] = PROCESSED_QUOTE_CODE; delete callRegistry[quoteHash]; + emit PegInRegistered(quoteHash, transferredAmountOrErrorCode); return transferredAmountOrErrorCode; } @@ -708,7 +710,7 @@ contract LiquidityBridgeContract is Initializable, OwnableUpgradeable, Reentranc require(registeredQuote.lbcAddress == address(0), "LBC028"); registeredPegoutQuotes[quoteHash] = quote; pegoutRegistry[quoteHash].depositTimestamp = block.timestamp; - emit PegOutDeposit(quoteHash, msg.sender , msg.value, block.timestamp); + emit PegOutDeposit(quoteHash, msg.sender, msg.value, block.timestamp); } function refundUserPegOut(