Skip to content

Instantly share code, notes, and snippets.

@ashwinYardi
Created August 19, 2022 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashwinYardi/4847131182c31e58a0e61714253cdd7f to your computer and use it in GitHub Desktop.
Save ashwinYardi/4847131182c31e58a0e61714253cdd7f to your computer and use it in GitHub Desktop.
Contract which describes InheritedStorage approach for proxies and diamonds.
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract Storage {
uint firstVar;
uint secondVar;
string thirdVar;
string fourthVar;
}
contract FacetA is Storage {
function getVars() public view returns(uint, uint) {
return (firstVar, secondVar);
}
}
contract FacetB is Storage {
function getVars() public returns(string memory, string memory) {
thirdVar = "Ashwin";
fourthVar = "Yardi";
return (thirdVar, fourthVar);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment