<!-- canonical: https://0xsimao.com/findings/orange-parameters-passed-arguments-gas -->

# BRC20 parameters should be passed as arguments to the constructor of BRC20 to save gas

Low/Info · Three Sigma · Cross-chain bridge · 15th July, 2024

Finding 3S-OB-N04 of the Orange Bridge security review.

- Protocol: https://www.orangeweb3.com/
- Report: /reports/orange
- Source: https://cdn.sanity.io/files/qoqld077/production/686ad4e1d5035d69002f5f97e281e3c5a8b7ce00.pdf

---

### Description

BRC20Factory::createBRC20() creates new BRC20 tokens by setting the parameters
storage variable to the name, symbol and decimals of the new token, and then the BRC20
token in the constructor fetching this storage variable.

### Recommendation

Send the name, symbol and decimals in the constructor to save gas, as create2 will work
just as fine, but it becomes significantly cheaper to deploy the tokens.

### Status

Addressed in [#1fd3288](https://github.com/orangecryptohq/orange-bridge-contract/commit/1fd328870063db5711540dcc48d4177f84839ea6).

---

Related findings:

- [StakingOperator does not set isUnlockWindowActive to true in the constructor if the flag passed is true](https://0xsimao.com/findings/singularity-staking-window-active-flag): Singularity
- [Saving parameters in memory without using them spends gas](https://0xsimao.com/findings/fuji-finance-saving-memory-spends-gas): Fuji Finance
- [Attacker can block LayerZero channel due to missing check of minimum gas passed](https://0xsimao.com/findings/tapioca-dao-layer-zero-channel-gas): Tapioca DAO
- [In glAVAX, checking that amount > 0 earlier can save some gas](https://0xsimao.com/findings/glacier-avax-checking-earlier-gas): Glacier
