votemarket-toolkit


Namevotemarket-toolkit JSON
Version 1.0.4 PyPI version JSON
download
home_pageNone
SummaryPython SDK for VoteMarket - campaign management, proofs, and analytics
upload_time2025-10-08 17:44:02
maintainerNone
docs_urlNone
authorNone
requires_python<4,>=3.10
licenseAGPL-3.0
keywords dao defi ethereum votemarket voting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # VoteMarket Toolkit

Python SDK for VoteMarket - campaign management, proofs, and analytics.

[![PyPI version](https://badge.fury.io/py/votemarket-toolkit.svg)](https://badge.fury.io/py/votemarket-toolkit)
[![Python](https://img.shields.io/pypi/pyversions/votemarket-toolkit.svg)](https://pypi.org/project/votemarket-toolkit/)
[![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL%203.0-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)

## Installation

```bash
pip install votemarket-toolkit
```

## Quick Start

```python
from votemarket_toolkit.campaigns.service import CampaignService
from votemarket_toolkit.shared import registry

# Get platform address
curve_platform = registry.get_platform("curve", chain_id=42161)

# Fetch campaigns
service = CampaignService()
campaigns = await service.get_campaigns(
    chain_id=42161,
    platform_address=curve_platform,
    campaign_id=97
)
```

## Features

- **Campaign Management**: Fetch, create, and manage VoteMarket campaigns
- **Proof Generation**: Generate merkle proofs for reward claims
- **Analytics**: Analyze historical performance and optimize parameters
- **Multi-chain**: Supports Ethereum, Arbitrum, and other networks
- **Registry**: Built-in platform and gauge registries

## Services

### CampaignService
Fetch and manage campaign data, lifecycle status, and proof insertion.

```python
from votemarket_toolkit.campaigns import CampaignService

service = CampaignService()
campaigns = await service.get_campaigns(chain_id=42161, platform_address="0x...")
```

### AnalyticsService
Access historical performance metrics from the VoteMarket analytics repository.

```python
from votemarket_toolkit.analytics import get_analytics_service

analytics = get_analytics_service()
history = await analytics.fetch_gauge_history("curve", "0x...")
```

### CampaignOptimizer
Calculate optimal campaign parameters using market data and historical performance.

```python
from votemarket_toolkit.analytics import get_campaign_optimizer

optimizer = get_campaign_optimizer()
result = await optimizer.calculate_optimal_campaign(
    protocol="curve",
    gauge="0x...",
    reward_token="0x...",
    chain_id=1,
    total_reward_tokens=10000
)
```

### VoteMarketProofs
Generate merkle proofs for user and gauge rewards.

```python
from votemarket_toolkit.proofs import VoteMarketProofs

proofs = VoteMarketProofs(chain_id=1)
gauge_proof = proofs.get_gauge_proof("curve", "0x...", epoch, block_number)
user_proof = proofs.get_user_proof("curve", "0x...", "0x...", block_number)
```

### Web3Service
Multi-chain Web3 connections with contract interaction utilities.

```python
from votemarket_toolkit.shared.services import Web3Service

web3 = Web3Service.get_instance(chain_id=1)
contract = web3.get_contract(address, "vm_platform")
```

### LaPosteService
Handle wrapped/native token conversions for cross-chain rewards.

```python
from votemarket_toolkit.shared.services.laposte_service import laposte_service

native_tokens = await laposte_service.get_native_tokens(chain_id, ["0x..."])
token_info = await laposte_service.get_token_info(chain_id, "0x...")
```

### VotesService
Fetch and cache voting data for gauges.

```python
from votemarket_toolkit.votes.services import VotesService

votes = VotesService()
gauge_votes = await votes.get_gauge_votes("curve", "0x...", start_block, end_block)
```

## Configuration

Create `.env` file with RPC endpoints:

```bash
ETHEREUM_MAINNET_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
ARBITRUM_MAINNET_RPC_URL=https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY
```

## Examples

See [examples/python](examples/python/) for complete usage examples:

- `all_campaigns.py` - Fetch all campaigns across protocols
- `check_user_status.py` - Check user eligibility and rewards
- `generate_proofs.py` - Generate claim proofs
- `compute_campaign.py` - Optimize campaign parameters

## Development

```bash
# Clone repository
git clone https://github.com/stake-dao/votemarket-proof-toolkit
cd votemarket-proof-toolkit

# Install dependencies
uv sync

# Run examples
uv run examples/python/compute_campaign.py
uv run examples/python/get_token_prices.py

# Format and lint
make format              # Format all code
make format FILE=path    # Format specific file

# Build and publish
make build               # Build package
make test-build          # Test build locally
make deploy              # Deploy to PyPI

# Development commands (see Makefile for full list)
make list-campaigns CHAIN_ID=42161 PLATFORM=0x...
make get-active-campaigns PROTOCOL=curve
```

## License

AGPL-3.0 License - see [LICENSE](LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "votemarket-toolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.10",
    "maintainer_email": null,
    "keywords": "dao, defi, ethereum, votemarket, voting",
    "author": null,
    "author_email": "Stake DAO <admin@stakedao.org>",
    "download_url": "https://files.pythonhosted.org/packages/04/de/8c8ce90622dcca189ec88f1672dac38de67495869c1182df115bd0cff59c/votemarket_toolkit-1.0.4.tar.gz",
    "platform": null,
    "description": "# VoteMarket Toolkit\n\nPython SDK for VoteMarket - campaign management, proofs, and analytics.\n\n[![PyPI version](https://badge.fury.io/py/votemarket-toolkit.svg)](https://badge.fury.io/py/votemarket-toolkit)\n[![Python](https://img.shields.io/pypi/pyversions/votemarket-toolkit.svg)](https://pypi.org/project/votemarket-toolkit/)\n[![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL%203.0-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)\n\n## Installation\n\n```bash\npip install votemarket-toolkit\n```\n\n## Quick Start\n\n```python\nfrom votemarket_toolkit.campaigns.service import CampaignService\nfrom votemarket_toolkit.shared import registry\n\n# Get platform address\ncurve_platform = registry.get_platform(\"curve\", chain_id=42161)\n\n# Fetch campaigns\nservice = CampaignService()\ncampaigns = await service.get_campaigns(\n    chain_id=42161,\n    platform_address=curve_platform,\n    campaign_id=97\n)\n```\n\n## Features\n\n- **Campaign Management**: Fetch, create, and manage VoteMarket campaigns\n- **Proof Generation**: Generate merkle proofs for reward claims\n- **Analytics**: Analyze historical performance and optimize parameters\n- **Multi-chain**: Supports Ethereum, Arbitrum, and other networks\n- **Registry**: Built-in platform and gauge registries\n\n## Services\n\n### CampaignService\nFetch and manage campaign data, lifecycle status, and proof insertion.\n\n```python\nfrom votemarket_toolkit.campaigns import CampaignService\n\nservice = CampaignService()\ncampaigns = await service.get_campaigns(chain_id=42161, platform_address=\"0x...\")\n```\n\n### AnalyticsService\nAccess historical performance metrics from the VoteMarket analytics repository.\n\n```python\nfrom votemarket_toolkit.analytics import get_analytics_service\n\nanalytics = get_analytics_service()\nhistory = await analytics.fetch_gauge_history(\"curve\", \"0x...\")\n```\n\n### CampaignOptimizer\nCalculate optimal campaign parameters using market data and historical performance.\n\n```python\nfrom votemarket_toolkit.analytics import get_campaign_optimizer\n\noptimizer = get_campaign_optimizer()\nresult = await optimizer.calculate_optimal_campaign(\n    protocol=\"curve\",\n    gauge=\"0x...\",\n    reward_token=\"0x...\",\n    chain_id=1,\n    total_reward_tokens=10000\n)\n```\n\n### VoteMarketProofs\nGenerate merkle proofs for user and gauge rewards.\n\n```python\nfrom votemarket_toolkit.proofs import VoteMarketProofs\n\nproofs = VoteMarketProofs(chain_id=1)\ngauge_proof = proofs.get_gauge_proof(\"curve\", \"0x...\", epoch, block_number)\nuser_proof = proofs.get_user_proof(\"curve\", \"0x...\", \"0x...\", block_number)\n```\n\n### Web3Service\nMulti-chain Web3 connections with contract interaction utilities.\n\n```python\nfrom votemarket_toolkit.shared.services import Web3Service\n\nweb3 = Web3Service.get_instance(chain_id=1)\ncontract = web3.get_contract(address, \"vm_platform\")\n```\n\n### LaPosteService\nHandle wrapped/native token conversions for cross-chain rewards.\n\n```python\nfrom votemarket_toolkit.shared.services.laposte_service import laposte_service\n\nnative_tokens = await laposte_service.get_native_tokens(chain_id, [\"0x...\"])\ntoken_info = await laposte_service.get_token_info(chain_id, \"0x...\")\n```\n\n### VotesService\nFetch and cache voting data for gauges.\n\n```python\nfrom votemarket_toolkit.votes.services import VotesService\n\nvotes = VotesService()\ngauge_votes = await votes.get_gauge_votes(\"curve\", \"0x...\", start_block, end_block)\n```\n\n## Configuration\n\nCreate `.env` file with RPC endpoints:\n\n```bash\nETHEREUM_MAINNET_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY\nARBITRUM_MAINNET_RPC_URL=https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY\n```\n\n## Examples\n\nSee [examples/python](examples/python/) for complete usage examples:\n\n- `all_campaigns.py` - Fetch all campaigns across protocols\n- `check_user_status.py` - Check user eligibility and rewards\n- `generate_proofs.py` - Generate claim proofs\n- `compute_campaign.py` - Optimize campaign parameters\n\n## Development\n\n```bash\n# Clone repository\ngit clone https://github.com/stake-dao/votemarket-proof-toolkit\ncd votemarket-proof-toolkit\n\n# Install dependencies\nuv sync\n\n# Run examples\nuv run examples/python/compute_campaign.py\nuv run examples/python/get_token_prices.py\n\n# Format and lint\nmake format              # Format all code\nmake format FILE=path    # Format specific file\n\n# Build and publish\nmake build               # Build package\nmake test-build          # Test build locally\nmake deploy              # Deploy to PyPI\n\n# Development commands (see Makefile for full list)\nmake list-campaigns CHAIN_ID=42161 PLATFORM=0x...\nmake get-active-campaigns PROTOCOL=curve\n```\n\n## License\n\nAGPL-3.0 License - see [LICENSE](LICENSE)\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0",
    "summary": "Python SDK for VoteMarket - campaign management, proofs, and analytics",
    "version": "1.0.4",
    "project_urls": {
        "Documentation": "https://github.com/stake-dao/votemarket-proof-toolkit/tree/main/docs",
        "Homepage": "https://github.com/stake-dao/votemarket-proof-toolkit",
        "Issues": "https://github.com/stake-dao/votemarket-proof-toolkit/issues",
        "Repository": "https://github.com/stake-dao/votemarket-proof-toolkit"
    },
    "split_keywords": [
        "dao",
        " defi",
        " ethereum",
        " votemarket",
        " voting"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "07da0a45f9b41be624b90d16d55a82a2fb52547e1312c53c725c848c69e6bf19",
                "md5": "3f89f38cfd769529b35bc0a3849a21eb",
                "sha256": "22cbf0a2a7f359d6a0f1d7e3ccc6e9cfd34394e96cc5c4e44a8f664c0752b29a"
            },
            "downloads": -1,
            "filename": "votemarket_toolkit-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f89f38cfd769529b35bc0a3849a21eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.10",
            "size": 132924,
            "upload_time": "2025-10-08T17:44:01",
            "upload_time_iso_8601": "2025-10-08T17:44:01.059980Z",
            "url": "https://files.pythonhosted.org/packages/07/da/0a45f9b41be624b90d16d55a82a2fb52547e1312c53c725c848c69e6bf19/votemarket_toolkit-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "04de8c8ce90622dcca189ec88f1672dac38de67495869c1182df115bd0cff59c",
                "md5": "1fb1af4124be1a2f8adc034d141e6f9c",
                "sha256": "8dc5fca3039273c8fd4043613845b246c2bf67653ed3526faddaf13ae1481a25"
            },
            "downloads": -1,
            "filename": "votemarket_toolkit-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "1fb1af4124be1a2f8adc034d141e6f9c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.10",
            "size": 97961,
            "upload_time": "2025-10-08T17:44:02",
            "upload_time_iso_8601": "2025-10-08T17:44:02.902118Z",
            "url": "https://files.pythonhosted.org/packages/04/de/8c8ce90622dcca189ec88f1672dac38de67495869c1182df115bd0cff59c/votemarket_toolkit-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-08 17:44:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stake-dao",
    "github_project": "votemarket-proof-toolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "votemarket-toolkit"
}
        
Elapsed time: 1.59120s