Skip to content

Instantly share code, notes, and snippets.

@yohanelly95
Created November 2, 2023 06:08
Show Gist options
  • Save yohanelly95/7e269e35e0f5b847daa965c59a7c67f2 to your computer and use it in GitHub Desktop.
Save yohanelly95/7e269e35e0f5b847daa965c59a7c67f2 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ITransparentForwarder {
/**
* @dev using the hash of collection name, clients can query the result of that collection
* @param _name bytes32 hash of the collection name
* @return result of the collection and its power
*/
function getResult(bytes32 _name) external payable returns (uint256, int8);
}
contract DataFeed {
ITransparentForwarder public transparentForwarder;
uint256 public latestResult;
int8 public latestPower;
constructor() {
transparentForwarder = ITransparentForwarder(
0x53Df936a3594777185DF12Cd073d9033cfF348D6
);
}
function getResult(bytes32 name) public payable returns (uint256, int8) {
(uint256 result, int8 power) = transparentForwarder.getResult{value: msg.value}(name);
latestResult = result;
latestPower = power;
return (result, power);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment