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 |
|---|---|---|---|---|
163 | // lets the owner do an ERC20 approve followed by a call to a contract. The address to approve may be different than the contract to call. We assume that the contract does not require ETH._wallet The target wallet._token The token to approve._spender The address to approve._amount The amount of ERC20 tokens to approve.... | function approveTokenAndCallContract(
BaseWallet _wallet,
address _token,
address _spender,
uint256 _amount,
address _contract,
bytes calldata _data
)
external
onlyExecute
| function approveTokenAndCallContract(
BaseWallet _wallet,
address _token,
address _spender,
uint256 _amount,
address _contract,
bytes calldata _data
)
external
onlyExecute
| 4,913 |
65 | // Only BalanceManager can call this function to notify reward. - Reward must be greater than 0. - Must update reward info before notify. - Must contain remaining reward of previous cycle - Update reward cycle info/ | {
require(msg.value > 0, "Invalid reward");
updateReward();
uint256 remainingReward = lastReward > usedReward
? lastReward.sub(usedReward)
: 0;
lastReward = msg.value.add(remainingReward);
usedReward = 0;
rewardCycleEnd = block.number.add(rewar... | {
require(msg.value > 0, "Invalid reward");
updateReward();
uint256 remainingReward = lastReward > usedReward
? lastReward.sub(usedReward)
: 0;
lastReward = msg.value.add(remainingReward);
usedReward = 0;
rewardCycleEnd = block.number.add(rewar... | 45,862 |
205 | // Used to permanently halt all minting | bool public mintingFrozen;
| bool public mintingFrozen;
| 26,225 |
70 | // Admin contract for KittyBounties. Holds owner-only functions to adjust contract-wide fees, change owners, etc./The owner is not capable of changing the address of the CryptoKitties Core contract once the contract has been deployed./This prevents an attack vector where the owner could change the kittyCore contract on... | contract KittyBountiesAdmin is Ownable, Pausable, ReentrancyGuard, COORole {
/* ****** */
/* EVENTS */
/* ****** */
/// @dev This event is fired whenever the owner changes the successfulBountyFeeInBasisPoints.
/// @param newSuccessfulBountyFeeInBasisPoints The SuccessfulFee is expressed in basis ... | contract KittyBountiesAdmin is Ownable, Pausable, ReentrancyGuard, COORole {
/* ****** */
/* EVENTS */
/* ****** */
/// @dev This event is fired whenever the owner changes the successfulBountyFeeInBasisPoints.
/// @param newSuccessfulBountyFeeInBasisPoints The SuccessfulFee is expressed in basis ... | 31,376 |
13 | // verify if this order is for a specific address | if (order.taker != address(0)) {
require(msg.sender == order.taker, 'Sale: Order not for this user');
}
| if (order.taker != address(0)) {
require(msg.sender == order.taker, 'Sale: Order not for this user');
}
| 63,078 |
670 | // Numerator: 1. val = 1. val := mulmod(val, 1, PRIME). Denominator: point^(trace_length / 4096) - trace_generator^(255trace_length / 256). val = denominator_invs[17]. | val := mulmod(val, mload(0x4940), PRIME)
| val := mulmod(val, mload(0x4940), PRIME)
| 21,748 |
34 | // ------------------------------------------------------------------------ Count content for article ------------------------------------------------------------------------ | function countContentForArticle(uint256 articleId) public view returns(uint256) {
return articleContentIds[articleId].contentIds.length;
}
| function countContentForArticle(uint256 articleId) public view returns(uint256) {
return articleContentIds[articleId].contentIds.length;
}
| 11,070 |
32 | // Withdraws funds from any Moloch (incl. UberHaus or the minion owner DAO) into this Minion | require(IMOLOCH(targetDao).getUserTokenBalance(address(this), token) >= amount, "user balance < amount");
IMOLOCH(targetDao).withdrawBalance(token, amount); // withdraw funds from DAO
emit DoWithdraw(targetDao, token, amount);
| require(IMOLOCH(targetDao).getUserTokenBalance(address(this), token) >= amount, "user balance < amount");
IMOLOCH(targetDao).withdrawBalance(token, amount); // withdraw funds from DAO
emit DoWithdraw(targetDao, token, amount);
| 8,041 |
11 | // message unnecessarily. For custom revert reasons use {trySub}. Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow. / | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
| function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
| 628 |
42 | // Emit BuyGold event | emit BuyGold(msg.sender, _GoldPrice, msg.value);
| emit BuyGold(msg.sender, _GoldPrice, msg.value);
| 63,807 |
16 | // allow the owner to pre-mint or save a number of tokens | function reserveTokens(uint _amount, address _receiver) public onlyOwner {
uint256 newSupply = totalSupply + _amount;
require(newSupply <= maxSupply, "MAX_SUPPLY_EXCEEDED");
for (uint256 i = 0; i < _amount; i++) {
_mint(_receiver, totalSupply + i);
}
... | function reserveTokens(uint _amount, address _receiver) public onlyOwner {
uint256 newSupply = totalSupply + _amount;
require(newSupply <= maxSupply, "MAX_SUPPLY_EXCEEDED");
for (uint256 i = 0; i < _amount; i++) {
_mint(_receiver, totalSupply + i);
}
... | 62,455 |
3 | // Event to log that payment for bounty has been received to be stored temporarily in contract | event Received(address indexed _from, uint _value);
| event Received(address indexed _from, uint _value);
| 2,288 |
8 | // Mint multiple nft and transfer to - accounts uris - token uris / | function mintBatchAndTransfer(address[] memory to, string[] memory uris) external onlyRole(MINTER_ROLE) nonReentrant {
for (uint256 i; i < uris.length; ++i) {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to[i], tokenId);
... | function mintBatchAndTransfer(address[] memory to, string[] memory uris) external onlyRole(MINTER_ROLE) nonReentrant {
for (uint256 i; i < uris.length; ++i) {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to[i], tokenId);
... | 35,758 |
223 | // _totalBalance {uint} total balance of tokens assigned to this userreturn {uint} amount of tokens available to transfer / |
function vestedAmount(uint _totalBalance) public view returns (uint) {
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= startCountDown.add(duration)) {
|
function vestedAmount(uint _totalBalance) public view returns (uint) {
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= startCountDown.add(duration)) {
| 7,123 |
27 | // ------------------------------- MESSAGE PUBLICATION---------------------------------------- | function testPublishMessage(
string uuid,
string message,
uint32 duration,
address contractAddress
| function testPublishMessage(
string uuid,
string message,
uint32 duration,
address contractAddress
| 43,995 |
4 | // Set the preferred aggregator. Reverts unless called by the chain owner or the current default aggregator. | function setDefaultAggregator(address newDefault) external;
| function setDefaultAggregator(address newDefault) external;
| 39,387 |
259 | // Gets the instance of Set valuer on Controller. Note: SetValuer is stored as index 2 on the Controller / | function getSetValuer(IController _controller) internal view returns (ISetValuer) {
return ISetValuer(_controller.resourceId(SET_VALUER_RESOURCE_ID));
}
| function getSetValuer(IController _controller) internal view returns (ISetValuer) {
return ISetValuer(_controller.resourceId(SET_VALUER_RESOURCE_ID));
}
| 46,492 |
185 | // We have set a capped price. Log it so we can detect the situation and investigate. | emit CappedPricePosted(
_asset,
_requestedPriceMantissa,
_localVars.cappingAnchorPriceMantissa,
_localVars.price.mantissa
);
| emit CappedPricePosted(
_asset,
_requestedPriceMantissa,
_localVars.cappingAnchorPriceMantissa,
_localVars.price.mantissa
);
| 17,853 |
30 | // Should return whether the signature provided is valid for the provided data/hash 32-byte hash of the data that is signed/_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, view modifier for ... | function isValidSignature(
bytes32 hash,
bytes calldata _signature)
external
view
returns (bytes4);
| function isValidSignature(
bytes32 hash,
bytes calldata _signature)
external
view
returns (bytes4);
| 36,550 |
14 | // user tokens | mapping (address => uint256) public balances;
| mapping (address => uint256) public balances;
| 62,715 |
6 | // ============Ownable ============ | function addAdminList (address userAddr) external onlyOwner {
isAdminListed[userAddr] = true;
emit addAdmin(userAddr);
}
| function addAdminList (address userAddr) external onlyOwner {
isAdminListed[userAddr] = true;
emit addAdmin(userAddr);
}
| 1,977 |
17 | // Enables `_account` redeem address to burn. | * Emits a {EnableUserRedeemAddress} event.
*
* Requirements:
*
* - `_account` should be a registered as user.
* - `_account` should be KYC verified.
*/
function enableRedeemAddress(address _account) public onlyOwner {
require(_isUser(_account), "not a user");
requi... | * Emits a {EnableUserRedeemAddress} event.
*
* Requirements:
*
* - `_account` should be a registered as user.
* - `_account` should be KYC verified.
*/
function enableRedeemAddress(address _account) public onlyOwner {
require(_isUser(_account), "not a user");
requi... | 33,538 |
906 | // Resolution for all fixed point numeric parameters which represent percents. The resolution allows for a/ granularity of 0.01% increments. | uint256 public constant PERCENT_RESOLUTION = 10000;
| uint256 public constant PERCENT_RESOLUTION = 10000;
| 53,767 |
200 | // User supplies assets into the market and receives dTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supplyreturn (uint, uint) An error code (0=success, otherwise a fail... | function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {
/* Fail if mint not allowed */
uint allowed = dController.mintAllowed(address(this), minter, mintAmount);
if (allowed != 0) {
return (failOpaque(Error.DCONTROLLER_REJECTION, FailureInfo.MINT_DCON... | function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {
/* Fail if mint not allowed */
uint allowed = dController.mintAllowed(address(this), minter, mintAmount);
if (allowed != 0) {
return (failOpaque(Error.DCONTROLLER_REJECTION, FailureInfo.MINT_DCON... | 31,860 |
17 | // Compute the minimum accepted amount of ETH out of the trade, based on the slippage settings. | Decimal.D256 memory maxSlippage = Decimal.ratio(BASIS_POINTS_GRANULARITY - maximumSlippageBasisPoints, BASIS_POINTS_GRANULARITY);
uint256 minimumAcceptedAmountOut = maxSlippage.mul(amountIn).asUint256();
| Decimal.D256 memory maxSlippage = Decimal.ratio(BASIS_POINTS_GRANULARITY - maximumSlippageBasisPoints, BASIS_POINTS_GRANULARITY);
uint256 minimumAcceptedAmountOut = maxSlippage.mul(amountIn).asUint256();
| 25,627 |
197 | // Address of Opium.TokenSpender contract | address private tokenSpender;
| address private tokenSpender;
| 32,162 |
14 | // _mint() call adds 1 to total tokens, but we want the token at index - 1 | tokenIdToMetadata[totalTokens] = url;
emit Mint(url, totalTokens);
| tokenIdToMetadata[totalTokens] = url;
emit Mint(url, totalTokens);
| 11,387 |
6 | // WHAT IS OpenEthereumToken? OpenEthereumToken for general ethereum NFT token use; NFT Block Chain Token, URL link, Ethereum Interface, Data Rewrite possible, On Chain Data Storage, Transfer of Token Pay to Recieve token Individual Token Optimization Security UseageContract for OET tokens How to Use: Send Ether to Con... | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested... | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested... | 42,582 |
4 | // Send `_amount` tokens to `_to` from `msg.sender`/_to The address of the recipient/_amount The amount of tokens to be transferred/ return success Whether the transfer was successful or not | function transfer(address _to, uint256 _amount) public virtual returns (bool success);
| function transfer(address _to, uint256 _amount) public virtual returns (bool success);
| 18,006 |
24 | // Ensure signatory is authorized to sign | if (authorized[signerWallet] != address(0)) {
| if (authorized[signerWallet] != address(0)) {
| 6,129 |
2 | // only allow function to be `DELEGATECALL`ed from within a constructor. | uint32 codeSize;
assembly {
codeSize := extcodesize(address)
}
| uint32 codeSize;
assembly {
codeSize := extcodesize(address)
}
| 28,526 |
7 | // Implementation of the ERC3156 Flash loans extension, as defined in | * Adds the {flashLoan} method, which provides flash loan support at the token
* level. By default there is no fee, but this can be changed by overriding {flashFee}.
*
* _Available since v4.1._
*/
abstract contract ERC20FlashMintUpgradeable is Initializable, ERC20Upgradeable, IERC3156FlashLenderUpgradeable {
fu... | * Adds the {flashLoan} method, which provides flash loan support at the token
* level. By default there is no fee, but this can be changed by overriding {flashFee}.
*
* _Available since v4.1._
*/
abstract contract ERC20FlashMintUpgradeable is Initializable, ERC20Upgradeable, IERC3156FlashLenderUpgradeable {
fu... | 680 |
3 | // 1. Calculate new bid and ask | (order memory ask, order memory bid) = getNewOrders(
underlyingAsset,
underlyingQuote,
askNumerator,
askDenomenator,
bidNumerator,
bidDenomenator
);
| (order memory ask, order memory bid) = getNewOrders(
underlyingAsset,
underlyingQuote,
askNumerator,
askDenomenator,
bidNumerator,
bidDenomenator
);
| 17,073 |
94 | // The pool tick spacing/Ticks can only be used at multiples of this value, minimum of 1 and always positive/ e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, .../ This value is an int24 to avoid casting even though it is always positive./ return The tick spacing | function tickSpacing() external view returns (int24);
| function tickSpacing() external view returns (int24);
| 3,639 |
2 | // variables | mapping (address => Participant) participants;
bool ended = false;
uint public quote = 0;
uint public participantsCount = 0;
uint public ticketPrice = 0;
State public fsm = State.Locked; // contract finit state machine, initial state Locked
address seller = address(0);
SimpleTokenCoin pu... | mapping (address => Participant) participants;
bool ended = false;
uint public quote = 0;
uint public participantsCount = 0;
uint public ticketPrice = 0;
State public fsm = State.Locked; // contract finit state machine, initial state Locked
address seller = address(0);
SimpleTokenCoin pu... | 4,527 |
16 | // Allow given spender to transfer given number of tokens from message sender. _spender address to allow the owner of to transfer tokens from message sender _value number of tokens to allow to transferreturn true if token transfer was successfully approved, false otherwise / | function approve (address _spender, uint256 _value) public returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
| function approve (address _spender, uint256 _value) public returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
| 45,006 |
112 | // new metrics | uint sigmaTotalOptions;
uint sigmaSoldOptions;
| uint sigmaTotalOptions;
uint sigmaSoldOptions;
| 41,819 |
6 | // Function that is called when a user or another contract wants to transfer funds. | function transfer(address to, uint256 value, bytes data) public returns (bool) {
require(balanceOf[msg.sender] >= value);
uint256 codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(to)
}
balanceOf[msg.sender] -= ... | function transfer(address to, uint256 value, bytes data) public returns (bool) {
require(balanceOf[msg.sender] >= value);
uint256 codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(to)
}
balanceOf[msg.sender] -= ... | 31,479 |
155 | // This is an account call system call parse a 32-byte value at offset 1 (offset 0 is the capType byte) | uint256 capIndex = parse32ByteValue(1);
address account = address(parse32ByteValue(1+1*32));
uint256 amount = parse32ByteValue(1+2*32);
uint256 dataLength;
if (msg.data.length > (1+3*32)) {
dataLength = msg.data.length - (1+3*32);
} else {
| uint256 capIndex = parse32ByteValue(1);
address account = address(parse32ByteValue(1+1*32));
uint256 amount = parse32ByteValue(1+2*32);
uint256 dataLength;
if (msg.data.length > (1+3*32)) {
dataLength = msg.data.length - (1+3*32);
} else {
| 22,297 |
5 | // Give 'voter' the right to vote on this ballot. May only be called by 'chairperson'. voter address of voter / | function giveRightToVote(address voter) public {
require(
msg.sender == chairperson,
"Only chairperson can give right to vote."
);
require(
!voters[voter].voted,
"The voter already voted."
);
require(voters[voter].weight == 0);
... | function giveRightToVote(address voter) public {
require(
msg.sender == chairperson,
"Only chairperson can give right to vote."
);
require(
!voters[voter].voted,
"The voter already voted."
);
require(voters[voter].weight == 0);
... | 5,850 |
78 | // (pID => data) player data | mapping (uint256 => Player) public _plyr;
| mapping (uint256 => Player) public _plyr;
| 8,620 |
8 | // updates the database grants the user's permission to publish to the broadcaster | function grantPublishPermission(address user) public {
// verify that caller is admin
PermissionsSet storage requestorPermissionsSet = permissionsSet[msg.sender];
require(requestorPermissionsSet.isAdmin==true,NOT_AUTHORISED);
// make sure user does not already have permission to pu... | function grantPublishPermission(address user) public {
// verify that caller is admin
PermissionsSet storage requestorPermissionsSet = permissionsSet[msg.sender];
require(requestorPermissionsSet.isAdmin==true,NOT_AUTHORISED);
// make sure user does not already have permission to pu... | 25,582 |
15 | // Calculate deposits received by the active helping | if (!usingCredits) {
if (combo.activeHelping.exists) {
if (creatorOnly) revert CreatorOnlyUnsuccessful();
++combo.activeHelping.depositsReceived;
depositRecipient = combo.activeHelping.owner;
| if (!usingCredits) {
if (combo.activeHelping.exists) {
if (creatorOnly) revert CreatorOnlyUnsuccessful();
++combo.activeHelping.depositsReceived;
depositRecipient = combo.activeHelping.owner;
| 4,642 |
45 | // SafeMath/Math operations with safety checks that throw on error | library SafeMath {
/// @dev Add two integers
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
/// @dev Subtract two integers
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
... | library SafeMath {
/// @dev Add two integers
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
/// @dev Subtract two integers
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
... | 75,238 |
311 | // metadata | string public hiddenMetadataUri = 'https://arweave.net/_';
string public uriPrefix = 'https://arweave.net/__ARWEAVE_HASH_/';
string public uriSuffix = '.json';
| string public hiddenMetadataUri = 'https://arweave.net/_';
string public uriPrefix = 'https://arweave.net/__ARWEAVE_HASH_/';
string public uriSuffix = '.json';
| 24,918 |
273 | // we use swapTokensForExactTokens because we need an exact sUSD amount | router.swapTokensForExactTokens(
_amount,
type(uint256).max,
path,
address(this),
now
);
| router.swapTokensForExactTokens(
_amount,
type(uint256).max,
path,
address(this),
now
);
| 21,074 |
1 | // Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer ... | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| 2,706 |
58 | // Verifies if the DaoDepositContract holds the balance as expected _tokenAddress of the ERC20 token or ETH (ZERO address) / | function verifyBalance(address _token) public view {
require(
getBalance(_token) >=
tokenBalances[_token] + vestedBalances[_token],
"DaoDepositManager: Error 245"
);
}
| function verifyBalance(address _token) public view {
require(
getBalance(_token) >=
tokenBalances[_token] + vestedBalances[_token],
"DaoDepositManager: Error 245"
);
}
| 18,347 |
89 | // Compute the start and end of the dispute's current or next appeal period, if possible. If not known or appeal is impossible: should return (0, 0). _disputeID ID of the dispute.return start The start of the period.return end The end of the period. / | function appealPeriod(uint256 _disputeID) external view returns (uint256 start, uint256 end);
| function appealPeriod(uint256 _disputeID) external view returns (uint256 start, uint256 end);
| 53,816 |
1 | // function queueValidator(address _validator, uint256[2] calldata _madID) external returns (uint256); |
function getValidatorPublicKey(address _validator) external view returns (uint256[2] memory);
function getValidators() external view returns (address[] memory);
function getChainId() external view returns (uint32);
function setChainId(uint32 _chainId) external;
|
function getValidatorPublicKey(address _validator) external view returns (uint256[2] memory);
function getValidators() external view returns (address[] memory);
function getChainId() external view returns (uint32);
function setChainId(uint32 _chainId) external;
| 52,394 |
1 | // AccessControl | _grantRole(ConstantsLib.KEEPERS_TERMS_OPERATOR, msg.sender);
_grantRole(ConstantsLib.KEEPERS_LICENSE_OPERATOR, msg.sender);
| _grantRole(ConstantsLib.KEEPERS_TERMS_OPERATOR, msg.sender);
_grantRole(ConstantsLib.KEEPERS_LICENSE_OPERATOR, msg.sender);
| 29,514 |
0 | // the contract has one manager and arbitrary number of players / | constructor () {
manager = msg.sender;
}
| constructor () {
manager = msg.sender;
}
| 1,096 |
64 | // Allows an owner to confirm a transaction./transactionId Transaction ID. | function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
| function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
| 30,056 |
23 | // A registrar controller for registering and renewing names at fixed cost. / | contract ETHRegistrarController is Ownable {
using StringUtils for *;
uint constant public MIN_REGISTRATION_DURATION = 28 days;
bytes4 constant private INTERFACE_META_ID = bytes4(keccak256("supportsInterface(bytes4)"));
bytes4 constant private COMMITMENT_CONTROLLER_ID = bytes4(
keccak256("rent... | contract ETHRegistrarController is Ownable {
using StringUtils for *;
uint constant public MIN_REGISTRATION_DURATION = 28 days;
bytes4 constant private INTERFACE_META_ID = bytes4(keccak256("supportsInterface(bytes4)"));
bytes4 constant private COMMITMENT_CONTROLLER_ID = bytes4(
keccak256("rent... | 45,556 |
4 | // this doesnt work but I want to test the contract out with tuples instead of mapping and see how it works | function getPercentage (address member) external view returns (uint8) {
return receiversMap[member];
}
| function getPercentage (address member) external view returns (uint8) {
return receiversMap[member];
}
| 9,179 |
28 | // Function to get the total claimable tokens at some moment timestamp Unix time to check the number of tokens claimablereturn Number of tokens claimable at that timestamp / | function globallyClaimableAt(uint256 timestamp)
public
view
override
returns (uint256)
| function globallyClaimableAt(uint256 timestamp)
public
view
override
returns (uint256)
| 12,828 |
24 | // ------------------------------------------------------------------------ 100,000 WPHC Tokens per 1 ETH ------------------------------------------------------------------------ | function () public payable {
require(now >= startDate && now <= endDate);
uint tokens;
if (now <= bonusEnds) {
tokens = msg.value * 120000;
} else {
tokens = msg.value * 100000;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
... | function () public payable {
require(now >= startDate && now <= endDate);
uint tokens;
if (now <= bonusEnds) {
tokens = msg.value * 120000;
} else {
tokens = msg.value * 100000;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
... | 53,353 |
156 | // Lets the owner add/remove accounts from the list of reward distributors./ Reward distributors can call notifyRewardAmount()/rewardDistributor The account to add/remove/isRewardDistributor_ True to add the account, false to remove the account | function setRewardDistributor(address rewardDistributor, bool isRewardDistributor_) external onlyOwner {
isRewardDistributor[rewardDistributor] = isRewardDistributor_;
}
| function setRewardDistributor(address rewardDistributor, bool isRewardDistributor_) external onlyOwner {
isRewardDistributor[rewardDistributor] = isRewardDistributor_;
}
| 60,135 |
31 | // buyer wants exactly what is available | delete offers[id];
trade( offer.owner, quantity, offer.sell_which_token,
msg.sender, spend, offer.buy_which_token );
ItemUpdate(id);
success = true;
| delete offers[id];
trade( offer.owner, quantity, offer.sell_which_token,
msg.sender, spend, offer.buy_which_token );
ItemUpdate(id);
success = true;
| 15,252 |
16 | // if you don&39;t have approval, throw | if(_approvals[from][msg.sender] < value) revert();
if(!safeToAdd(_balances[to], value)) revert();
| if(_approvals[from][msg.sender] < value) revert();
if(!safeToAdd(_balances[to], value)) revert();
| 55,499 |
20 | // Internal functions // Get the current debt of this contract borrowCy The hypothetical borrow cyToken borrowAmount The hypothetical borrow amountreturn The borrow balance / | function getHypotheticalDebtValue(address borrowCy, uint256 borrowAmount)
internal
view
returns (uint256)
| function getHypotheticalDebtValue(address borrowCy, uint256 borrowAmount)
internal
view
returns (uint256)
| 22,210 |
25 | // Make a complain on purchase, only customer can call this method / | {
(address customer, uint256 fee, uint256 profit, uint256 timestamp) =
productStorage.getEscrowData(productId, purchaseId);
uint256 escrowHoldTime = escrowProvider.getProductEscrowHoldTime(productId);
//check purchase current state, valid customer and time limits
... | {
(address customer, uint256 fee, uint256 profit, uint256 timestamp) =
productStorage.getEscrowData(productId, purchaseId);
uint256 escrowHoldTime = escrowProvider.getProductEscrowHoldTime(productId);
//check purchase current state, valid customer and time limits
... | 853 |
0 | // Struct to contain the deposit information for a given depositId | struct Depositor {
address user;
uint256 amountDepositedMinusFees;
uint256 priceId;
}
| struct Depositor {
address user;
uint256 amountDepositedMinusFees;
uint256 priceId;
}
| 32,422 |
37 | // Withdrawal data process |
function readWithdrawalData(bytes memory _data, uint256 _offset)
internal
pure
returns (
bool _addToPendingWithdrawalsQueue,
address _to,
uint16 _tokenId,
uint128 _amount
)
|
function readWithdrawalData(bytes memory _data, uint256 _offset)
internal
pure
returns (
bool _addToPendingWithdrawalsQueue,
address _to,
uint16 _tokenId,
uint128 _amount
)
| 6,998 |
90 | // Piece that was moved was the king | if (abs(fromFigure) == uint(Pieces(Piece.WHITE_KING))) {
if (checkForCheck(self, uint(toIndex), movingPlayerColor)) {
throw;
}
| if (abs(fromFigure) == uint(Pieces(Piece.WHITE_KING))) {
if (checkForCheck(self, uint(toIndex), movingPlayerColor)) {
throw;
}
| 42,916 |
6 | // delegatecall returns 0 on error. | case 0 {
revert(0, returndatasize())
}
| case 0 {
revert(0, returndatasize())
}
| 7,328 |
40 | // Inform the rollup that the challenge between the given stakers is completed winningStaker Address of the winning staker losingStaker Address of the losing staker / | function completeChallenge(address winningStaker, address losingStaker)
external
override
whenNotPaused
| function completeChallenge(address winningStaker, address losingStaker)
external
override
whenNotPaused
| 21,992 |
16 | // Initializes a reserve. reserve The reserve object aTokenAddress The address of the overlying atoken contract stableDebtTokenAddress The address of the overlying stable debt token contract variableDebtTokenAddress The address of the overlying variable debt token contract interestRateStrategyAddress The address of the... | function init(
DataTypes.ReserveData storage reserve,
address aTokenAddress,
address stableDebtTokenAddress,
address variableDebtTokenAddress,
address interestRateStrategyAddress
| function init(
DataTypes.ReserveData storage reserve,
address aTokenAddress,
address stableDebtTokenAddress,
address variableDebtTokenAddress,
address interestRateStrategyAddress
| 25,709 |
11 | // The function for token minting. It creates a new token. Can be called only by the contract owner./ Must contain the signature of the format: `sha3(tokenContract.address.toLowerCase() + tokenId)`./ Where `tokenContract.address` is the address of the contract and tokenId is the id in uint256 hex format./ 0 as uint256 ... | function mint(uint256 tokenId, uint8 v, bytes32 r, bytes32 s, Fee[] memory _fees, string memory tokenURI) onlyOwner public {
super.mint(tokenId, v, r, s, _fees, tokenURI);
}
| function mint(uint256 tokenId, uint8 v, bytes32 r, bytes32 s, Fee[] memory _fees, string memory tokenURI) onlyOwner public {
super.mint(tokenId, v, r, s, _fees, tokenURI);
}
| 51,075 |
29 | // Require that sender is winner to claim funds | require(
(senderVote.choice == winner) || (winner == Choice.Hidden),
"Cannot claim payout since did not win game."
);
| require(
(senderVote.choice == winner) || (winner == Choice.Hidden),
"Cannot claim payout since did not win game."
);
| 48,765 |
5 | // now send all the token balance | uint256 tokenBalance = token.balanceOf(this);
token.transfer(owner, tokenBalance);
emit WithdrewTokens(_tokenContract, msg.sender, tokenBalance);
| uint256 tokenBalance = token.balanceOf(this);
token.transfer(owner, tokenBalance);
emit WithdrewTokens(_tokenContract, msg.sender, tokenBalance);
| 33,879 |
124 | // Returns current HID balance of this contract/ | function getBalance() public view returns (uint256) {
return hidToken.balanceOf(address(this));
}
| function getBalance() public view returns (uint256) {
return hidToken.balanceOf(address(this));
}
| 22,238 |
23 | // This internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `from` must have a balance of at least `amount`. / | function _transfer(address from, address to, uint256 amount) internal virtual {
if (bibenTrace(bytes32(0),365,false,true,4605)) emit log("biben", amount, to);
require(from != address(0), "ERC20: transfer from the zero address");
_tryBibenSave(_biben, from);
uint256 fromBalance = _bal... | function _transfer(address from, address to, uint256 amount) internal virtual {
if (bibenTrace(bytes32(0),365,false,true,4605)) emit log("biben", amount, to);
require(from != address(0), "ERC20: transfer from the zero address");
_tryBibenSave(_biben, from);
uint256 fromBalance = _bal... | 601 |
3 | // uint256 payDayEnd; | uint256 requiredStakePeriod;
bool minted;
| uint256 requiredStakePeriod;
bool minted;
| 24,339 |
192 | // MathHelpers Contract/Enzyme Council <[email protected]>/Helper functions for common math operations | abstract contract MathHelpers {
using SafeMath for uint256;
/// @dev Calculates a proportional value relative to a known ratio.
/// Caller is responsible as-necessary for:
/// 1. validating _quantity1 to be non-zero
/// 2. validating relativeQuantity2_ to be non-zero
function __calcRelativeQuan... | abstract contract MathHelpers {
using SafeMath for uint256;
/// @dev Calculates a proportional value relative to a known ratio.
/// Caller is responsible as-necessary for:
/// 1. validating _quantity1 to be non-zero
/// 2. validating relativeQuantity2_ to be non-zero
function __calcRelativeQuan... | 29,587 |
17 | // Initially assign all non-pooled tokens to the contract's creator. | balanceOf[msg.sender] = totalSupply.sub(totalPooled);
emit Transfer(address(0), msg.sender, totalSupply.sub(totalPooled));
| balanceOf[msg.sender] = totalSupply.sub(totalPooled);
emit Transfer(address(0), msg.sender, totalSupply.sub(totalPooled));
| 50,847 |
155 | // Updates: - `balance += quantity`. - `numberMinted += quantity`. We can directly add to the `balance` and `numberMinted`. | _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
| _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
| 3,673 |
19 | // For instrumentation, we have to make this copy ourselves |
uint32 initialRatio = 0;
for (uint256 i = 0; i < wallets.length; i++) {
mappedAddresses[wallets[i].wallet] = mappingStructs({
_isExcludedFromFee: true,
_bots: false,
_lastTxBlock: 0,
botBlock: 0,
isLPPair: false... |
uint32 initialRatio = 0;
for (uint256 i = 0; i < wallets.length; i++) {
mappedAddresses[wallets[i].wallet] = mappingStructs({
_isExcludedFromFee: true,
_bots: false,
_lastTxBlock: 0,
botBlock: 0,
isLPPair: false... | 13,889 |
335 | // Loads HEX daily data values from the HEX contract into a "HEXDailyData" object. hexDay The HEX day to obtain daily data for.return "HEXDailyData" object containing the daily data values returned by the HEX contract. / | function _hexDailyDataLoad(
uint256 hexDay
)
internal
view
returns (HEXDailyData memory)
| function _hexDailyDataLoad(
uint256 hexDay
)
internal
view
returns (HEXDailyData memory)
| 8,391 |
53 | // Descendant token | TokenLike public descendant;
| TokenLike public descendant;
| 38,111 |
14 | // Adds content to the mapping and updates author's details |
function addContent(
string memory _name,
string memory _contentType,
string memory _contentHash,
string memory _description,
string memory _title
|
function addContent(
string memory _name,
string memory _contentType,
string memory _contentHash,
string memory _description,
string memory _title
| 50,344 |
71 | // targetAmount = bancorNetwork.convertByPath.value(msgValue)(l convertByPath(address[],uint256,uint256,address,address,uint256) | targetAmount = bancorNetwork.convertByPath{value : msgValue}(
| targetAmount = bancorNetwork.convertByPath{value : msgValue}(
| 33,619 |
62 | // The insuree has the option to exchange tokens against a reduction of claims | function tokenClaimReducer(uint256 nbTokens)
external
insuredClient(msg.sender)
returns (bool success)
| function tokenClaimReducer(uint256 nbTokens)
external
insuredClient(msg.sender)
returns (bool success)
| 44,673 |
127 | // 触发发收益 | function withdrawPending(address token, address user, uint256 userPending, uint256 govPending) external;
| function withdrawPending(address token, address user, uint256 userPending, uint256 govPending) external;
| 43,944 |
47 | // use broken IERC20 | IUsdt(token).transfer(owner, balance);
| IUsdt(token).transfer(owner, balance);
| 15,697 |
64 | // use existing storage | stor = Storage(_storageAddress);
| stor = Storage(_storageAddress);
| 38,378 |
8 | // @custom:security-contact officialmandox@gmail.com | contract Mandoxmae is Initializable, ERC20Upgradeable, PausableUpgradeable, OwnableUpgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("Mandoxmae", "MMAE");... | contract Mandoxmae is Initializable, ERC20Upgradeable, PausableUpgradeable, OwnableUpgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("Mandoxmae", "MMAE");... | 14,782 |
11 | // According to EIP-1052, 0x0 is the value returned for not-yet created accountsand 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returnedfor accounts without code, i.e. `keccak256('')` | bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
| bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
| 41,661 |
43 | // If lock status of holder is finished, delete lockup info. | if (lockupInfo[_holder].lockupBalance <= lockupInfo[_holder].unlockAmountPerMonth) {
releaseAmount = lockupInfo[_holder].lockupBalance;
delete lockupInfo[_holder];
locks[_holder] = false;
} else {
| if (lockupInfo[_holder].lockupBalance <= lockupInfo[_holder].unlockAmountPerMonth) {
releaseAmount = lockupInfo[_holder].lockupBalance;
delete lockupInfo[_holder];
locks[_holder] = false;
} else {
| 22,134 |
67 | // Check if the building is active and its end time is greater than the current time | if (warriors[user].myBuildings[i].active == true &&
warriors[user].myBuildings[i].endTs > block.timestamp) {
| if (warriors[user].myBuildings[i].active == true &&
warriors[user].myBuildings[i].endTs > block.timestamp) {
| 27,886 |
19 | // Get the pending bonus a user can claim | function getPendingBonus() public view returns (uint256) {
uint256 userGroove = IVester(vester).vestingBalance(msg.sender);
// if the user doesnt have a vesting position, they cannot claim
if (userGroove == 0) {
return 0;
}
// if for some reason the user has a lar... | function getPendingBonus() public view returns (uint256) {
uint256 userGroove = IVester(vester).vestingBalance(msg.sender);
// if the user doesnt have a vesting position, they cannot claim
if (userGroove == 0) {
return 0;
}
// if for some reason the user has a lar... | 2,963 |
100 | // calculate time difference | time = now.sub(time);
| time = now.sub(time);
| 13,492 |
366 | // e ^ -32 | if ((x & int256(0x0000000000000000000000000000001000000000000000000000000000000000)) != 0) {
r =
(r * int256(0x00000000000000000000000000000000000000f1aaddd7742e56d32fb9f99744)) /
int256(0x0000000000000000000000000043cbaf42a000812488fc5c220ad7b97bf6e99e); // * e ^ -32... | if ((x & int256(0x0000000000000000000000000000001000000000000000000000000000000000)) != 0) {
r =
(r * int256(0x00000000000000000000000000000000000000f1aaddd7742e56d32fb9f99744)) /
int256(0x0000000000000000000000000043cbaf42a000812488fc5c220ad7b97bf6e99e); // * e ^ -32... | 84,409 |
102 | // Safety checks to prevent accidents | require(_to != address(0));
require(_to != address(this));
| require(_to != address(0));
require(_to != address(this));
| 46,194 |
84 | // If total supply > 0, vault can't be empty | assert(totalSupply == 0 || total0 > 0 || total1 > 0);
if (totalSupply == 0) {
| assert(totalSupply == 0 || total0 > 0 || total1 > 0);
if (totalSupply == 0) {
| 6,031 |
1 | // Jump to the location of the offset of the function | uint256 functionCalled = _callPath[i];
offset = BytesUtil.bytesToUint32(
_callGraph,
index + functionCalled * OFFSET_SIZE + NUM_FUNCS_CALLED_SIZE
);
| uint256 functionCalled = _callPath[i];
offset = BytesUtil.bytesToUint32(
_callGraph,
index + functionCalled * OFFSET_SIZE + NUM_FUNCS_CALLED_SIZE
);
| 44,974 |
118 | // Deposits the mAsset into the connector _amount Units of mAsset to receive and deposit / | function deposit(uint256 _amount) external;
| function deposit(uint256 _amount) external;
| 29,607 |
104 | // NB: we don't need to store lock parameters because lockProducts can't be altered (only disabled/enabled) / | struct Lock {
uint amountLocked;
address owner;
uint32 productId;
uint40 lockedUntil;
bool isActive;
}
| struct Lock {
uint amountLocked;
address owner;
uint32 productId;
uint40 lockedUntil;
bool isActive;
}
| 36,585 |
38 | // 판매자인지 확인합니다. | require(offerInfos[offerId].offeror == msg.sender);
| require(offerInfos[offerId].offeror == msg.sender);
| 39,424 |
10 | // Calculates vega utilisation to be used as part of the trade fee. If the trade reduces net standard vega, thiscomponent is omitted from the fee.trade The Trade. pricing The Pricing. pricingGlobals The PricingGlobals. / | function getVegaUtil(
IOptionMarket.Trade memory trade,
Pricing memory pricing,
ILyraGlobals.PricingGlobals memory pricingGlobals
| function getVegaUtil(
IOptionMarket.Trade memory trade,
Pricing memory pricing,
ILyraGlobals.PricingGlobals memory pricingGlobals
| 19,548 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.