Explore Philand
  • Welcome to Phi
    • 🏝️What's Phi?
    • 🌄Mission
    • 🏃‍♀️Story
    • 🏄Phi Crew
  • ⚡Products
    • 🏝️Phi Land
      • 🔦User Guide for Phi Land
        • 0️⃣Before Playing Phi
          • 🦊Download a Crypto Wallet
          • 🟣Get $MATIC
          • 🔷Get an ENS Domain
        • 1️⃣Access Phi Land
        • 2️⃣Create your Phi Land
        • 3️⃣Claim Quest Objects
        • 4️⃣Purchase Items on Shop
        • 5️⃣Deposit Objects to Land
        • 6️⃣Build your land
        • 7️⃣Share your land on Twitter
      • 🎧Phi Music
      • ⛓️Hyperlinks & Link List
      • 💫Transferring Land
      • ↔️Phi Connect
    • ⚔️Phi Quest
      • 🔦User Guide for Phi Quest
        • 0️⃣Before Playing Phi
          • 🦊Download a Crypto Wallet
          • 🟣Get $MATIC
        • 1️⃣Access Phi Quest
        • 2️⃣Claim Quest Objects
          • Quest List
          • Adventure
          • Campaign
        • 3️⃣Purchase Items on Shop
        • 4️⃣Play Phi Land with Items you got
      • 🧑Account
      • 🏅Active Score Rank Quests
    • 🍭Phi Opportunity (beta)
    • 💎Phi Material
      • ⚒️Phi Craft
      • 🥗UGC Craft
    • 🔮OpenSea Collection Links
    • 💡How-to's
      • 🏷️Mastering ENS (Ethereum Name Service)
        • How to Register an ENS Domain Name
        • How to Renew an ENS Domain Name
        • How to Manage ENS records
          • How to set up the Avatar record in ENS
            • Using MintYourPFP to set an Avatar to an ENS name
        • How to Transfer ENS to Another Wallet
        • How to set up an ENS Subdomain
    • ❓FAQ
      • Must I have an ENS to play Phi Quest?
      • How can I get an ENS domain?
      • Why don't my ENS domains show up?
      • Can I use ENS subdomains for Phi Land?
      • What happens when I transfer ENS?
      • I can't create a land
      • Why cannot access to my land?
      • Why can't I change the baseplate?
      • Why can’t I claim Quest objects?
      • Any rewards for participating in Testnet?
      • What is Phi Quest?
      • How the Leaderboard on Phi Quest is calculated?
      • Why are there two EXPs?
      • I claimed objects on Phi Quest. How can I create my Phi Land?
      • Why can’t I see my objects in my wallet?
      • Can I trade Quest Objects?
      • Are traded objects included in my EXP calculation?
      • My EXP not showing, leaderboard not updating
      • Which browser should I use?
      • Which devices are supported?
      • How to update my Twitter OGP image (card)?
    • 📬Submit Feedback
      • Bug Report
      • Feature Request
      • User Survey
  • ⚙️DEVELOPERS
    • 🪴Create Philand
    • 🎨Objects NFT
      • ⛓️Quest Object
      • 🌾Free Object
      • 🧊Premium Object
      • 🍰Baseplate Object
      • 🧮Wallpaper Object
      • 💄Other Topics
      • 💡Appendix
    • 🛠️Use PhiMap
      • 🗺️Deposit/Withdraw
      • 🍧Save Philand
      • 👀View Function
      • 💡Appendix
    • 💝Philand API
      • ⌚Introduction
      • 🔑Authentication
        • 😄Use API key
        • 😍Get Access Token
        • 🤩Verify Access Token
        • 🤪Get Refresh Token
        • 😎Refresh JWT
      • 🫔Quest
        • 🎾Get Quest List
        • 🏀Get Quest Status
        • ⚽Trigger Eligible Check
        • 🎯Get Claimed Status
        • 🏓Get Verify Coupon
      • 🏝️Philand
        • 🫑View Philand Link
        • 🍍Get Philand Image
      • 🧸Account
        • 🍞Get Philand List
        • 👑Get PhiRank
      • 🎺Object
        • 🎸Get Object Info
      • 🦖Example Call
        • 🤠Quest Claim
      • 👔Related Links
    • 🧑‍🏫How to Verify your transaction
      • 👓Read Contract Method
      • 🚩Third-party API
      • 🦷Whitelist
    • 📄Contracts
      • 👮Audit
  • 💼Career
    • 👯Phi is hiring
  • 🔗Official links
    • Website
    • Twitter
    • Discord
    • Discourse
    • Medium
    • Github
    • Guild.xyz
    • Lenster
    • Instagram
Powered by GitBook
On this page
  • - Curve Pool Quest
  • - DAI Holding Quest

Was this helpful?

  1. DEVELOPERS
  2. How to Verify your transaction

Read Contract Method

Checking the state of a contract and verifying it.

PreviousHow to Verify your transactionNextThird-party API

Last updated 2 years ago

Was this helpful?

Most quests verify by reading on-chain data and checking conditions.

- Curve Pool Quest

At first, we obtain liquidity pools using the following method:

  • Pool List from documentation

  • Retrieve meta pool info from meta pool factory contract

async function getFromMetaPoolFactory() {
  const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_MAINNET);
  const metapool = new ethers.Contract("0xB9fC157394Af804a3578134A6585C0dc9cc990d4", abi, provider);
  const addresses: Array<string> = [];
  const numPools = await metapool.pool_count();

  for (let i = 0; i < numPools; ++i) {
    const addr = await metapool.pool_list(i);
    console.log(`got metapool address ${addr}`);
    addresses.push(addr.toLowerCase());
  }
  return addresses;
}
  • Get V2 pool

    • trycrypto2:

      0xd51a44d3fae010294c616388b506acda1bfaae46
    • crveth:

      0x8301AE4fc9c624d1D396cbDAa1ed877821D7C511

Next, we check users tx history

  1. Retrieve the transaction data (txdata) for the address. We can do this using an API such as EtherscanAPI or a blockchain explorer tool.

  2. Inspect the txdata to see if any of the transactions include calls to the desired function.

  3. If you find a transaction that includes a call to the function, we can verify that it was executed.

export const txFilter_22: EtherscanFilter = (tx: EtherscanTxItem) => {
  // check tx target is a curve pool
  if (deps.curvePools[tx.to] && tx.isError === "0") {
    // check tx function name
    const functionName: string = tx.functionName.split("(")[0];
    if (functionName === "add_liquidity") {
      return true;
    }
  }
  return false;
};
const txs = await getEtherScanTx('homestead', address, etherscanApiKey)
let count = 0
txs.data.every((tx: EtherscanTxItem) => {
    if (txFilter_22(tx)) { ++count; }
    if (count >= value) {
        // break the loop
        return false
    }
    return true
})

if (count >= value) {
    return [true, count]
}
else {
    return [false, count]
}

Finally, if user get true result, they can mint curve pool object.

- DAI Holding Quest

In this case, we can check contract's read method is used to verify the balance of DAI.

We verify whether an address has a sufficient balance.

const DAI = new ethers.Contract(DAI_ADDRESS, ERC20ABI, provider);
DAIBalance = await DAI.balanceOf(useraddress);

Balance is easy to check. You can check DAI contract read method.

⚙️
🧑‍🏫
👓
https://quest.philand.xyz/items/0x3D8C06e65ebf06A9d40F313a35353be06BD46038/101104
https://etherscan.io/token/0x6b175474e89094c44da98b954eedeac495271d0f#readContract
Deployment Addresses — Curve 1.0.0 documentation
Pool Address
Logo
Curve Pool Object
Dai Etherscan