LayerZero-Labs / LayerZero-v2

Other
492 stars 312 forks source link

`sharedDecimals` function is defined as `pure` making it too restrictive #47

Open Mattijah opened 2 months ago

Mattijah commented 2 months ago

The sharedDecimals function is defined as pure, which makes overriding in a subclass impossible if the value returned is a locally defined constant (not pre-set in the contract with a literal). The tutorial or suggestion mentioning overriding of sharedDecimals using view is therefore also non-functional https://docs.layerzero.network/v2/developers/evm/oft/quickstart#token-supply-cap. The interface IOFTdefines the function with view as well, which should really be used: https://github.com/LayerZero-Labs/LayerZero-v2/blob/142846c3d6d51e3c2a0852c41b4c2b63fcda5a0a/oapp/contracts/oft/interfaces/IOFT.sol#L104