Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
151 | // Returns the address of the current migrationOwner. / | function migrationOwner() public view returns (address) {
return _migrationOwner;
}
| function migrationOwner() public view returns (address) {
return _migrationOwner;
}
| 43,053 |
103 | // Changes the BLOCK_DELAY to value > MIN_BLOCK_DELAY.Meant to allow for increasing the block delay in case of clogged transactions. / | function changeBlockDelay(uint8 newBlockDelay) onlyOwner public {
require(newBlockDelay >= MIN_BLOCK_DELAY, "Block delay can't be smaller than the MIN_BLOCK_DELAY.");
BLOCK_DELAY = newBlockDelay;
}
| function changeBlockDelay(uint8 newBlockDelay) onlyOwner public {
require(newBlockDelay >= MIN_BLOCK_DELAY, "Block delay can't be smaller than the MIN_BLOCK_DELAY.");
BLOCK_DELAY = newBlockDelay;
}
| 53,010 |
329 | // No need to use safe math, based on the loop above `sum` is greater than or equal to `balances[tokenIndex]` | sum = sum - balances[tokenIndex];
uint256 inv2 = Math.mul(invariant, invariant);
| sum = sum - balances[tokenIndex];
uint256 inv2 = Math.mul(invariant, invariant);
| 64,027 |
4 | // Returns true if the path contains two or more pools/path The encoded swap path/ return True if path contains two or more pools, otherwise false | function hasMultiplePools(bytes memory path) internal pure returns (bool) {
return path.length >= MULTIPLE_POOLS_MIN_LENGTH;
}
| function hasMultiplePools(bytes memory path) internal pure returns (bool) {
return path.length >= MULTIPLE_POOLS_MIN_LENGTH;
}
| 45,252 |
2 | // POAP Contract - Only Mint Token function | Poap POAPToken;
| Poap POAPToken;
| 46,258 |
54 | // Set pause/_pause pause value | function setPause(bool _pause) public onlyOperator {
pause = _pause;
emit UpdatedPause(msg.sender, _pause);
}
| function setPause(bool _pause) public onlyOperator {
pause = _pause;
emit UpdatedPause(msg.sender, _pause);
}
| 57,614 |
6 | // Unusual market closing time. | uint256 marketclosingTime;
| uint256 marketclosingTime;
| 52,112 |
33 | // Returns the downcasted uint56 from uint256, reverting onoverflow (when the input is greater than largest uint56). Counterpart to Solidity's `uint56` operator. Requirements: - input must fit into 56 bits _Available since v4.7._ / | function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
| function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
| 32,149 |
2 | // if(!_recipientAddress.send() | if(!_recipientAddress.send(_amount))
throw;
return true;
| if(!_recipientAddress.send(_amount))
throw;
return true;
| 23,739 |
64 | // Returns the number of NFTs in `owner`'s account. / | function balanceOf(address owner) public view returns (uint256 balance);
| function balanceOf(address owner) public view returns (uint256 balance);
| 1,947 |
11 | // Countercall type = call | require(howToCalls[1] == AuthenticatedProxy.HowToCall.Call, "ERC721: countercall must be a direct call");
| require(howToCalls[1] == AuthenticatedProxy.HowToCall.Call, "ERC721: countercall must be a direct call");
| 4,974 |
106 | // use the proxy to execute calldata _data on contract _code | function execute(bytes memory _code, bytes memory _data)
public
payable
virtual
returns (address target, bytes32 response);
function execute(address _target, bytes memory _data)
public
payable
virtual
| function execute(bytes memory _code, bytes memory _data)
public
payable
virtual
returns (address target, bytes32 response);
function execute(address _target, bytes memory _data)
public
payable
virtual
| 8,192 |
36 | // Creates a new Covfefe with the given term. | function createContractCovfefe(string _term, string _meaning, uint16 _generation) public onlyCovmanager {
require(contractCreatedCount < CONTRACT_CREATION_LIMIT);
contractCreatedCount++;
_createCovfefe(_term, _meaning, _generation, address(this), startingPrice);
}
| function createContractCovfefe(string _term, string _meaning, uint16 _generation) public onlyCovmanager {
require(contractCreatedCount < CONTRACT_CREATION_LIMIT);
contractCreatedCount++;
_createCovfefe(_term, _meaning, _generation, address(this), startingPrice);
}
| 22,614 |
7 | // decor | rarities[4] = [ 19, 59, 9, 21, 116, 46, 8, 30, 11, 45, 39, 49, 255, 21,163, 10, 26, 6, 202, 11];
aliases[4] = [4, 4, 4, 5, 5, 7, 7, 11, 7, 10, 12, 12, 12, 10, 7, 10, 10, 11, 10, 11];
| rarities[4] = [ 19, 59, 9, 21, 116, 46, 8, 30, 11, 45, 39, 49, 255, 21,163, 10, 26, 6, 202, 11];
aliases[4] = [4, 4, 4, 5, 5, 7, 7, 11, 7, 10, 12, 12, 12, 10, 7, 10, 10, 11, 10, 11];
| 46,049 |
180 | // the flash sale has been set an end time and expired | flashSales[_saleID].base.isAvailable = false;
emit FlashSaleExpired(_saleID, msg.sender);
return;
| flashSales[_saleID].base.isAvailable = false;
emit FlashSaleExpired(_saleID, msg.sender);
return;
| 35,384 |
29 | // Returns an Ethereum Signed Message, created from `s`. Thisproduces hash corresponding to the one signed with theJSON-RPC method as part of EIP-191. | * See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
| * See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
| 1,578 |
98 | // The amount of the payment. | uint256 paymentAmountGwei;
| uint256 paymentAmountGwei;
| 23,773 |
170 | // See {IERC721-balanceOf}. / | function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _holderTokens[owner].length();
}
| function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _holderTokens[owner].length();
}
| 621 |
57 | // Called by the delegator on a delegate to forfeit its responsibility / | function _resignImplementation() public;
| function _resignImplementation() public;
| 27,327 |
26 | // This event is triggered whenever the merkle root gets updated. | event MerkleRootUpdated(bytes32 indexed merkleRoot, uint32 indexed week);
| event MerkleRootUpdated(bytes32 indexed merkleRoot, uint32 indexed week);
| 29,902 |
8 | // require(_isApprovedOrOwner(msg.sender, _hunter)); | uint _skill_level = skill[_hunter][_skill_index];
uint _coin_required = coin_required(_skill_level);
| uint _skill_level = skill[_hunter][_skill_index];
uint _coin_required = coin_required(_skill_level);
| 1,909 |
123 | // if bonus>0 | if (reward > 0) {
| if (reward > 0) {
| 56,347 |
219 | // Withdraw deposit. | function withdrawDeposit(uint256 _amount)
public
| function withdrawDeposit(uint256 _amount)
public
| 18,129 |
44 | // Shift and mask to calculate the current filled numerator. | filledNumerator := and(shr(OrderStatus_filledNumerator_offset, filledNumerator), MaxUint120)
| filledNumerator := and(shr(OrderStatus_filledNumerator_offset, filledNumerator), MaxUint120)
| 17,104 |
14 | // Policy exists. | Policy memory _policy = policies[_policyId];
return _policy;
| Policy memory _policy = policies[_policyId];
return _policy;
| 51,662 |
14 | // This function transfers items for a single ERC721 collection. tokenAddress Token address from Sender address to Recipient address itemIds Array of itemIds amounts Array of amounts / | function transferItemsERC721(
| function transferItemsERC721(
| 46,349 |
5 | // Emitted when `owner` enables `approved` to manage the `tokenId` token. / | event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
| event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
| 2,192 |
4 | // TokenReg interface | contract TokenReg {
function register(address _addr, string memory _tla, uint _base, string memory _name) public payable returns (bool);
function registerAs(address _addr, string memory _tla, uint _base, string memory _name, address _owner) public payable returns (bool);
function unregister(uint _id) public;
functi... | contract TokenReg {
function register(address _addr, string memory _tla, uint _base, string memory _name) public payable returns (bool);
function registerAs(address _addr, string memory _tla, uint _base, string memory _name, address _owner) public payable returns (bool);
function unregister(uint _id) public;
functi... | 39,101 |
82 | // Remember that only owner can call so be careful when use on contracts generated from other contracts. _tokenAddress The token contract address _tokenAmount Number of tokens to be sent / | function recoverERC20(address _tokenAddress, uint256 _tokenAmount) public onlyOwner {
ERC20i(_tokenAddress).transfer(owner(), _tokenAmount);
}
| function recoverERC20(address _tokenAddress, uint256 _tokenAmount) public onlyOwner {
ERC20i(_tokenAddress).transfer(owner(), _tokenAmount);
}
| 58,362 |
4 | // 移除操作员 | function removeOperator(address operator) public onlyOwner {
operators[operator] = false;
}
| function removeOperator(address operator) public onlyOwner {
operators[operator] = false;
}
| 10,358 |
84 | // External function for the owner returning a list of addresses in the blacklist. It is necessary to take a value so that explorer will not display an empty array.return address array. Requirements: - the caller must be the owner.- the value of true. / | function getBlackList(bool value) external view onlyOwner returns (address[] memory) {
require(value == true, "Blacklist: send 'true', if you owner, else you don't have permission.");
return _blackList;
}
| function getBlackList(bool value) external view onlyOwner returns (address[] memory) {
require(value == true, "Blacklist: send 'true', if you owner, else you don't have permission.");
return _blackList;
}
| 39,638 |
174 | // remove order | delete orderByAssetId[_nftAddress][_assetId];
| delete orderByAssetId[_nftAddress][_assetId];
| 20,139 |
61 | // sending Eth to Marketing wallet | if (ethForMarketing > 0)
payable(marketingWallet).transfer(ethForMarketing);
| if (ethForMarketing > 0)
payable(marketingWallet).transfer(ethForMarketing);
| 22,824 |
8 | // return the negation of p, i.e. p.addition(p.negate()) should be zero. | function negate(G1Point memory p) internal pure returns (G1Point memory) {
// The prime q in the base field F_q for G1
uint256 q
= 21888242871839275222246405745257275088696311157297823662689037894645226208583;
if (p.X == 0 && p.Y == 0) return G1Point(0, 0);
return G1Po... | function negate(G1Point memory p) internal pure returns (G1Point memory) {
// The prime q in the base field F_q for G1
uint256 q
= 21888242871839275222246405745257275088696311157297823662689037894645226208583;
if (p.X == 0 && p.Y == 0) return G1Point(0, 0);
return G1Po... | 30,718 |
10 | // Deploy new proxy | MetawinMinterProxy newProxy = MetawinMinterProxy(
address(_MINTER_IMPLEMENTATION).clone()
);
proxyAddress = address(newProxy);
| MetawinMinterProxy newProxy = MetawinMinterProxy(
address(_MINTER_IMPLEMENTATION).clone()
);
proxyAddress = address(newProxy);
| 14,830 |
124 | // Internal function to check whether the ACO strike asset is valid for the pool. _strikePrice ACO strike price. price Current underlying price.return TRUE whether it is valid, otherwise FALSE. / | function _acoStrikePriceIsValid(uint256 _strikePrice, uint256 price) internal view returns(bool) {
uint256 _tolerancePriceAbove = tolerancePriceAbove;
uint256 _tolerancePriceBelow = tolerancePriceBelow;
return (_tolerancePriceBelow == 0 && _tolerancePriceAbove == 0) ||
(_tolerancePriceBelow == 0 && _strikePri... | function _acoStrikePriceIsValid(uint256 _strikePrice, uint256 price) internal view returns(bool) {
uint256 _tolerancePriceAbove = tolerancePriceAbove;
uint256 _tolerancePriceBelow = tolerancePriceBelow;
return (_tolerancePriceBelow == 0 && _tolerancePriceAbove == 0) ||
(_tolerancePriceBelow == 0 && _strikePri... | 31,401 |
22 | // Replacement for Solidity's transfer: sends amount wei torecipient, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limitimposed by transfer, making them unable to receive funds via | * transfer. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to recipient, care must be
* taken to not create reentrancy vulnerabilities. Consider using
... | * transfer. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to recipient, care must be
* taken to not create reentrancy vulnerabilities. Consider using
... | 11,475 |
26 | // Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow... |
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
|
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
| 56,581 |
71 | // Transfers entire brrrX balance into brrr at 1 to 1 Deposits on brrrX will not be cleared. / | {
require(BRRRxContracts[_contract] == true, "Not a BRRRx contract");
_transferBrr(address(_contract));
return true;
}
| {
require(BRRRxContracts[_contract] == true, "Not a BRRRx contract");
_transferBrr(address(_contract));
return true;
}
| 36,977 |
253 | // Successful auction/Transfer contributed tokens to wallet. | _safeTokenPayment(paymentCurrency, wallet, uint256(status.commitmentsTotal));
| _safeTokenPayment(paymentCurrency, wallet, uint256(status.commitmentsTotal));
| 32,048 |
76 | // Emits a {CallScheduled} event. Requirements: - the caller must have the 'proposer' role. / | function schedule(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
bytes32 id = hashOperation(target, value, data, predecessor, salt);
_schedule(id, del... | function schedule(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
bytes32 id = hashOperation(target, value, data, predecessor, salt);
_schedule(id, del... | 41,996 |
55 | // Function to redeem the collateral and the premium from the pool.Only can be called when the pool is finished.return The amount of underlying asset received and the amount of strike asset received. / | function redeem() public override returns(uint256, uint256) {
return _redeem(msg.sender);
}
| function redeem() public override returns(uint256, uint256) {
return _redeem(msg.sender);
}
| 56,511 |
32 | // Withdraws LP tokens and sends them to a specified address/_pid The pool id to deposit lp tokens into/_amount amount of LP tokens to withdraw | function withdrawTo(
uint256 _pid,
uint256 _amount,
address _to
) external;
| function withdrawTo(
uint256 _pid,
uint256 _amount,
address _to
) external;
| 5,573 |
206 | // Leaf hash we're updating with is on the right | left = filledSubTrees[level];
right = _leafHashes[insertionElement];
| left = filledSubTrees[level];
right = _leafHashes[insertionElement];
| 62,932 |
56 | // set up a new ico round | function newIcoRound(uint _rMinEthPayment, uint _rKrsUsdFixed, uint _rKycTreshold,
| function newIcoRound(uint _rMinEthPayment, uint _rKrsUsdFixed, uint _rKycTreshold,
| 32,816 |
16 | // Multiplies two numbers/ | function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "mul failed");
return c;
}
| function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "mul failed");
return c;
}
| 49,094 |
283 | // raffle mint | mapping (address => bool) public mintedTBforRaffle;
mapping(address => uint256) addressBlockBought;
bytes32 private freeMintBoneMerkleRoot;
bytes32 private freeMintListMerkleRoot;
bytes32 private presaleMerkleRoot;
bytes32 private raffleMerkleRoot;
ApprovingBone public approvingBoneContrac... | mapping (address => bool) public mintedTBforRaffle;
mapping(address => uint256) addressBlockBought;
bytes32 private freeMintBoneMerkleRoot;
bytes32 private freeMintListMerkleRoot;
bytes32 private presaleMerkleRoot;
bytes32 private raffleMerkleRoot;
ApprovingBone public approvingBoneContrac... | 47,722 |
407 | // Multiplier representing the most one can borrow against their collateral in this market. For instance, 0.9 to allow borrowing 90% of collateral value. Must be between 0 and 1, and stored as a mantissa. / | uint256 collateralFactorMantissa;
| uint256 collateralFactorMantissa;
| 50,976 |
6 | // Registers the root NFT of each NFT | mapping(uint256 => uint256) private _root;
| mapping(uint256 => uint256) private _root;
| 19,653 |
147 | // eof (./contracts/token/ERC721/IERC721Metadata.sol) // file: ./contracts/token/ERC721/ERC721Metadata.sol / | contract ERC721Metadata is Context, ERC165, ERC721, IERC721Metadata {
// Token name
string private _name;
// Token symbol
string private _symbol;
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
// Base URI
string private _baseURI;
/*
* b... | contract ERC721Metadata is Context, ERC165, ERC721, IERC721Metadata {
// Token name
string private _name;
// Token symbol
string private _symbol;
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
// Base URI
string private _baseURI;
/*
* b... | 35,732 |
154 | // Build the bytes31 function hash from the payment, callback and expiration. payment The payment amount that will be released for the oracle (specified in wei) callbackAddress The callback address to call for fulfillment callbackFunctionId The callback function ID to use for fulfillment expiration The expiration that ... | function _buildFunctionHash(
uint256 payment,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 expiration
)
internal
pure
returns (
bytes31
| function _buildFunctionHash(
uint256 payment,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 expiration
)
internal
pure
returns (
bytes31
| 31,066 |
164 | // switch period must be called after each new period switch the switch will auto renew part of the tokens and update the weights accordingly / | function switchPeriod() external;
| function switchPeriod() external;
| 77,190 |
111 | // Decrements quantites owned of a collection of tokens for a given address. Canonly be called by authorized core contracts. _tokensThe addresses of the ERC20 tokens_owner The address of the token owner_quantitiesThe numbers of tokens to attribute to owner / | function batchDecrementTokenOwner(
| function batchDecrementTokenOwner(
| 7,044 |
594 | // 20 decimal constants | int256 constant x2 = 3200000000000000000000; // 2ˆ5
int256 constant a2 = 7896296018268069516100000000000000; // eˆ(x2)
int256 constant x3 = 1600000000000000000000; // 2ˆ4
int256 constant a3 = 888611052050787263676000000; // eˆ(x3)
int256 constant x4 = 800000000000000000000; // 2ˆ3
int256 constan... | int256 constant x2 = 3200000000000000000000; // 2ˆ5
int256 constant a2 = 7896296018268069516100000000000000; // eˆ(x2)
int256 constant x3 = 1600000000000000000000; // 2ˆ4
int256 constant a3 = 888611052050787263676000000; // eˆ(x3)
int256 constant x4 = 800000000000000000000; // 2ˆ3
int256 constan... | 5,134 |
78 | // The SPHERE TOKEN! | IERC20 public sphere;
IERC20 public rewardToken;
| IERC20 public sphere;
IERC20 public rewardToken;
| 35,028 |
13 | // return The result of safely multiplying x and y, interpreting the operandsas fixed-point decimals of a precise unit.The operands should be in the precise unit factor which will bedivided out after the product of x and y is evaluated, so that product must beless than 2256. Unlike multiplyDecimal, this function rounds... | function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, PRECISE_UNIT);
}
| function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, PRECISE_UNIT);
}
| 2,252 |
57 | // Returns an account's deposits. It can be either a deposit of a paymaster, or a revenue of a relay manager. | function balanceOf(address target) external view returns (uint256);
function stakeManager() external view returns (IStakeManager);
function penalizer() external view returns (address);
| function balanceOf(address target) external view returns (uint256);
function stakeManager() external view returns (IStakeManager);
function penalizer() external view returns (address);
| 26,429 |
47 | // General constructor called by the master / | function initialize(PaymentMaster _master) public {
require(initialized == false, 'Contract is already initialized');
initialized = true;
master = _master;
}
| function initialize(PaymentMaster _master) public {
require(initialized == false, 'Contract is already initialized');
initialized = true;
master = _master;
}
| 27,412 |
18 | // Returns implementation address for a particular beacon. / | function escrowImplAddress() public view returns (address) {
return UpgradeableBeacon(beacon).implementation();
}
| function escrowImplAddress() public view returns (address) {
return UpgradeableBeacon(beacon).implementation();
}
| 32,195 |
2 | // Execute multiple meta transactions/_transactions Arrays of transaction data ([to, value, gasLimit, data],[...],...)/ return The responses of the calls | function executeMultipleMetaTransactions(bytes[] memory _transactions) public onlySelf returns (bytes[] memory) {
bool isMetaTransaction = true;
return _executeMultipleTransactions(_transactions, isMetaTransaction);
}
| function executeMultipleMetaTransactions(bytes[] memory _transactions) public onlySelf returns (bytes[] memory) {
bool isMetaTransaction = true;
return _executeMultipleTransactions(_transactions, isMetaTransaction);
}
| 47,651 |
56 | // - Must read price from {FujiOracle}.borrower to whom to check max borrow amount / | function _computeMaxBorrow(address borrower) internal view returns (uint256 max) {
uint256 price = oracle.getPriceOf(debtAsset(), asset(), _debtDecimals);
uint256 assetShares = balanceOf(borrower);
uint256 assets = convertToAssets(assetShares);
uint256 debtShares = _debtShares[borrower];
uint256 d... | function _computeMaxBorrow(address borrower) internal view returns (uint256 max) {
uint256 price = oracle.getPriceOf(debtAsset(), asset(), _debtDecimals);
uint256 assetShares = balanceOf(borrower);
uint256 assets = convertToAssets(assetShares);
uint256 debtShares = _debtShares[borrower];
uint256 d... | 22,062 |
280 | // Get send Merkle tree statereturn size number of sends in the historyreturn root root hash of the send historyreturn partials hashes of partial subtrees in the send history tree / | function sendMerkleTreeState()
| function sendMerkleTreeState()
| 11,395 |
19 | // transfer token for a specified address_to The address to transfer to._value The amount to be transferred./ | function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value)... | function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value)... | 20,952 |
6 | // OwnableThe Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". / | contract Ownable {
/* Current Owner */
address public owner;
/* New owner which can be set in future */
address public newOwner;
/* event to indicate finally ownership has been succesfully transferred and accepted */
event OwnershipTransferred(address indexed _from, address indexed _to);
/* release o... | contract Ownable {
/* Current Owner */
address public owner;
/* New owner which can be set in future */
address public newOwner;
/* event to indicate finally ownership has been succesfully transferred and accepted */
event OwnershipTransferred(address indexed _from, address indexed _to);
/* release o... | 32,451 |
16 | // Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow. / | function sub(
uint256 a,
uint256 b,
string memory errorMessage
| function sub(
uint256 a,
uint256 b,
string memory errorMessage
| 1,155 |
101 | // Internal function to burn a specific token.Reverts if the token does not exist.Deprecated, use _burn(uint256) instead. owner owner of the token to burn tokenId uint256 ID of the token being burned / | function _burn(address owner, uint256 tokenId) internal {
require(ownerOf(tokenId) == owner, "KIP17: burn of token that is not own");
_clearApproval(tokenId);
_ownedTokensCount[owner].decrement();
_tokenOwner[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId)... | function _burn(address owner, uint256 tokenId) internal {
require(ownerOf(tokenId) == owner, "KIP17: burn of token that is not own");
_clearApproval(tokenId);
_ownedTokensCount[owner].decrement();
_tokenOwner[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId)... | 17,307 |
110 | // to receive ETH from uniswapV2Router when swapping | receive() external payable {}
function _reflectFee(
uint256 rCharity,
uint256 rTeam,
uint256 rFee,
uint256 tFee
) private {
_rTotal = _rTotal.sub(rFee).sub(rCharity).sub(rTeam);
_tFeeTotal = _tFeeTotal.add(tFee);
}
| receive() external payable {}
function _reflectFee(
uint256 rCharity,
uint256 rTeam,
uint256 rFee,
uint256 tFee
) private {
_rTotal = _rTotal.sub(rFee).sub(rCharity).sub(rTeam);
_tFeeTotal = _tFeeTotal.add(tFee);
}
| 38,055 |
29 | // TRANSFER LAND REGISTRY FROM AN EXISTING OWNER TO ANOTHER ONE | function transferLand(uint _landId, uint _originalOwnerId, uint _newOwnerId) external payable {
// CHECK IF THE ORIGINAL OWNER DOES INDEED HAVE THE LAND REGISTERED TO HIS/HER ADDRESS
if (lands[_landId-1].ownerAddress == owners[_originalOwnerId-1].ownerAddress) {
// require(msg.value == r... | function transferLand(uint _landId, uint _originalOwnerId, uint _newOwnerId) external payable {
// CHECK IF THE ORIGINAL OWNER DOES INDEED HAVE THE LAND REGISTERED TO HIS/HER ADDRESS
if (lands[_landId-1].ownerAddress == owners[_originalOwnerId-1].ownerAddress) {
// require(msg.value == r... | 36,211 |
21 | // List subscriptions of an user token Super token address subscriber The subscriber's addressreturn publishers Publishers of the subcriptionsreturn indexIds Indexes of the subscriptionsreturn unitsList Units of the subscriptions / | function listSubscriptions(
| function listSubscriptions(
| 12,982 |
53 | // _newStatus desired new status, can be {COF, COMPLAIN} / | function checkIfApplicableAndResetPeriod(uint256 _tokenIdVoucher, VoucherState _newStatus)
internal
{
uint8 tStatus = vouchersStatus[_tokenIdVoucher].status;
require(
!isStatus(tStatus, VoucherState.FINAL),
"ALREADY_FINALIZED"
);
| function checkIfApplicableAndResetPeriod(uint256 _tokenIdVoucher, VoucherState _newStatus)
internal
{
uint8 tStatus = vouchersStatus[_tokenIdVoucher].status;
require(
!isStatus(tStatus, VoucherState.FINAL),
"ALREADY_FINALIZED"
);
| 10,107 |
9 | // returns address of dispute manager contract | function getDisputeManagerAddress() external view returns (address);
| function getDisputeManagerAddress() external view returns (address);
| 43,148 |
83 | // Opens compound positions with a leverage | contract CompoundCreateTaker is ProxyPermission {
using SafeERC20 for ERC20;
address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
ILendingPool public constant lendingPool = ILendingPool(0x398eC7346DcD622eDc5ae82352F02bE94C62d119);
// solhint-disable-next-line const-name-sn... | contract CompoundCreateTaker is ProxyPermission {
using SafeERC20 for ERC20;
address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
ILendingPool public constant lendingPool = ILendingPool(0x398eC7346DcD622eDc5ae82352F02bE94C62d119);
// solhint-disable-next-line const-name-sn... | 39,243 |
99 | // Get Start Time | * @return {uint256} timestamp
*/
function getStartTime() public pure returns (uint256) {
return 1617625740; // DEEPER TIMESTAMP DAO Maker
}
| * @return {uint256} timestamp
*/
function getStartTime() public pure returns (uint256) {
return 1617625740; // DEEPER TIMESTAMP DAO Maker
}
| 36,104 |
470 | // Where fees are pooled in sUSD. | address public constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF;
| address public constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF;
| 34,222 |
18 | // only claimonce | require(allocations[teamWallet] == 0);
require(token.balanceOf(address(this)) >= totalAllocation);
allocations[teamWallet] = teamAllocation;
stageSettings[teamWallet] = teamStageSetting;
timeLockDurations[teamWallet] = teamTimeLock;
| require(allocations[teamWallet] == 0);
require(token.balanceOf(address(this)) >= totalAllocation);
allocations[teamWallet] = teamAllocation;
stageSettings[teamWallet] = teamStageSetting;
timeLockDurations[teamWallet] = teamTimeLock;
| 26,725 |
1,248 | // Ensure that Synthetix can write to its State contract; | synthetixstate_i.setAssociatedContract(new_Issuer_contract);
| synthetixstate_i.setAssociatedContract(new_Issuer_contract);
| 81,522 |
56 | // eslint-ignore | ICash Dollars;
mapping(address => uint256) private _bondBalances;
mapping (address => mapping (address => uint256)) private _allowedBond;
uint256 public claimableUSD;
uint256 public lastRebase;
mapping (address => uint256) public lastUserRebase;
uint256 public constantUsdRebase;
| ICash Dollars;
mapping(address => uint256) private _bondBalances;
mapping (address => mapping (address => uint256)) private _allowedBond;
uint256 public claimableUSD;
uint256 public lastRebase;
mapping (address => uint256) public lastUserRebase;
uint256 public constantUsdRebase;
| 17,871 |
15 | // ERC20 token smart contract managing tokens to be sold. / | Token private token;
| Token private token;
| 17,746 |
131 | // 1% airDropPot | airDropPot_ = airDropPot_.add((_eth)/(100));
| airDropPot_ = airDropPot_.add((_eth)/(100));
| 40,318 |
88 | // Updates the currently active fork to given block number This is similar to `roll` but for the currently active fork | function rollFork(uint256 blockNumber) external;
| function rollFork(uint256 blockNumber) external;
| 27,673 |
220 | // Same as `simulateDelegatecall` on StorageAccessible. Marked as view so that it can be called from external contractsthat want to run simulations from within view functions. Will revert if the invoked simulation attempts to change state. / | function simulateDelegatecall(
address targetContract,
bytes memory calldataPayload
) external view returns (bytes memory);
| function simulateDelegatecall(
address targetContract,
bytes memory calldataPayload
) external view returns (bytes memory);
| 54,762 |
189 | // Hash(current element of the proof + current computed hash) | computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
| computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
| 5,582 |
180 | // Update state variables | lockedTokenBalances[msg.sender] = sub(lockedTokenBalances[msg.sender], amount);
unlockedTokens[msg.sender].amountUnlocked = add(unlockedTokens[msg.sender].amountUnlocked, amount);
unlockedTokens[msg.sender].withdrawalTime = now + 24 hours;
| lockedTokenBalances[msg.sender] = sub(lockedTokenBalances[msg.sender], amount);
unlockedTokens[msg.sender].amountUnlocked = add(unlockedTokens[msg.sender].amountUnlocked, amount);
unlockedTokens[msg.sender].withdrawalTime = now + 24 hours;
| 19,657 |
43 | // Checks unprefixed signatures | function _isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s)
internal
pure
returns (bool)
| function _isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s)
internal
pure
returns (bool)
| 18,719 |
36 | // Deploys new tokens on a DRCT_Token contract -- called from within a swap"_supply": The number of tokens to create"_party": The address to send the tokens to"_long": Whether the party is long or short returns "created": The address of the created DRCT token returns "token_ratio": The ratio of the created DRCT token/ | function createToken(uint _supply, address _party, bool _long, uint _start_date) public returns (address created, uint token_ratio) {
require(created_contracts[msg.sender] > 0);
address ltoken = long_tokens[_start_date];
address stoken = short_tokens[_start_date];
require(ltoken != address(0) && stoke... | function createToken(uint _supply, address _party, bool _long, uint _start_date) public returns (address created, uint token_ratio) {
require(created_contracts[msg.sender] > 0);
address ltoken = long_tokens[_start_date];
address stoken = short_tokens[_start_date];
require(ltoken != address(0) && stoke... | 6,880 |
210 | // if newest observation equals target, we're in the same block, so we can ignore atOrAfter | return (beforeOrAt, atOrAfter);
| return (beforeOrAt, atOrAfter);
| 26,926 |
13 | // We track benefactor addresses for extra safety; In the case of central ETH issuance tracking has problems we can construct ETH contributions solely based on blockchain data | paymentsByBenefactor[benefactor] += weiAmount;
| paymentsByBenefactor[benefactor] += weiAmount;
| 35,613 |
55 | // update lvr lock value | linkAmountA = SafeMath.sub(linkAmountA,_amountA);
linkAmountB = SafeMath.sub(linkAmountB,_amountB);
totalAmount = SafeMath.add(linkAmountA,linkAmountB);
| linkAmountA = SafeMath.sub(linkAmountA,_amountA);
linkAmountB = SafeMath.sub(linkAmountB,_amountB);
totalAmount = SafeMath.add(linkAmountA,linkAmountB);
| 33,674 |
5 | // Generate a swarm tree / | function SwarmRedistribution() {
/* Tax-rate in parts per thousand */
taxRate = 20;
JohanNygren = 0x948176CB42B65d835Ee4324914B104B66fB93B52;
campaignOpen = true;
}
| function SwarmRedistribution() {
/* Tax-rate in parts per thousand */
taxRate = 20;
JohanNygren = 0x948176CB42B65d835Ee4324914B104B66fB93B52;
campaignOpen = true;
}
| 28,418 |
145 | // function to allow admin to enable farming.. | function enableFarm() external onlyOwner() {
require(tokenAddress != address(0), "tokenAddress is zero, admin need to set tokenAddress");
farmEnabled = true;
}
| function enableFarm() external onlyOwner() {
require(tokenAddress != address(0), "tokenAddress is zero, admin need to set tokenAddress");
farmEnabled = true;
}
| 316 |
5 | // Apply a mask on an integer to extract a certain number of bits, where angle is the integer whose bits we want to get, the width is the width of the bits (in bits) we want to extract, and the offset is the offset of the bits (in bits) we want to extract. The result is an integer containing _width bits of _value start... | uint256 interp = (_angle >> INTERP_OFFSET) & ((1 << INTERP_WIDTH) - 1);
uint256 index = (_angle >> INDEX_OFFSET) & ((1 << INDEX_WIDTH) - 1);
| uint256 interp = (_angle >> INTERP_OFFSET) & ((1 << INTERP_WIDTH) - 1);
uint256 index = (_angle >> INDEX_OFFSET) & ((1 << INDEX_WIDTH) - 1);
| 27,258 |
14 | // any non-zero byte is considered true | function toBoolean(RLPItem memory item) internal pure returns (bool) {
require(item.len == 1);
uint256 result;
uint256 memPtr = item.memPtr;
assembly {
result := byte(0, mload(memPtr))
}
return result == 0 ? false : true;
}
| function toBoolean(RLPItem memory item) internal pure returns (bool) {
require(item.len == 1);
uint256 result;
uint256 memPtr = item.memPtr;
assembly {
result := byte(0, mload(memPtr))
}
return result == 0 ? false : true;
}
| 17,226 |
2 | // Should return whether the signature provided is valid for the provided data _hash Hash of the data signed on the behalf of address(this) _signature Signature byte array associated with _data MUST return the bytes4 magic value 0x1626ba7e when function passes.MUST NOT modify state (using STATICCALL for solc < 0.5, vie... | function isValidSignature(bytes32 _hash, bytes calldata _signature) virtual external view returns (bytes4 magicValue);
| function isValidSignature(bytes32 _hash, bytes calldata _signature) virtual external view returns (bytes4 magicValue);
| 28,524 |
1 | // Returns true if minting is allowed_minter Address of minter_entryId An id associated with the entry return true if minting is allowed/ | function mintingAllowed(address _minter, uint256 _entryId) public view returns (bool _mintingAllowed);
| function mintingAllowed(address _minter, uint256 _entryId) public view returns (bool _mintingAllowed);
| 170 |
46 | // change between the token and one of its reserves | if (toToken == token)
return getPurchaseReturn(fromToken, _amount);
else if (fromToken == token)
return getSaleReturn(toToken, _amount);
| if (toToken == token)
return getPurchaseReturn(fromToken, _amount);
else if (fromToken == token)
return getSaleReturn(toToken, _amount);
| 42,703 |
14 | // TODO(asa): Gas optimizations by passing in elements to isValueBetween/ Returns the keys of the elements greaterKey than and less than the provided value. value The element value. lesserKey The key of the element which could be just left of the new value. greaterKey The key of the element which could be just right of... | function getLesserAndGreater(
List storage list,
uint256 value,
bytes32 lesserKey,
bytes32 greaterKey
| function getLesserAndGreater(
List storage list,
uint256 value,
bytes32 lesserKey,
bytes32 greaterKey
| 23,846 |
160 | // Using 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF as burn address. GHST token contract does not allow transferring to address(0) address: https:etherscan.io/address/0x3F382DbD960E3a9bbCeaE22651E88158d2791550code | address ghstContract = s.ghstContract;
LibERC20.transferFrom(ghstContract, _from, address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF), burnShare);
LibERC20.transferFrom(ghstContract, _from, s.pixelCraft, companyShare);
LibERC20.transferFrom(ghstContract, _from, s.rarityFarming, rarityFar... | address ghstContract = s.ghstContract;
LibERC20.transferFrom(ghstContract, _from, address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF), burnShare);
LibERC20.transferFrom(ghstContract, _from, s.pixelCraft, companyShare);
LibERC20.transferFrom(ghstContract, _from, s.rarityFarming, rarityFar... | 17,067 |
185 | // Allow this contract to be an ERC1155 holder | _setupCFolio = true;
| _setupCFolio = true;
| 68,581 |
55 | // add up the rest of the amounts in the array and return them | finalOutputAmount += swapAmounts[i];
| finalOutputAmount += swapAmounts[i];
| 16,766 |
15 | // console.log("lastPrice", lastPrice); calculation of the new amount of tokens on the router | uint256 routerNewToken = routerLastToken + ammount;
| uint256 routerNewToken = routerLastToken + ammount;
| 29,057 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.