Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(target_chains/ethereum): add arbirum stylus sdk #2041

Draft
wants to merge 164 commits into
base: main
Choose a base branch
from

Conversation

Ifechukwudaniel
Copy link

I’m currently working on the early draft of the Stylus SDK, focusing on documentation, writing examples, and conducting end-to-end testing for the SDK

Copy link

vercel bot commented Oct 14, 2024

@Ifechukwudaniel is attempting to deploy a commit to the Pyth Network Team on Vercel.

A member of the Team first needs to authorize it.

@Ifechukwudaniel
Copy link
Author

Ifechukwudaniel commented Oct 14, 2024

This is an early draft of the Pyth stylus SDK. Using external calls. I am working on the examples

@Ifechukwudaniel
Copy link
Author

This looks very promising overall. However, I think you should try to use sol_interface! macro to facilitate cross-contract calls, as recommended by the Stylus docs. Please see the comments for details.

The issue with this approach is the return type. The sol_interface! {} does not support custom types like PriceFeed or Price. Using just Price will look like this:

   struct Price {
        int64 price;
        uint64 conf;
        int32 expo;
        uint publish_time;
    }

    struct PriceFeed {
        bytes32 id;
        Price price;
        Price ema_price;
    }

The interface will look like

sol_interface! {
 interface IPyth {
     function getEmaPriceNoOlderThan(
            bytes32 id,
            uint age
        ) external view returns (int64,uint64,uint32, unit);
    
     function parsePriceFeedUpdates(
            bytes[] calldata updateData,
            bytes32[] calldata priceIds,
            uint64 minPublishTime,
            uint64 maxPublishTime
        ) external payable returns (PriceFeed[] memory priceFeeds);
 }
}

getEmaPriceNoOlderThan wors because the return type is not complicated

@Ifechukwudaniel
Copy link
Author

@Riateche

@Ifechukwudaniel
Copy link
Author

@Riateche @SEJeff @thmzlt

@Ifechukwudaniel Ifechukwudaniel marked this pull request as draft December 12, 2024 02:00
@Ifechukwudaniel Ifechukwudaniel marked this pull request as ready for review December 12, 2024 02:22
@Ifechukwudaniel Ifechukwudaniel marked this pull request as draft December 12, 2024 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants