# xWin Token

### SafeMath

#### add

```solidity
function add(uint256 a, uint256 b) internal pure returns (uint256)
```

\_Returns the addition of two unsigned integers, reverting on overflow.

Counterpart to Solidity's `+` operator.

Requirements:

* Addition cannot overflow.\_

#### sub

```solidity
function sub(uint256 a, uint256 b) internal pure returns (uint256)
```

\_Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative).

Counterpart to Solidity's `-` operator.

Requirements:

* Subtraction cannot overflow.\_

#### sub

```solidity
function sub(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)
```

\_Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative).

Counterpart to Solidity's `-` operator.

Requirements:

* Subtraction cannot overflow.\_

#### mul

```solidity
function mul(uint256 a, uint256 b) internal pure returns (uint256)
```

\_Returns the multiplication of two unsigned integers, reverting on overflow.

Counterpart to Solidity's `*` operator.

Requirements:

* Multiplication cannot overflow.\_

#### div

```solidity
function div(uint256 a, uint256 b) internal pure returns (uint256)
```

\_Returns the integer division of two unsigned integers. Reverts on division by zero. The result is rounded towards zero.

Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements:

* The divisor cannot be zero.\_

#### div

```solidity
function div(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)
```

\_Returns the integer division of two unsigned integers. Reverts with custom message on division by zero. The result is rounded towards zero.

Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements:

* The divisor cannot be zero.\_

#### mod

```solidity
function mod(uint256 a, uint256 b) internal pure returns (uint256)
```

\_Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero.

Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements:

* The divisor cannot be zero.\_

#### mod

```solidity
function mod(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)
```

\_Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero.

Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements:

* The divisor cannot be zero.\_

#### min

```solidity
function min(uint256 x, uint256 y) internal pure returns (uint256 z)
```

#### sqrt

```solidity
function sqrt(uint256 y) internal pure returns (uint256 z)
```

### Address

#### isContract

```solidity
function isContract(address account) internal view returns (bool)
```

\_Returns true if `account` is a contract.

## \[IMPORTANT]

It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract.

Among others, `isContract` will return false for the following types of addresses:

* an externally-owned account
* a contract in construction
* an address where a contract will be created
* an address where a contract lived, but was destroyed ====\_

#### sendValue

```solidity
function sendValue(address payable recipient, uint256 amount) internal
```

\_Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors.

<https://eips.ethereum.org/EIPS/eip-1884\\[EIP1884>] increases the gas cost of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation.

<https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/\\[Learn> more].

IMPORTANT: because control is transferred to `recipient`, care must be taken to not create reentrancy vulnerabilities. Consider using {ReentrancyGuard} or the <https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern\\[checks-effects-interactions> pattern].\_

#### functionCall

```solidity
function functionCall(address target, bytes data) internal returns (bytes)
```

\_Performs a Solidity function call using a low level `call`. A plain`call` is an unsafe replacement for a function call: use this function instead.

If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls).

Returns the raw returned data. To convert to the expected return value, use <https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions\\[`abi.decode`>].

Requirements:

* `target` must be a contract.
* calling `target` with `data` must not revert.

*Available since v3.1.*\_

#### functionCall

```solidity
function functionCall(address target, bytes data, string errorMessage) internal returns (bytes)
```

\_Same as {xref-Address-functionCall-address-bytes-}\[`functionCall`], but with `errorMessage` as a fallback revert reason when `target` reverts.

*Available since v3.1.*\_

#### functionCallWithValue

```solidity
function functionCallWithValue(address target, bytes data, uint256 value) internal returns (bytes)
```

\_Same as {xref-Address-functionCall-address-bytes-}\[`functionCall`], but also transferring `value` wei to `target`.

Requirements:

* the calling contract must have an ETH balance of at least `value`.
* the called Solidity function must be `payable`.

*Available since v3.1.*\_

#### functionCallWithValue

```solidity
function functionCallWithValue(address target, bytes data, uint256 value, string errorMessage) internal returns (bytes)
```

\_Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}\[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts.

*Available since v3.1.*\_

### EnumerableSet

\_Library for managing <https://en.wikipedia.org/wiki/Set_(abstract\\_data\\_type)\\[sets>] of primitive types.

Sets have the following properties:

* Elements are added, removed, and checked for existence in constant time (O(1)).
* Elements are enumerated in O(n). No guarantees are made on the ordering.

```
contract Example {
    // Add the library methods
    using EnumerableSet for EnumerableSet.AddressSet;

    // Declare a set state variable
    EnumerableSet.AddressSet private mySet;
}
```

As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` (`UintSet`) are supported.\_

#### Set

```solidity
struct Set {
  bytes32[] _values;
  mapping(bytes32 => uint256) _indexes;
}
```

#### AddressSet

```solidity
struct AddressSet {
  struct EnumerableSet.Set _inner;
}
```

#### add

```solidity
function add(struct EnumerableSet.AddressSet set, address value) internal returns (bool)
```

\_Add a value to a set. O(1).

Returns true if the value was added to the set, that is if it was not already present.\_

#### remove

```solidity
function remove(struct EnumerableSet.AddressSet set, address value) internal returns (bool)
```

\_Removes a value from a set. O(1).

Returns true if the value was removed from the set, that is if it was present.\_

#### contains

```solidity
function contains(struct EnumerableSet.AddressSet set, address value) internal view returns (bool)
```

*Returns true if the value is in the set. O(1).*

#### length

```solidity
function length(struct EnumerableSet.AddressSet set) internal view returns (uint256)
```

*Returns the number of values in the set. O(1).*

#### at

```solidity
function at(struct EnumerableSet.AddressSet set, uint256 index) internal view returns (address)
```

\_Returns the value stored at position `index` in the set. O(1).

Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed.

Requirements:

* `index` must be strictly less than {length}.\_

#### UintSet

```solidity
struct UintSet {
  struct EnumerableSet.Set _inner;
}
```

#### add

```solidity
function add(struct EnumerableSet.UintSet set, uint256 value) internal returns (bool)
```

\_Add a value to a set. O(1).

Returns true if the value was added to the set, that is if it was not already present.\_

#### remove

```solidity
function remove(struct EnumerableSet.UintSet set, uint256 value) internal returns (bool)
```

\_Removes a value from a set. O(1).

Returns true if the value was removed from the set, that is if it was present.\_

#### contains

```solidity
function contains(struct EnumerableSet.UintSet set, uint256 value) internal view returns (bool)
```

*Returns true if the value is in the set. O(1).*

#### length

```solidity
function length(struct EnumerableSet.UintSet set) internal view returns (uint256)
```

*Returns the number of values on the set. O(1).*

#### at

```solidity
function at(struct EnumerableSet.UintSet set, uint256 index) internal view returns (uint256)
```

\_Returns the value stored at position `index` in the set. O(1).

Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed.

Requirements:

* `index` must be strictly less than {length}.\_

### Context

#### constructor

```solidity
constructor() internal
```

#### \_msgSender

```solidity
function _msgSender() internal view returns (address payable)
```

#### \_msgData

```solidity
function _msgData() internal view returns (bytes)
```

### AccessControl

#### RoleData

```solidity
struct RoleData {
  struct EnumerableSet.AddressSet members;
  bytes32 adminRole;
}
```

#### DEFAULT\_ADMIN\_ROLE

```solidity
bytes32 DEFAULT_ADMIN_ROLE
```

#### RoleAdminChanged

```solidity
event RoleAdminChanged(bytes32 role, bytes32 previousAdminRole, bytes32 newAdminRole)
```

\_Emitted when `newAdminRole` is set as `role`'s admin role, replacing `previousAdminRole`

`DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.

*Available since v3.1.*\_

#### RoleGranted

```solidity
event RoleGranted(bytes32 role, address account, address sender)
```

\_Emitted when `account` is granted `role`.

`sender` is the account that originated the contract call, an admin role bearer except when using {*setupRole}.*

#### RoleRevoked

```solidity
event RoleRevoked(bytes32 role, address account, address sender)
```

\_Emitted when `account` is revoked `role`.

`sender` is the account that originated the contract call:

* if using `revokeRole`, it is the admin role bearer
* if using `renounceRole`, it is the role bearer (i.e. `account`)\_

#### hasRole

```solidity
function hasRole(bytes32 role, address account) public view returns (bool)
```

*Returns `true` if `account` has been granted `role`.*

#### getRoleMemberCount

```solidity
function getRoleMemberCount(bytes32 role) public view returns (uint256)
```

*Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.*

#### getRoleMember

```solidity
function getRoleMember(bytes32 role, uint256 index) public view returns (address)
```

\_Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive.

Role bearers are not sorted in any particular way, and their ordering may change at any point.

WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following <https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296\\[forum> post] for more information.\_

#### getRoleAdmin

```solidity
function getRoleAdmin(bytes32 role) public view returns (bytes32)
```

\_Returns the admin role that controls `role`. See {grantRole} and {revokeRole}.

To change a role's admin, use {*setRoleAdmin}.*

#### grantRole

```solidity
function grantRole(bytes32 role, address account) public virtual
```

\_Grants `role` to `account`.

If `account` had not been already granted `role`, emits a {RoleGranted} event.

Requirements:

* the caller must have `role`'s admin role.\_

#### revokeRole

```solidity
function revokeRole(bytes32 role, address account) public virtual
```

\_Revokes `role` from `account`.

If `account` had been granted `role`, emits a {RoleRevoked} event.

Requirements:

* the caller must have `role`'s admin role.\_

#### renounceRole

```solidity
function renounceRole(bytes32 role, address account) public virtual
```

\_Revokes `role` from the calling account.

Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced).

If the calling account had been granted `role`, emits a {RoleRevoked} event.

Requirements:

* the caller must be `account`.\_

#### \_setupRole

```solidity
function _setupRole(bytes32 role, address account) internal virtual
```

\_Grants `role` to `account`.

If `account` had not been already granted `role`, emits a {RoleGranted} event. Note that unlike {grantRole}, this function doesn't perform any checks on the calling account.

## \[WARNING]

This function should only be called from the constructor when setting up the initial roles for the system.

Using this function in any other way is effectively circumventing the admin system imposed by {AccessControl}. ====\_

#### \_setRoleAdmin

```solidity
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual
```

\_Sets `adminRole` as `role`'s admin role.

Emits a {RoleAdminChanged} event.\_

### AdminAccessRoles

#### MINT\_ROLE

```solidity
bytes32 MINT_ROLE
```

#### constructor

```solidity
constructor(address root) public
```

*Add `root` to the admin role as a member.*

#### onlyAdmin

```solidity
modifier onlyAdmin()
```

*Restricted to members of the admin role.*

#### onlyMintUser

```solidity
modifier onlyMintUser()
```

*Restricted to members of the user role.*

#### isAdmin

```solidity
function isAdmin(address account) public view virtual returns (bool)
```

*Return `true` if the account belongs to the admin role.*

#### isMintUser

```solidity
function isMintUser(address account) public view virtual returns (bool)
```

*Return `true` if the account belongs to the user role.*

#### addMintUser

```solidity
function addMintUser(address account) public virtual
```

*Add an account to the user role. Restricted to admins.*

#### addAdmin

```solidity
function addAdmin(address account) public virtual
```

*Add an account to the admin role. Restricted to admins.*

#### removeMintUser

```solidity
function removeMintUser(address account) public virtual
```

*Remove an account from the user role. Restricted to admins.*

#### renounceAdmin

```solidity
function renounceAdmin() public virtual
```

*Remove oneself from the admin role.*

### IBEP20

#### totalSupply

```solidity
function totalSupply() external view returns (uint256)
```

*Returns the amount of tokens in existence.*

#### decimals

```solidity
function decimals() external view returns (uint8)
```

*Returns the token decimals.*

#### symbol

```solidity
function symbol() external view returns (string)
```

*Returns the token symbol.*

#### name

```solidity
function name() external view returns (string)
```

*Returns the token name.*

#### getOwner

```solidity
function getOwner() external view returns (address)
```

*Returns the bep token owner.*

#### balanceOf

```solidity
function balanceOf(address account) external view returns (uint256)
```

*Returns the amount of tokens owned by `account`.*

#### transfer

```solidity
function transfer(address recipient, uint256 amount) external returns (bool)
```

\_Moves `amount` tokens from the caller's account to `recipient`.

Returns a boolean value indicating whether the operation succeeded.

Emits a {Transfer} event.\_

#### allowance

```solidity
function allowance(address _owner, address spender) external view returns (uint256)
```

\_Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default.

This value changes when {approve} or {transferFrom} are called.\_

#### approve

```solidity
function approve(address spender, uint256 amount) external returns (bool)
```

\_Sets `amount` as the allowance of `spender` over the caller's tokens.

Returns a boolean value indicating whether the operation succeeded.

IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: <https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729>

Emits an {Approval} event.\_

#### transferFrom

```solidity
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool)
```

\_Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance.

Returns a boolean value indicating whether the operation succeeded.

Emits a {Transfer} event.\_

#### Transfer

```solidity
event Transfer(address from, address to, uint256 value)
```

\_Emitted when `value` tokens are moved from one account (`from`) to another (`to`).

Note that `value` may be zero.\_

#### Approval

```solidity
event Approval(address owner, address spender, uint256 value)
```

*Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.*

### Ownable

#### OwnershipTransferred

```solidity
event OwnershipTransferred(address previousOwner, address newOwner)
```

#### constructor

```solidity
constructor() internal
```

*Initializes the contract setting the deployer as the initial owner.*

#### owner

```solidity
function owner() public view returns (address)
```

*Returns the address of the current owner.*

#### onlyOwner

```solidity
modifier onlyOwner()
```

*Throws if called by any account other than the owner.*

#### renounceOwnership

```solidity
function renounceOwnership() public
```

\_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.\_

#### transferOwnership

```solidity
function transferOwnership(address newOwner) public
```

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

#### \_transferOwnership

```solidity
function _transferOwnership(address newOwner) internal
```

*Transfers ownership of the contract to a new account (`newOwner`).*

### BEP20

#### constructor

```solidity
constructor(string name, string symbol) public
```

\_Sets the values for {name} and {symbol}, initializes {decimals} with a default value of 18.

To select a different value for {decimals}, use {\_setupDecimals}.

All three of these values are immutable: they can only be set once during construction.\_

#### getOwner

```solidity
function getOwner() external view returns (address)
```

*Returns the bep token owner.*

#### name

```solidity
function name() public view returns (string)
```

*Returns the token name.*

#### decimals

```solidity
function decimals() public view returns (uint8)
```

*Returns the token decimals.*

#### symbol

```solidity
function symbol() public view returns (string)
```

*Returns the token symbol.*

#### totalSupply

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

*See {BEP20-totalSupply}.*

#### balanceOf

```solidity
function balanceOf(address account) public view returns (uint256)
```

*See {BEP20-balanceOf}.*

#### transfer

```solidity
function transfer(address recipient, uint256 amount) public returns (bool)
```

\_See {BEP20-transfer}.

Requirements:

* `recipient` cannot be the zero address.
* the caller must have a balance of at least `amount`.\_

#### allowance

```solidity
function allowance(address owner, address spender) public view returns (uint256)
```

*See {BEP20-allowance}.*

#### approve

```solidity
function approve(address spender, uint256 amount) public returns (bool)
```

\_See {BEP20-approve}.

Requirements:

* `spender` cannot be the zero address.\_

#### transferFrom

```solidity
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool)
```

\_See {BEP20-transferFrom}.

Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {BEP20};

Requirements:

* `sender` and `recipient` cannot be the zero address.
* `sender` must have a balance of at least `amount`.
* the caller must have allowance for `sender`'s tokens of at least `amount`.\_

#### increaseAllowance

```solidity
function increaseAllowance(address spender, uint256 addedValue) public returns (bool)
```

\_Atomically increases the allowance granted to `spender` by the caller.

This is an alternative to {approve} that can be used as a mitigation for problems described in {BEP20-approve}.

Emits an {Approval} event indicating the updated allowance.

Requirements:

* `spender` cannot be the zero address.\_

#### decreaseAllowance

```solidity
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool)
```

\_Atomically decreases the allowance granted to `spender` by the caller.

This is an alternative to {approve} that can be used as a mitigation for problems described in {BEP20-approve}.

Emits an {Approval} event indicating the updated allowance.

Requirements:

* `spender` cannot be the zero address.
* `spender` must have allowance for the caller of at least `subtractedValue`.\_

#### \_transfer

```solidity
function _transfer(address sender, address recipient, uint256 amount) internal
```

\_Moves tokens `amount` from `sender` to `recipient`.

This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc.

Emits a {Transfer} event.

Requirements:

* `sender` cannot be the zero address.
* `recipient` cannot be the zero address.
* `sender` must have a balance of at least `amount`.\_

#### \_mint

```solidity
function _mint(address account, uint256 amount) internal
```

\_Creates `amount` tokens and assigns them to `account`, increasing the total supply.

Emits a {Transfer} event with `from` set to the zero address.

Requirements

* `to` cannot be the zero address.\_

#### \_burn

```solidity
function _burn(address account, uint256 amount) internal
```

\_Destroys `amount` tokens from `account`, reducing the total supply.

Emits a {Transfer} event with `to` set to the zero address.

Requirements

* `account` cannot be the zero address.
* `account` must have at least `amount` tokens.\_

#### \_approve

```solidity
function _approve(address owner, address spender, uint256 amount) internal
```

\_Sets `amount` as the allowance of `spender` over the `owner`s tokens.

This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc.

Emits an {Approval} event.

Requirements:

* `owner` cannot be the zero address.
* `spender` cannot be the zero address.\_

#### \_burnFrom

```solidity
function _burnFrom(address account, uint256 amount) internal
```

\_Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance.

See {\_burn} and {*approve}.*

#### \_beforeTokenTransfer

```solidity
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual
```

\_Hook that is called before any transfer of tokens. This includes minting and burning.

Calling conditions:

* when `from` and `to` are both non-zero, `amount` of `from`'s tokens will be to transferred to `to`.
* when `from` is zero, `amount` tokens will be minted for `to`.
* when `to` is zero, `amount` of `from`'s tokens will be burned.
* `from` and `to` are never both zero.

To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks\[Using Hooks].\_

### XWINToken

#### constructor

```solidity
constructor(uint256 cap_) public
```

#### mint

```solidity
function mint(address _to, uint256 _amount) external
```

Creates `_amount` token to `_to`. Must only be called by the owner (admin).

#### isCapReach

```solidity
function isCapReach() external view returns (bool)
```

#### maxCap

```solidity
function maxCap() external view returns (uint256)
```

#### \_delegates

```solidity
mapping(address => address) _delegates
```

#### Checkpoint

```solidity
struct Checkpoint {
  uint32 fromBlock;
  uint256 votes;
}
```

#### checkpoints

```solidity
mapping(address => mapping(uint32 => struct XWINToken.Checkpoint)) checkpoints
```

A record of votes checkpoints for each account, by index

#### numCheckpoints

```solidity
mapping(address => uint32) numCheckpoints
```

The number of checkpoints for each account

#### DOMAIN\_TYPEHASH

```solidity
bytes32 DOMAIN_TYPEHASH
```

The EIP-712 typehash for the contract's domain

#### DELEGATION\_TYPEHASH

```solidity
bytes32 DELEGATION_TYPEHASH
```

The EIP-712 typehash for the delegation struct used by the contract

#### nonces

```solidity
mapping(address => uint256) nonces
```

A record of states for signing / validating signatures

#### DelegateChanged

```solidity
event DelegateChanged(address delegator, address fromDelegate, address toDelegate)
```

An event thats emitted when an account changes its delegate

#### DelegateVotesChanged

```solidity
event DelegateVotesChanged(address delegate, uint256 previousBalance, uint256 newBalance)
```

An event thats emitted when a delegate account's vote balance changes

#### delegates

```solidity
function delegates(address delegator) external view returns (address)
```

Delegate votes from `msg.sender` to `delegatee`

**Parameters**

| Name      | Type    | Description                      |
| --------- | ------- | -------------------------------- |
| delegator | address | The address to get delegatee for |

#### delegate

```solidity
function delegate(address delegatee) external
```

Delegate votes from `msg.sender` to `delegatee`

**Parameters**

| Name      | Type    | Description                      |
| --------- | ------- | -------------------------------- |
| delegatee | address | The address to delegate votes to |

#### delegateBySig

```solidity
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external
```

Delegates votes from signatory to `delegatee`

**Parameters**

| Name      | Type    | Description                                        |
| --------- | ------- | -------------------------------------------------- |
| delegatee | address | The address to delegate votes to                   |
| nonce     | uint256 | The contract state required to match the signature |
| expiry    | uint256 | The time at which to expire the signature          |
| v         | uint8   | The recovery byte of the signature                 |
| r         | bytes32 | Half of the ECDSA signature pair                   |
| s         | bytes32 | Half of the ECDSA signature pair                   |

#### getCurrentVotes

```solidity
function getCurrentVotes(address account) external view returns (uint256)
```

Gets the current votes balance for `account`

**Parameters**

| Name    | Type    | Description                      |
| ------- | ------- | -------------------------------- |
| account | address | The address to get votes balance |

**Return Values**

| Name | Type    | Description                               |
| ---- | ------- | ----------------------------------------- |
| \[0] | uint256 | The number of current votes for `account` |

#### getPriorVotes

```solidity
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256)
```

Determine the prior number of votes for an account as of a block number

*Block number must be a finalized block or else this function will revert to prevent misinformation.*

**Parameters**

| Name        | Type    | Description                                 |
| ----------- | ------- | ------------------------------------------- |
| account     | address | The address of the account to check         |
| blockNumber | uint256 | The block number to get the vote balance at |

**Return Values**

| Name | Type    | Description                                               |
| ---- | ------- | --------------------------------------------------------- |
| \[0] | uint256 | The number of votes the account had as of the given block |

#### \_delegate

```solidity
function _delegate(address delegator, address delegatee) internal
```

#### \_moveDelegates

```solidity
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal
```

#### \_writeCheckpoint

```solidity
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes) internal
```

#### safe32

```solidity
function safe32(uint256 n, string errorMessage) internal pure returns (uint32)
```

#### getChainId

```solidity
function getChainId() internal pure returns (uint256)
```
