# VGlobalMinter

vGlobalMinter is deployed on Ethereum and is responsible for minting and distributing VRSW tokens

vGlobalMinter supports multi-chain deployment of VirtuSwap DEX, and distribution of protocol rewards between chains. In v1 the distribution between chains is performed manually by the DAO. In the second version, an automated and trustless way will be introduced.

## Events

#### event NewVesting

```solidity
event NewVesting(
 address vestingWallet,
 address beneficiary,
 uint32 startTs,
 uint32 duration
);
```

Emitted when a new vVestingWallet contract is created.

## State-Changing Functions

#### function newVesting

```solidity
function newVesting(
        address beneficiary,
        uint32 startTs,
        uint32 duration,
        uint256 amount
    ) external override onlyOwner returns (address vestingWallet)
```

Creates a new vVestingWallet contract for the given beneficiary.

✏️Can only be called by the owner

Parameters:

<table><thead><tr><th width="164">Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td>beneficiary</td><td><code>address</code></td><td>Address of the beneficiary of the new wallet</td></tr><tr><td>startTs</td><td><code>uint32</code></td><td>The start timestamp of the vesting contract </td></tr><tr><td>duration</td><td><code>uint32</code></td><td>Duration of the vesting (in seconds)</td></tr><tr><td>amount </td><td><code>uint256</code></td><td>The amount of tokens to be vested</td></tr></tbody></table>

#### function arbitraryTransfer

```solidity
function arbitraryTransfer(
    address to, 
    uint256 amount) external override onlyOwner;
```

This function allows the owner of the contract to transfer a specified amount of unlocked VRSW tokens to a recipient address.&#x20;

The method is used by the DAO to transfer VRSW tokens to be used in different chains.

✏️ In v1, cross-chain communication is not implemented in VirtuSwap contracts, so the transfers between chains will be done manually by the designated DAO wallet.

The recipient wallet will be responsible to bridge the received VRSW tokens to the target chain.

✏️Can only be called by the owner

Parameters:

<table><thead><tr><th width="164">Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td>to</td><td><code>address</code></td><td>Recipient of the transfer</td></tr><tr><td>amount</td><td><code>uint256</code></td><td>Amount to transfer</td></tr></tbody></table>

#### function setEpochParams

```solidity
function setEpochParams(
        uint32 _epochDuration,
        uint32 _epochPreparationTime
 ) external override onlyOwner
```

Changes minting epoch duration and preparation time. A minting epoch is the time period between changes in distribution of rewards between VirtuSwap pools. Default is 4 week.

The Epoch Preparation Time is the time window before the start of the epoch in which it is allowed to transfer the rewards for the upcoming epoch. Default is 1 week.

✏️Can only be called by the owner

Parameters:

<table><thead><tr><th width="271">Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td>_epochDuration</td><td><code>uint32</code></td><td>Epoch duration (in seconds)</td></tr><tr><td>_epochPreparationTime</td><td><code>uint32</code></td><td>Amount to transfer</td></tr></tbody></table>

#### function nextEpochTransfer

```solidity
function nextEpochTransfer() external override onlyOwner 
```

Transfers the amount of VRSW tokens minted for the next epoch to the caller (VirtuSwap DAO). The DAO will transfer the tokens to [`vChainMinter`](https://docs.virtuswap.io/virtuswap-documentation/technical-reference/smart-contracts-v1/tokenomics-contracts/vchainminter) contracts on each supported network. The distribution between networks is decided by the DAO.

✏️ In v1, cross-chain communication is not implemented in VirtuSwap contracts, so the transfers between chains will be done manually by the designated DAO wallet.

✏️Can only be called by the owner

### Read-Only Functions

#### function getAllVestingWallets

```solidity
function getAllVestingWallets()
        external
        view
        override
returns (address[] memory) 
```

Returns an array of VVestingWallet instances

#### function unlockedBalance

```solidity
function unlockedBalance() public view returns (uint256)
```

Retuns the total amount of unlocked VRSW tokens.
