Skip to content

Instantly share code, notes, and snippets.

Created April 27, 2020 15:08
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
pragma solidity ^0.6.0;
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
modifier onlyOwner() {
require(msg.sender == owner, "must be owner");
contract SecretVault {
string secret;
constructor(string memory _secret) public {
secret = _secret;
function getSecret() public view returns(string memory) {
return secret;
contract MyContract is Ownable {
address secretVault;
constructor(string memory _secret) public {
SecretVault _secretVault = new SecretVault(_secret);
secretVault = address(_secretVault);
function getSecret() public view onlyOwner returns(string memory) {
SecretVault _secretVault = SecretVault(secretVault);
return _secretVault.getSecret();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment