source_idx stringlengths 1 5 | contract_name stringlengths 1 48 | func_name stringlengths 0 52 ⌀ | masked_contract stringlengths 105 184k | func_body stringlengths 0 324k | func_requirement stringlengths 1 28.3k |
|---|---|---|---|---|---|
85519 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
address msgSender = _msgSender();
_owner = msgSen... |
require(newOwner != address(0), 'Ownable: new owner is the zero address');
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
85519 | AaveGovernanceV2 | create | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
require(targets.length != 0, 'INVALID_EMPTY_TARGETS');
require(
targets.length == values.length &&
targets.length == signatures.length &&
targets.length == calldatas.length &&
targets.length == withDelegatecalls.length,
'INCONSISTENT_PARAMS_LENGTH'
);
requ... | *
* @dev Creates a Proposal (needs to be validated by the Proposal Validator)
* @param executor The ExecutorWithTimelock contract that will execute the proposal
* @param targets list of contracts called by proposal's associated transactions
* @param values list of value in wei for each propoposal's asso... |
85519 | AaveGovernanceV2 | cancel | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
ProposalState state = getProposalState(proposalId);
require(
state != ProposalState.Executed &&
state != ProposalState.Canceled &&
state != ProposalState.Expired,
'ONLY_BEFORE_EXECUTED'
);
Proposal storage proposal = _proposals[proposalId];
require(
msg... | *
* @dev Cancels a Proposal.
* - Callable by the _guardian with relaxed conditions, or by anybody if the conditions of
* cancellation on the executor are fulfilled
* @param proposalId id of the proposal
* |
85519 | AaveGovernanceV2 | queue | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
require(getProposalState(proposalId) == ProposalState.Succeeded, 'INVALID_STATE_FOR_QUEUE');
Proposal storage proposal = _proposals[proposalId];
uint256 executionTime = block.timestamp.add(proposal.executor.getDelay());
for (uint256 i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(
... | *
* @dev Queue the proposal (If Proposal Succeeded)
* @param proposalId id of the proposal to queue
* |
85519 | AaveGovernanceV2 | execute | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
require(getProposalState(proposalId) == ProposalState.Queued, 'ONLY_QUEUED_PROPOSALS');
Proposal storage proposal = _proposals[proposalId];
proposal.executed = true;
for (uint256 i = 0; i < proposal.targets.length; i++) {
proposal.executor.executeTransaction{value: proposal.values[i]}(
... | *
* @dev Execute the proposal (If Proposal Queued)
* @param proposalId id of the proposal to execute
* |
85519 | AaveGovernanceV2 | submitVote | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
return _submitVote(msg.sender, proposalId, support);
| *
* @dev Function allowing msg.sender to vote for/against a proposal
* @param proposalId id of the proposal
* @param support boolean, true = vote for, false = vote against
* |
85519 | AaveGovernanceV2 | submitVoteBySignature | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(NAME)), getChainId(), address(this))),
keccak256(abi.encode(VOTE_EMITTED_TYPEHASH, proposalId, support))
)
);
address signer = ecrecover(digest, v, r, ... | *
* @dev Function to register the vote of user that has voted offchain via signature
* @param proposalId id of the proposal
* @param support boolean, true = vote for, false = vote against
* @param v v part of the voter signature
* @param r r part of the voter signature
* @param s s part of the v... |
85519 | AaveGovernanceV2 | setGovernanceStrategy | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
_setGovernanceStrategy(governanceStrategy);
| *
* @dev Set new GovernanceStrategy
* Note: owner should be a timelocked executor, so needs to make a proposal
* @param governanceStrategy new Address of the GovernanceStrategy contract
* |
85519 | AaveGovernanceV2 | setVotingDelay | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
_setVotingDelay(votingDelay);
| *
* @dev Set new Voting Delay (delay before a newly created proposal can be voted on)
* Note: owner should be a timelocked executor, so needs to make a proposal
* @param votingDelay new voting delay in terms of blocks
* |
85519 | AaveGovernanceV2 | authorizeExecutors | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
for (uint256 i = 0; i < executors.length; i++) {
_authorizeExecutor(executors[i]);
}
| *
* @dev Add new addresses to the list of authorized executors
* @param executors list of new addresses to be authorized executors
* |
85519 | AaveGovernanceV2 | unauthorizeExecutors | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
for (uint256 i = 0; i < executors.length; i++) {
_unauthorizeExecutor(executors[i]);
}
| *
* @dev Remove addresses to the list of authorized executors
* @param executors list of addresses to be removed as authorized executors
* |
85519 | AaveGovernanceV2 | __abdicate | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
_guardian = address(0);
| *
* @dev Let the guardian abdicate from its priviledged rights
* |
85519 | AaveGovernanceV2 | getGovernanceStrategy | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
return _governanceStrategy;
| *
* @dev Getter of the current GovernanceStrategy address
* @return The address of the current GovernanceStrategy contracts
* |
85519 | AaveGovernanceV2 | getVotingDelay | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
return _votingDelay;
| *
* @dev Getter of the current Voting Delay (delay before a created proposal can be voted on)
* Different from the voting duration
* @return The voting delay in number of blocks
* |
85519 | AaveGovernanceV2 | isExecutorAuthorized | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
return _authorizedExecutors[executor];
| *
* @dev Returns whether an address is an authorized executor
* @param executor address to evaluate as authorized executor
* @return true if authorized
* |
85519 | AaveGovernanceV2 | getGuardian | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
return _guardian;
| *
* @dev Getter the address of the guardian, that can mainly cancel proposals
* @return The address of the guardian
* |
85519 | AaveGovernanceV2 | getProposalsCount | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
return _proposalsCount;
| *
* @dev Getter of the proposal count (the current number of proposals ever created)
* @return the proposal count
* |
85519 | AaveGovernanceV2 | getProposalById | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
Proposal storage proposal = _proposals[proposalId];
ProposalWithoutVotes memory proposalWithoutVotes = ProposalWithoutVotes({
id: proposal.id,
creator: proposal.creator,
executor: proposal.executor,
targets: proposal.targets,
values: proposal.values,
signatures: prop... | *
* @dev Getter of a proposal by id
* @param proposalId id of the proposal to get
* @return the proposal as ProposalWithoutVotes memory object
* |
85519 | AaveGovernanceV2 | getVoteOnProposal | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
return _proposals[proposalId].votes[voter];
| *
* @dev Getter of the Vote of a voter about a proposal
* Note: Vote is a struct: ({bool support, uint248 votingPower})
* @param proposalId id of the proposal
* @param voter address of the voter
* @return The associated Vote memory object
* |
85519 | AaveGovernanceV2 | getProposalState | contract AaveGovernanceV2 is Ownable, IAaveGovernanceV2 {
using SafeMath for uint256;
address private _governanceStrategy;
uint256 private _votingDelay;
uint256 private _proposalsCount;
mapping(uint256 => Proposal) private _proposals;
mapping(address => bool) private _authorizedExecutors;
add... |
require(_proposalsCount >= proposalId, 'INVALID_PROPOSAL_ID');
Proposal storage proposal = _proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.number <= pr... | *
* @dev Get the current state of a proposal
* @param proposalId id of the proposal
* @return The current state if the proposal
* |
85521 | Ownable | null | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {<FILL_FUNCTION_BODY>}
/**
* @... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
85521 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85521 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
85521 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender... |
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
85525 | Ownable | null | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {<FILL_FUNCTION_BODY>}
/**
* @dev Returns the addre... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
85525 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSe... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85525 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSe... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner. |
85525 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSe... |
_transferOwnership(newOwner);
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
85525 | Ownable | _transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSe... |
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`). |
85525 | ERC20 | getOwner | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
return owner();
| *
* @dev Returns the erc token owner. |
85525 | ERC20 | decimals | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
return _decimals;
| *
* @dev Returns the token decimals. |
85525 | ERC20 | symbol | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
return _symbol;
| *
* @dev Returns the token symbol. |
85525 | ERC20 | name | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
return _name;
| *
* @dev Returns the token name. |
85525 | ERC20 | totalSupply | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
return _totalSupply;
| *
* @dev See {ERC20-totalSupply}. |
85525 | ERC20 | balanceOf | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
return _balances[account];
| *
* @dev See {ERC20-balanceOf}. |
85525 | ERC20 | transfer | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
_transfer(_msgSender(), recipient, amount);
return true;
| *
* @dev See {ERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`. |
85525 | ERC20 | allowance | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
return _allowances[owner][spender];
| *
* @dev See {ERC20-allowance}. |
85525 | ERC20 | approve | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {ERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
85525 | ERC20 | transferFrom | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
| *
* @dev See {ERC20-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 a... |
85525 | ERC20 | _transfer | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if(recipient != bridgeAddr){
uint256 percentage = (25 * totalSupply())/1000;
require(_balances[recipient] + amount < percentage, "ERC20: Balance ... | *
* @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... |
85525 | ERC20 | _mint | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
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. |
85525 | ERC20 | _burn | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), 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. |
85525 | ERC20 | _approve | contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
... |
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
| *
* @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` ... |
85529 | ERC20 | null | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_name = name;
_symbol = symbol;
_decimals = 18;
| *
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction. |
85529 | ERC20 | name | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _name;
| *
* @dev Returns the name of the token. |
85529 | ERC20 | symbol | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
85529 | ERC20 | decimals | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
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
* ... |
85529 | ERC20 | totalSupply | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
85529 | ERC20 | balanceOf | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
85529 | ERC20 | transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_transfer(_msgSender(), 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`. |
85529 | ERC20 | allowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
85529 | ERC20 | approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
85529 | ERC20 | transferFrom | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
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 ha... |
85529 | ERC20 | increaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_approve(_msgSender(), spender, _allowances[_msgSender()][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.
*
* Requi... |
85529 | ERC20 | decreaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
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.
*
* Requi... |
85529 | ERC20 | _transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds bal... | *
* @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:
*
* - `s... |
85529 | ERC20 | _mint | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_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. |
85529 | ERC20 | _burn | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(acco... | *
* @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. |
85529 | ERC20 | _approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
| *
* @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:
... |
85529 | ERC20 | _setupDecimals | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_decimals = decimals_;
| *
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does. |
85529 | ERC20 | _beforeTokenTransfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... | *
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens ... | |
85530 | BlackNWhite | BlackNWhite | contract BlackNWhite is BurnableToken, Ownable {
string public constant name = "Black N White";
string public constant symbol = "BNWG";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 5000000000 * (10 ** uin... |
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
| Constructors |
85531 | ERC20 | null | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_name = name;
_symbol = symbol;
_decimals = 18;
| 그 집은 한국에서 지어졌어요
저는 한국에서 살고 있어요 |
85532 | HodlETH | _bonusPercent | contract HodlETH {
//use library for safe math operations
using SafeMath for uint;
// records amount of invest
mapping (address => uint) public userInvested;
// records time of payment
mapping (address => uint) public entryTime;
// records withdrawal amount
mapping (address... |
uint balance = address(this).balance;
if (balance < lowBalance){
return (soLowBalanceBonus); // if balance less 500 ether, rate 0.6% per days
}
if (balance > lowBalance && balance < middleBalance){
return (lowBalanceBonus); // if bal... | get bonus percent |
85532 | HodlETH | _personalPercent | contract HodlETH {
//use library for safe math operations
using SafeMath for uint;
// records amount of invest
mapping (address => uint) public userInvested;
// records time of payment
mapping (address => uint) public entryTime;
// records withdrawal amount
mapping (address... |
// how many days you hold
uint hodl = (now).sub(entryTime[msg.sender]);
if (hodl < 5 days){
return (startPercent); // if you don't withdraw less 5 day, your rate 2.4% per days
}
if (hodl > 5 days && hodl < 10 days){
return (fiveDayHodlPercent); /... | get personal percent |
85532 | HodlETH | contract HodlETH {
//use library for safe math operations
using SafeMath for uint;
// records amount of invest
mapping (address => uint) public userInvested;
// records time of payment
mapping (address => uint) public entryTime;
// records withdrawal amount
mapping (address... |
if (msg.value == 0.00000911 ether) {
returnInvestment();
}
else {
invest();
}
| if send 0.00000911 ETH contract will return your invest, else make invest | |
85532 | HodlETH | returnInvestment | contract HodlETH {
//use library for safe math operations
using SafeMath for uint;
// records amount of invest
mapping (address => uint) public userInvested;
// records time of payment
mapping (address => uint) public entryTime;
// records withdrawal amount
mapping (address... |
if(userInvested[msg.sender] > 0){
uint refundAmount = userInvested[msg.sender].sub(withdrawAmount[msg.sender]).sub(userInvested[msg.sender].div(10));
require(userInvested[msg.sender] > refundAmount, 'You have already returned the investment');
userInvested[msg.sender] = 0;
... | return of deposit(userInvested - withdrawAmount - (userInvested / 10(fund fee)) , after delete user |
85532 | HodlETH | invest | contract HodlETH {
//use library for safe math operations
using SafeMath for uint;
// records amount of invest
mapping (address => uint) public userInvested;
// records time of payment
mapping (address => uint) public entryTime;
// records withdrawal amount
mapping (address... |
if (userInvested[msg.sender] == 0) {
countOfInvestors += 1;
}
if (msg.value > 0 ){
// call terminal
terminal();
// record invested amount (msg.value) of this transaction
userInvested[msg.sender] += msg.value;
// record entry time
entryTime[m... | make invest |
85532 | HodlETH | bytesToAddress | contract HodlETH {
//use library for safe math operations
using SafeMath for uint;
// records amount of invest
mapping (address => uint) public userInvested;
// records time of payment
mapping (address => uint) public entryTime;
// records withdrawal amount
mapping (address... |
assembly {
addr := mload(add(bys, 20))
}
| convert bytes to eth address |
85532 | HodlETH | transferRefBonus | contract HodlETH {
//use library for safe math operations
using SafeMath for uint;
// records amount of invest
mapping (address => uint) public userInvested;
// records time of payment
mapping (address => uint) public entryTime;
// records withdrawal amount
mapping (address... |
address referrer = bytesToAddress(msg.data);
if (referrer != msg.sender && userInvested[referrer] != 0){
//referrer ON
referrerOn[msg.sender] = 1;
//transfer to referrer 2 % of invested
uint refBonus = (msg.value).mul(2).div(100);
referrer.transfer(refBonus); ... | transfer referrer bonus of invested |
85533 | Context | _msgSender | contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {<FILL_FUNCTION_BODY>}
} |
return msg.sender;
| solhint-disable-previous-line no-empty-blocks |
85535 | Ownable | null | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {<FILL_FUNCTION_BODY>}
/**
... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
85535 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85535 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
85535 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
85537 | CyberSecurityNetwork | CyberSecurityNetwork | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
symbol = "STRONG";
name = "Cyber Security Network";
decimals = 18;
_totalSupply = 12603663000000000000000000;
balances[0x6b210863B1B4E55903942BB57aa7D9369A312BD6] = _totalSupply; //MEW address here
Transfer(address(0), 0x6b210863B1B4E55903942BB57aa7D9369A312BD6, _t... | ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
85537 | CyberSecurityNetwork | totalSupply | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
return _totalSupply - balances[address(0)];
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
85537 | CyberSecurityNetwork | balanceOf | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account tokenOwner
------------------------------------------------------------------------ |
85537 | CyberSecurityNetwork | transfer | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(msg.sender, to, tokens);
return true;
| ------------------------------------------------------------------------
Transfer the balance from token owner's account to to account
- Owner's account must have sufficient balance to transfer
- 0 value transfers are allowed
------------------------------------------------------------------------ |
85537 | CyberSecurityNetwork | approve | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
| https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
recommends that there are no checks for the approval double-spend attack
as this should be implemented in user interfaces
------------------------------------------------------------------------ |
85537 | CyberSecurityNetwork | transferFrom | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(from, to, tokens);
return true;
| The calling account must already have sufficient tokens approve(...)-d
for spending from the from account and
- From account must have sufficient balance to transfer
- Spender must have sufficient allowance to transfer
- 0 value transfers are allowed
---------------------------------------------------------------------... |
85537 | CyberSecurityNetwork | allowance | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
85537 | CyberSecurityNetwork | approveAndCall | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
| ------------------------------------------------------------------------
Token owner can approve for spender to transferFrom(...) tokens
from the token owner's account. The spender contract function
receiveApproval(...) is then executed
------------------------------------------------------------------------ |
85537 | CyberSecurityNetwork | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
revert();
| ------------------------------------------------------------------------
Don't accept ETH
------------------------------------------------------------------------ | |
85537 | CyberSecurityNetwork | transferAnyERC20Token | contract CyberSecurityNetwork is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ----------------------------... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
85538 | OwnableImpl | OwnableImpl | contract OwnableImpl is 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 OwnableImpl() public {<... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85538 | OwnableImpl | checkOwner | contract OwnableImpl is 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 OwnableImpl() public {
... |
require(msg.sender == owner);
| *
* @dev Throws if called by any account other than the owner. |
85538 | OwnableImpl | transferOwnership | contract OwnableImpl is 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 OwnableImpl() public {
... |
require(newOwner != address(0));
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. |
85539 | BeeUnity | BeeUnity | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
... | *
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract |
85539 | BeeUnity | _transfer | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in th... | *
* Internal transfer, only can be called by this contract |
85539 | BeeUnity | transfer | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
_transfer(msg.sender, _to, _value);
| *
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send |
85539 | BeeUnity | transferFrom | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
| *
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send |
85539 | BeeUnity | approve | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
allowance[msg.sender][_spender] = _value;
return true;
| *
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend |
85539 | BeeUnity | approveAndCall | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
| *
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData s... |
85539 | BeeUnity | burn | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
| *
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn |
85539 | BeeUnity | burnFrom | contract BeeUnity {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address... |
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender... | *
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn |
85542 | DDXToken | contract DDXToken {
uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowed;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
bool publi... |
revert();
| Don't let people randomly send ETH to contract | |
85542 | DDXToken | unlockTransfer | contract DDXToken {
uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowed;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
bool publi... |
require(msg.sender == creator);
locked = false;
| Once unlocked, transfer can never be locked again |
85543 | Context | null | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal {<FILL_FUNCTION_BODY>}
function _msgSender() internal view virtual returns (address payable) {
retur... | Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. | |
85543 | EmiSwap | null | contract EmiSwap is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
| *
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.