infernet-1.0.0 update

This commit is contained in:
arshan-ritual
2024-06-06 13:18:48 -04:00
parent 2a11fd3953
commit 40a6c590da
98 changed files with 879 additions and 506 deletions

View File

@ -58,7 +58,7 @@ import {console2} from "forge-std/console2.sol";
import {CallbackConsumer} from "infernet-sdk/consumer/Callback.sol";
contract SaysGM is CallbackConsumer {
constructor(address coordinator) CallbackConsumer(coordinator) {}
constructor(address registry) CallbackConsumer(registry) {}
function sayGM() public {
_requestCompute(
@ -128,9 +128,9 @@ contract Deploy is Script {
address deployerAddress = vm.addr(deployerPrivateKey);
console2.log("Loaded deployer: ", deployerAddress);
address coordinator = 0x5FbDB2315678afecb367f032d93F642f64180aa3;
address registry = 0x663F3ad617193148711d28f5334eE4Ed07016602;
// Create consumer
SaysGM saysGm = new SaysGM(coordinator);
SaysGM saysGm = new SaysGM(registry);
console2.log("Deployed SaysHello: ", address(saysGm));
// Execute
@ -160,7 +160,7 @@ contract CallContract is Script {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
SaysGM saysGm = SaysGM(0x663F3ad617193148711d28f5334eE4Ed07016602);
SaysGM saysGm = SaysGM(0x13D69Cf7d6CE4218F646B759Dcf334D82c023d8e);
saysGm.sayGM();

View File

@ -1,2 +1,3 @@
forge-std/=lib/forge-std/src
infernet-sdk/=lib/infernet-sdk/src
solady/=lib/infernet-sdk/lib/solady/src

View File

@ -10,7 +10,7 @@ contract CallContract is Script {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
SaysGM saysGm = SaysGM(0x663F3ad617193148711d28f5334eE4Ed07016602);
SaysGM saysGm = SaysGM(0x13D69Cf7d6CE4218F646B759Dcf334D82c023d8e);
saysGm.sayGM();

View File

@ -14,9 +14,9 @@ contract Deploy is Script {
address deployerAddress = vm.addr(deployerPrivateKey);
console2.log("Loaded deployer: ", deployerAddress);
address coordinator = 0x5FbDB2315678afecb367f032d93F642f64180aa3;
address registry = 0x663F3ad617193148711d28f5334eE4Ed07016602;
// Create consumer
SaysGM saysGm = new SaysGM(coordinator);
SaysGM saysGm = new SaysGM(registry);
console2.log("Deployed SaysHello: ", address(saysGm));
// Execute

View File

@ -5,15 +5,17 @@ import {console2} from "forge-std/console2.sol";
import {CallbackConsumer} from "infernet-sdk/consumer/Callback.sol";
contract SaysGM is CallbackConsumer {
constructor(address coordinator) CallbackConsumer(coordinator) {}
constructor(address registry) CallbackConsumer(registry) {}
function sayGM() public {
_requestCompute(
"hello-world",
bytes("Good morning!"),
20 gwei,
1_000_000,
1
1, // redundancy
address(0), // paymentToken
0, // paymentAmount
address(0), // wallet
address(0) // prover
);
}
@ -24,7 +26,9 @@ contract SaysGM is CallbackConsumer {
address node,
bytes calldata input,
bytes calldata output,
bytes calldata proof
bytes calldata proof,
bytes32 containerId,
uint256 index
) internal override {
console2.log("\n\n"
"_____ _____ _______ _ _ _\n"
@ -43,6 +47,8 @@ contract SaysGM is CallbackConsumer {
console2.logBytes(input);
console2.log("output:");
console2.logBytes(output);
(string memory decoded)= abi.decode(output, (string));
console2.log("decoded output: ", decoded);
console2.log("proof:");
console2.logBytes(proof);
}