contract_name
stringlengths 1
61
| file_path
stringlengths 5
50.4k
| contract_address
stringlengths 42
42
| language
stringclasses 1
value | class_name
stringlengths 1
61
| class_code
stringlengths 4
330k
| class_documentation
stringlengths 0
29.1k
| class_documentation_type
stringclasses 6
values | func_name
stringlengths 0
62
| func_code
stringlengths 1
303k
| func_documentation
stringlengths 2
14.9k
| func_documentation_type
stringclasses 4
values | compiler_version
stringlengths 15
42
| license_type
stringclasses 14
values | swarm_source
stringlengths 0
71
| meta
dict | __index_level_0__
int64 0
60.4k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Metafam721 | contracts/MetaFam721.sol | 0xb53e9ff3cca6343ff7ede9414921fef19ef01c5e | Solidity | Metafam721 | contract Metafam721 is ERC721Enumerable, Ownable {
using Counters for Counters.Counter;
using Strings for uint256;
string public baseURI;
string public notRevealedUri;
//Counters
Counters.Counter internal _airdrops;
//Inventory
uint16 public maxMintAmountPerTransaction = 10;
uint16 public maxMintAmountPerWallet = 10;
uint256 public maxSupply = 5000;
//Prices
uint256 public cost = 0.06 ether;
//Utility
bool public paused = false;
bool public revealed = false;
constructor(string memory _baseUrl, string memory _notRevealedUrl)
ERC721("METAFAM", "MTFM")
{
baseURI = _baseUrl;
notRevealedUri = _notRevealedUrl;
}
// public
function mint(uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
if (msg.sender != owner()) {
uint256 ownerTokenCount = balanceOf(msg.sender);
require(!paused);
require(_mintAmount > 0, "Mint amount should be greater than 1");
require(
_mintAmount <= maxMintAmountPerTransaction,
"Sorry you cant mint this amount at once"
);
require(supply + _mintAmount <= maxSupply, "Exceeds Max Supply");
require(
(ownerTokenCount + _mintAmount) <= maxMintAmountPerWallet,
"Sorry you cant mint more"
);
require(msg.value >= cost * _mintAmount, "Insuffient funds");
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(msg.sender, supply + i);
}
}
function gift(address _to, uint256 _mintAmount) public onlyOwner {
for (uint256 i = 1; i <= _mintAmount; i++) {
uint256 supply = totalSupply();
_safeMint(_to, supply + i);
_airdrops.increment();
}
}
function totalAirdrops() public view returns (uint256) {
return _airdrops.current();
}
function airdrop(address[] memory _airdropAddresses) public onlyOwner {
for (uint256 i = 0; i < _airdropAddresses.length; i++) {
uint256 supply = totalSupply();
address to = _airdropAddresses[i];
_safeMint(to, supply + 1);
_airdrops.increment();
}
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function getTotalMints() public view returns (uint256) {
return totalSupply() - _airdrops.current();
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
if (revealed == false) {
return notRevealedUri;
} else {
string memory currentBaseURI = _baseURI();
return
bytes(currentBaseURI).length > 0
? string(
abi.encodePacked(currentBaseURI, tokenId.toString())
)
: "";
}
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}
function toggleReveal() public onlyOwner {
revealed = !revealed;
}
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
function setmaxMintAmountPerTransaction(uint16 _amount) public onlyOwner {
maxMintAmountPerTransaction = _amount;
}
function setMaxMintAmountPerWallet(uint16 _amount) public onlyOwner {
maxMintAmountPerWallet = _amount;
}
function setMaxSupply(uint256 _supply) public onlyOwner {
maxSupply = _supply;
}
function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner {
notRevealedUri = _notRevealedURI;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function togglePause() public onlyOwner {
paused = !paused;
}
function withdraw() public payable onlyOwner {
(bool os, ) = payable(owner()).call{value: address(this).balance}("");
require(os);
}
} | //import "hardhat/console.sol"; | LineComment | mint | function mint(uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
if (msg.sender != owner()) {
uint256 ownerTokenCount = balanceOf(msg.sender);
require(!paused);
require(_mintAmount > 0, "Mint amount should be greater than 1");
require(
_mintAmount <= maxMintAmountPerTransaction,
"Sorry you cant mint this amount at once"
);
require(supply + _mintAmount <= maxSupply, "Exceeds Max Supply");
require(
(ownerTokenCount + _mintAmount) <= maxMintAmountPerWallet,
"Sorry you cant mint more"
);
require(msg.value >= cost * _mintAmount, "Insuffient funds");
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(msg.sender, supply + i);
}
}
| // public | LineComment | v0.8.7+commit.e28d00a7 | {
"func_code_index": [
732,
1623
]
} | 1,000 |
||
NotifyHelper | contracts/NotifyHelper.sol | 0xeeae0c791d38e1e1fc9f7989d081c9fc290716dd | Solidity | NotifyHelper | contract NotifyHelper is Controllable {
constructor(address _storage)
Controllable(_storage) public {}
/**
* Notifies all the pools, safe guarding the notification amount.
*/
function notifyPools(uint256[] memory amounts, address[] memory pools) public onlyGovernance {
require(amounts.length == pools.length, "Amounts and pools lengths mismatch");
for (uint i = 0; i < pools.length; i++) {
require(amounts[i] > 0, "Notify zero");
NoMintRewardPool pool = NoMintRewardPool(pools[i]);
IERC20 token = IERC20(pool.rewardToken());
uint256 limit = token.balanceOf(pools[i]);
require(amounts[i] <= limit, "Notify limit hit");
NoMintRewardPool(pools[i]).notifyRewardAmount(amounts[i]);
}
}
} | notifyPools | function notifyPools(uint256[] memory amounts, address[] memory pools) public onlyGovernance {
require(amounts.length == pools.length, "Amounts and pools lengths mismatch");
for (uint i = 0; i < pools.length; i++) {
require(amounts[i] > 0, "Notify zero");
NoMintRewardPool pool = NoMintRewardPool(pools[i]);
IERC20 token = IERC20(pool.rewardToken());
uint256 limit = token.balanceOf(pools[i]);
require(amounts[i] <= limit, "Notify limit hit");
NoMintRewardPool(pools[i]).notifyRewardAmount(amounts[i]);
}
}
| /**
* Notifies all the pools, safe guarding the notification amount.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | MIT | bzzr://477a3332b348873ebd9c365e56a106de3d8a85633adcdf983bdffc53fa1abbe0 | {
"func_code_index": [
195,
764
]
} | 1,001 |
||
RealAssetDepositaryBalanceView | contracts/depositary/RealAssetDepositaryBalanceView.sol | 0xaa6945212acfceec06ae29d67efd21d4cb7d96e8 | Solidity | RealAssetDepositaryBalanceView | contract RealAssetDepositaryBalanceView is IDepositaryBalanceView, IUpdatable, AccessControl {
using SafeMath for uint256;
/// @notice Signed data of asset information.
struct Proof {
string data;
string signature;
}
/// @notice Asset information.
struct Asset {
string id;
uint256 amount;
uint256 price;
uint256 updatedBlockAt;
}
/// @notice The number of assets in depositary.
uint256 public maxSize;
/// @notice Decimals balance.
uint256 public override decimals = 6;
/// @notice Assets list.
Asset[] public portfolio;
/// @dev Assets list index.
mapping(string => uint256) internal portfolioIndex;
/// @notice An event thats emitted when asset updated in portfolio.
event AssetUpdated(string id, uint256 updatedAt, Proof proof);
/// @notice An event thats emitted when asset removed from portfolio.
event AssetRemoved(string id);
/**
* @param _decimals Decimals balance.
* @param _maxSize Max number assets in depositary.
*/
constructor(uint256 _decimals, uint256 _maxSize) public {
decimals = _decimals;
maxSize = _maxSize;
}
/**
* @return Assets count of depositary.
*/
function size() public view returns (uint256) {
return portfolio.length;
}
/**
* @return Assets list.
*/
function assets() external view returns (Asset[] memory) {
Asset[] memory result = new Asset[](size());
for (uint256 i = 0; i < size(); i++) {
result[i] = portfolio[i];
}
return result;
}
function lastUpdateBlockNumber() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = portfolio[i].updatedBlockAt > result ? portfolio[i].updatedBlockAt : result;
}
return result;
}
/**
* @notice Update information of asset.
* @param id Asset identificator.
* @param amount Amount of asset.
* @param price Cost of one asset in base currency.
* @param updatedAt Timestamp of updated.
* @param proofData Signed data.
* @param proofSignature Data signature.
*/
function put(
string calldata id,
uint256 amount,
uint256 price,
uint256 updatedAt,
string calldata proofData,
string calldata proofSignature
) external onlyAllowed {
require(size() < maxSize, "RealAssetDepositaryBalanceView::put: too many assets");
uint256 valueIndex = portfolioIndex[id];
if (valueIndex != 0) {
portfolio[valueIndex.sub(1)] = Asset(id, amount, price, block.number);
} else {
portfolio.push(Asset(id, amount, price, block.number));
portfolioIndex[id] = size();
}
emit AssetUpdated(id, updatedAt, Proof(proofData, proofSignature));
}
/**
* @notice Remove information of asset.
* @param id Asset identificator.
*/
function remove(string calldata id) external onlyAllowed {
uint256 valueIndex = portfolioIndex[id];
require(valueIndex != 0, "RealAssetDepositaryBalanceView::remove: asset already removed");
uint256 toDeleteIndex = valueIndex.sub(1);
uint256 lastIndex = size().sub(1);
Asset memory lastValue = portfolio[lastIndex];
portfolio[toDeleteIndex] = lastValue;
portfolioIndex[lastValue.id] = toDeleteIndex.add(1);
portfolio.pop();
delete portfolioIndex[id];
emit AssetRemoved(id);
}
function balance() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = result.add(portfolio[i].amount.mul(portfolio[i].price));
}
return result;
}
} | size | function size() public view returns (uint256) {
return portfolio.length;
}
| /**
* @return Assets count of depositary.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | {
"func_code_index": [
1267,
1357
]
} | 1,002 |
|||
RealAssetDepositaryBalanceView | contracts/depositary/RealAssetDepositaryBalanceView.sol | 0xaa6945212acfceec06ae29d67efd21d4cb7d96e8 | Solidity | RealAssetDepositaryBalanceView | contract RealAssetDepositaryBalanceView is IDepositaryBalanceView, IUpdatable, AccessControl {
using SafeMath for uint256;
/// @notice Signed data of asset information.
struct Proof {
string data;
string signature;
}
/// @notice Asset information.
struct Asset {
string id;
uint256 amount;
uint256 price;
uint256 updatedBlockAt;
}
/// @notice The number of assets in depositary.
uint256 public maxSize;
/// @notice Decimals balance.
uint256 public override decimals = 6;
/// @notice Assets list.
Asset[] public portfolio;
/// @dev Assets list index.
mapping(string => uint256) internal portfolioIndex;
/// @notice An event thats emitted when asset updated in portfolio.
event AssetUpdated(string id, uint256 updatedAt, Proof proof);
/// @notice An event thats emitted when asset removed from portfolio.
event AssetRemoved(string id);
/**
* @param _decimals Decimals balance.
* @param _maxSize Max number assets in depositary.
*/
constructor(uint256 _decimals, uint256 _maxSize) public {
decimals = _decimals;
maxSize = _maxSize;
}
/**
* @return Assets count of depositary.
*/
function size() public view returns (uint256) {
return portfolio.length;
}
/**
* @return Assets list.
*/
function assets() external view returns (Asset[] memory) {
Asset[] memory result = new Asset[](size());
for (uint256 i = 0; i < size(); i++) {
result[i] = portfolio[i];
}
return result;
}
function lastUpdateBlockNumber() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = portfolio[i].updatedBlockAt > result ? portfolio[i].updatedBlockAt : result;
}
return result;
}
/**
* @notice Update information of asset.
* @param id Asset identificator.
* @param amount Amount of asset.
* @param price Cost of one asset in base currency.
* @param updatedAt Timestamp of updated.
* @param proofData Signed data.
* @param proofSignature Data signature.
*/
function put(
string calldata id,
uint256 amount,
uint256 price,
uint256 updatedAt,
string calldata proofData,
string calldata proofSignature
) external onlyAllowed {
require(size() < maxSize, "RealAssetDepositaryBalanceView::put: too many assets");
uint256 valueIndex = portfolioIndex[id];
if (valueIndex != 0) {
portfolio[valueIndex.sub(1)] = Asset(id, amount, price, block.number);
} else {
portfolio.push(Asset(id, amount, price, block.number));
portfolioIndex[id] = size();
}
emit AssetUpdated(id, updatedAt, Proof(proofData, proofSignature));
}
/**
* @notice Remove information of asset.
* @param id Asset identificator.
*/
function remove(string calldata id) external onlyAllowed {
uint256 valueIndex = portfolioIndex[id];
require(valueIndex != 0, "RealAssetDepositaryBalanceView::remove: asset already removed");
uint256 toDeleteIndex = valueIndex.sub(1);
uint256 lastIndex = size().sub(1);
Asset memory lastValue = portfolio[lastIndex];
portfolio[toDeleteIndex] = lastValue;
portfolioIndex[lastValue.id] = toDeleteIndex.add(1);
portfolio.pop();
delete portfolioIndex[id];
emit AssetRemoved(id);
}
function balance() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = result.add(portfolio[i].amount.mul(portfolio[i].price));
}
return result;
}
} | assets | function assets() external view returns (Asset[] memory) {
Asset[] memory result = new Asset[](size());
for (uint256 i = 0; i < size(); i++) {
result[i] = portfolio[i];
}
return result;
}
| /**
* @return Assets list.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | {
"func_code_index": [
1403,
1644
]
} | 1,003 |
|||
RealAssetDepositaryBalanceView | contracts/depositary/RealAssetDepositaryBalanceView.sol | 0xaa6945212acfceec06ae29d67efd21d4cb7d96e8 | Solidity | RealAssetDepositaryBalanceView | contract RealAssetDepositaryBalanceView is IDepositaryBalanceView, IUpdatable, AccessControl {
using SafeMath for uint256;
/// @notice Signed data of asset information.
struct Proof {
string data;
string signature;
}
/// @notice Asset information.
struct Asset {
string id;
uint256 amount;
uint256 price;
uint256 updatedBlockAt;
}
/// @notice The number of assets in depositary.
uint256 public maxSize;
/// @notice Decimals balance.
uint256 public override decimals = 6;
/// @notice Assets list.
Asset[] public portfolio;
/// @dev Assets list index.
mapping(string => uint256) internal portfolioIndex;
/// @notice An event thats emitted when asset updated in portfolio.
event AssetUpdated(string id, uint256 updatedAt, Proof proof);
/// @notice An event thats emitted when asset removed from portfolio.
event AssetRemoved(string id);
/**
* @param _decimals Decimals balance.
* @param _maxSize Max number assets in depositary.
*/
constructor(uint256 _decimals, uint256 _maxSize) public {
decimals = _decimals;
maxSize = _maxSize;
}
/**
* @return Assets count of depositary.
*/
function size() public view returns (uint256) {
return portfolio.length;
}
/**
* @return Assets list.
*/
function assets() external view returns (Asset[] memory) {
Asset[] memory result = new Asset[](size());
for (uint256 i = 0; i < size(); i++) {
result[i] = portfolio[i];
}
return result;
}
function lastUpdateBlockNumber() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = portfolio[i].updatedBlockAt > result ? portfolio[i].updatedBlockAt : result;
}
return result;
}
/**
* @notice Update information of asset.
* @param id Asset identificator.
* @param amount Amount of asset.
* @param price Cost of one asset in base currency.
* @param updatedAt Timestamp of updated.
* @param proofData Signed data.
* @param proofSignature Data signature.
*/
function put(
string calldata id,
uint256 amount,
uint256 price,
uint256 updatedAt,
string calldata proofData,
string calldata proofSignature
) external onlyAllowed {
require(size() < maxSize, "RealAssetDepositaryBalanceView::put: too many assets");
uint256 valueIndex = portfolioIndex[id];
if (valueIndex != 0) {
portfolio[valueIndex.sub(1)] = Asset(id, amount, price, block.number);
} else {
portfolio.push(Asset(id, amount, price, block.number));
portfolioIndex[id] = size();
}
emit AssetUpdated(id, updatedAt, Proof(proofData, proofSignature));
}
/**
* @notice Remove information of asset.
* @param id Asset identificator.
*/
function remove(string calldata id) external onlyAllowed {
uint256 valueIndex = portfolioIndex[id];
require(valueIndex != 0, "RealAssetDepositaryBalanceView::remove: asset already removed");
uint256 toDeleteIndex = valueIndex.sub(1);
uint256 lastIndex = size().sub(1);
Asset memory lastValue = portfolio[lastIndex];
portfolio[toDeleteIndex] = lastValue;
portfolioIndex[lastValue.id] = toDeleteIndex.add(1);
portfolio.pop();
delete portfolioIndex[id];
emit AssetRemoved(id);
}
function balance() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = result.add(portfolio[i].amount.mul(portfolio[i].price));
}
return result;
}
} | put | function put(
string calldata id,
uint256 amount,
uint256 price,
uint256 updatedAt,
string calldata proofData,
string calldata proofSignature
) external onlyAllowed {
require(size() < maxSize, "RealAssetDepositaryBalanceView::put: too many assets");
uint256 valueIndex = portfolioIndex[id];
if (valueIndex != 0) {
portfolio[valueIndex.sub(1)] = Asset(id, amount, price, block.number);
} else {
portfolio.push(Asset(id, amount, price, block.number));
portfolioIndex[id] = size();
}
emit AssetUpdated(id, updatedAt, Proof(proofData, proofSignature));
}
| /**
* @notice Update information of asset.
* @param id Asset identificator.
* @param amount Amount of asset.
* @param price Cost of one asset in base currency.
* @param updatedAt Timestamp of updated.
* @param proofData Signed data.
* @param proofSignature Data signature.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | {
"func_code_index": [
2257,
2952
]
} | 1,004 |
|||
RealAssetDepositaryBalanceView | contracts/depositary/RealAssetDepositaryBalanceView.sol | 0xaa6945212acfceec06ae29d67efd21d4cb7d96e8 | Solidity | RealAssetDepositaryBalanceView | contract RealAssetDepositaryBalanceView is IDepositaryBalanceView, IUpdatable, AccessControl {
using SafeMath for uint256;
/// @notice Signed data of asset information.
struct Proof {
string data;
string signature;
}
/// @notice Asset information.
struct Asset {
string id;
uint256 amount;
uint256 price;
uint256 updatedBlockAt;
}
/// @notice The number of assets in depositary.
uint256 public maxSize;
/// @notice Decimals balance.
uint256 public override decimals = 6;
/// @notice Assets list.
Asset[] public portfolio;
/// @dev Assets list index.
mapping(string => uint256) internal portfolioIndex;
/// @notice An event thats emitted when asset updated in portfolio.
event AssetUpdated(string id, uint256 updatedAt, Proof proof);
/// @notice An event thats emitted when asset removed from portfolio.
event AssetRemoved(string id);
/**
* @param _decimals Decimals balance.
* @param _maxSize Max number assets in depositary.
*/
constructor(uint256 _decimals, uint256 _maxSize) public {
decimals = _decimals;
maxSize = _maxSize;
}
/**
* @return Assets count of depositary.
*/
function size() public view returns (uint256) {
return portfolio.length;
}
/**
* @return Assets list.
*/
function assets() external view returns (Asset[] memory) {
Asset[] memory result = new Asset[](size());
for (uint256 i = 0; i < size(); i++) {
result[i] = portfolio[i];
}
return result;
}
function lastUpdateBlockNumber() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = portfolio[i].updatedBlockAt > result ? portfolio[i].updatedBlockAt : result;
}
return result;
}
/**
* @notice Update information of asset.
* @param id Asset identificator.
* @param amount Amount of asset.
* @param price Cost of one asset in base currency.
* @param updatedAt Timestamp of updated.
* @param proofData Signed data.
* @param proofSignature Data signature.
*/
function put(
string calldata id,
uint256 amount,
uint256 price,
uint256 updatedAt,
string calldata proofData,
string calldata proofSignature
) external onlyAllowed {
require(size() < maxSize, "RealAssetDepositaryBalanceView::put: too many assets");
uint256 valueIndex = portfolioIndex[id];
if (valueIndex != 0) {
portfolio[valueIndex.sub(1)] = Asset(id, amount, price, block.number);
} else {
portfolio.push(Asset(id, amount, price, block.number));
portfolioIndex[id] = size();
}
emit AssetUpdated(id, updatedAt, Proof(proofData, proofSignature));
}
/**
* @notice Remove information of asset.
* @param id Asset identificator.
*/
function remove(string calldata id) external onlyAllowed {
uint256 valueIndex = portfolioIndex[id];
require(valueIndex != 0, "RealAssetDepositaryBalanceView::remove: asset already removed");
uint256 toDeleteIndex = valueIndex.sub(1);
uint256 lastIndex = size().sub(1);
Asset memory lastValue = portfolio[lastIndex];
portfolio[toDeleteIndex] = lastValue;
portfolioIndex[lastValue.id] = toDeleteIndex.add(1);
portfolio.pop();
delete portfolioIndex[id];
emit AssetRemoved(id);
}
function balance() external view override returns (uint256) {
uint256 result;
for (uint256 i = 0; i < size(); i++) {
result = result.add(portfolio[i].amount.mul(portfolio[i].price));
}
return result;
}
} | remove | function remove(string calldata id) external onlyAllowed {
uint256 valueIndex = portfolioIndex[id];
require(valueIndex != 0, "RealAssetDepositaryBalanceView::remove: asset already removed");
uint256 toDeleteIndex = valueIndex.sub(1);
uint256 lastIndex = size().sub(1);
Asset memory lastValue = portfolio[lastIndex];
portfolio[toDeleteIndex] = lastValue;
portfolioIndex[lastValue.id] = toDeleteIndex.add(1);
portfolio.pop();
delete portfolioIndex[id];
emit AssetRemoved(id);
}
| /**
* @notice Remove information of asset.
* @param id Asset identificator.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | {
"func_code_index": [
3052,
3617
]
} | 1,005 |
|||
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | addKey | function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
| /**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
2695,
2798
]
} | 1,006 |
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | approve | function approve(uint256 _id, bool _approve) external returns (bool success);
| /**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
3263,
3345
]
} | 1,007 |
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | execute | function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
| /**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
3722,
3842
]
} | 1,008 |
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | getKey | function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
| /**
* @dev Returns the full key data, if present in the identity.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
3931,
4046
]
} | 1,009 |
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | getKeyPurposes | function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
| /**
* @dev Returns the list of purposes associated with a key.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
4132,
4225
]
} | 1,010 |
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | getKeysByPurpose | function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
| /**
* @dev Returns an array of public key bytes32 held by this identity.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
4321,
4416
]
} | 1,011 |
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | keyHasPurpose | function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
| /**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
4554,
4650
]
} | 1,012 |
IdentityRegistry | @onchain-id/solidity/contracts/IERC734.sol | 0x28384c92af6ac686ca934ddc3874356611ff048c | Solidity | IERC734 | interface IERC734 {
/**
* @dev Definition of the structure of a Key.
*
* Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.
* The structure should be as follows:
* - key: A public key owned by this identity
* - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION
* - keyType: The type of key used, which would be a uint256 for different key types. e.g. 1 = ECDSA, 2 = RSA, etc.
* - key: bytes32 The public key. // Its the Keccak256 hash of the key
*/
struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
/**
* @dev Emitted when an execution request was approved.
*
* Specification: MUST be triggered when approve was successfully called.
*/
event Approved(uint256 indexed executionId, bool approved);
/**
* @dev Emitted when an execute operation was approved and successfully performed.
*
* Specification: MUST be triggered when approve was called and the execution was successfully approved.
*/
event Executed(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when an execution request was performed via `execute`.
*
* Specification: MUST be triggered when execute was successfully called.
*/
event ExecutionRequested(uint256 indexed executionId, address indexed to, uint256 indexed value, bytes data);
/**
* @dev Emitted when a key was added to the Identity.
*
* Specification: MUST be triggered when addKey was successfully called.
*/
event KeyAdded(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when a key was removed from the Identity.
*
* Specification: MUST be triggered when removeKey was successfully called.
*/
event KeyRemoved(bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType);
/**
* @dev Emitted when the list of required keys to perform an action was updated.
*
* Specification: MUST be triggered when changeKeysRequired was successfully called.
*/
event KeysRequiredChanged(uint256 purpose, uint256 number);
/**
* @dev Adds a _key to the identity. The _purpose specifies the purpose of the key.
*
* Triggers Event: `KeyAdded`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) external returns (bool success);
/**
* @dev Approves an execution or claim addition.
*
* Triggers Event: `Approved`, `Executed`
*
* Specification:
* This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution.
* And COULD require n of m approvals of keys purpose 2, if the _to of the execution is another contract, to successfully approve an execution.
*/
function approve(uint256 _id, bool _approve) external returns (bool success);
/**
* @dev Passes an execution instruction to an ERC725 identity.
*
* Triggers Event: `ExecutionRequested`, `Executed`
*
* Specification:
* SHOULD require approve to be called with one or more keys of purpose 1 or 2 to approve this execution.
* Execute COULD be used as the only accessor for `addKey` and `removeKey`.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external payable returns (uint256 executionId);
/**
* @dev Returns the full key data, if present in the identity.
*/
function getKey(bytes32 _key) external view returns (uint256[] memory purposes, uint256 keyType, bytes32 key);
/**
* @dev Returns the list of purposes associated with a key.
*/
function getKeyPurposes(bytes32 _key) external view returns(uint256[] memory _purposes);
/**
* @dev Returns an array of public key bytes32 held by this identity.
*/
function getKeysByPurpose(uint256 _purpose) external view returns (bytes32[] memory keys);
/**
* @dev Returns TRUE if a key is present and has the given purpose. If the key is not present it returns FALSE.
*/
function keyHasPurpose(bytes32 _key, uint256 _purpose) external view returns (bool exists);
/**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/
function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
} | /**
* @dev Interface of the ERC734 (Key Holder) standard as defined in the EIP.
*/ | NatSpecMultiLine | removeKey | function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
| /**
* @dev Removes _purpose for _key from the identity.
*
* Triggers Event: `KeyRemoved`
*
* Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval.
*/ | NatSpecMultiLine | v0.6.2+commit.bacdbe57 | GNU GPLv3 | ipfs://b1c7af754b749d9d19a1cd2334d059e43862ff3e51e72d33197d9f8b78d2f9da | {
"func_code_index": [
4948,
5036
]
} | 1,013 |
GodviewChain | GodviewChain.sol | 0xac49b4a6010e32d7a52d4e3aeaba001a0cb74321 | Solidity | ContractReceiver | contract ContractReceiver {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
} | /**
* @title Contract that will work with ERC223 tokens.
*/ | NatSpecMultiLine | tokenFallback | function tokenFallback(address _from, uint _value, bytes _data) public;
| /**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://50a88a4d366de30fa8557f3a27ba8efd6502dd9ca8d805565f7b7d8234964661 | {
"func_code_index": [
255,
329
]
} | 1,014 |
|
GodviewChain | GodviewChain.sol | 0xac49b4a6010e32d7a52d4e3aeaba001a0cb74321 | Solidity | GodviewChain | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint256 initialSupply, string tokenName, string tokenSymbol) public {
owner = msg.sender;
totalSupply = initialSupply * 10 ** uint256(decimals);
name = tokenName;
symbol = tokenSymbol;
balances[owner] = totalSupply;
}
event Transfer(address indexed from, address indexed to, uint256 value); // ERC20
event Transfer(address indexed from, address indexed to, uint256 value, bytes data); // ERC233
event Burn(address indexed from, uint256 amount, uint256 currentSupply, bytes data);
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public returns (bool) {
bytes memory empty;
transfer(_to, _value, empty);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
* @param _data Transaction metadata.
*/
function burn(uint256 _value, bytes _data) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value, totalSupply, _data);
return true;
}
/**
* @dev Returns balance of the `_address`.
*
* @param _address The address whose balance will be returned.
* @return balance Balance of the `_address`.
*/
function balanceOf(address _address) public constant returns (uint256 balance) {
return balances[_address];
}
} | /**
* @title ERC223 standard token implementation.
*/ | NatSpecMultiLine | GodviewChain | function GodviewChain(uint256 initialSupply, string tokenName, string tokenSymbol) public {
owner = msg.sender;
talSupply = initialSupply * 10 ** uint256(decimals);
me = tokenName;
mbol = tokenSymbol;
balances[owner] = totalSupply;
}
| // List of user balances. | LineComment | v0.4.19+commit.c4cbbb05 | bzzr://50a88a4d366de30fa8557f3a27ba8efd6502dd9ca8d805565f7b7d8234964661 | {
"func_code_index": [
288,
608
]
} | 1,015 |
|
GodviewChain | GodviewChain.sol | 0xac49b4a6010e32d7a52d4e3aeaba001a0cb74321 | Solidity | GodviewChain | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint256 initialSupply, string tokenName, string tokenSymbol) public {
owner = msg.sender;
totalSupply = initialSupply * 10 ** uint256(decimals);
name = tokenName;
symbol = tokenSymbol;
balances[owner] = totalSupply;
}
event Transfer(address indexed from, address indexed to, uint256 value); // ERC20
event Transfer(address indexed from, address indexed to, uint256 value, bytes data); // ERC233
event Burn(address indexed from, uint256 amount, uint256 currentSupply, bytes data);
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public returns (bool) {
bytes memory empty;
transfer(_to, _value, empty);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
* @param _data Transaction metadata.
*/
function burn(uint256 _value, bytes _data) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value, totalSupply, _data);
return true;
}
/**
* @dev Returns balance of the `_address`.
*
* @param _address The address whose balance will be returned.
* @return balance Balance of the `_address`.
*/
function balanceOf(address _address) public constant returns (uint256 balance) {
return balances[_address];
}
} | /**
* @title ERC223 standard token implementation.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint _value) public returns (bool) {
bytes memory empty;
ansfer(_to, _value, empty);
}
| /**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://50a88a4d366de30fa8557f3a27ba8efd6502dd9ca8d805565f7b7d8234964661 | {
"func_code_index": [
1265,
1406
]
} | 1,016 |
|
GodviewChain | GodviewChain.sol | 0xac49b4a6010e32d7a52d4e3aeaba001a0cb74321 | Solidity | GodviewChain | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint256 initialSupply, string tokenName, string tokenSymbol) public {
owner = msg.sender;
totalSupply = initialSupply * 10 ** uint256(decimals);
name = tokenName;
symbol = tokenSymbol;
balances[owner] = totalSupply;
}
event Transfer(address indexed from, address indexed to, uint256 value); // ERC20
event Transfer(address indexed from, address indexed to, uint256 value, bytes data); // ERC233
event Burn(address indexed from, uint256 amount, uint256 currentSupply, bytes data);
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public returns (bool) {
bytes memory empty;
transfer(_to, _value, empty);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
* @param _data Transaction metadata.
*/
function burn(uint256 _value, bytes _data) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value, totalSupply, _data);
return true;
}
/**
* @dev Returns balance of the `_address`.
*
* @param _address The address whose balance will be returned.
* @return balance Balance of the `_address`.
*/
function balanceOf(address _address) public constant returns (uint256 balance) {
return balances[_address];
}
} | /**
* @title ERC223 standard token implementation.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint _value, bytes _data) public returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
ansfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
}
| /**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://50a88a4d366de30fa8557f3a27ba8efd6502dd9ca8d805565f7b7d8234964661 | {
"func_code_index": [
1932,
2507
]
} | 1,017 |
|
GodviewChain | GodviewChain.sol | 0xac49b4a6010e32d7a52d4e3aeaba001a0cb74321 | Solidity | GodviewChain | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint256 initialSupply, string tokenName, string tokenSymbol) public {
owner = msg.sender;
totalSupply = initialSupply * 10 ** uint256(decimals);
name = tokenName;
symbol = tokenSymbol;
balances[owner] = totalSupply;
}
event Transfer(address indexed from, address indexed to, uint256 value); // ERC20
event Transfer(address indexed from, address indexed to, uint256 value, bytes data); // ERC233
event Burn(address indexed from, uint256 amount, uint256 currentSupply, bytes data);
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public returns (bool) {
bytes memory empty;
transfer(_to, _value, empty);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
* @param _data Transaction metadata.
*/
function burn(uint256 _value, bytes _data) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value, totalSupply, _data);
return true;
}
/**
* @dev Returns balance of the `_address`.
*
* @param _address The address whose balance will be returned.
* @return balance Balance of the `_address`.
*/
function balanceOf(address _address) public constant returns (uint256 balance) {
return balances[_address];
}
} | /**
* @title ERC223 standard token implementation.
*/ | NatSpecMultiLine | burn | function burn(uint256 _value, bytes _data) public returns (bool success) {
lances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value, totalSupply, _data);
return true;
}
| /**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
* @param _data Transaction metadata.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://50a88a4d366de30fa8557f3a27ba8efd6502dd9ca8d805565f7b7d8234964661 | {
"func_code_index": [
2716,
2987
]
} | 1,018 |
|
GodviewChain | GodviewChain.sol | 0xac49b4a6010e32d7a52d4e3aeaba001a0cb74321 | Solidity | GodviewChain | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint256 initialSupply, string tokenName, string tokenSymbol) public {
owner = msg.sender;
totalSupply = initialSupply * 10 ** uint256(decimals);
name = tokenName;
symbol = tokenSymbol;
balances[owner] = totalSupply;
}
event Transfer(address indexed from, address indexed to, uint256 value); // ERC20
event Transfer(address indexed from, address indexed to, uint256 value, bytes data); // ERC233
event Burn(address indexed from, uint256 amount, uint256 currentSupply, bytes data);
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public returns (bool) {
bytes memory empty;
transfer(_to, _value, empty);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
* @param _data Transaction metadata.
*/
function burn(uint256 _value, bytes _data) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value, totalSupply, _data);
return true;
}
/**
* @dev Returns balance of the `_address`.
*
* @param _address The address whose balance will be returned.
* @return balance Balance of the `_address`.
*/
function balanceOf(address _address) public constant returns (uint256 balance) {
return balances[_address];
}
} | /**
* @title ERC223 standard token implementation.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _address) public constant returns (uint256 balance) {
return balances[_address];
}
| /**
* @dev Returns balance of the `_address`.
*
* @param _address The address whose balance will be returned.
* @return balance Balance of the `_address`.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://50a88a4d366de30fa8557f3a27ba8efd6502dd9ca8d805565f7b7d8234964661 | {
"func_code_index": [
3183,
3311
]
} | 1,019 |
|
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* */ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
78,
410
]
} | 1,020 |
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* */ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
484,
738
]
} | 1,021 |
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* */ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
841,
941
]
} | 1,022 |
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* */ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
996,
1105
]
} | 1,023 |
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
* */
function totalSupply() public view returns (uint256){
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. */
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances. */ | NatSpecMultiLine | totalSupply | function totalSupply() public view returns (uint256){
return totalSupply_;
}
| /**
* @dev total number of tokens in existence
* */ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
177,
253
]
} | 1,024 |
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
* */
function totalSupply() public view returns (uint256){
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. */
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances. */ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
395,
715
]
} | 1,025 |
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
* */
function totalSupply() public view returns (uint256){
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. */
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances. */ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. */ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
906,
999
]
} | 1,026 |
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of
msg.sender. *
* 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 * @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. */
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
} | transferFrom | function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
| /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
370,
807
]
} | 1,027 |
||
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of
msg.sender. *
* 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 * @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. */
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
} | approve | function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| /**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of
msg.sender. *
* 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 * @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
1398,
1572
]
} | 1,028 |
||
DpheToken | dphe.sol | 0xc30b841e0e1613210ddff6d3241867df3a634cf3 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true; //AUDIT// 返回值符合 EIP20 规范
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of
msg.sender. *
* 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 * @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. */
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
} | allowance | function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. */ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://96f317a63e06cd17d7a9b71f39dcd0817d3ca314e7b517c12b6a76794989b10b | {
"func_code_index": [
1872,
1994
]
} | 1,029 |
||
BluzelleStakingRewards | BluzelleStakingRewards.sol | 0x521e6682b7ff3e412b9f5a13c3173be3e30e743b | Solidity | BluzelleStakingRewards | contract BluzelleStakingRewards is ERC20Detailed {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply = 11000e18;
uint256 public basePercent = 320;
constructor() public ERC20Detailed("Bluzelle Staking Rewards", "BLSR", 18) {
_mint(msg.sender, _totalSupply);
}
/// @return Total number of tokens in circulation
function totalSupply() public view returns(uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns(uint256) {
return _balances[owner];
}
function allowance(address owner, address spender) public view returns(uint256) {
return _allowances[owner][spender];
}
function findBurnAmount(uint256 value) public view returns(uint256) {
if (value == 1) {
return 0;
}
uint256 roundValue = value.ceil(basePercent);
//Gas optimized
uint256 burnAmount = roundValue.mul(100).div(32000);
return burnAmount;
}
function transfer(address to, uint256 value) public returns(bool) {
require(to != address(0));
uint256 tokensToBurn = findBurnAmount(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(tokensToTransfer);
_totalSupply = _totalSupply.sub(tokensToBurn);
emit Transfer(msg.sender, to, tokensToTransfer);
emit Transfer(msg.sender, address(0), tokensToBurn);
return true;
}
function approve(address spender, uint256 value) public returns(bool) {
require(spender != address(0));
_allowances[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns(bool) {
require(value <= _allowances[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
uint256 tokensToBurn = findBurnAmount(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[to] = _balances[to].add(tokensToTransfer);
_totalSupply = _totalSupply.sub(tokensToBurn);
_allowances[from][msg.sender] = _allowances[from][msg.sender].sub(value);
emit Transfer(from, to, tokensToTransfer);
emit Transfer(from, address(0), tokensToBurn);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns(bool) {
require(spender != address(0));
_allowances[msg.sender][spender] = (_allowances[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns(bool) {
require(spender != address(0));
_allowances[msg.sender][spender] = (_allowances[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
return true;
}
function _mint(address account, uint256 amount) internal {
require(amount != 0);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function burn(uint256 amount) external {
_burn(msg.sender, amount);
}
function _burn(address account, uint256 amount) internal {
require(amount != 0);
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0), amount);
}
function burnFrom(address account, uint256 amount) external {
require(amount <= _allowances[account][msg.sender]);
_allowances[account][msg.sender] = _allowances[account][msg.sender].sub(amount);
_burn(account, amount);
}
} | totalSupply | function totalSupply() public view returns(uint256) {
return _totalSupply;
}
| /// @return Total number of tokens in circulation | NatSpecSingleLine | v0.5.17+commit.d19bba13 | None | bzzr://9640a697ff548a566ae2f32bd21b90349a44e06dcb71709987b48423da4e4726 | {
"func_code_index": [
495,
590
]
} | 1,030 |
||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | Ownable | function Ownable() public {
owner = msg.sender;
}
| /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
261,
321
]
} | 1,031 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
644,
825
]
} | 1,032 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | Pausable | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
} | pause | function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
| /**
* @dev called by the owner to pause, triggers stopped state
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
513,
609
]
} | 1,033 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | Pausable | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
} | unpause | function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
| /**
* @dev called by the owner to unpause, returns to normal state
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
693,
791
]
} | 1,034 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
} | transfer | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
268,
664
]
} | 1,035 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
} | balanceOf | function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
870,
982
]
} | 1,036 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
401,
858
]
} | 1,037 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | approve | function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| /**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
1490,
1685
]
} | 1,038 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | allowance | function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
2009,
2140
]
} | 1,039 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | increaseApproval | function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
2606,
2875
]
} | 1,040 |
|||
EthereumEra | EthereumEra.sol | 0xfcf2e7f0a4c91944d995083c9495c14eb58383c9 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | decreaseApproval | function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://29f33fcb8b263f31e4307cc5d2037f98ee1e15b70992edc2b3887cc0bc363562 | {
"func_code_index": [
3346,
3761
]
} | 1,041 |
|||
PrivateDistribution | contracts/PrivateDistribution.sol | 0xb95010420cd82e58bbe38b233dbcdf49eb52af16 | Solidity | PrivateDistribution | contract PrivateDistribution is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event InvestorsAdded(address[] investors, uint256[] tokenAllocations, address caller);
event InvestorAdded(address indexed investor, address indexed caller, uint256 allocation);
event InvestorRemoved(address indexed investor, address indexed caller, uint256 allocation);
event WithdrawnTokens(address indexed investor, uint256 value);
event DepositInvestment(address indexed investor, uint256 value);
event RecoverToken(address indexed token, uint256 indexed amount);
uint256 private _totalAllocatedAmount;
uint256 private _initialTimestamp;
IERC20 private _blankToken;
address[] public investors;
struct Investor {
bool exists;
uint256 withdrawnTokens;
uint256 tokensAllotment;
}
struct Vesting {
uint256 releaseTime;
uint256 releasePercentage;
}
mapping(uint256 => Vesting) public vestingsInfo;
mapping(address => Investor) public investorsInfo;
/// @dev Boolean variable that indicates whether the contract was initialized.
bool public isInitialized = false;
/// @dev Boolean variable that indicates whether the investors set was finalized.
bool public isFinalized = false;
/// @dev Checks that the contract is initialized.
modifier initialized() {
require(isInitialized, "not initialized");
_;
}
// 20% on TGE, 8% for Month 1 2; then 7% for Month 3 6; then 6% for Month 7 12
uint256[] _privateVesting = [
20000000000000000000,
28000000000000000000,
36000000000000000000,
43000000000000000000,
50000000000000000000,
57000000000000000000,
64000000000000000000,
70000000000000000000,
76000000000000000000,
82000000000000000000,
88000000000000000000,
94000000000000000000,
100000000000000000000
];
/// @dev Checks that the contract is initialized.
modifier notInitialized() {
require(!isInitialized, "initialized");
_;
}
modifier onlyInvestor() {
require(investorsInfo[_msgSender()].exists, "Only investors allowed");
_;
}
constructor(address _token) {
_blankToken = IERC20(_token);
}
function getInitialTimestamp() public view returns (uint256 timestamp) {
return _initialTimestamp;
}
/// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor.
function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
// 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff
function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
/// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting
function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
/// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address
function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
/// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor.
function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
/// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address.
function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
/// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount
function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
function _calculateAvailablePercentage() private view returns (uint256 availablePercentage) {
uint256 currentTimeStamp = block.timestamp;
uint256 noOfDays = BokkyPooBahsDateTimeLibrary.diffDays(_initialTimestamp, currentTimeStamp);
uint256 noOfMonths = _daysToMonths(noOfDays);
// console.log("Months=%s, Release Percentage=%s%", noOfMonths.add(1), vesting.releasePercentage.div(1e18));
return _privateVesting[noOfMonths];
}
function _daysToMonths(uint256 _days) private view returns (uint256 noOfMonths) {
uint256 noOfDaysInMonth = uint256(30).mul(1e18);
uint256 daysNormalized = _days.mul(1e18);
uint256 noOfMontsNormalized = daysNormalized.div(noOfDaysInMonth);
return noOfMontsNormalized.div(1e18);
}
function recoverToken(address _token, uint256 amount) external onlyOwner {
IERC20(_token).safeTransfer(_msgSender(), amount);
emit RecoverToken(_token, amount);
}
} | addInvestors | function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
| /// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor. | NatSpecSingleLine | v0.7.4+commit.3f05b770 | {
"func_code_index": [
2764,
3266
]
} | 1,042 |
||||
PrivateDistribution | contracts/PrivateDistribution.sol | 0xb95010420cd82e58bbe38b233dbcdf49eb52af16 | Solidity | PrivateDistribution | contract PrivateDistribution is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event InvestorsAdded(address[] investors, uint256[] tokenAllocations, address caller);
event InvestorAdded(address indexed investor, address indexed caller, uint256 allocation);
event InvestorRemoved(address indexed investor, address indexed caller, uint256 allocation);
event WithdrawnTokens(address indexed investor, uint256 value);
event DepositInvestment(address indexed investor, uint256 value);
event RecoverToken(address indexed token, uint256 indexed amount);
uint256 private _totalAllocatedAmount;
uint256 private _initialTimestamp;
IERC20 private _blankToken;
address[] public investors;
struct Investor {
bool exists;
uint256 withdrawnTokens;
uint256 tokensAllotment;
}
struct Vesting {
uint256 releaseTime;
uint256 releasePercentage;
}
mapping(uint256 => Vesting) public vestingsInfo;
mapping(address => Investor) public investorsInfo;
/// @dev Boolean variable that indicates whether the contract was initialized.
bool public isInitialized = false;
/// @dev Boolean variable that indicates whether the investors set was finalized.
bool public isFinalized = false;
/// @dev Checks that the contract is initialized.
modifier initialized() {
require(isInitialized, "not initialized");
_;
}
// 20% on TGE, 8% for Month 1 2; then 7% for Month 3 6; then 6% for Month 7 12
uint256[] _privateVesting = [
20000000000000000000,
28000000000000000000,
36000000000000000000,
43000000000000000000,
50000000000000000000,
57000000000000000000,
64000000000000000000,
70000000000000000000,
76000000000000000000,
82000000000000000000,
88000000000000000000,
94000000000000000000,
100000000000000000000
];
/// @dev Checks that the contract is initialized.
modifier notInitialized() {
require(!isInitialized, "initialized");
_;
}
modifier onlyInvestor() {
require(investorsInfo[_msgSender()].exists, "Only investors allowed");
_;
}
constructor(address _token) {
_blankToken = IERC20(_token);
}
function getInitialTimestamp() public view returns (uint256 timestamp) {
return _initialTimestamp;
}
/// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor.
function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
// 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff
function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
/// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting
function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
/// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address
function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
/// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor.
function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
/// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address.
function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
/// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount
function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
function _calculateAvailablePercentage() private view returns (uint256 availablePercentage) {
uint256 currentTimeStamp = block.timestamp;
uint256 noOfDays = BokkyPooBahsDateTimeLibrary.diffDays(_initialTimestamp, currentTimeStamp);
uint256 noOfMonths = _daysToMonths(noOfDays);
// console.log("Months=%s, Release Percentage=%s%", noOfMonths.add(1), vesting.releasePercentage.div(1e18));
return _privateVesting[noOfMonths];
}
function _daysToMonths(uint256 _days) private view returns (uint256 noOfMonths) {
uint256 noOfDaysInMonth = uint256(30).mul(1e18);
uint256 daysNormalized = _days.mul(1e18);
uint256 noOfMontsNormalized = daysNormalized.div(noOfDaysInMonth);
return noOfMontsNormalized.div(1e18);
}
function recoverToken(address _token, uint256 amount) external onlyOwner {
IERC20(_token).safeTransfer(_msgSender(), amount);
emit RecoverToken(_token, amount);
}
} | withdrawTokens | function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
| // 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff | LineComment | v0.7.4+commit.3f05b770 | {
"func_code_index": [
3340,
3835
]
} | 1,043 |
||||
PrivateDistribution | contracts/PrivateDistribution.sol | 0xb95010420cd82e58bbe38b233dbcdf49eb52af16 | Solidity | PrivateDistribution | contract PrivateDistribution is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event InvestorsAdded(address[] investors, uint256[] tokenAllocations, address caller);
event InvestorAdded(address indexed investor, address indexed caller, uint256 allocation);
event InvestorRemoved(address indexed investor, address indexed caller, uint256 allocation);
event WithdrawnTokens(address indexed investor, uint256 value);
event DepositInvestment(address indexed investor, uint256 value);
event RecoverToken(address indexed token, uint256 indexed amount);
uint256 private _totalAllocatedAmount;
uint256 private _initialTimestamp;
IERC20 private _blankToken;
address[] public investors;
struct Investor {
bool exists;
uint256 withdrawnTokens;
uint256 tokensAllotment;
}
struct Vesting {
uint256 releaseTime;
uint256 releasePercentage;
}
mapping(uint256 => Vesting) public vestingsInfo;
mapping(address => Investor) public investorsInfo;
/// @dev Boolean variable that indicates whether the contract was initialized.
bool public isInitialized = false;
/// @dev Boolean variable that indicates whether the investors set was finalized.
bool public isFinalized = false;
/// @dev Checks that the contract is initialized.
modifier initialized() {
require(isInitialized, "not initialized");
_;
}
// 20% on TGE, 8% for Month 1 2; then 7% for Month 3 6; then 6% for Month 7 12
uint256[] _privateVesting = [
20000000000000000000,
28000000000000000000,
36000000000000000000,
43000000000000000000,
50000000000000000000,
57000000000000000000,
64000000000000000000,
70000000000000000000,
76000000000000000000,
82000000000000000000,
88000000000000000000,
94000000000000000000,
100000000000000000000
];
/// @dev Checks that the contract is initialized.
modifier notInitialized() {
require(!isInitialized, "initialized");
_;
}
modifier onlyInvestor() {
require(investorsInfo[_msgSender()].exists, "Only investors allowed");
_;
}
constructor(address _token) {
_blankToken = IERC20(_token);
}
function getInitialTimestamp() public view returns (uint256 timestamp) {
return _initialTimestamp;
}
/// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor.
function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
// 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff
function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
/// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting
function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
/// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address
function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
/// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor.
function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
/// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address.
function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
/// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount
function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
function _calculateAvailablePercentage() private view returns (uint256 availablePercentage) {
uint256 currentTimeStamp = block.timestamp;
uint256 noOfDays = BokkyPooBahsDateTimeLibrary.diffDays(_initialTimestamp, currentTimeStamp);
uint256 noOfMonths = _daysToMonths(noOfDays);
// console.log("Months=%s, Release Percentage=%s%", noOfMonths.add(1), vesting.releasePercentage.div(1e18));
return _privateVesting[noOfMonths];
}
function _daysToMonths(uint256 _days) private view returns (uint256 noOfMonths) {
uint256 noOfDaysInMonth = uint256(30).mul(1e18);
uint256 daysNormalized = _days.mul(1e18);
uint256 noOfMontsNormalized = daysNormalized.div(noOfDaysInMonth);
return noOfMontsNormalized.div(1e18);
}
function recoverToken(address _token, uint256 amount) external onlyOwner {
IERC20(_token).safeTransfer(_msgSender(), amount);
emit RecoverToken(_token, amount);
}
} | setInitialTimestamp | function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
| /// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting | NatSpecSingleLine | v0.7.4+commit.3f05b770 | {
"func_code_index": [
3965,
4133
]
} | 1,044 |
||||
PrivateDistribution | contracts/PrivateDistribution.sol | 0xb95010420cd82e58bbe38b233dbcdf49eb52af16 | Solidity | PrivateDistribution | contract PrivateDistribution is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event InvestorsAdded(address[] investors, uint256[] tokenAllocations, address caller);
event InvestorAdded(address indexed investor, address indexed caller, uint256 allocation);
event InvestorRemoved(address indexed investor, address indexed caller, uint256 allocation);
event WithdrawnTokens(address indexed investor, uint256 value);
event DepositInvestment(address indexed investor, uint256 value);
event RecoverToken(address indexed token, uint256 indexed amount);
uint256 private _totalAllocatedAmount;
uint256 private _initialTimestamp;
IERC20 private _blankToken;
address[] public investors;
struct Investor {
bool exists;
uint256 withdrawnTokens;
uint256 tokensAllotment;
}
struct Vesting {
uint256 releaseTime;
uint256 releasePercentage;
}
mapping(uint256 => Vesting) public vestingsInfo;
mapping(address => Investor) public investorsInfo;
/// @dev Boolean variable that indicates whether the contract was initialized.
bool public isInitialized = false;
/// @dev Boolean variable that indicates whether the investors set was finalized.
bool public isFinalized = false;
/// @dev Checks that the contract is initialized.
modifier initialized() {
require(isInitialized, "not initialized");
_;
}
// 20% on TGE, 8% for Month 1 2; then 7% for Month 3 6; then 6% for Month 7 12
uint256[] _privateVesting = [
20000000000000000000,
28000000000000000000,
36000000000000000000,
43000000000000000000,
50000000000000000000,
57000000000000000000,
64000000000000000000,
70000000000000000000,
76000000000000000000,
82000000000000000000,
88000000000000000000,
94000000000000000000,
100000000000000000000
];
/// @dev Checks that the contract is initialized.
modifier notInitialized() {
require(!isInitialized, "initialized");
_;
}
modifier onlyInvestor() {
require(investorsInfo[_msgSender()].exists, "Only investors allowed");
_;
}
constructor(address _token) {
_blankToken = IERC20(_token);
}
function getInitialTimestamp() public view returns (uint256 timestamp) {
return _initialTimestamp;
}
/// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor.
function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
// 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff
function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
/// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting
function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
/// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address
function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
/// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor.
function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
/// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address.
function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
/// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount
function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
function _calculateAvailablePercentage() private view returns (uint256 availablePercentage) {
uint256 currentTimeStamp = block.timestamp;
uint256 noOfDays = BokkyPooBahsDateTimeLibrary.diffDays(_initialTimestamp, currentTimeStamp);
uint256 noOfMonths = _daysToMonths(noOfDays);
// console.log("Months=%s, Release Percentage=%s%", noOfMonths.add(1), vesting.releasePercentage.div(1e18));
return _privateVesting[noOfMonths];
}
function _daysToMonths(uint256 _days) private view returns (uint256 noOfMonths) {
uint256 noOfDaysInMonth = uint256(30).mul(1e18);
uint256 daysNormalized = _days.mul(1e18);
uint256 noOfMontsNormalized = daysNormalized.div(noOfDaysInMonth);
return noOfMontsNormalized.div(1e18);
}
function recoverToken(address _token, uint256 amount) external onlyOwner {
IERC20(_token).safeTransfer(_msgSender(), amount);
emit RecoverToken(_token, amount);
}
} | withdrawableTokens | function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
| /// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address | NatSpecSingleLine | v0.7.4+commit.3f05b770 | {
"func_code_index": [
4236,
4671
]
} | 1,045 |
||||
PrivateDistribution | contracts/PrivateDistribution.sol | 0xb95010420cd82e58bbe38b233dbcdf49eb52af16 | Solidity | PrivateDistribution | contract PrivateDistribution is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event InvestorsAdded(address[] investors, uint256[] tokenAllocations, address caller);
event InvestorAdded(address indexed investor, address indexed caller, uint256 allocation);
event InvestorRemoved(address indexed investor, address indexed caller, uint256 allocation);
event WithdrawnTokens(address indexed investor, uint256 value);
event DepositInvestment(address indexed investor, uint256 value);
event RecoverToken(address indexed token, uint256 indexed amount);
uint256 private _totalAllocatedAmount;
uint256 private _initialTimestamp;
IERC20 private _blankToken;
address[] public investors;
struct Investor {
bool exists;
uint256 withdrawnTokens;
uint256 tokensAllotment;
}
struct Vesting {
uint256 releaseTime;
uint256 releasePercentage;
}
mapping(uint256 => Vesting) public vestingsInfo;
mapping(address => Investor) public investorsInfo;
/// @dev Boolean variable that indicates whether the contract was initialized.
bool public isInitialized = false;
/// @dev Boolean variable that indicates whether the investors set was finalized.
bool public isFinalized = false;
/// @dev Checks that the contract is initialized.
modifier initialized() {
require(isInitialized, "not initialized");
_;
}
// 20% on TGE, 8% for Month 1 2; then 7% for Month 3 6; then 6% for Month 7 12
uint256[] _privateVesting = [
20000000000000000000,
28000000000000000000,
36000000000000000000,
43000000000000000000,
50000000000000000000,
57000000000000000000,
64000000000000000000,
70000000000000000000,
76000000000000000000,
82000000000000000000,
88000000000000000000,
94000000000000000000,
100000000000000000000
];
/// @dev Checks that the contract is initialized.
modifier notInitialized() {
require(!isInitialized, "initialized");
_;
}
modifier onlyInvestor() {
require(investorsInfo[_msgSender()].exists, "Only investors allowed");
_;
}
constructor(address _token) {
_blankToken = IERC20(_token);
}
function getInitialTimestamp() public view returns (uint256 timestamp) {
return _initialTimestamp;
}
/// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor.
function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
// 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff
function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
/// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting
function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
/// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address
function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
/// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor.
function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
/// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address.
function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
/// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount
function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
function _calculateAvailablePercentage() private view returns (uint256 availablePercentage) {
uint256 currentTimeStamp = block.timestamp;
uint256 noOfDays = BokkyPooBahsDateTimeLibrary.diffDays(_initialTimestamp, currentTimeStamp);
uint256 noOfMonths = _daysToMonths(noOfDays);
// console.log("Months=%s, Release Percentage=%s%", noOfMonths.add(1), vesting.releasePercentage.div(1e18));
return _privateVesting[noOfMonths];
}
function _daysToMonths(uint256 _days) private view returns (uint256 noOfMonths) {
uint256 noOfDaysInMonth = uint256(30).mul(1e18);
uint256 daysNormalized = _days.mul(1e18);
uint256 noOfMontsNormalized = daysNormalized.div(noOfDaysInMonth);
return noOfMontsNormalized.div(1e18);
}
function recoverToken(address _token, uint256 amount) external onlyOwner {
IERC20(_token).safeTransfer(_msgSender(), amount);
emit RecoverToken(_token, amount);
}
} | _addInvestor | function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
| /// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor. | NatSpecSingleLine | v0.7.4+commit.3f05b770 | {
"func_code_index": [
5070,
5829
]
} | 1,046 |
||||
PrivateDistribution | contracts/PrivateDistribution.sol | 0xb95010420cd82e58bbe38b233dbcdf49eb52af16 | Solidity | PrivateDistribution | contract PrivateDistribution is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event InvestorsAdded(address[] investors, uint256[] tokenAllocations, address caller);
event InvestorAdded(address indexed investor, address indexed caller, uint256 allocation);
event InvestorRemoved(address indexed investor, address indexed caller, uint256 allocation);
event WithdrawnTokens(address indexed investor, uint256 value);
event DepositInvestment(address indexed investor, uint256 value);
event RecoverToken(address indexed token, uint256 indexed amount);
uint256 private _totalAllocatedAmount;
uint256 private _initialTimestamp;
IERC20 private _blankToken;
address[] public investors;
struct Investor {
bool exists;
uint256 withdrawnTokens;
uint256 tokensAllotment;
}
struct Vesting {
uint256 releaseTime;
uint256 releasePercentage;
}
mapping(uint256 => Vesting) public vestingsInfo;
mapping(address => Investor) public investorsInfo;
/// @dev Boolean variable that indicates whether the contract was initialized.
bool public isInitialized = false;
/// @dev Boolean variable that indicates whether the investors set was finalized.
bool public isFinalized = false;
/// @dev Checks that the contract is initialized.
modifier initialized() {
require(isInitialized, "not initialized");
_;
}
// 20% on TGE, 8% for Month 1 2; then 7% for Month 3 6; then 6% for Month 7 12
uint256[] _privateVesting = [
20000000000000000000,
28000000000000000000,
36000000000000000000,
43000000000000000000,
50000000000000000000,
57000000000000000000,
64000000000000000000,
70000000000000000000,
76000000000000000000,
82000000000000000000,
88000000000000000000,
94000000000000000000,
100000000000000000000
];
/// @dev Checks that the contract is initialized.
modifier notInitialized() {
require(!isInitialized, "initialized");
_;
}
modifier onlyInvestor() {
require(investorsInfo[_msgSender()].exists, "Only investors allowed");
_;
}
constructor(address _token) {
_blankToken = IERC20(_token);
}
function getInitialTimestamp() public view returns (uint256 timestamp) {
return _initialTimestamp;
}
/// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor.
function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
// 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff
function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
/// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting
function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
/// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address
function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
/// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor.
function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
/// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address.
function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
/// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount
function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
function _calculateAvailablePercentage() private view returns (uint256 availablePercentage) {
uint256 currentTimeStamp = block.timestamp;
uint256 noOfDays = BokkyPooBahsDateTimeLibrary.diffDays(_initialTimestamp, currentTimeStamp);
uint256 noOfMonths = _daysToMonths(noOfDays);
// console.log("Months=%s, Release Percentage=%s%", noOfMonths.add(1), vesting.releasePercentage.div(1e18));
return _privateVesting[noOfMonths];
}
function _daysToMonths(uint256 _days) private view returns (uint256 noOfMonths) {
uint256 noOfDaysInMonth = uint256(30).mul(1e18);
uint256 daysNormalized = _days.mul(1e18);
uint256 noOfMontsNormalized = daysNormalized.div(noOfDaysInMonth);
return noOfMontsNormalized.div(1e18);
}
function recoverToken(address _token, uint256 amount) external onlyOwner {
IERC20(_token).safeTransfer(_msgSender(), amount);
emit RecoverToken(_token, amount);
}
} | removeInvestor | function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
| /// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address. | NatSpecSingleLine | v0.7.4+commit.3f05b770 | {
"func_code_index": [
6035,
6562
]
} | 1,047 |
||||
PrivateDistribution | contracts/PrivateDistribution.sol | 0xb95010420cd82e58bbe38b233dbcdf49eb52af16 | Solidity | PrivateDistribution | contract PrivateDistribution is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
event InvestorsAdded(address[] investors, uint256[] tokenAllocations, address caller);
event InvestorAdded(address indexed investor, address indexed caller, uint256 allocation);
event InvestorRemoved(address indexed investor, address indexed caller, uint256 allocation);
event WithdrawnTokens(address indexed investor, uint256 value);
event DepositInvestment(address indexed investor, uint256 value);
event RecoverToken(address indexed token, uint256 indexed amount);
uint256 private _totalAllocatedAmount;
uint256 private _initialTimestamp;
IERC20 private _blankToken;
address[] public investors;
struct Investor {
bool exists;
uint256 withdrawnTokens;
uint256 tokensAllotment;
}
struct Vesting {
uint256 releaseTime;
uint256 releasePercentage;
}
mapping(uint256 => Vesting) public vestingsInfo;
mapping(address => Investor) public investorsInfo;
/// @dev Boolean variable that indicates whether the contract was initialized.
bool public isInitialized = false;
/// @dev Boolean variable that indicates whether the investors set was finalized.
bool public isFinalized = false;
/// @dev Checks that the contract is initialized.
modifier initialized() {
require(isInitialized, "not initialized");
_;
}
// 20% on TGE, 8% for Month 1 2; then 7% for Month 3 6; then 6% for Month 7 12
uint256[] _privateVesting = [
20000000000000000000,
28000000000000000000,
36000000000000000000,
43000000000000000000,
50000000000000000000,
57000000000000000000,
64000000000000000000,
70000000000000000000,
76000000000000000000,
82000000000000000000,
88000000000000000000,
94000000000000000000,
100000000000000000000
];
/// @dev Checks that the contract is initialized.
modifier notInitialized() {
require(!isInitialized, "initialized");
_;
}
modifier onlyInvestor() {
require(investorsInfo[_msgSender()].exists, "Only investors allowed");
_;
}
constructor(address _token) {
_blankToken = IERC20(_token);
}
function getInitialTimestamp() public view returns (uint256 timestamp) {
return _initialTimestamp;
}
/// @dev Adds investors. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investors The addresses of new investors.
/// @param _tokenAllocations The amounts of the tokens that belong to each investor.
function addInvestors(
address[] calldata _investors,
uint256[] calldata _tokenAllocations,
uint256[] calldata _withdrawnTokens
) external onlyOwner {
require(_investors.length == _tokenAllocations.length, "different arrays sizes");
for (uint256 i = 0; i < _investors.length; i++) {
_addInvestor(_investors[i], _tokenAllocations[i], _withdrawnTokens[i]);
}
emit InvestorsAdded(_investors, _tokenAllocations, msg.sender);
}
// 25% at TGE, 75% released daily over 120 Days after 30 Days Cliff
function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = investor.withdrawnTokens.add(tokensAvailable);
_blankToken.safeTransfer(_msgSender(), tokensAvailable);
emit WithdrawnTokens(_msgSender(), tokensAvailable);
}
/// @dev The starting time of TGE
/// @param _timestamp The initial timestamp, this timestap should be used for vesting
function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
isInitialized = true;
_initialTimestamp = _timestamp;
}
/// @dev withdrawble tokens for an address
/// @param _investor whitelisted investor address
function withdrawableTokens(address _investor) public view returns (uint256 tokens) {
Investor storage investor = investorsInfo[_investor];
uint256 availablePercentage = _calculateAvailablePercentage();
uint256 noOfTokens = _calculatePercentage(investor.tokensAllotment, availablePercentage);
uint256 tokensAvailable = noOfTokens.sub(investor.withdrawnTokens);
return tokensAvailable;
}
/// @dev Adds investor. This function doesn't limit max gas consumption,
/// so adding too many investors can cause it to reach the out-of-gas error.
/// @param _investor The addresses of new investors.
/// @param _tokensAllotment The amounts of the tokens that belong to each investor.
/// @param _withdrawnTokens The amounts of the tokens already withdrawn by each investor.
function _addInvestor(
address _investor,
uint256 _tokensAllotment,
uint256 _withdrawnTokens
) internal onlyOwner {
require(_investor != address(0), "Invalid address");
require(_tokensAllotment > 0, "the investor allocation must be more than 0");
Investor storage investor = investorsInfo[_investor];
require(investor.tokensAllotment == 0, "investor already added");
investor.tokensAllotment = _tokensAllotment;
investor.withdrawnTokens = _withdrawnTokens;
investor.exists = true;
investors.push(_investor);
_totalAllocatedAmount = _totalAllocatedAmount.add(_tokensAllotment);
emit InvestorAdded(_investor, _msgSender(), _tokensAllotment);
}
/// @dev Removes investor. This function doesn't limit max gas consumption,
/// so having too many investors can cause it to reach the out-of-gas error.
/// @param _investor Investor address.
function removeInvestor(address _investor) external onlyOwner() {
require(_investor != address(0), "invalid address");
Investor storage investor = investorsInfo[_investor];
uint256 allocation = investor.tokensAllotment;
require(allocation > 0, "the investor doesn't exist");
_totalAllocatedAmount = _totalAllocatedAmount.sub(allocation);
investor.exists = false;
investor.tokensAllotment = 0;
emit InvestorRemoved(_investor, _msgSender(), allocation);
}
/// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount
function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
function _calculateAvailablePercentage() private view returns (uint256 availablePercentage) {
uint256 currentTimeStamp = block.timestamp;
uint256 noOfDays = BokkyPooBahsDateTimeLibrary.diffDays(_initialTimestamp, currentTimeStamp);
uint256 noOfMonths = _daysToMonths(noOfDays);
// console.log("Months=%s, Release Percentage=%s%", noOfMonths.add(1), vesting.releasePercentage.div(1e18));
return _privateVesting[noOfMonths];
}
function _daysToMonths(uint256 _days) private view returns (uint256 noOfMonths) {
uint256 noOfDaysInMonth = uint256(30).mul(1e18);
uint256 daysNormalized = _days.mul(1e18);
uint256 noOfMontsNormalized = daysNormalized.div(noOfDaysInMonth);
return noOfMontsNormalized.div(1e18);
}
function recoverToken(address _token, uint256 amount) external onlyOwner {
IERC20(_token).safeTransfer(_msgSender(), amount);
emit RecoverToken(_token, amount);
}
} | _calculatePercentage | function _calculatePercentage(uint256 _amount, uint256 _percentage) private pure returns (uint256 percentage) {
return _amount.mul(_percentage).div(100).div(1e18);
}
| /// @dev calculate percentage value from amount
/// @param _amount amount input to find the percentage
/// @param _percentage percentage for an amount | NatSpecSingleLine | v0.7.4+commit.3f05b770 | {
"func_code_index": [
6727,
6908
]
} | 1,048 |
||||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20Factory | contract PersonalERC20Factory {
// index of created contracts
mapping (address => bool) public validContracts;
address[] public contracts;
// useful to know the row count in contracts index
function getContractCount()
public
view
returns(uint contractCount)
{
return contracts.length;
}
// get all contracts
function getDeployedContracts() public view returns (address[] memory)
{
return contracts;
}
// deploy a new contract
function newPersonalERC20(string memory name, string memory symbol, uint256 init, address owner)
public
returns(address)
{
PersonalERC20 c = new PersonalERC20(name, symbol, init, owner);
validContracts[c] = true;
contracts.push(c);
return c;
}
} | getContractCount | function getContractCount()
public
view
returns(uint contractCount)
{
return contracts.length;
}
| // useful to know the row count in contracts index | LineComment | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
212,
338
]
} | 1,049 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20Factory | contract PersonalERC20Factory {
// index of created contracts
mapping (address => bool) public validContracts;
address[] public contracts;
// useful to know the row count in contracts index
function getContractCount()
public
view
returns(uint contractCount)
{
return contracts.length;
}
// get all contracts
function getDeployedContracts() public view returns (address[] memory)
{
return contracts;
}
// deploy a new contract
function newPersonalERC20(string memory name, string memory symbol, uint256 init, address owner)
public
returns(address)
{
PersonalERC20 c = new PersonalERC20(name, symbol, init, owner);
validContracts[c] = true;
contracts.push(c);
return c;
}
} | getDeployedContracts | function getDeployedContracts() public view returns (address[] memory)
{
return contracts;
}
| // get all contracts | LineComment | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
367,
473
]
} | 1,050 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20Factory | contract PersonalERC20Factory {
// index of created contracts
mapping (address => bool) public validContracts;
address[] public contracts;
// useful to know the row count in contracts index
function getContractCount()
public
view
returns(uint contractCount)
{
return contracts.length;
}
// get all contracts
function getDeployedContracts() public view returns (address[] memory)
{
return contracts;
}
// deploy a new contract
function newPersonalERC20(string memory name, string memory symbol, uint256 init, address owner)
public
returns(address)
{
PersonalERC20 c = new PersonalERC20(name, symbol, init, owner);
validContracts[c] = true;
contracts.push(c);
return c;
}
} | newPersonalERC20 | function newPersonalERC20(string memory name, string memory symbol, uint256 init, address owner)
public
returns(address)
{
PersonalERC20 c = new PersonalERC20(name, symbol, init, owner);
validContracts[c] = true;
contracts.push(c);
return c;
}
| // deploy a new contract | LineComment | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
506,
788
]
} | 1,051 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
251,
437
]
} | 1,052 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
707,
896
]
} | 1,053 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| /**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1142,
1617
]
} | 1,054 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
2080,
2418
]
} | 1,055 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
2870,
3027
]
} | 1,056 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
} | /**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/ | NatSpecMultiLine | add | function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
| /**
* @dev Give an account access to this role.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
156,
339
]
} | 1,057 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
} | /**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/ | NatSpecMultiLine | remove | function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
| /**
* @dev Remove an account's access to this role.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
414,
602
]
} | 1,058 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
} | /**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/ | NatSpecMultiLine | has | function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
| /**
* @dev Check if an account has this role.
* @return bool
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
692,
900
]
} | 1,059 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | Pausable | contract Pausable is PauserRole {
/**
* @dev Emitted when the pause is triggered by a pauser (`account`).
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by a pauser (`account`).
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state. Assigns the Pauser role
* to the deployer.
*/
constructor () internal {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
/**
* @dev Called by a pauser to pause, triggers stopped state.
*/
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev Called by a pauser to unpause, returns to normal state.
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
} | /**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/ | NatSpecMultiLine | paused | function paused() public view returns (bool) {
return _paused;
}
| /**
* @dev Returns true if the contract is paused, and false otherwise.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
605,
688
]
} | 1,060 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | Pausable | contract Pausable is PauserRole {
/**
* @dev Emitted when the pause is triggered by a pauser (`account`).
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by a pauser (`account`).
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state. Assigns the Pauser role
* to the deployer.
*/
constructor () internal {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
/**
* @dev Called by a pauser to pause, triggers stopped state.
*/
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev Called by a pauser to unpause, returns to normal state.
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
} | /**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/ | NatSpecMultiLine | pause | function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
| /**
* @dev Called by a pauser to pause, triggers stopped state.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1185,
1306
]
} | 1,061 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | Pausable | contract Pausable is PauserRole {
/**
* @dev Emitted when the pause is triggered by a pauser (`account`).
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by a pauser (`account`).
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state. Assigns the Pauser role
* to the deployer.
*/
constructor () internal {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
/**
* @dev Called by a pauser to pause, triggers stopped state.
*/
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev Called by a pauser to unpause, returns to normal state.
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
} | /**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/ | NatSpecMultiLine | unpause | function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
| /**
* @dev Called by a pauser to unpause, returns to normal state.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1396,
1519
]
} | 1,062 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/ | NatSpecMultiLine | totalSupply | function totalSupply() external view returns (uint256);
| /**
* @dev Returns the amount of tokens in existence.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
94,
154
]
} | 1,063 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
237,
310
]
} | 1,064 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
534,
616
]
} | 1,065 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
895,
983
]
} | 1,066 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1638,
1717
]
} | 1,067 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
2030,
2132
]
} | 1,068 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | totalSupply | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| /**
* @dev See `IERC20.totalSupply`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
293,
389
]
} | 1,069 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | balanceOf | function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
| /**
* @dev See `IERC20.balanceOf`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
447,
562
]
} | 1,070 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | transfer | function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| /**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
770,
931
]
} | 1,071 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | allowance | function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
| /**
* @dev See `IERC20.allowance`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
989,
1128
]
} | 1,072 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | approve | function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
| /**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1270,
1423
]
} | 1,073 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
| /**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1889,
2150
]
} | 1,074 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | increaseAllowance | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
| /**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
2554,
2765
]
} | 1,075 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | decreaseAllowance | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
| /**
* @dev 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 `IERC20.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`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
3263,
3484
]
} | 1,076 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | _transfer | 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);
}
| /**
* @dev 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`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
3969,
4403
]
} | 1,077 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | _mint | 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);
}
| /** @dev 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
4679,
4992
]
} | 1,078 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | _burn | 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);
}
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
5320,
5631
]
} | 1,079 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | _approve | 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);
}
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
6066,
6406
]
} | 1,080 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20 | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev 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 `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev 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 `IERC20.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`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev 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`.
*/
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);
}
/** @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev 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.
*/
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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
} | _burnFrom | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
| /**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
6586,
6779
]
} | 1,081 |
|||
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20Burnable | contract ERC20Burnable is ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
} | /**
* @dev Extension of `ERC20` that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/ | NatSpecMultiLine | burn | function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
| /**
* @dev Destroys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
143,
229
]
} | 1,082 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | ERC20Burnable | contract ERC20Burnable is ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
} | /**
* @dev Extension of `ERC20` that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/ | NatSpecMultiLine | burnFrom | function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
| /**
* @dev See `ERC20._burnFrom`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
286,
394
]
} | 1,083 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20 | contract PersonalERC20 is MinterRole, ERC20Burnable, ERC20Pausable {
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
/**
* @dev Sets the values for `name`, `symbol`, 'init', 'owner'. All four of
* these values are immutable: they can only be set once during
* construction. Decimals are defaulted to '18', per ERC20 norms, imitating
* the relationship between Ether and Wei.
*/
constructor (string memory name, string memory symbol, uint256 init, address owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_balances[_owner] = init; // provides initial deposit to owner set by constructor
_totalSupply = init; // initializes totalSupply with initial deposit
_addMinter(_owner);
_addPauser(_owner);
emit Transfer(address(0), _owner, _totalSupply);
}
/**
* @dev See `ERC20._mint`.
*
* Requirements:
*
* - the caller must have the `MinterRole`.
*/
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token's initial owner.
*/
function owner() public view returns (address) {
return _owner;
}
} | /**
* @dev Extension of ERC20 standard designed for simple 'personal token' deployments.
*/ | NatSpecMultiLine | mint | function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
| /**
* @dev See `ERC20._mint`.
*
* Requirements:
*
* - the caller must have the `MinterRole`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1117,
1265
]
} | 1,084 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20 | contract PersonalERC20 is MinterRole, ERC20Burnable, ERC20Pausable {
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
/**
* @dev Sets the values for `name`, `symbol`, 'init', 'owner'. All four of
* these values are immutable: they can only be set once during
* construction. Decimals are defaulted to '18', per ERC20 norms, imitating
* the relationship between Ether and Wei.
*/
constructor (string memory name, string memory symbol, uint256 init, address owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_balances[_owner] = init; // provides initial deposit to owner set by constructor
_totalSupply = init; // initializes totalSupply with initial deposit
_addMinter(_owner);
_addPauser(_owner);
emit Transfer(address(0), _owner, _totalSupply);
}
/**
* @dev See `ERC20._mint`.
*
* Requirements:
*
* - the caller must have the `MinterRole`.
*/
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token's initial owner.
*/
function owner() public view returns (address) {
return _owner;
}
} | /**
* @dev Extension of ERC20 standard designed for simple 'personal token' deployments.
*/ | NatSpecMultiLine | name | function name() public view returns (string memory) {
return _name;
}
| /**
* @dev Returns the name of the token.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1334,
1422
]
} | 1,085 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20 | contract PersonalERC20 is MinterRole, ERC20Burnable, ERC20Pausable {
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
/**
* @dev Sets the values for `name`, `symbol`, 'init', 'owner'. All four of
* these values are immutable: they can only be set once during
* construction. Decimals are defaulted to '18', per ERC20 norms, imitating
* the relationship between Ether and Wei.
*/
constructor (string memory name, string memory symbol, uint256 init, address owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_balances[_owner] = init; // provides initial deposit to owner set by constructor
_totalSupply = init; // initializes totalSupply with initial deposit
_addMinter(_owner);
_addPauser(_owner);
emit Transfer(address(0), _owner, _totalSupply);
}
/**
* @dev See `ERC20._mint`.
*
* Requirements:
*
* - the caller must have the `MinterRole`.
*/
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token's initial owner.
*/
function owner() public view returns (address) {
return _owner;
}
} | /**
* @dev Extension of ERC20 standard designed for simple 'personal token' deployments.
*/ | NatSpecMultiLine | symbol | function symbol() public view returns (string memory) {
return _symbol;
}
| /**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
1536,
1628
]
} | 1,086 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20 | contract PersonalERC20 is MinterRole, ERC20Burnable, ERC20Pausable {
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
/**
* @dev Sets the values for `name`, `symbol`, 'init', 'owner'. All four of
* these values are immutable: they can only be set once during
* construction. Decimals are defaulted to '18', per ERC20 norms, imitating
* the relationship between Ether and Wei.
*/
constructor (string memory name, string memory symbol, uint256 init, address owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_balances[_owner] = init; // provides initial deposit to owner set by constructor
_totalSupply = init; // initializes totalSupply with initial deposit
_addMinter(_owner);
_addPauser(_owner);
emit Transfer(address(0), _owner, _totalSupply);
}
/**
* @dev See `ERC20._mint`.
*
* Requirements:
*
* - the caller must have the `MinterRole`.
*/
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token's initial owner.
*/
function owner() public view returns (address) {
return _owner;
}
} | /**
* @dev Extension of ERC20 standard designed for simple 'personal token' deployments.
*/ | NatSpecMultiLine | decimals | function decimals() public view returns (uint8) {
return _decimals;
}
| /**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
2192,
2280
]
} | 1,087 |
|
PersonalERC20Factory | PersonalERC20Factory.sol | 0x2cdd094120783abd27dd979de423a25ae45601ed | Solidity | PersonalERC20 | contract PersonalERC20 is MinterRole, ERC20Burnable, ERC20Pausable {
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
/**
* @dev Sets the values for `name`, `symbol`, 'init', 'owner'. All four of
* these values are immutable: they can only be set once during
* construction. Decimals are defaulted to '18', per ERC20 norms, imitating
* the relationship between Ether and Wei.
*/
constructor (string memory name, string memory symbol, uint256 init, address owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_balances[_owner] = init; // provides initial deposit to owner set by constructor
_totalSupply = init; // initializes totalSupply with initial deposit
_addMinter(_owner);
_addPauser(_owner);
emit Transfer(address(0), _owner, _totalSupply);
}
/**
* @dev See `ERC20._mint`.
*
* Requirements:
*
* - the caller must have the `MinterRole`.
*/
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token's initial owner.
*/
function owner() public view returns (address) {
return _owner;
}
} | /**
* @dev Extension of ERC20 standard designed for simple 'personal token' deployments.
*/ | NatSpecMultiLine | owner | function owner() public view returns (address) {
return _owner;
}
| /**
* @dev Returns the token's initial owner.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | bzzr://4c47716c55d6caa927fe2f18c2ba24972ce69ad9730960ea53485d41c4f67bf9 | {
"func_code_index": [
2353,
2437
]
} | 1,088 |
|
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
165,
238
]
} | 1,089 |
||
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
462,
544
]
} | 1,090 |
||
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
823,
911
]
} | 1,091 |
||
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
1575,
1654
]
} | 1,092 |
||
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev 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.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev 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.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
1967,
2069
]
} | 1,093 |
||
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev 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.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
259,
445
]
} | 1,094 |
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev 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.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
723,
864
]
} | 1,095 |
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev 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.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
1162,
1359
]
} | 1,096 |
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev 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.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| /**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
1613,
2089
]
} | 1,097 |
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev 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.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
2560,
2697
]
} | 1,098 |
SSPARK | SSPARK.sol | 0xed90c424a1044479e24d710d85ca0cb4d0f34b00 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev 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.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev 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.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev 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.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev 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.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | Unlicense | ipfs://98e00f45558a48b89c992117ea1ba1710b63ee655bd60c94b4191f8634ba9986 | {
"func_code_index": [
3188,
3471
]
} | 1,099 |
Subsets and Splits