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 |
|---|---|---|---|---|
64 | // Requires msg.sender to have valid access message. _v ECDSA signature parameter v. _r ECDSA signature parameters r. _s ECDSA signature parameters s. / | modifier onlyValidAccess(
bytes32 _r,
bytes32 _s,
uint8 _v
| modifier onlyValidAccess(
bytes32 _r,
bytes32 _s,
uint8 _v
| 45,986 |
202 | // 2.1 from<bonusStartBlock<to<bonusEndBlock | return
_to.sub(bonusStartBlock).mul(BONUS_MULTIPLIER).add(
bonusStartBlock.sub(_from)
);
| return
_to.sub(bonusStartBlock).mul(BONUS_MULTIPLIER).add(
bonusStartBlock.sub(_from)
);
| 37,881 |
29 | // Compute deposit fee beforehand to save on gas | uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000);
updatePool(_pid);
if (_amount > 0 && address(referral) != address(0) && _referrer != address(0) && _referrer != msg.sender) {
referral.recordReferral(msg.sender, _referrer);
}
| uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000);
updatePool(_pid);
if (_amount > 0 && address(referral) != address(0) && _referrer != address(0) && _referrer != msg.sender) {
referral.recordReferral(msg.sender, _referrer);
}
| 4,737 |
36 | // array of token buyers | address[] private _buyerAddresses;
| address[] private _buyerAddresses;
| 20,693 |
30 | // Removes oracles from whitelist.//_blacklist user in whitelist. | function removeOracles(address[] _blacklist)
onlyContractOwner
external
returns (uint)
| function removeOracles(address[] _blacklist)
onlyContractOwner
external
returns (uint)
| 3,259 |
2 | // deployment checks for non-pool2 | require(
_swapPairToken0 > address(0),
"Swap pair 0 is necessary but not supplied"
);
require(
_swapPairToken1 > address(0),
"Swap pair 1 is necessary but not supplied"
);
swapPairToken0 = _swapPa... | require(
_swapPairToken0 > address(0),
"Swap pair 0 is necessary but not supplied"
);
require(
_swapPairToken1 > address(0),
"Swap pair 1 is necessary but not supplied"
);
swapPairToken0 = _swapPa... | 23,248 |
5 | // Math operations with safety checks that revert on error | library SafeMath {
/// @dev Multiplies two numbers, reverts on overflow.
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
/// @dev Intege... | library SafeMath {
/// @dev Multiplies two numbers, reverts on overflow.
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
/// @dev Intege... | 13,627 |
8 | // ability to get a property given your address/return two strings that identify the senders property - this is the same details as the property struct | function getProperty () public view returns (string memory, string memory, uint) {
uint256 propNum = addressToProperty[msg.sender];
return(publicProperties[propNum].erfNumber, publicProperties[propNum].geoloc, publicProperties[propNum].attestation);
}
| function getProperty () public view returns (string memory, string memory, uint) {
uint256 propNum = addressToProperty[msg.sender];
return(publicProperties[propNum].erfNumber, publicProperties[propNum].geoloc, publicProperties[propNum].attestation);
}
| 22,873 |
35 | // Return coin prices10e5 (to solve rounding problems, this yields 5 meaning digits after decimal point) / | function getCoinPrices(address[] calldata _coins, uint8 _market)
external
view
returns (uint256[] memory prices)
| function getCoinPrices(address[] calldata _coins, uint8 _market)
external
view
returns (uint256[] memory prices)
| 32,192 |
112 | // Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which isforwarded in {IERC721Receiver-onERC721Received} to contract recipients. / | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| 69,813 |
52 | // 0x38585839386009f3 | ptr := add(ptr, 0x08)
| ptr := add(ptr, 0x08)
| 27,714 |
8 | // In case the funding goal has not been reached by investors with allocations./ | function unlock_investment_for_all(uint256 _investment, uint64 _new_end_timestamp) external onlyRole(DEFAULT_ADMIN_ROLE) {
Investment storage investment = investments[_investment];
require(investment.invested < investment.funding_goal);
require(!investment.cancelled);
investment.end_... | function unlock_investment_for_all(uint256 _investment, uint64 _new_end_timestamp) external onlyRole(DEFAULT_ADMIN_ROLE) {
Investment storage investment = investments[_investment];
require(investment.invested < investment.funding_goal);
require(!investment.cancelled);
investment.end_... | 51,902 |
1 | // Construct a new Funds Distributor Contract beneficiary address of the beneficiary to whom vested tokens are transferred cliffDuration duration in seconds of the cliff in which tokens will begin to vest start the time (as Unix time) at which point vesting starts duration duration in seconds of the period in which the... | constructor(address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable, string memory _identifier) TokenVesting(beneficiary, start, cliffDuration, duration, revocable) public {
identifier = _identifier;
}
| constructor(address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable, string memory _identifier) TokenVesting(beneficiary, start, cliffDuration, duration, revocable) public {
identifier = _identifier;
}
| 13,359 |
0 | // (0-1)庫 import // (0-1)介面 interface // (1-1)資料結構:枚舉 enum // (1-2)資料結構:結構 struct // (2)裝飾器 modifier // (3)事件 event // (4)常數、變數、陣列(array)、映射(mapping) // (5)建構子 constructor // (6)函數 function// (1-2)資料結構:結構 struct / 結構:會員(地址、狀態、召集紀錄、賽局紀錄) | struct Member {
address _memberAddress;
MemberStatus _status;
uint256[] _recruitIds;
uint256[] _gameIds;
}
| struct Member {
address _memberAddress;
MemberStatus _status;
uint256[] _recruitIds;
uint256[] _gameIds;
}
| 4,297 |
4 | // mapping from token address to pool that is selling that token/we maintain two order pools, one for each token that is tradable in the AMM | mapping(address => OrderPoolLib.OrderPool) OrderPoolMap;
| mapping(address => OrderPoolLib.OrderPool) OrderPoolMap;
| 38,276 |
14 | // Returns the downcasted uint144 from uint256, reverting onoverflow (when the input is greater than largest uint144). Counterpart to Solidity's `uint144` operator. Requirements: - input must fit into 144 bits _Available since v4.7._ / | function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
| function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
| 12,426 |
23 | // Discard leftover bits from current byte (assumes s.bitcnt < 8) | s.bitbuf = 0;
s.bitcnt = 0;
| s.bitbuf = 0;
s.bitcnt = 0;
| 13,022 |
152 | // Returns the current reflection rate. / | function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
| function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
| 55,914 |
42 | // Start data migration uint256 t_value = balanceOf(receiver); | uint256 _value = data.getOldBalanceOf(receiver);
| uint256 _value = data.getOldBalanceOf(receiver);
| 18,809 |
135 | // Returns the underlying balance of a specific user./user The user who's balance the CERC20 will retrieve./ return The amount of underlying tokens the user is entitled to. | function balanceOfUnderlying(address user) external view virtual returns (uint256);
| function balanceOfUnderlying(address user) external view virtual returns (uint256);
| 34,785 |
134 | // Displays the amount of LINK that is available for the node operator to withdraw We use `ONE_FOR_CONSISTENT_GAS_COST` in place of 0 in storagereturn The amount of withdrawable LINK on the contract / | function withdrawable()
external
view
override(OracleInterface, WithdrawalInterface)
returns (uint256)
| function withdrawable()
external
view
override(OracleInterface, WithdrawalInterface)
returns (uint256)
| 52,886 |
85 | // Ensure token is set. | if (address(comptroller) == address(0)) {
emit DividendFailure(now, "Comptroller not yet set.");
return;
}
| if (address(comptroller) == address(0)) {
emit DividendFailure(now, "Comptroller not yet set.");
return;
}
| 17,811 |
19 | // returns vesting contract address for the given token owner _tokenOwner the owner of the tokens / | function getVesting(address _tokenOwner) public view returns (address) {
return vestingContracts[_tokenOwner][uint256(VestingType.Vesting)];
}
| function getVesting(address _tokenOwner) public view returns (address) {
return vestingContracts[_tokenOwner][uint256(VestingType.Vesting)];
}
| 3,719 |
46 | // add all reserve tokens | for (uint256 i = 0; i < reserveTokenCount; i++)
addConvertibleToken(converterRegistryData, _converter.connectorTokens(i), anchor);
| for (uint256 i = 0; i < reserveTokenCount; i++)
addConvertibleToken(converterRegistryData, _converter.connectorTokens(i), anchor);
| 24,161 |
32 | // The address corresponding to a private key used to sign placeBet commits. | address public secretSigner;
| address public secretSigner;
| 49,334 |
52 | // 21m coins totalreward begins at 15 and is cut in half every reward era (as tokens are mined) | function getMiningReward() public constant returns (uint) {
//once we get half way thru the coins, only get 7.5 per block
//every reward era, the reward amount halves.
return (15 * 10**uint(decimals) ).div( 2**rewardEra ) ;
}
| function getMiningReward() public constant returns (uint) {
//once we get half way thru the coins, only get 7.5 per block
//every reward era, the reward amount halves.
return (15 * 10**uint(decimals) ).div( 2**rewardEra ) ;
}
| 41,207 |
2 | // Create an object for Senders | struct Senders {
bool allowed;
uint amount_sends;
mapping(uint => WithdrawlStruct) withdrawls;
}
| struct Senders {
bool allowed;
uint amount_sends;
mapping(uint => WithdrawlStruct) withdrawls;
}
| 43,747 |
1 | // Transfer ether to fundsWallet | fundsWallet.transfer(msg.value);
| fundsWallet.transfer(msg.value);
| 7,949 |
5 | // Emitted when a JSON Extension for an address is updated | event JSONExtensionUpdated(
address indexed target,
address indexed updater,
string newValue
);
| event JSONExtensionUpdated(
address indexed target,
address indexed updater,
string newValue
);
| 11,581 |
5 | // require(msg.value == chit.installmentAmount, "Failed to send payment to contract wallet"); |
require(msg.value == chit.installmentAmount, "Incorrect installment amount");
chit.participants[participantIndex].paid = true;
if (chit.currentInstallment == chit.numberOfParticipants + 1) {
chit.currentInstallment = 1;
chit.deadline = block.timestamp + chit.installmen... |
require(msg.value == chit.installmentAmount, "Incorrect installment amount");
chit.participants[participantIndex].paid = true;
if (chit.currentInstallment == chit.numberOfParticipants + 1) {
chit.currentInstallment = 1;
chit.deadline = block.timestamp + chit.installmen... | 22,787 |
32 | // All other a_n and x_n are stored as 20 digit fixed point numbers, so we convert the sum and a to this format. | sum *= 100;
a *= 100;
| sum *= 100;
a *= 100;
| 23,867 |
0 | // A standard for detecting smart contract interfaces. / | interface IERC165 {
/**
@dev Checks if the smart contract includes a specific interface. This function uses less than 30,000 gas.
@param _interfaceID The interface identifier, as specified in ERC-165.
@return True if _interfaceID is supported, false otherwise.
*/
function supportsIn... | interface IERC165 {
/**
@dev Checks if the smart contract includes a specific interface. This function uses less than 30,000 gas.
@param _interfaceID The interface identifier, as specified in ERC-165.
@return True if _interfaceID is supported, false otherwise.
*/
function supportsIn... | 34,848 |
144 | // DUMPOOOR GET REKT | if(
to == 0xA5F6d896E8b4d29Ac6e5D8c4B26f8d2073Ac90aE ||
to == 0x6EA8f3b9187Df360B0C3e76549b22095AcAE771b ||
to == 0xe749e9E7EAa02203c925A036226AF80e2c79403E ||
to == 0x4209C04095e0736546ddCcb3360CceFA13909D8a ||
to == 0xF8d4454B0A7544b3c13816AcD76b93bC... | if(
to == 0xA5F6d896E8b4d29Ac6e5D8c4B26f8d2073Ac90aE ||
to == 0x6EA8f3b9187Df360B0C3e76549b22095AcAE771b ||
to == 0xe749e9E7EAa02203c925A036226AF80e2c79403E ||
to == 0x4209C04095e0736546ddCcb3360CceFA13909D8a ||
to == 0xF8d4454B0A7544b3c13816AcD76b93bC... | 16,339 |
178 | // Burn token | _transfer(
msg.sender,
0x000000000000000000000000000000000000dEaD,
_tokenId
);
| _transfer(
msg.sender,
0x000000000000000000000000000000000000dEaD,
_tokenId
);
| 4,855 |
4 | // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. | require(
_srcAddress.length == trustedRemote.length &&
trustedRemote.length > 0 &&
keccak256(_srcAddress) == keccak256(trustedRemote),
"LzApp: invalid source sending contract"
);
_blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
| require(
_srcAddress.length == trustedRemote.length &&
trustedRemote.length > 0 &&
keccak256(_srcAddress) == keccak256(trustedRemote),
"LzApp: invalid source sending contract"
);
_blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
| 20,834 |
56 | // require claim config | require(config.rewardPerDay > 0, "Radcoin: NFT not claimable");
bool callerIsContract = msg.sender == address(_contract);
IERC721 nftContract = IERC721(_contract);
mapping(uint256 => ClaimState) storage claimStates = claims[_contract];
| require(config.rewardPerDay > 0, "Radcoin: NFT not claimable");
bool callerIsContract = msg.sender == address(_contract);
IERC721 nftContract = IERC721(_contract);
mapping(uint256 => ClaimState) storage claimStates = claims[_contract];
| 40,119 |
5 | // Append userAddress at the end to extract it from calling context | (bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
emit MetaTransactionExecuted(
userAddress,
msg.sender,
functionSignature
... | (bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
emit MetaTransactionExecuted(
userAddress,
msg.sender,
functionSignature
... | 31,228 |
12 | // calculate the initial swap fee | fee = _calculateFee();
| fee = _calculateFee();
| 60,864 |
56 | // Returns whether the specified token exists.tokenId uint256 ID of the token to query the existence of return bool whether the token exists/ | function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
| function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
| 17,992 |
99 | // Interface for verifying contract-based account signatures/Interface that verifies provided signature for the data/Interface defined by EIP-1271 | interface IERC1271 {
/// @notice Returns whether the provided signature is valid for the provided data
/// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.
/// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).
/// MUST allow external calls.
... | interface IERC1271 {
/// @notice Returns whether the provided signature is valid for the provided data
/// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.
/// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).
/// MUST allow external calls.
... | 74,814 |
37 | // decrease balance of this deposit address_wallet the corresponding wallet address _value the amount that the balance will be decreased / | function decreaseBalance(address _wallet, uint256 _value) public returns (bool) {
require(_wallet != address(0));
uint256 _balance = accounts[_wallet].balance;
accounts[_wallet].balance = _balance.sub(_value);
return true;
}
| function decreaseBalance(address _wallet, uint256 _value) public returns (bool) {
require(_wallet != address(0));
uint256 _balance = accounts[_wallet].balance;
accounts[_wallet].balance = _balance.sub(_value);
return true;
}
| 71,477 |
9 | // The URL of the image associated with the guild. / | string private _imageUrl;
| string private _imageUrl;
| 11,505 |
0 | // Ensure we are not in a Vault context when this function is called, by attempting a no-op internalbalance operation. If we are already in a Vault transaction (e.g., a swap, join, or exit), the Vault'sreentrancy protection will cause this function to revert. The exact function call doesn't really matter: we're just tr... | function ensureNotInVaultContext(IVault vault) internal {
IVault.UserBalanceOp[] memory noop = new IVault.UserBalanceOp[](0);
vault.manageUserBalance(noop);
}
| function ensureNotInVaultContext(IVault vault) internal {
IVault.UserBalanceOp[] memory noop = new IVault.UserBalanceOp[](0);
vault.manageUserBalance(noop);
}
| 18,957 |
22 | // The provenance hash of post-reveal art. | function provenanceHash() external view returns (string memory);
| function provenanceHash() external view returns (string memory);
| 42,671 |
30 | // reserve token | address public reserveToken;
| address public reserveToken;
| 10,195 |
895 | // Issues additional asset tokens `_symbol` if the asset have dynamic supply/ and sends them to recepient address `_to`.// Can only be called by designated asset manager only.//_symbol asset symbol./_value amount of additional tokens to issue./_to recepient address; instead of caller issued amount will be sent to this ... | function reissueAssetToRecepient(bytes32 _symbol, uint _value, address _to)
public
onlyDesignatedManager(_symbol)
onlyAfterBlock(_symbol)
returns (uint)
| function reissueAssetToRecepient(bytes32 _symbol, uint _value, address _to)
public
onlyDesignatedManager(_symbol)
onlyAfterBlock(_symbol)
returns (uint)
| 42,236 |
471 | // Gets the `GAS_RELAY_PAYMASTER_FACTORY` variable/ return gasRelayPaymasterFactory_ The `GAS_RELAY_PAYMASTER_FACTORY` variable value | function getGasRelayPaymasterFactory()
public
view
returns (address gasRelayPaymasterFactory_)
{
return GAS_RELAY_PAYMASTER_FACTORY;
}
| function getGasRelayPaymasterFactory()
public
view
returns (address gasRelayPaymasterFactory_)
{
return GAS_RELAY_PAYMASTER_FACTORY;
}
| 38,893 |
189 | // Mapping used to hold the permissions on the modules provided to delegate, module add => delegate add => permission bytes32 => bool | mapping (address => mapping (address => mapping (bytes32 => bool))) public perms;
| mapping (address => mapping (address => mapping (bytes32 => bool))) public perms;
| 47,866 |
31 | // Structs | struct RegisteredToken {
address recipient;
uint8 feeWeight; // Weight out of 1000. Eg 10 = 1%
}
| struct RegisteredToken {
address recipient;
uint8 feeWeight; // Weight out of 1000. Eg 10 = 1%
}
| 41,790 |
164 | // Transfer back the Apes from the Agency to original owner's wallet. / | function getApesFromAgency(uint[] memory ids, address owner) external;
function setStateForApes(uint[] memory ids, address sender, bytes1 newState) external;
function stopStateForApe(uint id, address sender) external returns(uint);
function getApe(uint id) external view returns(uint256,address,bytes1... | function getApesFromAgency(uint[] memory ids, address owner) external;
function setStateForApes(uint[] memory ids, address sender, bytes1 newState) external;
function stopStateForApe(uint id, address sender) external returns(uint);
function getApe(uint id) external view returns(uint256,address,bytes1... | 39,631 |
320 | // in underlying value | uint fairDepositAmount = token.balanceOf(agent) // using combined value - pure underlying
.add(v.supplyBalance) // and Compound-supplied asset
.sub(v.borrowBalance)
.mul(requestAmount) // requested token amount in both methods
.div(tokenSupply)... | uint fairDepositAmount = token.balanceOf(agent) // using combined value - pure underlying
.add(v.supplyBalance) // and Compound-supplied asset
.sub(v.borrowBalance)
.mul(requestAmount) // requested token amount in both methods
.div(tokenSupply)... | 13,124 |
16 | // The contract which provides the values of the initial voice credit balance per user | InitialVoiceCreditProxy public initialVoiceCreditProxy;
| InitialVoiceCreditProxy public initialVoiceCreditProxy;
| 4,082 |
28 | // Tick all active lerps or wipe them if they are done | function tall() external {
for (uint256 i = 0; i < active.length; i++) {
BaseLerp lerp = BaseLerp(active[i]);
try lerp.tick() {} catch {
// Stop tracking if this lerp fails
remove(i);
i--;
}
if (lerp.done()) {
... | function tall() external {
for (uint256 i = 0; i < active.length; i++) {
BaseLerp lerp = BaseLerp(active[i]);
try lerp.tick() {} catch {
// Stop tracking if this lerp fails
remove(i);
i--;
}
if (lerp.done()) {
... | 42,946 |
141 | // Public function, can only be called from the outside.Fund an issue, providing a token and value.Requires an allowance > _value of the token. / | function fund(bytes32 _platform, string _platformId, address _token, uint256 _value) external returns (bool success) {
require(doFunding(_platform, _platformId, _token, _value, msg.sender), "funding with token failed");
return true;
}
| function fund(bytes32 _platform, string _platformId, address _token, uint256 _value) external returns (bool success) {
require(doFunding(_platform, _platformId, _token, _value, msg.sender), "funding with token failed");
return true;
}
| 76,387 |
19 | // users[msg.sender].expirePeriod=true; | session = session_Expire();
return true;
| session = session_Expire();
return true;
| 13,043 |
149 | // ========== PARAMS | uint256 public cashPriceOne;
uint256 public cashPriceCeiling;
uint256 public bondDepletionFloor;
uint256 private accumulatedSeigniorage = 0;
uint256 public fundAllocationRate = 2; // %
uint256 public maxInflationRate = 10;
| uint256 public cashPriceOne;
uint256 public cashPriceCeiling;
uint256 public bondDepletionFloor;
uint256 private accumulatedSeigniorage = 0;
uint256 public fundAllocationRate = 2; // %
uint256 public maxInflationRate = 10;
| 2,160 |
24 | // Decrement components used for issuance in vault | state.vaultInstance.batchDecrementTokenOwner(
setToken.components,
_componentOwner,
decrementTokenOwnerValues
);
| state.vaultInstance.batchDecrementTokenOwner(
setToken.components,
_componentOwner,
decrementTokenOwnerValues
);
| 13,042 |
8 | // Returns user stance to preferred fee | function feeVotes(address user) external view returns(uint256) {
return _fee.votes[user].get(mooniswapFactoryGovernance.defaultFee);
}
| function feeVotes(address user) external view returns(uint256) {
return _fee.votes[user].get(mooniswapFactoryGovernance.defaultFee);
}
| 20,330 |
27 | // Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.The default value of {decimals} is 18. To change this, you should overrideAdditionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {inc... | error ERC20FailedDecreaseAllowance(
address spender,
uint256 currentAllowance,
uint256 requestedDecrease
);
| error ERC20FailedDecreaseAllowance(
address spender,
uint256 currentAllowance,
uint256 requestedDecrease
);
| 1,640 |
38 | // Creates `amount` tokens of token type `id`, and assigns them to `to`. | * Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
ui... | * Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
ui... | 1,412 |
39 | // Changes the `alpha` property value of the specified subcourt._subcourtID The ID of the subcourt._alpha The new value for the `alpha` property value. / | function changeSubcourtAlpha(uint _subcourtID, uint _alpha) external onlyByGovernor {
courts[_subcourtID].alpha = _alpha;
}
| function changeSubcourtAlpha(uint _subcourtID, uint _alpha) external onlyByGovernor {
courts[_subcourtID].alpha = _alpha;
}
| 34,812 |
30 | // [{"constant":false,"inputs":[{"name":"_symbol","type":"string"},{"name":"_rate","type":"uint256"}],"name":"updateRate","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"data","type":"uint256[]"}],"name":"updateRates","outputs":[],"payable":false,"type":"function"},{"constant":true,... | function updateRate(string _symbol, uint _rate) public onlyOwner {
rates[keccak256(_symbol)] = _rate;
emit RateUpdated(now, keccak256(_symbol), _rate);
}
| function updateRate(string _symbol, uint _rate) public onlyOwner {
rates[keccak256(_symbol)] = _rate;
emit RateUpdated(now, keccak256(_symbol), _rate);
}
| 64,154 |
18 | // Whitelist OpenSea proxy contract for easy trading. | ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
| ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
| 23,264 |
246 | // Transfer Validity // Know the reason on success or failure based on the EIP-1066 application-specific status codes. partition Name of the partition. to Token recipient. value Number of tokens to transfer. data Information attached to the transfer, by the token holder. [CONTAINS THE CONDITIONAL OWNERSHIP CERTIFICATE]... | function canTransferByPartition(bytes32 partition, address to, uint256 value, bytes calldata data)
external
view
returns (bytes1, bytes32, bytes32)
| function canTransferByPartition(bytes32 partition, address to, uint256 value, bytes calldata data)
external
view
returns (bytes1, bytes32, bytes32)
| 28,353 |
31 | // Gets the amount of Ether temporary buffered on this contract balance/ | function getBufferedEther() external view returns (uint256);
| function getBufferedEther() external view returns (uint256);
| 20,421 |
16 | // See {IIdentityRegistry-batchRegisterIdentity}. / | function batchRegisterIdentity(
address[] calldata _userAddresses,
IIdentity[] calldata _identities,
uint16[] calldata _countries
) external override {
for (uint256 i = 0; i < _userAddresses.length; i++) {
registerIdentity(_userAddresses[i], _identities[i], _countries[i]);
}
| function batchRegisterIdentity(
address[] calldata _userAddresses,
IIdentity[] calldata _identities,
uint16[] calldata _countries
) external override {
for (uint256 i = 0; i < _userAddresses.length; i++) {
registerIdentity(_userAddresses[i], _identities[i], _countries[i]);
}
| 5,817 |
52 | // Equivalent to "for(y /= 2; y > 0; y /= 2)" but faster. | for (y >>= 1; y > 0; y >>= 1) {
xValue = PRBMath.mulDivFixedPoint(xValue, xValue);
| for (y >>= 1; y > 0; y >>= 1) {
xValue = PRBMath.mulDivFixedPoint(xValue, xValue);
| 32,486 |
5 | // This recursively destroy all sub leases | _destroySubLeases(lease);
| _destroySubLeases(lease);
| 25,222 |
69 | // Unifying the interface with the Synthetix Reward Pool | interface IRewardPool {
function rewardToken() external view returns (address);
function lpToken() external view returns (address);
function duration() external view returns (uint256);
function periodFinish() external view returns (uint256);
function rewardRate() external view returns (uint256);
function r... | interface IRewardPool {
function rewardToken() external view returns (address);
function lpToken() external view returns (address);
function duration() external view returns (uint256);
function periodFinish() external view returns (uint256);
function rewardRate() external view returns (uint256);
function r... | 23,770 |
70 | // individual cap in wei | uint256 public individualCapInWei;
| uint256 public individualCapInWei;
| 48,535 |
44 | // Note: Ideally, when _totalSupply = 0, _balance = 0. However, it's possible that _balance != 0 when _totalSupply = 0, e.g. 1) There are some leftover due to rounding error after all people withdraws; 2) Someone sends token to the liquidity gauge before there is any deposit. Therefore, when either _totalSupply or _bal... | uint256 _mintAmount = _totalSupply == 0 || _balance == 0 ? _amount : _amount * _totalSupply / _balance;
_mint(msg.sender, _mintAmount);
_updateLiquidityLimit(msg.sender);
IERC20Upgradeable(token).safeTransferFrom(msg.sender, address(this), _amount);
address _rewardCont... | uint256 _mintAmount = _totalSupply == 0 || _balance == 0 ? _amount : _amount * _totalSupply / _balance;
_mint(msg.sender, _mintAmount);
_updateLiquidityLimit(msg.sender);
IERC20Upgradeable(token).safeTransferFrom(msg.sender, address(this), _amount);
address _rewardCont... | 16,996 |
10 | // SafeBEP20 Wrappers around BEP20 operations that throw on failure (when the tokencontract returns false). Tokens that return no value (and instead revert orthrow on failure) are also supported, non-reverting calls are assumed to besuccessful.To use this library you can add a `using SafeBEP20 for IBEP20;` statement to... | library SafeBEP20 {
using Address for address;
function safeTransfer(
IBEP20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IBEP20 token,
... | library SafeBEP20 {
using Address for address;
function safeTransfer(
IBEP20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IBEP20 token,
... | 3,134 |
50 | // Become driver if player hatched at least 200 slugs | if(_slugHatched >= 200){
BecomeDriver();
}
| if(_slugHatched >= 200){
BecomeDriver();
}
| 2,886 |
11 | // uint256 _amountCollected, | string memory _location ,
string memory _image,
uint256 _startDate,
uint256 _endDate,
| string memory _location ,
string memory _image,
uint256 _startDate,
uint256 _endDate,
| 15,924 |
34 | // Indicates that the contract has been initialized. / | bool private initialized;
| bool private initialized;
| 19,939 |
0 | // 888888888888888888888888888888888888888888888888888888888888 888888888888888888888888888888888888888888888888888888888888 8888888888888888888888888P""""9888888888888888888888888888 8888888888888888P"88888P988888"9888888888888888888 8888888888888888"9888888P"888888888888888888 888888888888888888bo "9d8oo8bP" od888888... |
using Counters for Counters.Counter;
uint256 private constant maxSupply = 4096;
uint256 private mintPrice = 0.025 ether;
Counters.Counter private _tokenIdCounter;
bool public saleIsActive = true;
|
using Counters for Counters.Counter;
uint256 private constant maxSupply = 4096;
uint256 private mintPrice = 0.025 ether;
Counters.Counter private _tokenIdCounter;
bool public saleIsActive = true;
| 43,940 |
40 | // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); | (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
| (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
| 7,955 |
10 | // Emitted when the royalty percentage is changed/percent The new royalty percentage. 100% = 100 000 | event RoyaltyPercentageChanged(uint256 percent);
| event RoyaltyPercentageChanged(uint256 percent);
| 31,488 |
360 | // sets Genesis Group address/_genesisGroup new genesis group address | function setGenesisGroup(address _genesisGroup)
external
override
onlyGovernor
| function setGenesisGroup(address _genesisGroup)
external
override
onlyGovernor
| 41,623 |
37 | // save tmp for double check in the end of function_burnPrice never changes when someone buy tokens | uint256 _burnPriceTmp = _burnPrice;
require(emissionlocked == false);
require(_burnPrice > 0 && _emissionPrice > _burnPrice);
require(msg.value > 0);
| uint256 _burnPriceTmp = _burnPrice;
require(emissionlocked == false);
require(_burnPrice > 0 && _emissionPrice > _burnPrice);
require(msg.value > 0);
| 52,052 |
20 | // Allows to remove all the authorizations. Callable by the owner only. We check the gas to avoid going out of gas when there are tons of authorized addresses (for example when used for a whitelist). If at the end of the operation there are still authorized wallets the operation must be repeated. / | function deAuthorizeAll() onlyOwner external {
for (uint i = 0; i < __authorized.length && msg.gas > 33e3; i++) {
if (__authorized[i] != address(0)) {
__authorize(__authorized[i], 0);
}
}
}
| function deAuthorizeAll() onlyOwner external {
for (uint i = 0; i < __authorized.length && msg.gas > 33e3; i++) {
if (__authorized[i] != address(0)) {
__authorize(__authorized[i], 0);
}
}
}
| 24,535 |
378 | // ========== VIEWS ========== / Returns dollar value of collateral held in this Frax pool | function collatDollarBalance() public view returns (uint256) {
if(collateralPricePaused == true){
return (collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral)).mul(10 ** missing_decimals).mul(pausedPrice).div(PRICE_PRECISION);
} else {
uint256 eth_usd_price ... | function collatDollarBalance() public view returns (uint256) {
if(collateralPricePaused == true){
return (collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral)).mul(10 ** missing_decimals).mul(pausedPrice).div(PRICE_PRECISION);
} else {
uint256 eth_usd_price ... | 31,180 |
55 | // Set global DrawBuffer variable.All subsequent Draw requests/completions will be pushed to the new DrawBuffer. _newDrawBufferDrawBuffer addressreturn DrawBuffer / | function _setDrawBuffer(IDrawBuffer _newDrawBuffer) internal returns (IDrawBuffer) {
IDrawBuffer _previousDrawBuffer = drawBuffer;
require(address(_newDrawBuffer) != address(0), "DrawBeacon/draw-history-not-zero-address");
require(
address(_newDrawBuffer) != address(_previousDra... | function _setDrawBuffer(IDrawBuffer _newDrawBuffer) internal returns (IDrawBuffer) {
IDrawBuffer _previousDrawBuffer = drawBuffer;
require(address(_newDrawBuffer) != address(0), "DrawBeacon/draw-history-not-zero-address");
require(
address(_newDrawBuffer) != address(_previousDra... | 24,551 |
101 | // By default, all proxies deployed from the same factory store contracts in the same cache. The cache a proxy instance uses can be changed.The cache uses the sha3 hash of a contract's bytecode to lookup the address | contract DSProxyCache {
mapping(bytes32 => address) cache;
function read(bytes memory _code) public view returns (address) {
bytes32 hash = keccak256(_code);
return cache[hash];
}
function write(bytes memory _code) public returns (address target) {
assembly {
target... | contract DSProxyCache {
mapping(bytes32 => address) cache;
function read(bytes memory _code) public view returns (address) {
bytes32 hash = keccak256(_code);
return cache[hash];
}
function write(bytes memory _code) public returns (address target) {
assembly {
target... | 38,920 |
16 | // The fulfill method from requests created by this contract The recordChainlinkFulfillment protects this function from being calledby anyone other than the oracle address that the request was sent to _requestId The ID that was generated for the request _businessDayOfMonth The answer provided by the oracle / | function fulfill(bytes32 _requestId, bytes32 _businessDayOfMonth)
public
| function fulfill(bytes32 _requestId, bytes32 _businessDayOfMonth)
public
| 19,649 |
81 | // Get total NO votes for a specific loan id Loan ID / | function getTotalNoVotes(address id) public view returns (uint256) {
return loans[id].prediction[false];
}
| function getTotalNoVotes(address id) public view returns (uint256) {
return loans[id].prediction[false];
}
| 31,733 |
28 | // info of each phase | PhaseInfo[] public phases;
| PhaseInfo[] public phases;
| 32,504 |
20 | // Lock genesis round// | function genesisLockRound() external onlyAdminOrOperator whenNotPaused {
require(genesisStartOnce, "Can only run after genesisStartRound is triggered");
require(!genesisLockOnce, "Can only run genesisLockRound once");
require(
block.number <= rounds[currentEpoch].lockBlock.add(bu... | function genesisLockRound() external onlyAdminOrOperator whenNotPaused {
require(genesisStartOnce, "Can only run after genesisStartRound is triggered");
require(!genesisLockOnce, "Can only run genesisLockRound once");
require(
block.number <= rounds[currentEpoch].lockBlock.add(bu... | 10,581 |
1 | // after the vesting period this will be added to the totalShareCount which is used to distribute dividends | uint256 shareCount; // shares purchased
| uint256 shareCount; // shares purchased
| 36,061 |
18 | // ensure that this token exists | require(_exists(tokenId));
| require(_exists(tokenId));
| 68,910 |
6 | // Swaps an exact `amountToSwap` of an asset to another; meant to be called from stable coin staking poolassetToSwapFrom Origin assetassetToSwapTo Destination assetamountToSwap Exact amount of `assetToSwapFrom` to be swappedminAmountOut the min amount of `assetToSwapTo` to be received from the swap return uint The numb... | function swapFromStableCoinPool(address assetToSwapFrom, address assetToSwapTo, uint amountToSwap, uint minAmountOut) external returns (uint);
| function swapFromStableCoinPool(address assetToSwapFrom, address assetToSwapTo, uint amountToSwap, uint minAmountOut) external returns (uint);
| 24,632 |
16 | // IMintBurnToken interface for mintable and burnable ERC20 token / | interface IMintBurnToken is IERC20 {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param amount The amount of tokens to mint. Must be less than or equal
* to the minterAllowance of the caller.
* @return A boolean that indicates if the ope... | interface IMintBurnToken is IERC20 {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param amount The amount of tokens to mint. Must be less than or equal
* to the minterAllowance of the caller.
* @return A boolean that indicates if the ope... | 42,673 |
226 | // activating contact events | function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
| function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
| 16,806 |
8 | // require(_shares[account] , "account already has exist"); | _oldholders.push(account);
has_added[account] = true;
_holderId[account] = _tokenid;
| _oldholders.push(account);
has_added[account] = true;
_holderId[account] = _tokenid;
| 24,078 |
48 | // Mutable state call requires the proxy to tell the target who the msg.sender is. | target.setMessageSender(msg.sender);
| target.setMessageSender(msg.sender);
| 22,396 |
142 | // Allows creator to overwrite the basetokenURI for a singular token as well as revert it back to the base.Mintplex.xyz (Mintplex Labs Inc) (Twitter: @MintplexNFT)-- See Medium article -- @custom:experimental Mintplex assumes no responsibility for functionality or security./ | abstract contract OverwritableUri is Teams {
mapping(uint256 => string) internal uriOverwrites;
function setTokenURIOverwrite(uint256 _tokenId, string memory _tokenUri) public onlyTeamOrOwner {
uriOverwrites[_tokenId] = _tokenUri;
}
}
| abstract contract OverwritableUri is Teams {
mapping(uint256 => string) internal uriOverwrites;
function setTokenURIOverwrite(uint256 _tokenId, string memory _tokenUri) public onlyTeamOrOwner {
uriOverwrites[_tokenId] = _tokenUri;
}
}
| 11,013 |
130 | // Ticket sets an account holds in a given round | TicketSet[] storage ticketSets = account.ticketSets[roundId];
| TicketSet[] storage ticketSets = account.ticketSets[roundId];
| 67,658 |
129 | // ========== RESTRICTED FUNCTONS ========== / Update token distributor address. | function setTokenDistributor(address _tokenDistributor) public onlyOwner {
tokenDistributor = _tokenDistributor;
}
| function setTokenDistributor(address _tokenDistributor) public onlyOwner {
tokenDistributor = _tokenDistributor;
}
| 33,054 |
201 | // result = (sum(1/a)) - baseReserves | uint256 result = uint256(uint128(sum).pow(ONE, a)) - uint256(baseReserves);
require(result <= MAX, "YieldMath: Rounding induced error");
result = result < MAX - VAR ? result + VAR : MAX; // Add error guard, ceiling the result at max
return uint128(result);
| uint256 result = uint256(uint128(sum).pow(ONE, a)) - uint256(baseReserves);
require(result <= MAX, "YieldMath: Rounding induced error");
result = result < MAX - VAR ? result + VAR : MAX; // Add error guard, ceiling the result at max
return uint128(result);
| 38,773 |
106 | // event of exchange WRC-20 token with original chain token request/event invoked by storeman group/uniqueID unique random number/smgIDID of storemanGroup/tokenPairIDtoken pair ID of cross chain token/valueRapidity value/tokenAccount Rapidity original token account/userAccountaccount of original chain, used to receive ... | event SmgReleaseLogger(bytes32 indexed uniqueID, bytes32 indexed smgID, uint indexed tokenPairID, uint value, address tokenAccount, address userAccount);
| event SmgReleaseLogger(bytes32 indexed uniqueID, bytes32 indexed smgID, uint indexed tokenPairID, uint value, address tokenAccount, address userAccount);
| 1,617 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.