Validating your statements
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { HashiProver } from "https://github.com/gnosis/hashi/blob/feat/hashi-prover/packages/evm/contracts/prover/HashiProver.sol";
contract UsdcTotalSupplyReader is HashiProver {
event UsdcTotalSupply(uint256 totalSupply);
constructor(address shoyuBashi) HashiProver(shoyuBashi) {}
function readTotalSupply(HashiProver.AccountAndStorageProof calldata proof) external {
require(proof.chainId == 10, "Invalid chain id"); // Optimism
require(proof.account == 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85, "Invalid account");
require(proof.storageKeys.length == 1 && proof.storageKeys[0] == bytes32(uint256(0xb)), "Invalid storage key");
// Verify the proof against the latest block header stored in Hashi
uint256 totalSupply = uint256(bytes32(verifyForeignStorage(proof)[0]));
emit UsdcTotalSupply(totalSupply);
}
}Deployment:
Last updated
Was this helpful?