Skip to content

Rewrite Gateway Contract for Solana [REWARD: $500-$800] #1

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

Open
chibie opened this issue Jan 23, 2025 · 11 comments · May be fixed by #3
Open

Rewrite Gateway Contract for Solana [REWARD: $500-$800] #1

chibie opened this issue Jan 23, 2025 · 11 comments · May be fixed by #3
Labels
difficulty: hard enhancement New feature or request

Comments

@chibie
Copy link
Contributor

chibie commented Jan 23, 2025

User Story

As a blockchain developer, I want to port the Gateway EVM contract to Solana, maintaining the same core functionality while leveraging Solana's native features and optimizations, ensure comprehensive test coverage, and demonstrate its functionality on testnet.

Acceptance Criteria

  1. Code Implementation
  • GIVEN the Gateway contract is deployed on Solana
    WHEN users interact with the contract
    THEN all core functionality from EVM version works equivalently

  • GIVEN contract state management in Solana
    WHEN implementing the Order struct and mappings
    THEN use appropriate Solana account structures

  • GIVEN protocol settings management
    WHEN implementing admin controls
    THEN maintain same permission levels as EVM version

  1. Test Coverage
  • Order Creation Tests

    • Create order with valid params succeeds
    • Create order with invalid token fails
    • Create order with zero amount fails
    • Create order with invalid refund address fails
    • Verify correct token transfers
    • Verify correct event emission
  • Refund Tests

    • Refund unfulfilled order succeeds
    • Refund with fee calculation is correct
    • Refund fulfilled order fails
    • Refund already refunded order fails
    • Verify correct token transfers
    • Verify state updates
  • Settlement Tests

    • Settle order with valid params succeeds
    • Partial settlement updates state correctly
    • Complete settlement marks order fulfilled
    • Settlement of fulfilled order fails
    • Settlement of refunded order fails
    • Protocol fee calculation and transfer
    • LP fee calculation and transfer
  1. Demonstration
  • GIVEN the contract is deployed to Solana Devnet
    WHEN demonstrating functionality
    THEN record video showing interaction with all core functions:
    • Creating an order
    • Setting protocol fees and supported tokens
    • Settling an order
    • Refunding an order

Tech Details

  • Implementation components:

    • Order PDA (Program Derived Account) structure
    • Token handling using SPL Token program
    • Admin/settings management using access control
    • Events as Solana program logs
    • State management via PDAs
    • Cross-program invocation for token transfers
    • Account validation
  • Testing framework:

    • Use Anchor testing framework
    • Program setup and deployment tests
    • Account creation and PDA derivation tests
    • Token account handling tests
    • Transaction signing and submission tests
    • State verification tests
    • Error condition tests
    • Helper functions for test setup and verification
  • Deployment and Demo:

    • Deploy to Solana Devnet
    • Create test token and accounts
    • Record demonstration video with narration
    • Show transaction confirmations

Notes/Assumptions

  • Use Anchor framework for development
  • Replace ERC20 with SPL Token program
  • State/storage handled via PDAs instead of mappings
  • Replace OpenZeppelin upgradeable pattern with Solana upgrade pattern
  • Use Solana program logs instead of Ethereum events
  • Tests will use local validator
  • Create mock SPL tokens for testing
  • Simulate multiple users/roles
  • Test both success and failure paths
  • Demo video should be narrated and show transaction confirmations

Open Questions

  • How to handle upgrades in Solana efficiently?
  • What's the equivalent pattern for OpenZeppelin's 2-step ownership?
  • Which wallet/tool should we use for the demo video?

REWARD: $500-$800

@jancris100
Copy link

Hey! I'm Jan.
Member of Dojo Coding. I have contributed before to other projects like:

• Dojo
Can I work on this issue?

@Supa-mega
Copy link

Could I take over this issue?

@Abeeujah
Copy link

Hi, Can I work on this, Rustacean and Smart Contract Developer here, I can help Migrate the Gateway contract over to Solana with my knowledge in Anchor and The Solana Ecosystem, Also I'd make sure the new implementation is heavily documented and have a high test coverage.

@kayceeDev
Copy link

Hi @chibie I will love to take on this issue to create a scalable and maintainable Gateway contract.
I will make sure the code is properly tested good covarage.

@Emeka000
Copy link

I'd be happy to do this.

@Joewizy
Copy link

Joewizy commented Jan 24, 2025

Blockchain developer and EVM expertise here! can I take on this project?

@Yunusabdul38
Copy link

Could I take a shot at this?

@dev-salami
Copy link

Is it okay if I tackle this?

@Abeeujah Abeeujah linked a pull request Jan 30, 2025 that will close this issue
@chibie chibie removed the ODBoost label Mar 18, 2025
@Hoossayn
Copy link

Hi,

i'm a smart contract dev, experienced in rust and cairo.

To answer your questions:

  1. anchor upgrade handles building and redeploying the program while preserving the program's upgrade authority. we can also appoint a multisig upgrade authority to secure upgrade permissions

  2. we can manually implement a similar pattern in the PDA state struct like

pub struct Settings {
    pub owner: Pubkey,
    pub pending_owner: Option<Pubkey>,
}
  1. metamask wallet, for demo video we can use solana explorer

@canva254
Copy link

canva254 commented May 5, 2025

Can I work on this, please?

@canva254
Copy link

canva254 commented May 5, 2025

I’d like to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: hard enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.