Eridian
Ctrlk
eridian.xyzx.comGitHub
  • Eridian Docs
  • Design Dev
  • General Dev
  • Ethereum Dev
    • Infrastructure
    • Ethereum Notes
    • Useful Tools
    • Solidity Notes
      • ❔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
    • DeFi Challenges
    • Auditing
    • MEV
Powered by GitBook
On this page
Edit
  1. Ethereum Dev
  2. Solidity Notes

ABI

  • https://coinsbench.com/solidity-tutorial-all-about-abi-46da8b517e7

  • https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917

LogoGitHub - EridianAlpha/ethereum-direct-deploy-contractGitHub

ABI with ethers.js

  • https://docs.ethers.io/v4/api-contract.html

Last updated 1 year ago

// Contract ABI copied directly from Remix
let abi = [
    {
        inputs: [],
        name: "consecutiveWins",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
]

let coinFlipContractAddress = "0xa0714D4539ADcfD7855B811382c49D7185D32977"

// Connect to the Contract
let coinFlipContract = new ethers.Contract(
    coinFlipContractAddress,
    abi,
    rinkebyHttpProvider
)

// Check current consecutiveWins value
let consecutiveWins = await coinFlipContract.consecutiveWins()