From c833afd12ee98801bcf5df0bd8558e4bb20a0f73 Mon Sep 17 00:00:00 2001 From: C4 <81770958+code423n4@users.noreply.github.com> Date: Mon, 19 Sep 2022 21:58:19 +0200 Subject: [PATCH] V_B data for issue #507 --- data/V_B-Q.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 data/V_B-Q.md diff --git a/data/V_B-Q.md b/data/V_B-Q.md new file mode 100644 index 0000000..761f7b4 --- /dev/null +++ b/data/V_B-Q.md @@ -0,0 +1,20 @@ +### 1. depositETH double work + +There is a `depositETH` function in a `Vault` smart contract. The function accepts ether, deposit it to WETH contract and transfer wrapped tokens to the sender. Later the funds will be transferred as a ERC20 token from users account to smart contract. + +The alternative approach can be just accepting the ether, that which will reduce the cost of depositing a lot and clarify the logic. + +### 2. symbol == "rY2K" check + +The Vault smart contract has the following check in the `beforeWithdraw` function: + +```solidity +if ( + keccak256(abi.encodePacked(symbol)) == + keccak256(abi.encodePacked("rY2K")) +) { + ... +} +``` + +It makes no sense to do this check every time the function is called, it's better to do this check once in the constructor and store the result as an `immutable` variable. \ No newline at end of file