Skip to content

Commit

Permalink
chore: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifechukwudaniel committed Nov 5, 2024
1 parent cd728b6 commit 30c5056
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 73 deletions.
1 change: 1 addition & 0 deletions target_chains/ethereum/sdk/stylus/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub enum MultiCallErrors {
impl FunctionCallsExample {
pub fn get_price_unsafe(&mut self) -> Result<(), Vec<u8>> {
let price = get_price_unsafe(self, self.pyth_address.get(), self.price_id.get())?;
self.price.set(price);
if price.price > 0 {
return Ok(());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,14 @@ use alloy::sol;

sol!(
#[sol(rpc)]
contract Pyth {
function approve(address to, uint256 tokenId) external;
#[derive(Debug)]
function balanceOf(address owner) external view returns (uint256 balance);
#[derive(Debug)]
function getApproved(uint256 tokenId) external view returns (address approved);
#[derive(Debug)]
function isApprovedForAll(address owner, address operator) external view returns (bool approved);
#[derive(Debug)]
function ownerOf(uint256 tokenId) external view returns (address ownerOf);
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
function setApprovalForAll(address operator, bool approved) external;
function totalSupply() external view returns (uint256 totalSupply);
function transferFrom(address from, address to, uint256 tokenId) external;

function mint(address to, uint256 tokenId) external;
function burn(uint256 tokenId) external;

function paused() external view returns (bool paused);
function pause() external;
function unpause() external;
#[derive(Debug)]
function whenPaused() external view;
#[derive(Debug)]
function whenNotPaused() external view;

#[derive(Debug)]
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
#[derive(Debug)]
function tokenByIndex(uint256 index) external view returns (uint256 tokenId);

function supportsInterface(bytes4 interface_id) external view returns (bool supportsInterface);

error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
error ERC721InsufficientApproval(address operator, uint256 tokenId);
error ERC721InvalidApprover(address approver);
error ERC721InvalidOperator(address operator);
error ERC721InvalidOwner(address owner);
error ERC721InvalidReceiver(address receiver);
error ERC721InvalidSender(address sender);
error ERC721NonexistentToken(uint256 tokenId);
error ERC721OutOfBoundsIndex(address owner, uint256 index);
error ERC721EnumerableForbiddenBatchMint();
error EnforcedPause();
error ExpectedPause();

#[derive(Debug, PartialEq)]
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
#[derive(Debug, PartialEq)]
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
#[derive(Debug, PartialEq)]
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
#[derive(Debug, PartialEq)]
event Paused(address account);
#[derive(Debug, PartialEq)]
event Unpaused(address account);
contract FunctionCalls {
function getPriceUnsafe() external ;
function getEmaPriceUnsafe() external ;
function getPriceNoOlderThan() external ;
function getEmaPriceNoOlderThan() external;
function getUpdateFee() external;
function getValidTimePeriod() external;
function updatePriceFeeds() external payable;
function updatePriceFeedsIfNecessary() external payable;
}
);
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
#![cfg(feature = "e2e")]

use alloy::hex;
use e2e::{receipt,ReceiptExt,Account};
use abi::FunctionCalls;
use alloy::{
primitives::{uint, Address, U256},
sol,
};
use e2e::{
receipt, send, watch, Account, EventExt, Panic, PanicCode, ReceiptExt,
Revert,
};
use eyre::Result;

// use crate::FunctionCallsExample::constructorCall;

mod abi;

sol!("src/constructor.sol");

// // ============================================================================
// // Integration Tests: Function Calls
// // ============================================================================

#[e2e::test]
async fn constructs(alice: Account) -> Result<()> {
let contract_addr = alice.as_deployer().deploy().await?.address()?;
// // assert_eq!(true, true);
// #[e2e::test]
// async fn constructs(alice: Account) -> Result<()> {
// let contract_addr = alice
// .as_deployer()
// .with_default_constructor::<constructorCall>()
// .deploy()
// .await?
// .address()?;
// // // assert_eq!(true, true);

Ok(())
}
// Ok(())
// }
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#![cfg(feature = "e2e")]

use alloy::hex;
use alloy::{hex, sol};
use e2e::{receipt,ReceiptExt,Account};
use eyre::Result;

mod abi;


sol!("src/constructor.sol");
// // ============================================================================
// // Integration Tests: Proxy Calls
// // ============================================================================

#[e2e::test]
async fn constructs(alice: Account) -> Result<()> {
// let contract_addr = alice.as_deployer().deploy().await?.address()?;
// // assert_eq!(true, true);
// #[e2e::test]
// async fn constructs(alice: Account) -> Result<()> {
// // // let contract_addr = alice.as_deployer().deploy().await?.address()?;
// // // // assert_eq!(true, true);

Ok(())
}
// Ok(())
// }

0 comments on commit 30c5056

Please sign in to comment.