Skip to content

Commit

Permalink
init structs
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalgek committed Nov 9, 2023
1 parent 800e33f commit d9ac556
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
9 changes: 5 additions & 4 deletions contracts/optimism/DepositDataCodec.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ contract DepositDataCodec {
revert ErrorDepositDataLength();
}

DepositData memory depositData;
depositData.rate = uint256(bytes32(buffer[0:32]));
depositData.time = uint256(bytes32(buffer[32:64]));
depositData.data = buffer[64:];
DepositData memory depositData = DepositData({
rate: uint256(bytes32(buffer[0:32])),
time: uint256(bytes32(buffer[32:64])),
data: buffer[64:]
});

return depositData;
}
Expand Down
11 changes: 6 additions & 5 deletions contracts/optimism/L1ERC20TokenBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ contract L1ERC20TokenBridge is
uint32 l2Gas_,
bytes calldata data_
) internal {

DepositData memory depositData;
depositData.rate = IERC20Wrapable(l1TokenNonRebasable).tokensPerStEth();
depositData.time = block.timestamp;
depositData.data = data_;

DepositData memory depositData = DepositData({
rate: IERC20Wrapable(l1TokenNonRebasable).tokensPerStEth(),
time: block.timestamp,
data: data_
});

bytes memory encodedDepositData = encodeDepositData(depositData);

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20Rebasable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract ERC20Rebasable is IERC20Wrapable, IERC20, ERC20Metadata {
return sharesAmount;
}

Check failure

Code scanning / Slither

Unchecked transfer High


function tokensPerStEth() external view returns (uint256) {
function tokensPerStEth() external pure returns (uint256) {
return 0;
}

Expand Down

0 comments on commit d9ac556

Please sign in to comment.