test their price feeds and entropy contracts, and submit a one page document which contains feedback on how they can improve their contracts, examples, docs to enhance developer experience.
enchance UIUX
GetValidTimePeriod -
function getValidTimePeriod() external view returns (uint) { // Call the Pyth contract to get the valid time period return pyth.getValidTimePeriod();
CREATE YOUR FIRST PYTH CONTRACT ON EVM (DOCS) solidity smart contract code incompatible with wsl
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13;
import "forge-std/Test.sol"; import "./MyFirstPythContract.sol";
contract MyFirstPythContractTest is Test { MyFirstPythContract pythContract;
address constant PYTH_CONTRACT_ADDRESS = 0x...; // Replace with actual Pyth contract address
bytes32 constant ETH_USD_PRICE_ID = 0x...; // Replace with actual price ID
function setUp() public {
pythContract = new MyFirstPythContract(PYTH_CONTRACT_ADDRESS, ETH_USD_PRICE_ID);
}
function testGetEthUsdPrice() public {
int64 price = pythContract.getEthUsdPrice();
console2.logInt(price); // Use Forge's logging for debugging
assertTrue(price > 0); // Ensure price is greater than 0
}
} getPriceUnsafe vs. getPrice: getPriceUnsafe does not verify whether the price is within the valid time window. Use it cautiously, and prefer getPrice in production if accuracy is crucial.
this project includes going through the documentation and API references in testnet to test and enhance the contract code where possible, certain grammatical errors need to be resolved in the documentation. I reviewed the Pyth Network documentation and API, tested their examples, and followed the user guide instructions for creating a smart contract linked to Pyth. Along the way, I identified some grammar issues in the documentation. However, I faced challenges integrating the smart contract, likely due to compatibility issues with my WSL setup. I suspect the Pyth tools or SDK may require a specific environment or version not fully supported by WSL.