# MasterWombatV2

contracts/wombat-governance/MasterWombatV2.sol

> Title: MasterWombatV2

> Notice: MasterWombat is a boss. He is not afraid of any snakes. In fact, he drinks their venoms. So, veWom holders boost their (boosted) emissions. This contract rewards users in function of their amount of lp staked (base pool) factor (boosted pool) Factor and sumOfFactors are updated by contract VeWom.sol after any veWom minting/burning (veERC20Upgradeable hook). Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once Wombat is sufficiently distributed and the community can show to govern itself.

> Details: Updates: - pack struct - move pendingWom into UserInfo - use MultiRewarderPerSec

### *event* Add

\*\*\*MasterWombatV2.Add(pid, allocPoint, lpToken, rewarder) \*\*\*

Arguments

| **name**   | **type** | **description** |
| ---------- | -------- | --------------- |
| pid        | uint256  | indexed         |
| allocPoint | uint256  | not indexed     |
| lpToken    | address  | indexed         |
| rewarder   | address  | indexed         |

### *event* Deposit

\*\*\*MasterWombatV2.Deposit(user, pid, amount) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| user     | address  | indexed         |
| pid      | uint256  | indexed         |
| amount   | uint256  | not indexed     |

### *event* DepositFor

\*\*\*MasterWombatV2.DepositFor(user, pid, amount) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| user     | address  | indexed         |
| pid      | uint256  | indexed         |
| amount   | uint256  | not indexed     |

### *event* EmergencyWithdraw

\*\*\*MasterWombatV2.EmergencyWithdraw(user, pid, amount) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| user     | address  | indexed         |
| pid      | uint256  | indexed         |
| amount   | uint256  | not indexed     |

### *event* EmergencyWomWithdraw

\*\*\*MasterWombatV2.EmergencyWomWithdraw(owner, balance) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| owner    | address  | not indexed     |
| balance  | uint256  | not indexed     |

### *event* Harvest

\*\*\*MasterWombatV2.Harvest(user, pid, amount) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| user     | address  | indexed         |
| pid      | uint256  | indexed         |
| amount   | uint256  | not indexed     |

### *event* OwnershipTransferred

\*\*\*MasterWombatV2.OwnershipTransferred(previousOwner, newOwner) \*\*\*

Arguments

| **name**      | **type** | **description** |
| ------------- | -------- | --------------- |
| previousOwner | address  | indexed         |
| newOwner      | address  | indexed         |

### *event* Paused

\*\*\*MasterWombatV2.Paused(account) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| account  | address  | not indexed     |

### *event* Set

\*\*\*MasterWombatV2.Set(pid, allocPoint, rewarder, overwrite) \*\*\*

Arguments

| **name**   | **type** | **description** |
| ---------- | -------- | --------------- |
| pid        | uint256  | indexed         |
| allocPoint | uint256  | not indexed     |
| rewarder   | address  | indexed         |
| overwrite  | bool     | not indexed     |

### *event* Unpaused

\*\*\*MasterWombatV2.Unpaused(account) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| account  | address  | not indexed     |

### *event* UpdateEmissionPartition

\*\*\*MasterWombatV2.UpdateEmissionPartition(user, basePartition, boostedPartition) \*\*\*

Arguments

| **name**         | **type** | **description** |
| ---------------- | -------- | --------------- |
| user             | address  | indexed         |
| basePartition    | uint256  | not indexed     |
| boostedPartition | uint256  | not indexed     |

### *event* UpdateEmissionRate

\*\*\*MasterWombatV2.UpdateEmissionRate(user, womPerSec) \*\*\*

Arguments

| **name**  | **type** | **description** |
| --------- | -------- | --------------- |
| user      | address  | indexed         |
| womPerSec | uint256  | not indexed     |

### *event* UpdatePool

\*\*\*MasterWombatV2.UpdatePool(pid, lastRewardTimestamp, lpSupply, accWomPerShare) \*\*\*

Arguments

| **name**            | **type** | **description** |
| ------------------- | -------- | --------------- |
| pid                 | uint256  | indexed         |
| lastRewardTimestamp | uint256  | not indexed     |
| lpSupply            | uint256  | not indexed     |
| accWomPerShare      | uint256  | not indexed     |

### *event* UpdateVeWOM

\*\*\*MasterWombatV2.UpdateVeWOM(user, oldVeWOM, newVeWOM) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| user     | address  | indexed         |
| oldVeWOM | address  | not indexed     |
| newVeWOM | address  | not indexed     |

### *event* Withdraw

\*\*\*MasterWombatV2.Withdraw(user, pid, amount) \*\*\*

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| user     | address  | indexed         |
| pid      | uint256  | indexed         |
| amount   | uint256  | not indexed     |

### *function* add

\*\*\*MasterWombatV2.add(\_allocPoint, \_lpToken, \_rewarder) \*\*\*

> Notice: Add a new lp to the pool. Can only be called by the owner.

> Details: Reverts if the same LP token is added more than once.

Arguments

| **name**     | **type** | **description**               |
| ------------ | -------- | ----------------------------- |
| \_allocPoint | uint96   | allocation points for this LP |
| \_lpToken    | address  | the corresponding lp token    |
| \_rewarder   | address  | the rewarder                  |

### *function* basePartition

***MasterWombatV2.basePartition() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint16   |                 |

### *function* boostedPartition

***MasterWombatV2.boostedPartition() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *function* deposit

\*\*\*MasterWombatV2.deposit(\_pid, \_amount) \*\*\*

> Notice: Deposit LP tokens to MasterChef for WOM allocation.

> Details: it is possible to call this function with \_amount == 0 to claim current rewards

Arguments

| **name** | **type** | **description**   |
| -------- | -------- | ----------------- |
| \_pid    | uint256  | the pool id       |
| \_amount | uint256  | amount to deposit |

Outputs

| **name** | **type**   | **description** |
| -------- | ---------- | --------------- |
|          | uint256    |                 |
|          | uint256\[] |                 |

### *function* depositFor

\*\*\*MasterWombatV2.depositFor(\_pid, \_amount, \_user) \*\*\*

> Notice: Deposit LP tokens to MasterChef for WOM allocation on behalf of user

> Details: user must initiate transaction from masterchef

Arguments

| **name** | **type** | **description**            |
| -------- | -------- | -------------------------- |
| \_pid    | uint256  | the pool id                |
| \_amount | uint256  | amount to deposit          |
| \_user   | address  | the user being represented |

### *function* emergencyWithdraw

\*\*\*MasterWombatV2.emergencyWithdraw(\_pid) \*\*\*

> Notice: Withdraw without caring about rewards. EMERGENCY ONLY.

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| \_pid    | uint256  | the pool id     |

### *function* emergencyWomWithdraw

\*\*\*MasterWombatV2.emergencyWomWithdraw() \*\*\*

> Notice: In case we need to manually migrate WOM funds from MasterChef Sends all remaining wom from the contract to the owner

### *function* getAssetPid

***MasterWombatV2.getAssetPid(asset) view***

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| asset    | address  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *function* initialize

\*\*\*MasterWombatV2.initialize(\_wom, \_veWom, \_womPerSec, \_basePartition, \_startTimestamp) \*\*\*

Arguments

| **name**         | **type** | **description** |
| ---------------- | -------- | --------------- |
| \_wom            | address  |                 |
| \_veWom          | address  |                 |
| \_womPerSec      | uint104  |                 |
| \_basePartition  | uint16   |                 |
| \_startTimestamp | uint40   |                 |

### *function* massUpdatePools

\*\*\*MasterWombatV2.massUpdatePools() \*\*\*

> Notice: Update reward variables for all pools.

> Details: Be careful of gas spending!

### *function* migrate

\*\*\*MasterWombatV2.migrate(\_pids) \*\*\*

> Notice: Helper function to migrate fund from multiple pools to the new MasterWombat.user must initiate transaction from masterchef

> Details: Assume the orginal MasterWombat has stopped emisions hence we can skip updatePool() to save gas cost

Arguments

| **name** | **type**   | **description** |
| -------- | ---------- | --------------- |
| \_pids   | uint256\[] |                 |

### *function* multiClaim

\*\*\*MasterWombatV2.multiClaim(\_pids) \*\*\*

> Notice: claims rewards for multiple pids

Arguments

| **name** | **type**   | **description**            |
| -------- | ---------- | -------------------------- |
| \_pids   | uint256\[] | array pids, pools to claim |

Outputs

| **name** | **type**      | **description** |
| -------- | ------------- | --------------- |
|          | uint256       |                 |
|          | uint256\[]    |                 |
|          | uint256\[]\[] |                 |

### *function* owner

***MasterWombatV2.owner() view***

> Details: Returns the address of the current owner.

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | address  |                 |

### *function* pause

\*\*\*MasterWombatV2.pause() \*\*\*

> Details: pause pool, restricting certain operations

### *function* paused

***MasterWombatV2.paused() view***

> Details: Returns true if the contract is paused, and false otherwise.

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | bool     |                 |

### *function* pendingTokens

***MasterWombatV2.pendingTokens(\_pid, \_user) view***

> Notice: View function to see pending WOMs on frontend.

Arguments

| **name** | **type** | **description**  |
| -------- | -------- | ---------------- |
| \_pid    | uint256  | the pool id      |
| \_user   | address  | the user address |

Outputs

| **name**            | **type**   | **description** |
| ------------------- | ---------- | --------------- |
| pendingRewards      | uint256    |                 |
| bonusTokenAddresses | address\[] |                 |
| bonusTokenSymbols   | string\[]  |                 |
| pendingBonusRewards | uint256\[] |                 |

### *function* poolInfo

***MasterWombatV2.poolInfo() view***

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

Outputs

| **name**             | **type** | **description** |
| -------------------- | -------- | --------------- |
| lpToken              | address  |                 |
| allocPoint           | uint96   |                 |
| rewarder             | address  |                 |
| sumOfFactors         | uint256  |                 |
| accWomPerShare       | uint104  |                 |
| accWomPerFactorShare | uint104  |                 |
| lastRewardTimestamp  | uint40   |                 |

### *function* poolLength

***MasterWombatV2.poolLength() view***

> Notice: returns pool length

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *function* renounceOwnership

\*\*\*MasterWombatV2.renounceOwnership() \*\*\*

> Details: Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

### *function* rewarderBonusTokenInfo

***MasterWombatV2.rewarderBonusTokenInfo(\_pid) view***

> Notice: Get bonus token info from the rewarder contract for a given pool, if it is a double reward farm

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| \_pid    | uint256  | the pool id     |

Outputs

| **name**            | **type**   | **description** |
| ------------------- | ---------- | --------------- |
| bonusTokenAddresses | address\[] |                 |
| bonusTokenSymbols   | string\[]  |                 |

### *function* set

\*\*\*MasterWombatV2.set(\_pid, \_allocPoint, \_rewarder, overwrite) \*\*\*

> Notice: Update the given pool's WOM allocation point. Can only be called by the owner.

Arguments

| **name**     | **type** | **description**     |
| ------------ | -------- | ------------------- |
| \_pid        | uint256  | the pool id         |
| \_allocPoint | uint96   | allocation points   |
| \_rewarder   | address  | the rewarder        |
| overwrite    | bool     | overwrite rewarder? |

### *function* setNewMasterWombat

\*\*\*MasterWombatV2.setNewMasterWombat(\_newMasterWombat) \*\*\*

Arguments

| **name**          | **type** | **description** |
| ----------------- | -------- | --------------- |
| \_newMasterWombat | address  |                 |

### *function* setVeWom

\*\*\*MasterWombatV2.setVeWom(\_newVeWom) \*\*\*

> Notice: updates veWom address

Arguments

| **name**   | **type** | **description**       |
| ---------- | -------- | --------------------- |
| \_newVeWom | address  | the new VeWom address |

### *function* startTimestamp

***MasterWombatV2.startTimestamp() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint40   |                 |

### *function* totalAllocPoint

***MasterWombatV2.totalAllocPoint() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint96   |                 |

### *function* transferOwnership

\*\*\*MasterWombatV2.transferOwnership(newOwner) \*\*\*

> Details: Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| newOwner | address  |                 |

### *function* unpause

\*\*\*MasterWombatV2.unpause() \*\*\*

> Details: unpause pool, enabling certain operations

### *function* updateEmissionPartition

\*\*\*MasterWombatV2.updateEmissionPartition(\_basePartition) \*\*\*

> Notice: updates emission partition

Arguments

| **name**        | **type** | **description**           |
| --------------- | -------- | ------------------------- |
| \_basePartition | uint16   | the future base partition |

### *function* updateEmissionRate

\*\*\*MasterWombatV2.updateEmissionRate(\_womPerSec) \*\*\*

> Notice: updates emission rate

> Details: Pancake has to add hidden dummy pools inorder to alter the emission,here we make it simple and transparent to all.

Arguments

| **name**    | **type** | **description**          |
| ----------- | -------- | ------------------------ |
| \_womPerSec | uint104  | wom amount to be updated |

### *function* updateFactor

\*\*\*MasterWombatV2.updateFactor(\_user, \_newVeWomBalance) \*\*\*

> Notice: updates factor after any veWom token operation (minting/burning)

> Details: can only be called by veWom

Arguments

| **name**          | **type** | **description**     |
| ----------------- | -------- | ------------------- |
| \_user            | address  | the user to update  |
| \_newVeWomBalance | uint256  | the amount of veWOM |

### *function* updatePool

\*\*\*MasterWombatV2.updatePool(\_pid) \*\*\*

> Notice: Update reward variables of the given pool to be up-to-date.

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| \_pid    | uint256  | the pool id     |

### *function* userInfo

***MasterWombatV2.userInfo(, ) view***

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |
|          | address  |                 |

Outputs

| **name**   | **type** | **description** |
| ---------- | -------- | --------------- |
| amount     | uint128  |                 |
| factor     | uint128  |                 |
| rewardDebt | uint128  |                 |
| pendingWom | uint128  |                 |

### *function* veWom

***MasterWombatV2.veWom() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | address  |                 |

### *function* withdraw

\*\*\*MasterWombatV2.withdraw(\_pid, \_amount) \*\*\*

> Notice: Withdraw LP tokens from MasterWombat.Automatically harvest pending rewards and sends to user

Arguments

| **name** | **type** | **description**        |
| -------- | -------- | ---------------------- |
| \_pid    | uint256  | the pool id            |
| \_amount | uint256  | the amount to withdraw |

Outputs

| **name** | **type**   | **description** |
| -------- | ---------- | --------------- |
|          | uint256    |                 |
|          | uint256\[] |                 |

### *function* wom

***MasterWombatV2.wom() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | address  |                 |

### *function* womPerSec

***MasterWombatV2.womPerSec() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint104  |                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wombat.exchange/developers/integration-guideline/masterwombatv2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
