GithubHelp home page GithubHelp logo

whirlpool-cpi-sample's Introduction

Whirlpool CPI Sample

This repo contains samples contracts which interact with Whirlpool via CPI.

This sample will just proxy Whirlpool instructions via CPI.

sample1

Based on this sample, you can build a program executing Whirlpool instructions via CPI.

sample2

Anchor / Solana version mapping

Directory Anchor version Solana version (rustc version)
anchor-0.24.2 v0.24.2 Solana 1.9.29 (1.59.0-dev)
anchor-0.25.0 v0.25.0 Solana 1.10.41 (1.59.0-dev)
anchor-0.26.0 v0.26.0 Solana 1.14.29 (1.62.0-dev)
anchor-0.27.0 v0.27.0 Solana 1.14.17 (1.62.0-dev)
anchor-0.28.0 v0.28.0 Solana 1.16.26 (1.68.0-dev)
anchor-0.29.0 v0.29.0 Solana 1.17.14 (1.68.0-dev)

Contract Instruction

You can write a contract to execute CPI to Whirlpool based on the following sample instructions.

  • VerifyX reads the account and displays the contents.
  • ProxyX executes the received instructions directly through CPI.
Context (instruction) What to do
VerifyWhirlpoolsConfigAccount print fields of WhirlpoolsConfig account
VerifyFeeTierAccount print fields of FeeTier account
VerifyWhirlpoolAccount print fields of Whirlpool account
VerifyTickArrayAccount print fields of TickArray account
VerifyPositionAccount print field of Position account
ProxySwap execute swap instruction via CPI
ProxyOpenPosition execute open_position instruction via CPI
ProxyIncreaseLiquidity execute increase_liquidity instruction via CPI
ProxyDecreaseLiquidity execute decrease_liquidity instruction via CPI
ProxyUpdateFeesAndRewards execute update_fees_and_rewards instruction via CPI
ProxyCollectFees execute collect_fees instruction via CPI
ProxyCollectReward execute collect_reward instruction via CPI
ProxyClose execute close_position instruction via CPI
ProxyInitializePool execute initialize_pool instruction via CPI
ProxyInitializeTickArray execute initialize_tick_array instruction via CPI

whirlpool-cpi crate

The following crate is used to read accounts and execute CPI:

https://github.com/orca-so/whirlpool-cpi

whirlpool-cpi-sample's People

Contributors

yugure-orca avatar

Stargazers

 avatar zhouxuhui avatar  avatar amilz avatar  avatar 23333333 avatar Prince avatar xinyao avatar

Forkers

boyquotes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.