Skip to content

Extend Lido Staking Protocol Implementation for Polygon #41

@hpsing

Description

@hpsing

Description

We are seeking to extend our existing Lido staking protocol implementation (lido.go) to support the Polygon network. This enhancement will enable users to stake POL (previously MATIC) and receive Lido's liquid staking tokens on Polygon, thereby broadening our platform's staking capabilities and providing users with more options across different blockchain networks.

Tasks

  1. Update LidoOperation Struct
    • Introduce a field to identify the Polygon network.
    • Define an enumeration or similar construct to represent supported networks, including Polygon.
  2. Implement Constructor for Polygon
    • Modify the existing constructor to accept network parameters.
    • Initialize Polygon-specific contract addresses and ABI definitions.
  3. Handle Chain-Specific Configurations
    • Update methods such as GenerateCalldata, Validate, GetSupportedAssets, GetBalance, and GetContractAddress to accommodate Polygon.
    • Ensure that all interactions are correctly routed to Polygon's contracts.
  4. Generate Calldata for Polygon
    • Adapt the GenerateCalldata method to handle staking (NativeStake) and unstaking (NativeUnStake) actions specific to Polygon.
    • Use appropriate function signatures and parameters for Polygon's Lido contracts.
  5. Implement Validation Logic
    • Update the Validate method to include checks relevant to Polygon.
    • Ensure parameters for staking and unstaking are correctly validated on Polygon.
  6. Supported Assets
    • Update GetSupportedAssets to include POL and Lido's Polygon staking tokens.
    • Verify and use the correct token addresses for Polygon mainnet.
  7. Balance Retrieval
    • Modify GetBalance to fetch user balances of POL and Lido's Polygon staking tokens.
    • Ensure accurate interaction with Polygon's ERC-20 contracts.
  8. Protocol Configuration
    • Update GetProtocolConfig to include Polygon-specific settings such as RPC URLs, chain IDs, and contract addresses.
    • Ensure all configurations are correctly referenced based on the network.
  9. Update Naming and Versioning
    • Adjust methods like GetName and GetVersion to reflect the Polygon network where applicable.
    • Ensure clear differentiation between Ethereum and Polygon implementations.
  10. Unit Testing
    • Extend existing unit tests to cover Polygon-specific scenarios.
    • Ensure all new functionalities are thoroughly tested for correctness and reliability.
  11. Documentation
    • Update code comments to explain Polygon-specific logic.
    • Revise any relevant README or documentation files to include information about Lido on Polygon.
  12. Registry Registration
    • Update registry.go to register the Polygon implementation of the Lido protocol.
    • Ensure that the Polygon network is correctly initialized and associated with the Lido protocol in the registry.

Resources

Contribution Instructions

  1. Fork the Repository: Fork our GitHub repository to your account.
  2. Create a Branch: Create a new branch for your implementation, e.g., feature/extend-lido-polygon.
  3. Implement the Protocol: Follow the tasks outlined in this issue to extend the existing lido.go file.
  4. Write Tests: Develop unit tests to ensure the new Polygon functionalities work as expected.
  5. Update Documentation: Ensure all changes are well-documented, including code comments and README updates.
  6. Submit a Pull Request: Once completed, submit a pull request to the main branch for review.
  7. Add Hacktoberfest Label: Mention Hacktoberfest in your PR to be counted towards your contributions.
  8. Respond to Feedback: Address any feedback or requested changes promptly to facilitate smooth integration.

Questions?

If you have any questions or need further clarifications, feel free to:

  • Open a Discussion: Start a discussion in the repository to engage with maintainers and other contributors.
  • Comment on the Issue: Leave a comment on this issue for specific queries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions