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 |
|---|---|---|---|---|---|
85226 | RICHToken | allowance | contract RICHToken is Owned, Token {
using SafeMath for uint256;
// Ethereum token standaard
string public standard = "Token 0.1";
// Full name
string public name = "RICH token";
// Symbol
string public symbol = "RCH";
// No decimal points
uint8 public decimals = 8... |
return allowed[_owner][_spender];
| *
* Get the amount of remaining tokens that `_spender` is allowed to spend from `_owner`
*
* @param _owner The address of the account owning tokens
* @param _spender The address of the account able to transfer the tokens
* @return Amount of remaining tokens allowed to spent |
85226 | RICHToken | RICHToken | contract RICHToken is Owned, Token {
using SafeMath for uint256;
// Ethereum token standaard
string public standard = "Token 0.1";
// Full name
string public name = "RICH token";
// Symbol
string public symbol = "RCH";
// No decimal points
uint8 public decimals = 8... |
balances[msg.sender] = 0;
totalSupply = 0;
locked = false;
| *
* Starts with a total supply of zero and the creator starts with
* zero tokens (just like everyone else) |
85226 | RICHToken | unlock | contract RICHToken is Owned, Token {
using SafeMath for uint256;
// Ethereum token standaard
string public standard = "Token 0.1";
// Full name
string public name = "RICH token";
// Symbol
string public symbol = "RCH";
// No decimal points
uint8 public decimals = 8... |
locked = false;
return true;
| *
* Unlocks the token irreversibly so that the transfering of value is enabled
*
* @return Whether the unlocking was successful or not |
85226 | RICHToken | issue | contract RICHToken is Owned, Token {
using SafeMath for uint256;
// Ethereum token standaard
string public standard = "Token 0.1";
// Full name
string public name = "RICH token";
// Symbol
string public symbol = "RCH";
// No decimal points
uint8 public decimals = 8... |
// Create tokens
balances[_recipient] += _value;
totalSupply += _value;
balancesPerIcoPeriod[_recipient][getCurrentIcoNumber()] = balances[_recipient];
return true;
| *
* Issues `_value` new tokens to `_recipient`
*
* @param _recipient The address to which the tokens will be issued
* @param _value The amount of new tokens to issue
* @return Whether the approval was successful or not |
85226 | RICHToken | isIncreasedEnough | contract RICHToken is Owned, Token {
using SafeMath for uint256;
// Ethereum token standaard
string public standard = "Token 0.1";
// Full name
string public name = "RICH token";
// Symbol
string public symbol = "RCH";
// No decimal points
uint8 public decimals = 8... |
uint256 currentIcoNumber = getCurrentIcoNumber();
if (currentIcoNumber - 2 < 0) {
return true;
}
uint256 currentBalance = balances[_investor];
uint256 icosBefore = balancesPerIcoPeriod[_investor][currentIcoNumber - 2];
if (icosBefore == 0) {
... | *
* Check if investor has invested enough to avoid burning
*
* @param _investor Investor
* @return Whether investor has invested enough or not |
85226 | RICHToken | burn | contract RICHToken is Owned, Token {
using SafeMath for uint256;
// Ethereum token standaard
string public standard = "Token 0.1";
// Full name
string public name = "RICH token";
// Symbol
string public symbol = "RCH";
// No decimal points
uint8 public decimals = 8... |
uint256 burnLine = getBurnLine();
if (balances[_investor] > burnLine || isIncreasedEnough(_investor)) {
return;
}
uint256 toBeBurned = burnLine - balances[_investor];
if (toBeBurned > balances[_investor]) {
toBeBurned = balances[_investor];
... | *
* Function that everyone can call and burn for other tokens if they can
* be burned. In return, 10% of burned tokens go to executor of function
*
* @param _investor Address of investor which tokens are subject of burn |
85226 | RICHToken | contract RICHToken is Owned, Token {
using SafeMath for uint256;
// Ethereum token standaard
string public standard = "Token 0.1";
// Full name
string public name = "RICH token";
// Symbol
string public symbol = "RCH";
// No decimal points
uint8 public decimals = 8... |
throw;
| *
* Prevents accidental sending of ether | |
85228 | 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. |
85228 | 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. |
85228 | 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 ... |
85228 | 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. |
85230 | Token | balanceOf | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
return _balances[owner];
| *
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address. |
85230 | Token | allowance | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
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. |
85230 | Token | transfer | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
_transfer(msg.sender, to, value);
return true;
| *
* @dev Transfer token to a specified address.
* @param to The address to transfer to.
* @param value The amount to be transferred. |
85230 | Token | approve | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
_approve(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 thi... |
85230 | Token | transferFrom | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
| *
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
*... |
85230 | Token | increaseAllowance | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
| *
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][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 T... |
85230 | Token | decreaseAllowance | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
| *
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][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 T... |
85230 | Token | _transfer | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
require(to != address(0), "Cannot transfer to zero address");
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
| *
* @dev Transfer token for a specified address.
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred. |
85230 | Token | _approve | contract Token {
using SafeMath for uint256;
string public constant name = "Africa Trading Chain-ERC20";
string public constant symbol = "ATTE";
uint8 public constant decimals = 6;
uint256 private constant INITIAL_SUPPLY = 990000000000;
uint256 public constant totalSupply = INITIAL... |
require(spender != address(0), "Cannot approve to the zero address");
require(owner != address(0), "Setter cannot be a zero address");
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
| *
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent. |
85233 | LNI | owner | contract LNI is Context, IERC20 {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mappin... |
return _owner;
| ===============================================================================================================
===============================================================================================================
================================================================================================... |
85233 | LNI | totalSupply | contract LNI is Context, IERC20 {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mappin... | return _tTotal; | ===============================================================================================================
===============================================================================================================
================================================================================================... |
85234 | Ownable | null | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85234 | Ownable | renounceOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
emit OwnershipRenounced(owner);
owner = address(0);
| *
* @dev Allows the current owner to relinquish control of the contract. |
85234 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
_transferOwnership(_newOwner);
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
85234 | Ownable | _transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
| *
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
85234 | Pausable | pause | 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 ... |
paused = true;
emit Pause();
| *
* @dev called by the owner to pause, triggers stopped state |
85234 | Pausable | unpause | 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 ... |
paused = false;
emit Unpause();
| *
* @dev called by the owner to unpause, returns to normal state |
85234 | Arbitrator | isArbitrator | contract Arbitrator is Ownable {
mapping(address => bool) private aribitratorWhitelist;
address private primaryArbitrator;
event ArbitratorAdded(address indexed newArbitrator);
event ArbitratorRemoved(address indexed newArbitrator);
event ChangePrimaryArbitratorWallet(address indexed newPrimaryWallet... |
return (aribitratorWhitelist[arbitratorCheck] || arbitratorCheck == primaryArbitrator);
| Mainly for front-end administration |
85234 | ApprovedWithdrawer | isApprovedWallet | contract ApprovedWithdrawer is Ownable {
mapping(address => bool) private withdrawerWhitelist;
address private primaryWallet;
event WalletApproved(address indexed newAddress);
event WalletRemoved(address indexed removedAddress);
event ChangePrimaryApprovedWallet(address indexed newPrimaryWallet);
... |
return (withdrawerWhitelist[walletCheck] || walletCheck == primaryWallet);
| Mainly for front-end administration |
85234 | CoinSparrow | null | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
require(_maxSend > 0);
//a bit of protection. Set a limit, so users can't send stupid amounts of ETH
MAX_SEND = _maxSend;
| *
* ----------------------
* CONTRACT FUNCTIONALITY
* ----------------------
*
* @dev Constructor function for the contract
* @param _maxSend Maximum Wei the contract will accept in a transaction |
85234 | CoinSparrow | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//Log who sent, and how much so it can be returned
emit LogFallbackFunctionCalled(msg.sender, msg.value);
| *
* @dev fallback function for the contract. Log event so ETH can be tracked and returned | |
85234 | CoinSparrow | createJobEscrow | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
// Check sent eth against _value and also make sure is not 0
require(msg.value == _value && msg.value > 0);
//CoinSparrow's Fee should be less than the Job Value, because anything else would be daft.
require(_fee < _value);
//Check the amount sent is below the acceptable threshold
r... | *
* @dev Create a new escrow and add it to the `jobEscrows` mapping.
* Also updates/creates a reference to the job, and amount in Escrow for the job in hirerEscrowMap
* jobHash is created by hashing _jobId, _seller, _buyer, _value and _fee params.
* These params must be supplied on future contract calls... |
85234 | CoinSparrow | hirerReleaseFunds | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
//check hirer has funds in the Smart Contract assigned to this job
require(hirerEscrowMap[msg.sender][j... | *
* -----------------------
* RELEASE FUNDS FUNCTIONS
* -----------------------
*
* @dev Release funds to contractor. Can only be called by Hirer. Can be called at any time as long as the
* job exists in the contract (for example, two parties may have agreed job is complete external to the
* Coi... |
85234 | CoinSparrow | contractorReleaseFunds | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
//check job is actually completed
require(jobEscrows[jobHash].status == STATUS_JOB_COMPLETED);
//c... | *
* @dev Release funds to contractor in the event that the Hirer is unresponsive after job has been flagged as complete.
* Can only be called by the contractor, and only 4 weeks after the job has been flagged as complete.
* Following parameters are used to regenerate the jobHash:
* @param _jobId The uni... |
85234 | CoinSparrow | hirerLastResortRefund | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
//check job is started
require(jobEscrows[jobHash].status == STATUS_JOB_STARTED);
//can only sel... | *
* @dev Can be called by the hirer to claim a full refund, if job has been started but contractor has not
* completed within 4 weeks after agreed completion date, and becomes unresponsive.
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the Coin... |
85234 | CoinSparrow | jobStarted | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
//check job status.
require(jobEscrows[jobHash].status == STATUS_JOB_CREATED);
job... | *
* ---------------------------
* UPDATE JOB STATUS FUNCTIONS
* ---------------------------
*
* @dev Flags job started, and Stops the hirer from cancelling the job.
* Can only be called the contractor when job starts.
* Used to mark the job as started. After this point, hirer must request cancel... |
85234 | CoinSparrow | jobCompleted | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
require(jobEscrows[jobHash].exists); //check the job exists in the contract
require(jobEscrows[jobHash].status == STATUS_JOB_STARTED); //check job status.
jobEscrows[jo... | *
* @dev Flags job completed to inform hirer. Also sets flag to allow contractor to get their funds 4 weeks after
* completion in the event that the hirer is unresponsive and doesn't release the funds.
* Can only be called the contractor when job complete.
* Following parameters are used to regenerate t... |
85234 | CoinSparrow | contractorCancel | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
uint256 jobValue = hirerEscrowMap[_hirer][jobHash];
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
//Check values in contract and ... | *
* --------------------------
* JOB CANCELLATION FUNCTIONS
* --------------------------
*
* @dev Cancels the job and returns the ether to the hirer.
* Can only be called the contractor. Can be called at any time during the process
* Following parameters are used to regenerate the jobHash:
*... |
85234 | CoinSparrow | hirerCancel | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
require(jobEscrows[jobHash].hirerCanCancelAfter > 0);
require(jobEscrows[jobHash].sta... | *
* @dev Cancels the job and returns the ether to the hirer.
* Can only be called the hirer.
* Can only be called if the job start window was missed by the contractor
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
... |
85234 | CoinSparrow | requestMutualJobCancellation | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
require(jobEscrows[jobHash].status == STATUS_JOB_STARTED);
if (msg.sender == _hirer) ... | *
* @dev Called by the hirer or contractor to request mutual cancellation once job has started
* Can only be called when status = STATUS_JOB_STARTED
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The ... |
85234 | CoinSparrow | processMutuallyAgreedJobCancellation | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
require(msg.sender == _hirer || msg.sender == _contractor);
require(_contractorPercen... | *
* @dev Called when both hirer and contractor have agreed on cancellation conditions, and amount each will receive
* can be called by hirer or contractor once % amount has been signed by both parties.
* Both parties sign a hash of the % agreed upon. The signatures of both parties must be sent and verified
... |
85234 | CoinSparrow | requestDispute | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
require(
jobEscrows[jobHash].status == STATUS_JOB_STARTED||
jobEscrows[jobHa... | *
* -------------------------
* DISPUTE RELATED FUNCTIONS
* -------------------------
*
* @dev Called by hirer or contractor to raise a dispute during started, completed or canellation request statuses
* Once called, funds are locked until arbitrator can resolve the dispute. Assigned arbitrator
... |
85234 | CoinSparrow | resolveDispute | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
//check the job exists in the contract
require(jobEscrows[jobHash].exists);
require(jobEscrows[jobHash].status == STATUS_JOB_IN_DISPUTE);
require(_contractorPerc... | *
* @dev Called by the arbitrator to resolve a dispute
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet address of the hiring (buying) party
* @param _contractor The wallet address of the contractor (selling) party
* @param _value The ether amount be... |
85234 | CoinSparrow | withdrawFees | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
/**
* Withdraw fees collected by the contract. Only the owner can call this.
* Can only be sent to an approved wallet address
*/
require(_amount > 0);
require(_amount <= feesAvailableForWithdraw && feesAvailableForWithdraw > 0);
feesAvailableForWithdraw = feesAvailableForWithdra... | *
* ------------------------
* ADMINISTRATIVE FUNCTIONS
* ------------------------
*
* @dev Allows owner to transfer funds from the collected fees pool to an approved wallet address
* @param _to receiver wallet address
* @param _amount amount to withdraw and transfer |
85234 | CoinSparrow | howManyFees | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
return feesAvailableForWithdraw;
| *
* @dev returns how much has been collected in fees, and how much is available to withdraw
* @return feesAvailableForWithdraw amount available for CoinSparrow to withdraw |
85234 | CoinSparrow | howMuchInEscrow | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
return totalInEscrow;
| *
* @dev returns how much is currently held in escrow
* @return totalInEscrow amount currently held in escrow |
85234 | CoinSparrow | setMaxSend | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
require(_maxSend > 0);
MAX_SEND = _maxSend;
| *
* @dev modify the maximum amount of ETH the contract will allow in a transaction (when creating a new job)
* @param _maxSend amount in Wei |
85234 | CoinSparrow | getMaxSend | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
return MAX_SEND;
| *
* @dev return the current maximum amount the contract will allow in a transaction
* @return MAX_SEND current maximum value |
85234 | CoinSparrow | getContractVersion | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
return COINSPARROW_CONTRACT_VERSION;
| *
* @dev returns THIS contract instance's version
* @return COINSPARROW_CONTRACT_VERSION version number of THIS instance of the contract |
85234 | CoinSparrow | getJobStatus | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
uint8 status = STATUS_JOB_NOT_EXIST;
if (jobEscrows[jobHash].exists) {
status = jobEscrows[jobHash].status;
}
return status;
| *
* -------------------------
* JOB INFORMATION FUNCTIONS
* -------------------------
*
* @dev returns the status of the requested job
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet... |
85234 | CoinSparrow | getJobCanCancelAfter | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
uint32 hirerCanCancelAfter = 0;
if (jobEscrows[jobHash].exists) {
hirerCanCancelAfter = jobEscrows[jobHash].hirerCanCancelAfter;
}
return hirerCanCancelAf... | *
* @dev returns the date after which the Hirer can cancel the job
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet address of the hiring (buying) party
* @param _contractor The wallet addres... |
85234 | CoinSparrow | getSecondsToComplete | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
uint32 secondsToComplete = 0;
if (jobEscrows[jobHash].exists) {
secondsToComplete = jobEscrows[jobHash].secondsToComplete;
}
return secondsToComplete;
| *
* @dev returns the number of seconds for job completion
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet address of the hiring (buying) party
* @param _contractor The wallet address of the ... |
85234 | CoinSparrow | getAgreedCompletionDate | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
uint32 agreedCompletionDate = 0;
if (jobEscrows[jobHash].exists) {
agreedCompletionDate = jobEscrows[jobHash].agreedCompletionDate;
}
return agreedComplet... | *
* @dev returns the agreed completion date of the requested job
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet address of the hiring (buying) party
* @param _contractor The wallet address ... |
85234 | CoinSparrow | getActualCompletionDate | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
uint32 jobCompleteDate = 0;
if (jobEscrows[jobHash].exists) {
jobCompleteDate = jobEscrows[jobHash].jobCompleteDate;
}
return jobCompleteDate;
| *
* @dev returns the actual completion date of the job of the requested job
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet address of the hiring (buying) party
* @param _contractor The wall... |
85234 | CoinSparrow | getJobValue | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
//get job Hash
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
uint256 amount = 0;
if (jobEscrows[jobHash].exists) {
amount = hirerEscrowMap[_hirer][jobHash];
}
return amount;
| *
* @dev returns the value for the requested job
* Following parameters are used to regenerate the jobHash:
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet address of the hiring (buying) party
* @param _contractor The wallet address of the contracto... |
85234 | CoinSparrow | validateRefundSignature | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
return checkRefundSignature(_contractorPercent,_sigMsg,_signer);
| *
* @dev Helper function to pre-validate mutual cancellation signatures. Used by front-end app
* to let each party know that the other has signed off the agreed %
* @param _contractorPercent percentage agreed upon
* @param _sigMsg signed message to be validated
* @param _signer wallet address of the... |
85234 | CoinSparrow | checkRefundSignature | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
bytes32 percHash = keccak256(abi.encodePacked(_contractorPercent));
bytes32 msgHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32",percHash));
address addr = ECRecovery.recover(msgHash,_sigMsg);
return addr == _signer;
| *
* @dev Executes the actual signature verification.
* @param _contractorPercent percentage agreed upon
* @param _sigMsg signed message to be validated
* @param _signer wallet address of the message signer to validate against
* @return bool whether or not the signature is valid |
85234 | CoinSparrow | getJobHash | contract CoinSparrow is Ownable, Arbitrator, ApprovedWithdrawer, Pausable {
//Who wouldn't?
using SafeMath for uint256;
/**
* ------------------------------------
* SET UP SOME CONSTANTS FOR JOB STATUS
* ------------------------------------
*/
//Some of these are not used in the contr... |
return keccak256(abi.encodePacked(
_jobId,
_hirer,
_contractor,
_value,
_fee));
| *
* @dev Generates the sha256 jobHash based on job parameters. Used in several functions
* @param _jobId The unique ID of the job, from the CoinSparrow database
* @param _hirer The wallet address of the hiring (buying) party
* @param _contractor The wallet address of the contractor (selling) party
*... |
85236 | 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>}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal v... | Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. | |
85236 | Context | _msgSender | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (addres... |
return msg.sender;
| solhint-disable-previous-line no-empty-blocks |
85236 | ERC20 | totalSupply | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
85236 | ERC20 | balanceOf | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
85236 | ERC20 | transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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`. |
85236 | ERC20 | allowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
85236 | ERC20 | approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
85236 | ERC20 | transferFrom | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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... |
85236 | ERC20 | increaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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... |
85236 | ERC20 | decreaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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... |
85236 | ERC20 | _transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
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, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient]... | *
* @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... |
85236 | ERC20 | _mint | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
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. |
85236 | ERC20 | _burn | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
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. |
85236 | ERC20 | _approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
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:
... |
85236 | ERC20 | _burnFrom | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
| *
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}. |
85236 | ERC20Detailed | null | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
con... |
_name = name;
_symbol = symbol;
_decimals = decimals;
| *
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction. |
85236 | ERC20Detailed | name | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
con... |
return _name;
| *
* @dev Returns the name of the token. |
85236 | ERC20Detailed | symbol | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
con... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
85236 | ERC20Detailed | decimals | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
con... |
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
* ... |
85238 | Token | totalSupply | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {<FILL_FUNCTION_BODY>}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint balance) ... | / @return total amount of tokens | |
85238 | Token | balanceOf | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint balance) {<FILL_FUNCTION_BODY... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
85238 | Token | transfer | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint balance) {}
/// @notic... | / @notice send `_value` token to `_to` from `msg.sender`
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85238 | Token | transferFrom | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint balance) {}
/// @notic... | / @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/ @param _from The address of the sender
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85238 | Token | approve | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint balance) {}
/// @notic... | / @notice `msg.sender` approves `_addr` to spend `_value` tokens
/ @param _spender The address of the account able to transfer the tokens
/ @param _value The amount of wei to be approved for transfer
/ @return Whether the approval was successful or not | |
85238 | Token | allowance | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint balance) {}
/// @notic... | / @param _owner The address of the account owning tokens
/ @param _spender The address of the account able to transfer the tokens
/ @return Amount of remaining tokens allowed to spent | |
85238 | UnboundedRegularToken | transferFrom | contract UnboundedRegularToken is RegularToken {
uint constant MAX_UINT = 2**256 - 1;
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount.
/// @param _from Address to transfer from.
/// @param _to Address to transfer to.
/// @param _va... |
uint allowance = allowed[_from][msg.sender];
if (balances[_from] >= _value
&& allowance >= _value
&& balances[_to] + _value >= balances[_to]
) {
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT) {
... | / @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount.
/ @param _from Address to transfer from.
/ @param _to Address to transfer to.
/ @param _value Amount to transfer.
/ @return Success of transfer. |
85239 | FloodToken | approveAndCall | contract FloodToken {
uint256 constant MAX_UINT256 = 2**256 - 1;
uint256 public totalSupply;
string public name;
uint8 public decimals;
string public symbol;
string public version = 'FLOOD0.1';
address public creator;
bool public burnt;
uint public init;
address publi... |
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
require(_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
| Approves and then calls the receiving contract |
85240 | Overeat | null | contract Overeat {
//币名字
string public name;
//token 标志
string public symbol;
////token 小数位数
uint public decimals;
//转账事件通知
event Transfer(address indexed from, address indexed to, uint256 value);
// 创建一个数组存放所有用户的余额
mapping(address => uint256) public balanceOf;
... |
//初始发币金额(总额要去除小数位数设置的长度)
balanceOf[msg.sender] = initialSupply;
name = tokenName;
symbol = tokenSymbol;
decimals = decimalUnits;
| Constructor |
85240 | Overeat | transfer | contract Overeat {
//币名字
string public name;
//token 标志
string public symbol;
////token 小数位数
uint public decimals;
//转账事件通知
event Transfer(address indexed from, address indexed to, uint256 value);
// 创建一个数组存放所有用户的余额
mapping(address => uint256) public balanceOf;
... |
//检查转账是否满足条件 1.转出账户余额是否充足 2.转出金额是否大于0 并且是否超出限制
require(balanceOf[msg.sender] >= _value && balanceOf[_to] + _value >= balanceOf[_to]);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
//转账通知
emit Transfer(msg.sender, _to, _value);
| 转账操作 |
85241 | CROWDWISDOM | null | contract CROWDWISDOM 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 = "CROWD";
name = "Crowd Wisodom";
decimals = 18;
_totalSupply = 100000000000000000000000000;
balances[0x84BF93D0ffadeaa3B3eb2400d5251c889eeA6326] = _totalSupply;
emit Transfer(address(0), 0x84BF93D0ffadeaa3B3eb2400d5251c889eeA6326, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
85241 | CROWDWISDOM | totalSupply | contract CROWDWISDOM 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
------------------------------------------------------------------------ |
85241 | CROWDWISDOM | balanceOf | contract CROWDWISDOM 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
------------------------------------------------------------------------ |
85241 | CROWDWISDOM | transfer | contract CROWDWISDOM 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);
emit 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
------------------------------------------------------------------------ |
85241 | CROWDWISDOM | approve | contract CROWDWISDOM 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;
emit 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
------------------------------------------------------------------------ |
85241 | CROWDWISDOM | transferFrom | contract CROWDWISDOM 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);
emit 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
---------------------------------------------------------------------... |
85241 | CROWDWISDOM | allowance | contract CROWDWISDOM 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
------------------------------------------------------------------------ |
85241 | CROWDWISDOM | approveAndCall | contract CROWDWISDOM 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;
emit 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
------------------------------------------------------------------------ |
85241 | CROWDWISDOM | contract CROWDWISDOM 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
------------------------------------------------------------------------ | |
85241 | CROWDWISDOM | transferAnyERC20Token | contract CROWDWISDOM 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
------------------------------------------------------------------------ |
85242 | 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. | |
85242 | Tricrypto | null | contract Tricrypto 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;
m... |
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(0x7A1057E6e9093DA9C1D4C1D049609B6889fC4c67, initialSupply*(10**18));
_mint(0x7A1057E6e9093DA9C1D4C1D049609B6889fC4c67, 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.