Eridian
eridian.xyzx.comGitHub
  • ๐Ÿ“–Eridian Docs
  • Ethereum Dev
    • โœ๏ธEthereum Notes
      • ๐ŸŽ›๏ธTechnical Basics
      • ๐ŸชงEthereum Addresses
      • ๐Ÿ“šEthereum State Explained
      • โ›ฝGas Fees Explained
    • ๐Ÿ”งUseful Tools
      • โ˜๏ธEthers
      • *๏ธโƒฃEthernal
    • ๐Ÿ“Solidity Notes
      • โ”Interview Questions
        • ๐ŸŸข1. Easy - Interview Questions
        • ๐ŸŸ 2. Medium - Interview Questions
        • ๐ŸŸก3. Hard - Interview Questions
        • ๐Ÿ”ด4. Advanced - Interview Questions
      • ๐Ÿ’กNote Ideas
      • ABI
      • abi.encodePacked
      • Abstract Contracts
      • Arrays
      • Casting
      • CEI - Checks, Effects, Interactions
      • Comments (NATSPEC)
      • Constructor
      • Contract Structure & Versions
      • Data - Storage vs Memory
      • Data - Storage Layout
      • Enum
      • Errors (require & revert)
      • Events
      • EVM Opcodes
      • External Contract Interaction
      • ๐Ÿ—๏ธExternal Dependencies
      • Functions
      • Function Modifiers
      • If / Else / For / While Loops
      • Inheritance
      • Interfaces
      • Keccak256
      • Library
      • Mappings
      • msg.sender
      • Objects & Types
      • OpenZeppelin
      • Payable
      • Public State Variable vs Function
      • Receive & Fallback
      • Security
      • Self Destruct
      • Send ETH (transfer, send, call)
      • Stack Too Deep
      • Structs
      • Style Guide
      • Time Units
      • Try / Catch
      • Typecasting
      • Using Directive
      • Variables, Consts & Immutable
      • Withdraws
    • โš’๏ธFoundry Notes
      • ๐Ÿ“–Docs & GitHub Pages
      • ๐ŸคUseful Commands
        • ๐Ÿ”จAnvil
        • ๐Ÿช„Cast
        • ๐Ÿ”ฅForge
      • ๐ŸงชTests
        • Cheatcodes
      • ๐Ÿ“Useful Scripts
        • Deploy Contract Using Hex
    • ๐Ÿ‘พDeFi Challenges
      • ๐Ÿ‘จโ€๐Ÿš€Ethernaut
        • Ethernaut - Template
        • Level 1 - Fallback โบ
        • Level 2 - Fallout โบ
        • Level 3 - Coin Flip โบโบ
        • Level 4 - Telephone โบ
        • Level 5 - Token โบโบ
        • Level 6 - Delegation โบโบ
        • Level 7 - Force โบโบโบ
        • Level 8 - Vault โบโบ
        • Level 9 - King โบโบโบ
        • Level 10 - Re-entrancy โบโบโบ
        • Level 11 - Elevator โบโบ
        • Level 12 - Privacy โบโบโบ
        • Level 13 - Gatekeeper 1 โบโบโบโบ
        • Level 14 - Gatekeeper 2 โบโบโบ
        • Level 15 - Naught Coin โบโบโบ
        • Level 16 - Preservation โบโบโบโบ
        • Level 17 - Recovery โบโบโบ
        • Level 18 - Magic Number โบโบโบ
        • Level 19 - Alien Codex โบโบโบโบ
        • Level 20 - Denial โบโบโบ
        • Level 21 - Shop โบโบ
        • Level 22 - Dex โบโบ
        • Level 23 - Dex Two โบโบ
        • Level 24 - Puzzle Wallet โบโบโบโบ
        • Level 25 - Motorbike โบโบโบ
        • Level 26 - DoubleEntryPoint โบโบ
        • Level 27 - Good Samaritan โบโบโบ
        • Level 28 - Gatekeeper 3 โบโบโบ
        • Level 29 - Switch โบโบโบโบ
        • Level 30 - Higher Order โบโบโบโบ
        • Level 31 - Stake โบโบโบ
      • ๐Ÿ’ธDamn Vulnerable DeFi
    • ๐Ÿ”Auditing
      • ๐Ÿ—ž๏ธExploit Resources
      • ๐Ÿ”งAudit Tools
    • ๐Ÿค–MEV
  • Infrastructure Docs
    • ๐Ÿ’ปHardware
    • ๐ŸงLinux
      • ๐Ÿ“–Linux Glossary
      • โŒจ๏ธLinux Commands
      • ๐Ÿ’พInstallation
      • ๐Ÿ—๏ธMaintenance
      • ๐Ÿ–ฅ๏ธUbuntu Desktop
      • ๐Ÿ›œZeroTier
      • ๐ŸŽž๏ธTMUX
      • ๐Ÿ”ตBluetooth
    • โ›“๏ธEthereum Clients
      • โš™๏ธExecution Clients
        • โ›๏ธGeth
          • ๐Ÿ’พInstallation
          • โŒจ๏ธUseful Commands
          • ๐Ÿ—๏ธMaintenance
        • ๐ŸปErigon
          • ๐Ÿ’พInstallation
          • โŒจ๏ธUseful Commands
          • ๐Ÿ—๏ธMaintenance
        • ๐ŸงถBesu
          • ๐Ÿ’พInstallation
          • โŒจ๏ธUseful Commands
          • ๐Ÿ—๏ธMaintenance
      • ๐ŸคBeacon Clients
        • ๐Ÿ’กLighthouse
          • ๐Ÿ’พInstallation
          • โŒจ๏ธUseful Commands
          • ๐Ÿ—๏ธMaintenance
        • ๐Ÿช…Teku
          • ๐Ÿ’พInstallation
          • โŒจ๏ธUseful Commands
          • ๐Ÿ—๏ธMaintenance
      • ๐Ÿ’ŽValidator Clients
        • ๐Ÿ’กLighthouse
          • ๐Ÿ’พInstallation
          • โŒจ๏ธUseful Commands
          • ๐Ÿ—๏ธMaintenance
      • โž•L2 Clients
        • ๐Ÿ”ตBase
          • ๐Ÿ’พInstallation
          • โŒจ๏ธUseful Commands
          • ๐Ÿ—๏ธMaintenance
      • ๐Ÿ’ฐMEV Boost
        • ๐Ÿ’พInstallation
        • ๐Ÿ—๏ธMaintenance
    • ๐ŸšจAlerting and Monitoring
      • ๐Ÿ”ฅPrometheus
      • ๐ŸŒก๏ธHealthChecks.io
      • ๐Ÿ“ŸPagerDuty
  • General Dev
    • ๐Ÿ’พGit Notes
      • Repos
      • Committing changes
      • Branches
      • Merging & Rebasing
      • PRs
Powered by GitBook
On this page
Edit on GitHub
  1. Ethereum Dev
  2. Solidity Notes

External Contract Interaction

If a dependency contract had a bug it would render our DApp completely useless โ€” our DApp would point to a hardcoded address that no longer returns the expected result and we'd be unable to modify our contract to fix it.

For this reason, it often makes sense to have functions that will allow you to update key portions of the DApp.

For example, instead of hard coding the contract address into our DApp, we should probably have a setExternalContractAddress function that lets us change this address in the future in case something happens to the external contract being used.

ExternalContractInterface externalContract;

function setExternalContractAddress(address _address) external {
    externalContract = ExternalContractInterface(_address);
}

Last updated 1 year ago

๐Ÿ“