Skip to content

Extend Ankr Staking Protocol to Support Polygon #39

@hpsing

Description

@hpsing

Description

We are looking to extend our existing Ankr staking protocol implementation (ankr.go) to support the Polygon network. This enhancement will allow users to stake POL (previously MATIC) and receive Ankr's liquid staking tokens on Polygon, expanding our platform's staking capabilities.

Tasks

  1. Update AnkrOperation Struct
    • Introduce a new field network to identify the Polygon network.
    • Define an AnkrNetwork enum if not already present.
  2. Implement NewAnkrOperation Constructor for Polygon
    • Modify the constructor to accept the AnkrNetwork parameter.
    • Initialize Polygon-specific contract addresses and ABIs.
  3. Implement isAnkrChainSupported Function
    • Ensure that Polygon is a supported network.
  4. Handle Polygon-Specific Configurations
    • Update methods like GenerateCalldata, Validate, GetSupportedAssets, GetBalance, and GetContractAddress to handle Polygon-specific logic based on the network field.
  5. Update GenerateCalldata Method
    • Modify to handle staking (NativeStake) and unstaking (NativeUnStake) for Polygon.
    • Use correct function signatures and parameters for Ankr's Polygon staking contracts.
  6. Update Validate Method
    • Implement validation logic specific to Polygon.
    • Ensure correct parameters for staking and unstaking actions.
  7. Implement GetSupportedAssets
    • Return the addresses of POL and Ankr's Polygon staking tokens
  8. Implement GetBalance
    • Retrieve user balances of POL and Ankr's Polygon staking tokens.
    • Interact with the appropriate contracts to fetch balances.
  9. Update GetProtocolConfig
    • Include network-specific configurations such as RPC URLs, chain IDs, contract addresses, and ABIs.
    • Ensure that GetProtocolConfig returns accurate information based on the network.
  10. Update GetName and GetVersion Methods
    • Adjust these methods to reflect the network, if necessary.
    • For example, GetName could return "Ankr Ethereum", "Ankr Polygon", or "Ankr BSC".
  11. Unit Tests
    • Update or add unit tests in ankr_test.go to verify the correctness of your implementation across different networks.
    • Test all implemented methods, including edge cases.
  12. Documentation
    • Include comments explaining the logic in your code.
    • Update any relevant documentation or READMEs to include information about Ankr on Polygon.
  13. Update registry.go
    • In registry.go, update the setupPolygonProtocols method to register the Ankr protocol for Polygon.

Resources

Ankr Staking Documentation
Ankr Contracts on GitHub
Ankr Ethereum Implementation Reference

Contribution Instructions

  1. Fork the Repository: Fork our GitHub repository to your account.
  2. Create a Branch: Create a new branch for your protocol implementation. For example, feature/extend-ankr-polygon.
  3. Implement the Protocol: Follow the tasks outlined in this issue. Ensure your code adheres to the Protocol interface and extends the existing ankr.go file.
  4. Write Tests: Include unit tests to verify the correctness of your implementation.
  5. Submit a Pull Request: Once completed, submit a pull request to our main branch for review.
  6. Add Hacktoberfest Label: Mention Hacktoberfest in your PR to be counted towards your contributions.
  7. Code Review: Be responsive to any feedback during the code review process. Make necessary changes as requested.

Questions?

If you have any questions or need 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