xWin Token

SafeMath

add

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

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

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

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

Counterpart to Solidity's * operator.

Requirements:

  • Multiplication cannot overflow._

div

_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

_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

_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

_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

sqrt

Address

isContract

_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

_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

_Performs a Solidity function call using a low level call. A plaincall 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

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

Available since v3.1._

functionCallWithValue

_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

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

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

Set

AddressSet

add

_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

_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

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

length

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

at

_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

add

_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

_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

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

length

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

at

_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

_msgSender

_msgData

AccessControl

RoleData

DEFAULT_ADMIN_ROLE

RoleAdminChanged

_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

_Emitted when account is granted role.

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

RoleRevoked

_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

Returns true if account has been granted role.

getRoleMemberCount

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

getRoleMember

_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

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

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

grantRole

_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

_Revokes role from account.

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

Requirements:

  • the caller must have role's admin role._

renounceRole

_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

_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

_Sets adminRole as role's admin role.

Emits a {RoleAdminChanged} event._

AdminAccessRoles

MINT_ROLE

constructor

Add root to the admin role as a member.

onlyAdmin

Restricted to members of the admin role.

onlyMintUser

Restricted to members of the user role.

isAdmin

Return true if the account belongs to the admin role.

isMintUser

Return true if the account belongs to the user role.

addMintUser

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

addAdmin

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

removeMintUser

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

renounceAdmin

Remove oneself from the admin role.

IBEP20

totalSupply

Returns the amount of tokens in existence.

decimals

Returns the token decimals.

symbol

Returns the token symbol.

name

Returns the token name.

getOwner

Returns the bep token owner.

balanceOf

Returns the amount of tokens owned by account.

transfer

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

Returns a boolean value indicating whether the operation succeeded.

Emits a {Transfer} event._

allowance

_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

_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

_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

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

Note that value may be zero._

Approval

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

Ownable

OwnershipTransferred

constructor

Initializes the contract setting the deployer as the initial owner.

owner

Returns the address of the current owner.

onlyOwner

Throws if called by any account other than the owner.

renounceOwnership

_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

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

_transferOwnership

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

BEP20

constructor

_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

Returns the bep token owner.

name

Returns the token name.

decimals

Returns the token decimals.

symbol

Returns the token symbol.

totalSupply

See {BEP20-totalSupply}.

balanceOf

See {BEP20-balanceOf}.

transfer

_See {BEP20-transfer}.

Requirements:

  • recipient cannot be the zero address.

  • the caller must have a balance of at least amount._

allowance

See {BEP20-allowance}.

approve

_See {BEP20-approve}.

Requirements:

  • spender cannot be the zero address._

transferFrom

_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

_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

_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

_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

_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

_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

_Sets amount as the allowance of spender over the owners 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

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

See {_burn} and {approve}.

_beforeTokenTransfer

_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

mint

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

isCapReach

maxCap

_delegates

Checkpoint

checkpoints

A record of votes checkpoints for each account, by index

numCheckpoints

The number of checkpoints for each account

DOMAIN_TYPEHASH

The EIP-712 typehash for the contract's domain

DELEGATION_TYPEHASH

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

nonces

A record of states for signing / validating signatures

DelegateChanged

An event thats emitted when an account changes its delegate

DelegateVotesChanged

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

delegates

Delegate votes from msg.sender to delegatee

Parameters

Name
Type
Description

delegator

address

The address to get delegatee for

delegate

Delegate votes from msg.sender to delegatee

Parameters

Name
Type
Description

delegatee

address

The address to delegate votes to

delegateBySig

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

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

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

_moveDelegates

_writeCheckpoint

safe32

getChainId

Last updated