ERC20
This contract is an ERC20 token.
Name
STAKE
Symbol
STAKE
Decimals
18
Total Supply
8,642,506 STAKE
About link description
xDai (STAKE) is a cryptocurrency and operates on the Ethereum platform. xDai has a current supply of 8,382,505.79789401 with 5,931,767.74222667 in circulation. The last known price of xDai is 6.83034808 USD and is down -2.44 over the last 24 hours. It is currently trading on 23 active market(s) with $881,553.20 traded over the last 24 hours. More information can be found at http://xdaichain.com/.
Stats
Public Functions
27
Event Types
8
Code Size
43,915 bytes
Events (8) keyboard_arrow_up
Constants (4) keyboard_arrow_up
PERMIT_TYPEHASH Constant
bytes32 help
0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb
State Variables (15) keyboard_arrow_up
Functions
name keyboard_arrow_up
symbol keyboard_arrow_up
decimals keyboard_arrow_up
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Source Code
function transfer(address _to, uint256 _value) public returns (bool) {
_superTransfer(_to, _value);
_callAfterTransfer(msg.sender, _to, _value);
return true;
}
allowance keyboard_arrow_up
approve keyboard_arrow_up
Requirements help
Source Code
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
transferFrom keyboard_arrow_up
Source Code
function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool) {
_superTransferFrom(_from, _to, _value);
_callAfterTransfer(_from, _to, _value);
return true;
}
increaseAllowance keyboard_arrow_up
Requirements help
Source Code
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
_approve(
msg.sender,
spender,
_allowances[msg.sender][spender].add(addedValue)
);
return true;
}
decreaseAllowance keyboard_arrow_up
Requirements help
Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
_approve(
msg.sender,
spender,
_allowances[msg.sender][spender].sub(subtractedValue)
);
return true;
}
push keyboard_arrow_up
Requirements help
Source Code
function push(address _to, uint256 _amount) public {
transferFrom(msg.sender, _to, _amount);
}
pull keyboard_arrow_up
Requirements help
Source Code
function pull(address _from, uint256 _amount) public {
transferFrom(_from, msg.sender, _amount);
}
move keyboard_arrow_up
Requirements help
Source Code
function move(
address _from,
address _to,
uint256 _amount
) public {
transferFrom(_from, _to, _amount);
}
permit keyboard_arrow_up
Parameters help
Requirements help
Source Code
function permit(
address _holder,
address _spender,
uint256 _nonce,
uint256 _expiry,
bool _allowed,
uint8 _v,
bytes32 _r,
bytes32 _s
) external {
require(_expiry == 0 || _now() <= _expiry, "invalid expiry");
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(
abi.encode(
PERMIT_TYPEHASH,
_holder,
_spender,
_nonce,
_expiry,
_allowed
)
)
)
);
require(
_holder == ecrecover(digest, _v, _r, _s),
"invalid signature or parameters"
);
require(_nonce == nonces[_holder]++, "invalid nonce");
uint256 amount = _allowed ? uint256(-1) : 0;
_approve(_holder, _spender, amount);
expirations[_holder][_spender] = _allowed ? _expiry : 0;
}
owner keyboard_arrow_up
isOwner keyboard_arrow_up
renounceOwnership keyboard_arrow_up
transferOwnership keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
Source Code
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
isBridge keyboard_arrow_up
transferAndCall keyboard_arrow_up
Modifiers help
Source Code
function transferAndCall(
address _to,
uint256 _value,
bytes calldata _data
) external validRecipient(_to) returns (bool) {
_superTransfer(_to, _value);
emit Transfer(msg.sender, _to, _value, _data);
if (_to.isContract()) {
require(
_contractFallback(msg.sender, _to, _value, _data),
"contract call failed"
);
}
return true;
}
transferDistribution keyboard_arrow_up
Requirements help
One or more of the following:
-
advisorsRewardDistributionAddress
must be equal to
the sender's address
- OR
privateOfferingDistributionAddress
must be equal to
the sender's address
- OR
distributionAddress
must be equal to
the sender's address
success must be true
Source Code
function transferDistribution(address _to, uint256 _value)
public
returns (bool)
{
require(
msg.sender == distributionAddress ||
msg.sender == privateOfferingDistributionAddress ||
msg.sender == advisorsRewardDistributionAddress,
"wrong sender"
);
_superTransfer(_to, _value);
return true;
}
claimTokens keyboard_arrow_up
Modifiers help
Source Code
function claimTokens(address _token, address payable _to)
public
onlyOwner
validRecipient(_to)
{
if (_token == address(0)) {
uint256 value = address(this).balance;
if (!_to.send(value)) {
// solium-disable-line security/no-send
// We use the `Sacrifice` trick to be sure the coins can be 100% sent to the receiver.
// Otherwise, if the receiver is a contract which has a revert in its fallback function,
// the sending will fail.
(new Sacrifice).value(value)(_to);
}
} else {
ERC20 token = ERC20(_token);
uint256 balance = token.balanceOf(address(this));
token.safeTransfer(_to, balance);
}
}
mint keyboard_arrow_up
Modifiers help
onlyBridge checks for the following:
null
Source Code
function mint(address _account, uint256 _amount)
external
onlyBridge
returns (bool)
{
_mint(_account, _amount);
emit Mint(_account, _amount);
return true;
}
addBridge keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
Requirements help
Source Code
function addBridge(address _bridge) external onlyOwner {
require(
bridgeCount < MAX_BRIDGES,
"can't add one more bridge due to a limit"
);
require(_bridge.isContract(), "not a contract address");
require(!isBridge(_bridge), "bridge already exists");
address firstBridge = bridgePointers[F_ADDR];
require(firstBridge != address(0), "first bridge is zero address");
bridgePointers[F_ADDR] = _bridge;
bridgePointers[_bridge] = firstBridge;
bridgeCount = bridgeCount.add(1);
emit BridgeAdded(_bridge);
}
removeBridge keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
Source Code
function removeBridge(address _bridge) external onlyOwner {
require(isBridge(_bridge), "bridge isn't existed");
address nextBridge = bridgePointers[_bridge];
address index = F_ADDR;
address next = bridgePointers[index];
require(next != address(0), "zero address found");
while (next != _bridge) {
index = next;
next = bridgePointers[index];
require(next != F_ADDR && next != address(0), "invalid address found");
}
bridgePointers[index] = nextBridge;
delete bridgePointers[_bridge];
bridgeCount = bridgeCount.sub(1);
emit BridgeRemoved(_bridge);
}
bridgeList keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
Source Code
function bridgeList() external view returns (address[] memory) {
address[] memory list = new address[](bridgeCount);
uint256 counter = 0;
address nextBridge = bridgePointers[F_ADDR];
require(nextBridge != address(0), "zero address found");
while (nextBridge != F_ADDR) {
list[counter] = nextBridge;
nextBridge = bridgePointers[nextBridge];
counter++;
require(nextBridge != address(0), "zero address found");
}
return list;
}
Internal Functions
Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.
internal ERC677BridgeToken._superTransfer keyboard_arrow_up
Source Code
function _superTransfer(address _to, uint256 _value) internal {
bool success;
if (
msg.sender == distributionAddress ||
msg.sender == privateOfferingDistributionAddress ||
msg.sender == advisorsRewardDistributionAddress
) {
// Allow sending tokens to `address(0)` by
// Distribution, PrivateOffering, or AdvisorsReward contract
_balances[msg.sender] = _balances[msg.sender].sub(_value);
_balances[_to] = _balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
success = true;
} else {
success = super.transfer(_to, _value);
}
require(success, "transfer failed");
}
internal ERC677BridgeToken._superTransferFrom keyboard_arrow_up
Source Code
function _superTransferFrom(
address _from,
address _to,
uint256 _value
) internal {
bool success = super.transferFrom(_from, _to, _value);
require(success, "transfer failed");
}
internal ERC677BridgeToken._callAfterTransfer keyboard_arrow_up
Source Code
function _callAfterTransfer(
address _from,
address _to,
uint256 _value
) internal {
if (
_to.isContract() && !_contractFallback(_from, _to, _value, new bytes(0))
) {
require(!isBridge(_to), "you can't transfer to bridge contract");
require(
_to != distributionAddress,
"you can't transfer to Distribution contract"
);
require(
_to != privateOfferingDistributionAddress,
"you can't transfer to PrivateOffering contract"
);
require(
_to != advisorsRewardDistributionAddress,
"you can't transfer to AdvisorsReward contract"
);
emit ContractFallbackCallFailed(_from, _to, _value);
}
}
internal ERC677BridgeToken._contractFallback keyboard_arrow_up
Source Code
function _contractFallback(
address _from,
address _to,
uint256 _value,
bytes memory _data
) private returns (bool) {
string memory signature = "onTokenTransfer(address,uint256,bytes)";
// solium-disable-next-line security/no-low-level-calls
(bool success, ) = _to.call(
abi.encodeWithSignature(signature, _from, _value, _data)
);
return success;
}
internal Ownable.constructor keyboard_arrow_up
internal Ownable._transferOwnership keyboard_arrow_up
Source Code
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
internal ERC20Permittable._now keyboard_arrow_up
internal ERC20._transfer keyboard_arrow_up
Requirements help
Source Code
function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
internal ERC20._mint keyboard_arrow_up
Source Code
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
internal ERC20._burn keyboard_arrow_up
Source Code
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
internal ERC20._approve keyboard_arrow_up
Requirements help
Source Code
function _approve(
address owner,
address spender,
uint256 value
) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
internal ERC20._burnFrom keyboard_arrow_up
Requirements help
Source Code
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}