Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function getReferenceContract() #199

Open
rya-sge opened this issue Apr 24, 2024 · 1 comment
Open

Function getReferenceContract() #199

rya-sge opened this issue Apr 24, 2024 · 1 comment

Comments

@rya-sge
Copy link

rya-sge commented Apr 24, 2024

Hello,
Congratulations for all your work !

A quick remark:
In TREXImplementationAuthority.sol#L323, the function getReferenceContract() does not check if _trexFactory is different from zero, which is a possible case. Therefore the function reverts if _trexFactory is not set.

It is not a big problem, but I think it would be better if the function returns the address zero instead of reverting.

Quick example:

  function getReferenceContract() public view override returns (address) {
       if(_trexFactory != address(0)){
       	return ITREXFactory(_trexFactory).getImplementationAuthority();
       }
       return address(0);
   }
@Joachim-Lebrun
Copy link
Collaborator

Hi @rya-sge thanks! nice work on your side on CMTAT as well

That contract has been audited so i prefer to not modify it. In any case the getReferenceContract function will only be used with non-reference contracts and these can only be created by the IA factory if the parameters of TREX Factory and IA Factory are set properly. But i get your point, always avoid revert on view functions, i note that one for next update (TREXv4.2 that we are currently crafting and will be re-audited)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants