60 min
Fablabs Course
3.3.3.2 Session: Implementing Data Retrieval from Smart Contracts
Implementation
Ideate phase
Students explore options for connecting to an Ethereum node (e.g., Infura, Alchemy, or a local node) and setting up Web3.js or Ethers.js:
- Access Ethereum Node: Configure Web3.js or Ethers.js to connect to an Ethereum node.
- Locate and Load the Uniswap Contract: Identify the Uniswap contract address and load the ABI for data retrieval.
- Define Methods for Data Retrieval: Determine specific functions, such as getPrice or getReserves , that will allow Alice to access token price data.
Prototype
- Implementation:
- Students write code to connect to the Uniswap contract, using Web3.js or Ethers.js to call specific functions and retrieve token prices.
- Execute and test retrieval code, ensuring that it accurately retrieves Uniswap token prices.
- Verification and Reflection:
- Students verify data accuracy by comparing retrieved data with Uniswap’s user interface.
- Discuss challenges faced in the implementation, reflecting on methods to improve accuracy and reliability.
Licenciado baixo a Licenza Creative Commons Atribución Compartir igual 4.0