Skip to content

Instantly share code, notes, and snippets.

@pom421
Created February 9, 2023 23:04
Show Gist options
  • Save pom421/b2fa6f6be8c495b58de5f4e7fa1185ae to your computer and use it in GitHub Desktop.
Save pom421/b2fa6f6be8c495b58de5f4e7fa1185ae to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "./1_Storage.sol";
interface IStorage {
function store(uint256 num) external ;
function retrieve() external view returns (uint256);
}
/**
* Exemple d'interopérabilité des contrats.
*/
contract ExternalStorage {
IStorage myStorage;
function call(address _addr) public {
myStorage= IStorage(_addr);
}
function store(uint num) public {
myStorage.store(num);
}
function retrieve() public view returns (uint) {
return myStorage.retrieve();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment