Skip to content

Commit

Permalink
feat: create view scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoAcosta committed Nov 27, 2024
1 parent bef5098 commit 9326811
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions script/read/PointsView.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { Script, console } from "forge-std/Script.sol";
import { Points } from "../../src/points/Points.sol";
import { IPointsView } from "../../src/points/interfaces/IPointsView.sol";

contract PointsViewScript is Script {
function run() public {
// Get the points address from environment variable
address pointsAddress = vm.envAddress("POINTS_ADDRESS");
// Get the user address from environment variable
address userAddress = vm.envAddress("USER_ADDRESS");

console.log("Reading Points View for:");
console.log("Points:", pointsAddress);
console.log("User:", userAddress);

// Create interface instance
Points points = Points(pointsAddress);

points.getPointsView(userAddress);
}
}
24 changes: 24 additions & 0 deletions script/read/SpaceView.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { Script, console } from "forge-std/Script.sol";
import { Space } from "../../src/spaces/Space.sol";
import { ISpaceView } from "../../src/spaces/interfaces/ISpaceView.sol";

contract SpaceViewScript is Script {
function run() public {
// Get the space address from environment variable
address spaceAddress = vm.envAddress("SPACE_ADDRESS");
// Get the user address from environment variable
address userAddress = vm.envAddress("USER_ADDRESS");

console.log("Reading Space View for:");
console.log("Space:", spaceAddress);
console.log("User:", userAddress);

// Create interface instance
Space space = Space(spaceAddress);

space.getSpaceView(userAddress);
}
}

0 comments on commit 9326811

Please sign in to comment.