---
description: scripts/zkevm/deployBalancerPlugin.js
---

# zkEVM: Balancer Gauges

This script will deploy a factory that can deploy plugins for Balancer gauges on Polygon zkEVM.

#### Plugin Factory: contracts\plugins\zkevm\BPTGaugePluginFactory.sol

{% hint style="info" %}
**IMPORTANT NOTICE**

These plugins are not audited. It is recommended to get them audited if you plan to use them in production.
{% endhint %}

### Plugin Description

This plugin is made for Balancer BPT tokens that have gauges. Use the Factory to create the plugins with the following parameters.

#### **\_bpt**

Address of the Balancer BPT.\
Example. Address of the WETH-wstETH BPT:&#x20;

```javascript
const BPT_ADDRESS = '0xe1F2c039a68A216dE6DD427Be6c60dEcf405762A'    // BPT Address
```

#### \_balGauge

The address of the Balancer Gauge for the BPT.\
Example: For the WETH-wstETH BPT the gauge address is:

```javascript
const GAUGE_ADDRESS = '0x544BDCE27174EA8Ba829939bd3568efc6A6c9c53' // BPT Gauge Address
```

#### \_tokensInUnderlying

Array of addresses of the underlying tokens in the Balancer BPT.\
Example. The underlying tokens of the WETH-wstETH BPT are WETH and wstETH:

```javascript
const UNDERLYING_TOKENS = [
'0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9',   // WETH
'0x5D8cfF95D7A57c0BF50B30b43c7CC0D52825D4a9'    // wstETH
]
```

#### \_bribeTokens

Array of addresses of the Balancer Gauge reward tokens.\
Example. The gauge reward tokens for the WETH-wstETH BPT Gauge are USDC and MATIC:

```javascript
const GAUGE_REWARDS = [
'0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035',   // USDC
'0xa2036f0538221a77A3937F1379699f44945018d0'    // MATIC
]
```

{% hint style="info" %}
**IMPORTANT NOTICE**

A reward token should never be the same as underlying, things will break.
{% endhint %}

#### \_symbol

The desired symbol for this plugin.\
Example. The symbol for the WETH-wstETH BPT Gauge could be:

```javascript
const BPT_SYMBOL = 'B-wstETH-STABLE Gauge'
```

### Plugin Logic

#### depositFor

* User deposits BPT in plugin
* Plugin deposits BPT in Balancer gauge

#### withdrawTo

* Plugin withdraws BPT from Balancer gauge
* Plugin withdraws BPT to user

#### claimAndDistribute

* BPT deposited in the Balancer gauge earn gauge rewards
* If reward token is BAL, claim reward from Balancer minter
* If reward token is not BAL, claim reward from Balancer gauge
* Rewards sent to bribe contract for voters

***

### Refer to the Test Plugins deployment instructions for deploying this plugin factory

{% content-ref url="test-plugins" %}
[test-plugins](test-plugins)
{% endcontent-ref %}
