Saturday, April 18, 2026
  • Login
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse
No Result
View All Result
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS
CRYPTO MARKETCAP
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS
No Result
View All Result
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse
No Result
View All Result

Solidity/React situation when utilizing Ethers.js : ethereum

by SB Crypto Guru News
November 5, 2022
in Ethereum
Reading Time: 2 mins read
0 0
A A
0


Solidity/React Query: Utilizing Ethers.js, I am making an attempt to entry a operate taking in two variables as parameters utilizing the hook useContractReader. I replicated it from different useContractReader code I’ve in my undertaking, but it surely would not appear to be working for no matter motive. I assume it has to do with some parsing of the variables I’ve, however how I do it in different issues, it really works wonderful.

The React:

const check = useContractReader(writeContracts, "YourContract", "getTest", "1", "0"); // Indexing recreation 1, gamers 0

  operate getTestName() {
    if (check == null) {
      return "check is undefined.";
    } else if (check[0] == null) { // check[0] is the identify variable within the struct
      return "noName";
    } else {
      return check[0].toString();
    }
  }

The Solidity code:

struct Recreation {
        deal with host; // Establishes host operate entry 0
        uint gameId; // Permits totally different video games to be performed concurrently 1
        uint buyinRequirement; // To ascertain minimal buyin quantity for a recreation 2
        uint etherWithdrawalReqs; // Tracks # of ether in complete from requests. If >/< than contract stability, throws error 3   
        uint gamePot; // Tracks how a lot ether is within the recreation's pot 4 
        uint8 tableWithdrawalReqs; // Tracks what number of gamers have requested a withdrawal 5
        uint8 playerCount; // Tracks # of of gamers in a recreation 6
        uint8 verifiedWithdrawalReqs; // Tracks # of verifs that withdrawal requests are legitimate 7
        bool endedBuyin; // Host operate to finish buyin stage 8
        bool isActive; // Checks if recreation struct is already completed 9 
        deal with[] playerList; // 10
    }
    
    struct Participant {
        string identify; // Permits gamers to extra simply determine eachother
        uint gameId; // gameId generated from gameNumber
        uint buyinAmount; // How a lot a participant has purchased in with
        uint withdrawalAmount; // How a lot a participant has requested a withdrawal for
        bool withdrawalReq; // Tracks if a participant has submitted a request
        bool verifyReqs; // TO confirm that every one withdrawal requests look good at desk
        bool hasWithdrawn; // To indicate {that a} participant has paidout to forestall triggering of any features after they receieve again their funds
        bool isInGame; // Is in recreation bool
        bool isHost; // Is host
    }

mapping(deal with => Participant) public playerInfo; // To name Participant struct primarily based on the msg.sender

    // Mapping for finding every recreation's particulars
    mapping(uint => Recreation) public idToGame; // To name Recreation struct to see recreation particulars

operate getTest(uint gameId, uint playerIndex) public view returns (Participant reminiscence) {
        return playerInfo[idToGame[gameId].playerList[playerIndex]];
    }

Please discuss with my stack overflow query for extra info on the problem:

https://stackoverflow.com/questions/74323524/problem-accessing-solidity-getter-using-ethers-js



Source link

Tags: Bitcoin NewsCrypto NewsCrypto Updatesethereumethers.jsissueLatest News on CryptoSB Crypto Guru NewsSolidityReact
Previous Post

What Occurs To Dogecoin If Twitter Fails To Implement Crypto Plans?

Next Post

Solana (SOL) Continues To Lag In Worth; SOL Should Do This One Factor To Rally

Related Posts

ETH Rangers Program Recap | Ethereum Foundation Blog

ETH Rangers Program Recap | Ethereum Foundation Blog

by SB Crypto Guru News
April 16, 2026
0

In late 2024, the Ethereum Foundation, together with Secureum, The Red Guild, and Security Alliance (SEAL), launched the ETH Rangers...

Checkpoint #9: Apr 2026 | Ethereum Foundation Blog

Checkpoint #9: Apr 2026 | Ethereum Foundation Blog

by SB Crypto Guru News
April 10, 2026
0

Ethereum's All Core Developer calls can be a lot to keep up with, so this "Checkpoint" series aims for periodic...

A modern CLI based Solidity transaction debugger and tracer

A modern CLI based Solidity transaction debugger and tracer

by SB Crypto Guru News
April 5, 2026
0

Hi all, I build a new kind of cli based solidity debugger you might find useful. During the few days...

Been digging into old Ethereum contracts from 2015-2019 to find withdrawable ETH that portfolio trackers miss

Been digging into old Ethereum contracts from 2015-2019 to find withdrawable ETH that portfolio trackers miss

by SB Crypto Guru News
March 31, 2026
0

Hello everyone! I've built a tool to help recover ETH stuck in old smart contracts that no longer have frontends....

Onchain RWA protocols went from .1B to .1B in 2025. Here are 8 real-world tokenized assets you can buy right now:

Onchain RWA protocols went from $4.1B to $14.1B in 2025. Here are 8 real-world tokenized assets you can buy right now:

by SB Crypto Guru News
March 27, 2026
0

Source: https://www.coingecko.com/learn/real-world-assets-rwa-buy-on-chain RWAs were one of the fastest-growing sectors in crypto last year. DeFi yields from token emissions dried up,...

Load More
Next Post
Solana (SOL) Continues To Lag In Worth; SOL Should Do This One Factor To Rally

Solana (SOL) Continues To Lag In Worth; SOL Should Do This One Factor To Rally

Mastercard demo on the Polygon MATIC community! That is nice for Ethereum! : ethereum

Mastercard demo on the Polygon MATIC community! That is nice for Ethereum! : ethereum

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Facebook Twitter LinkedIn Tumblr RSS

CATEGORIES

  • Altcoin
  • Analysis
  • Bitcoin
  • Blockchain
  • Crypto Exchanges
  • Crypto Updates
  • DeFi
  • Ethereum
  • Metaverse
  • Mining
  • NFT
  • Regulations
  • Scam Alert
  • Uncategorized
  • Web3

SITE MAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2022 - SB Crypto Guru News.
SB Crypto Guru News is not responsible for the content of external sites.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS

Copyright © 2022 - SB Crypto Guru News.
SB Crypto Guru News is not responsible for the content of external sites.