Eridian
search
⌘Ctrlk
eridian.xyzx.comGitHub
Eridian
  • book-openEridian Docs
  • ethereumEthereum Dev
    • serverInfrastructure
    • pencilEthereum Notes
    • wrenchUseful Tools
    • file-penSolidity 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
    • screwdriver-wrenchFoundry Notes
    • gamepad-modernDeFi Challenges
    • magnifying-glassAuditing
    • robotMEV
  • rectangle-terminalGeneral Dev
  • object-groupDesign Dev
gitbookPowered by GitBook
block-quoteOn this pagechevron-down
githubEdit
  1. ethereumEthereum Devchevron-right
  2. file-penSolidity Notes

ABI

  • https://coinsbench.com/solidity-tutorial-all-about-abi-46da8b517e7arrow-up-right

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

LogoGitHub - EridianAlpha/ethereum-direct-deploy-contractGitHubchevron-right

hashtag
ABI with ethers.js

  • https://docs.ethers.io/v4/api-contract.htmlarrow-up-right

Last updated 2 years 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()