diff --git a/data/Funen-G.md b/data/Funen-G.md new file mode 100644 index 0000000..c03fda3 --- /dev/null +++ b/data/Funen-G.md @@ -0,0 +1,40 @@ +1. Short reason string can be used for saving more gas + +Every reason string takes at least 32 bytes. Use short reason strings that fits in 32 bytes or it will become more expensive. + +Files : + +1.) https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/oracles/PegOracle.sol#L23-L25 + +2.) https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/oracles/PegOracle.sol#L28-L31 + +3.) https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/SemiFungibleVault.sol#L116-L118 + +2. Custom Error + +Custom Error + +Custom errors can be used from Solidity 0.8.4 are cheaper than revert strings. Its cheaper deployment cost and runtime cost when the revert condition is met. + +Files : + +1.) https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/oracles/PegOracle.sol#L23-L25 + +2.) https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/oracles/PegOracle.sol#L28-L31 + +3.) https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/SemiFungibleVault.sol#L91 + +4.) https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/SemiFungibleVault.sol#L116-L118 + +3. Removing `uint i = 0` to `uint i` + +using this implementation can saving more gas for each loops. + +https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/Vault.sol#L443 + +4. Using `++i` than `i++` for saving more gas + +Using `i++` instead `++i` for all the loops, the variable i is incremented using i++. It is known that implementation by using `++i` costs less gas per iteration than `i++`. + +https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/Vault.sol#L443 +