From e31032a3d3a2428f74f79543872f79ceb236dc79 Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Fri, 16 Apr 2021 03:06:40 +0530 Subject: [PATCH] matic receiver condition --- contracts/receivers/aave-v2-receiver/main.sol | 2 ++ contracts/receivers/aave-v2-receiver/variables.sol | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contracts/receivers/aave-v2-receiver/main.sol b/contracts/receivers/aave-v2-receiver/main.sol index 58a659b..c549860 100644 --- a/contracts/receivers/aave-v2-receiver/main.sol +++ b/contracts/receivers/aave-v2-receiver/main.sol @@ -112,6 +112,8 @@ contract AaveV2Migrator is MigrateResolver { } function onStateReceive(uint256 stateId, bytes calldata receivedData) external { + // Add some more require statements. Any kind of hashing for better privacy? + require(msg.sender == maticReceiver, "not-receiver-address"); require(stateId > lastStateId, "wrong-data"); lastStateId = stateId; diff --git a/contracts/receivers/aave-v2-receiver/variables.sol b/contracts/receivers/aave-v2-receiver/variables.sol index 7741a24..bbe89a7 100644 --- a/contracts/receivers/aave-v2-receiver/variables.sol +++ b/contracts/receivers/aave-v2-receiver/variables.sol @@ -36,6 +36,9 @@ contract Variables { // TODO: Set by construtor? mapping(address => bool) public isSupportedToken; - address[] public supportedTokens; // don't add ethAddr. Only add wethAddr + address[] public supportedTokens; // don't add maticAddr. Only add wmaticAddr? + + // Address which will receive L1 data and post it on L2 + address public maticReceiver = address(0); // TODO: Change address } \ No newline at end of file