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 |
|---|---|---|---|---|
8 | // Overrides _mintWithoutURI(...) from ERC1155MultiURI, providing anadditional condition to check if a token is non-mintable. / | function _mintWithoutURI(
address to,
uint256 id,
uint256 amount,
bytes memory data
| function _mintWithoutURI(
address to,
uint256 id,
uint256 amount,
bytes memory data
| 54,889 |
62 | // _to 지갑으로 _cbmWei 만큼의 Cbm를 송금하고 _timeLockUpEnd 시간만큼 지갑을 잠근다 _to 토큰을 받는 지갑 주소 _cbmWei 전송되는 토큰의 양(wei) _timeLockUpEnd 잠금이 해제되는 시간 / | function transferAndLockUntil(address _to, uint256 _cbmWei, uint _timeLockUpEnd) onlyOwner public {
require(transfer(_to, _cbmWei));
walletLockBoth(_to, _timeLockUpEnd);
}
| function transferAndLockUntil(address _to, uint256 _cbmWei, uint _timeLockUpEnd) onlyOwner public {
require(transfer(_to, _cbmWei));
walletLockBoth(_to, _timeLockUpEnd);
}
| 13,219 |
122 | // get the extension of a given token / | function tokenExtension(uint256 tokenId) external view returns (address);
| function tokenExtension(uint256 tokenId) external view returns (address);
| 19,462 |
65 | // ----------HELPERS AND CALCULATORS----------//Method to view the current Hex stored in the contractExample: totalHexBalance() / | function totalHexBalance()
public
view
returns(uint)
| function totalHexBalance()
public
view
returns(uint)
| 27,973 |
34 | // deleting participant from list | ico.participants[ico.participantsList[ico.totalParticipants]].index = p.index;
ico.participantsList[p.index] = ico.participantsList[ico.totalParticipants];
delete ico.participantsList[ico.totalParticipants--];
delete ico.participants[msg.sender];
| ico.participants[ico.participantsList[ico.totalParticipants]].index = p.index;
ico.participantsList[p.index] = ico.participantsList[ico.totalParticipants];
delete ico.participantsList[ico.totalParticipants--];
delete ico.participants[msg.sender];
| 54,093 |
30 | // Accrue interest then return the up-to-date exchange ratereturn Calculated exchange rate scaled by 1e18 / | function exchangeRateCurrent() public returns (uint256) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature('exchangeRateCurrent()'));
return abi.decode(data, (uint256));
}
| function exchangeRateCurrent() public returns (uint256) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature('exchangeRateCurrent()'));
return abi.decode(data, (uint256));
}
| 27,352 |
82 | // update global info | totalDebtGlobal = totalDebtGlobal + _borrowWithLocked; // should not overflow.
| totalDebtGlobal = totalDebtGlobal + _borrowWithLocked; // should not overflow.
| 84,397 |
88 | // Calculate total fee to be taken | fee = expectedAmount.mul(feePercent).div(10000);
| fee = expectedAmount.mul(feePercent).div(10000);
| 3,633 |
82 | // Interface of the ERC3156 FlashBorrower, as defined in _Available since v4.1._ / | interface IERC3156FlashBorrower {
/**
* @dev Receive a flash loan.
* @param initiator The initiator of the loan.
* @param token The loan currency.
* @param amount The amount of tokens lent.
* @param fee The additional amount of tokens to repay.
* @param data Arbitrary data structure, i... | interface IERC3156FlashBorrower {
/**
* @dev Receive a flash loan.
* @param initiator The initiator of the loan.
* @param token The loan currency.
* @param amount The amount of tokens lent.
* @param fee The additional amount of tokens to repay.
* @param data Arbitrary data structure, i... | 9,510 |
16 | // Allow the player to attack the boss | if (bigBoss.hp < player.attackDamage) {
bigBoss.hp = 0;
} else {
| if (bigBoss.hp < player.attackDamage) {
bigBoss.hp = 0;
} else {
| 53,526 |
24 | // Split Signature Validation utility / | function _splitSignature(bytes memory sig) private pure returns (bytes32 r, bytes32 s, uint8 v) {
require(sig.length == 65, "Invalid signature length.");
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
}
| function _splitSignature(bytes memory sig) private pure returns (bytes32 r, bytes32 s, uint8 v) {
require(sig.length == 65, "Invalid signature length.");
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
}
| 76,755 |
82 | // Distributes rewards among pools at the latest block of a staking epoch./ This function is called by the `reward` function./_stakingContract The address of the StakingAuRa contract./_stakingEpoch The number of the current staking epoch./_stakingEpochEndBlock The number of the latest block of the current staking epoch... | function _distributeRewards(
IStakingAuRa _stakingContract,
uint256 _stakingEpoch,
uint256 _stakingEpochEndBlock
| function _distributeRewards(
IStakingAuRa _stakingContract,
uint256 _stakingEpoch,
uint256 _stakingEpochEndBlock
| 13,257 |
32 | // Get RATIO | return div(mul(add(outs[1], removableSushi), 1e18), gSushi.totalSupply());
| return div(mul(add(outs[1], removableSushi), 1e18), gSushi.totalSupply());
| 4,351 |
204 | // Converts passed bytes to V2 path pathBytes Swap path in bytes, converted to addressesreturn path list of addresses in the swap path (skipping first and last element) / | function _getV2Path(bytes calldata pathBytes) internal pure returns(address[] memory) {
require(pathBytes.length > ACTION_SIZE, "SwapHelper::_getV2Path: No path provided");
uint256 actualpathSize = pathBytes.length - ACTION_SIZE;
require(actualpathSize % ADDR_SIZE == 0 && actualpathSize <= M... | function _getV2Path(bytes calldata pathBytes) internal pure returns(address[] memory) {
require(pathBytes.length > ACTION_SIZE, "SwapHelper::_getV2Path: No path provided");
uint256 actualpathSize = pathBytes.length - ACTION_SIZE;
require(actualpathSize % ADDR_SIZE == 0 && actualpathSize <= M... | 61,128 |
2 | // keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); | bytes32 private constant _TYPE_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
| bytes32 private constant _TYPE_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
| 26,148 |
12 | // Save the hash of the message inthe state variable. | messages[hash] = expireAt;
| messages[hash] = expireAt;
| 27,359 |
25 | // The number of tokens this contract actually supports | uint public immutable numTokens;
address internal immutable cToken00;
address internal immutable cToken01;
address internal immutable cToken02;
address internal immutable cToken03;
address internal immutable cToken04;
address internal immutable cToken05;
address internal immutable cToke... | uint public immutable numTokens;
address internal immutable cToken00;
address internal immutable cToken01;
address internal immutable cToken02;
address internal immutable cToken03;
address internal immutable cToken04;
address internal immutable cToken05;
address internal immutable cToke... | 62,641 |
140 | // ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function withdrawAnyToken(address _tokenAddress, address _transferTo, uint _value) private returns (bool success) {
return IERC20(_tokenAddress).transfer(_transferTo, _value);
}
| function withdrawAnyToken(address _tokenAddress, address _transferTo, uint _value) private returns (bool success) {
return IERC20(_tokenAddress).transfer(_transferTo, _value);
}
| 186 |
46 | // This cannot be a delayed writing as we are writing the option now | _order.isDelayedWriting = false;
IPremiaOption optionContract = IPremiaOption(_order.optionContract);
_order.optionId = optionContract.writeOptionFrom(msg.sender, _option, _referrer);
return createOrder(_order, _option.amount);
| _order.isDelayedWriting = false;
IPremiaOption optionContract = IPremiaOption(_order.optionContract);
_order.optionId = optionContract.writeOptionFrom(msg.sender, _option, _referrer);
return createOrder(_order, _option.amount);
| 50,524 |
161 | // Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. Requirements: - `target` ... | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, 'Address: low-level call failed');
}
| function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, 'Address: low-level call failed');
}
| 45,624 |
6 | // Use the bid counter to assign the index if there is not an active bid. | bidIndex = bidCounterByToken[_tokenAddress][_tokenId];
| bidIndex = bidCounterByToken[_tokenAddress][_tokenId];
| 51,064 |
28 | // Initiate rewards program for all reward tokens in pool reward amounts must be ordered based on the initial reward token order each reward token will be initialized with exactly the reward amount set here clrPool pool to initiate rewards for totalRewardAmounts array of reward amounts for each reward token / | function _initiateRewardsProgram(
ICLR clrPool,
uint256[] memory totalRewardAmounts
| function _initiateRewardsProgram(
ICLR clrPool,
uint256[] memory totalRewardAmounts
| 63,845 |
158 | // View function to see pending PLATIN on frontend. | function pendingPlatin(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accPlatinPerShare = pool.accPlatinPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingPlatin(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accPlatinPerShare = pool.accPlatinPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 21,754 |
185 | // Get the uri for a given creator/tokenId / | function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
| function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
| 2,097 |
2 | // Write out zeros | pos := add(pos, 2)
let length := and(calldataload(add(36, pos)), 0xFFFF)
codecopy(ptr, codesize(), length)
ptr := add(ptr, length)
| pos := add(pos, 2)
let length := and(calldataload(add(36, pos)), 0xFFFF)
codecopy(ptr, codesize(), length)
ptr := add(ptr, length)
| 48,977 |
81 | // If seed sale ends and soft cap is not reached, Contributer can claim their funds | function refund() public {
require(refundAllowed);
require(!SoftCapReached);
require(weiContributedPending[msg.sender] > 0);
uint256 currentBalance = weiContributedPending[msg.sender];
weiContributedPending[msg.sender] = 0;
msg.sender.transfer(currentBalance);
}... | function refund() public {
require(refundAllowed);
require(!SoftCapReached);
require(weiContributedPending[msg.sender] > 0);
uint256 currentBalance = weiContributedPending[msg.sender];
weiContributedPending[msg.sender] = 0;
msg.sender.transfer(currentBalance);
}... | 33,341 |
11 | // SafeMathMath operations with safety checks that throw on error/ | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256... | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256... | 9,483 |
109 | // Increment the reward to transfer | rewardInDexTokenToTransfer += rewardForTicketId;
| rewardInDexTokenToTransfer += rewardForTicketId;
| 53,490 |
65 | // 18 decimals | constructor() ERC20("Small Business Coin", "SBC") {
_mint(_msgSender(), 100_000_000 * (10 ** uint256(decimals())));
}
| constructor() ERC20("Small Business Coin", "SBC") {
_mint(_msgSender(), 100_000_000 * (10 ** uint256(decimals())));
}
| 15,483 |
125 | // Sets the number of unwithdrawn rewards to 0. / | setPendingWithdrawal(_property, msg.sender, 0);
| setPendingWithdrawal(_property, msg.sender, 0);
| 34,976 |
66 | // Mints assetClass token, must be isAdmin / | function mintACToken(
address _recipientAddress,
uint256 tokenId,
string calldata _tokenURI
) external returns (uint256);
| function mintACToken(
address _recipientAddress,
uint256 tokenId,
string calldata _tokenURI
) external returns (uint256);
| 34,171 |
22 | // sub from balance of sender | _kassiahomeBalances[msg.sender] = _kassiahomeBalances[msg.sender].sub(kassiahomeValue);
| _kassiahomeBalances[msg.sender] = _kassiahomeBalances[msg.sender].sub(kassiahomeValue);
| 21,283 |
286 | // If the provided asset is not supported by the Turbo Fuse Pool, revert. | require(address(assetTurboCToken) != address(0), "UNSUPPORTED_ASSET");
| require(address(assetTurboCToken) != address(0), "UNSUPPORTED_ASSET");
| 71,847 |
49 | // Settings for eggs minted by administration | contract EggMinting is PetOwnership{
uint8 public uniquePetsCount = 100;
uint16 public globalPresaleLimit = 1500;
mapping (uint16 => uint16) public eggLimits;
mapping (uint16 => uint16) public purchesedEggs;
constructor() public {
eggLimits[55375] = 200;
eggLimits[477... | contract EggMinting is PetOwnership{
uint8 public uniquePetsCount = 100;
uint16 public globalPresaleLimit = 1500;
mapping (uint16 => uint16) public eggLimits;
mapping (uint16 => uint16) public purchesedEggs;
constructor() public {
eggLimits[55375] = 200;
eggLimits[477... | 36,724 |
2 | // Callback function / | function fulfillWindSpeed(bytes32 _requestId, uint256 _windSpeed) public recordChainlinkFulfillment(_requestId) {
windSpeed = _windSpeed;
}
| function fulfillWindSpeed(bytes32 _requestId, uint256 _windSpeed) public recordChainlinkFulfillment(_requestId) {
windSpeed = _windSpeed;
}
| 43,642 |
34 | // - Getter Function / | function balanceOfContract() public view returns (uint balanceOfContract_DAI, uint balanceOfContract_ETH) {
return (dai.balanceOf(address(this)), address(this).balance);
}
| function balanceOfContract() public view returns (uint balanceOfContract_DAI, uint balanceOfContract_ETH) {
return (dai.balanceOf(address(this)), address(this).balance);
}
| 49,464 |
84 | // Set the migrator contract (only the owner may call) | function setMigrator(ILpTokenMigrator _migrator) external;
| function setMigrator(ILpTokenMigrator _migrator) external;
| 32,003 |
30 | // 40% of holders approx |
uint256 public B = 5;
|
uint256 public B = 5;
| 36,572 |
175 | // if the order in book did NOT fully deal, then this new order DID fully deal, so stop here | if(orderInBook.amount != 0) {
_setOrder(!isBuy, currID, orderInBook);
break;
}
| if(orderInBook.amount != 0) {
_setOrder(!isBuy, currID, orderInBook);
break;
}
| 28,056 |
998 | // 501 | entry "clerkly" : ENG_ADVERB
| entry "clerkly" : ENG_ADVERB
| 21,337 |
414 | // keep track of token pricing when purchased | mapping(uint256 => address) internal _originalTokens;
mapping(address => uint) public referrerFees;
| mapping(uint256 => address) internal _originalTokens;
mapping(address => uint) public referrerFees;
| 37,866 |
184 | // chance of burning the donor trait is a flat 1/3 | if (rn.generate(1, 3) == 1) {
donorBurnt = true;
donor.genesis = false;
| if (rn.generate(1, 3) == 1) {
donorBurnt = true;
donor.genesis = false;
| 11,281 |
20 | // Current balances of contract -bank- available reward value -stock - available value for restore bank in emergency | uint256 public bank = 0;
uint256 public stock = 0;
| uint256 public bank = 0;
uint256 public stock = 0;
| 18,616 |
400 | // res += valcoefficients[80]. | res := addmod(res,
mulmod(val, /*coefficients[80]*/ mload(0xf40), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[80]*/ mload(0xf40), PRIME),
PRIME)
| 32,173 |
41 | // When a user calls `exitPool`, this is the first point of entry from the Vault. We first check whether this is a Recovery Mode exit - if so, we proceed using this special lightweight exit mechanism which avoids computing any complex values, interacting with external contracts, etc., and generally should always work, ... | if (userData.isRecoveryModeExitKind()) {
| if (userData.isRecoveryModeExitKind()) {
| 25,936 |
19 | // Deposits made with deposit() go to this function | function deposit() external payable onlyIfCreator {
availableFunds = availableFunds + msg.value;
}
| function deposit() external payable onlyIfCreator {
availableFunds = availableFunds + msg.value;
}
| 26,571 |
70 | // Staking contract for farming LPT rewards in return for staking a whitelisted token(s)/BlockRocket.tech/Fork of MasterChef.sol from SushiSwap/Only the owner can add new pools | contract LaunchPoolStaking is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/// @dev Details about each user in a pool
struct UserInfo {
uint256 amount; // How many tokens the user has provided to a pool
uint256 rewardDebt; // Reward debt. See explanation below.
... | contract LaunchPoolStaking is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/// @dev Details about each user in a pool
struct UserInfo {
uint256 amount; // How many tokens the user has provided to a pool
uint256 rewardDebt; // Reward debt. See explanation below.
... | 25,354 |
33 | // Set the borrower of the contract to the tx.origin We are using tx.origin, because the contract is going to be published by the main contract and msg.sender will break our logic./ | borrower = tx.origin;
| borrower = tx.origin;
| 16,154 |
20 | // Sets `_poolFactory` as the new BFactory module. Requirements: - `_poolFactory` should not be the zero address._poolFactory The address of the new Balance BFactory module. / | function _setPoolFactory(address _poolFactory) internal {
require(_poolFactory != address(0), "Pool Factory is the zero address");
emit PoolFactorySet(_poolFactory);
poolFactory = _poolFactory;
}
| function _setPoolFactory(address _poolFactory) internal {
require(_poolFactory != address(0), "Pool Factory is the zero address");
emit PoolFactorySet(_poolFactory);
poolFactory = _poolFactory;
}
| 30,621 |
151 | // params | function getPeriod() public view returns (uint256) {
return period;
}
| function getPeriod() public view returns (uint256) {
return period;
}
| 11,916 |
101 | // See {IERC721-transferFrom}. / | function transferFrom(address from, address to, uint256 tokenId) public virtual override {
| function transferFrom(address from, address to, uint256 tokenId) public virtual override {
| 851 |
26 | // Returns the daily token yield of `_address`.- Note: This is returned in wei which is the tiniest unit so to see the daily yield in whole tokens divide by 1000000000000000000. / | function getUserDailyYield(address _address) public view returns (uint256) {
uint256 units = totalStakeableUnits;
if (units == 0) return 0;
uint256 rewards;
for (uint256 i = 1; i <= units; i++){
if (stakeableUnits[i].stakeableContract.getStakingStatus(_address)){
... | function getUserDailyYield(address _address) public view returns (uint256) {
uint256 units = totalStakeableUnits;
if (units == 0) return 0;
uint256 rewards;
for (uint256 i = 1; i <= units; i++){
if (stakeableUnits[i].stakeableContract.getStakingStatus(_address)){
... | 1,006 |
262 | // Base auction contract of the Dyverse VREX Lab Co., Ltd Contains necessary functions and variables for the auction. Inherits `ERC721Holder` contract which is the implementation of the `ERC721TokenReceiver`. This is to accept safe transfers. / | contract AuctionBase is ERC721Holder {
using SafeMath for uint256;
// Represents an auction on an NFT
struct Auction {
// Current owner of NFT
address seller;
// Price (in wei) of NFT
uint128 price;
// Time when the auction started
// NOTE: 0 if this auction ... | contract AuctionBase is ERC721Holder {
using SafeMath for uint256;
// Represents an auction on an NFT
struct Auction {
// Current owner of NFT
address seller;
// Price (in wei) of NFT
uint128 price;
// Time when the auction started
// NOTE: 0 if this auction ... | 17,408 |
47 | // Transfer token or ETH to a destinatary _token - Address of the token _to - Address of the recipient _val - Uint256 of the amount to transferreturn bool - Whether the transfer was success or not / | function transfer(IERC20 _token, address _to, uint256 _val) internal returns (bool) {
if (ETH_ADDRESS == address(_token)) {
(bool success, ) = _to.call{value:_val}("");
return success;
}
return SafeERC20.transfer(_token, _to, _val);
}
| function transfer(IERC20 _token, address _to, uint256 _val) internal returns (bool) {
if (ETH_ADDRESS == address(_token)) {
(bool success, ) = _to.call{value:_val}("");
return success;
}
return SafeERC20.transfer(_token, _to, _val);
}
| 22,371 |
2 | // instead of gas oracle | gasPrice = _gasPriceLimit;
| gasPrice = _gasPriceLimit;
| 18,980 |
370 | // TokenMinter Token Minter and Burner Maintains registry of local mintable tokens and corresponding tokens on remote domains.This registry can be used by caller to determine which token on local domain to mint for aburned token on a remote domain, and vice versa.It is assumed that local and remote tokens are fungible ... | contract TokenMinter is ITokenMinter, TokenController, Pausable, Rescuable {
// ============ Events ============
/**
* @notice Emitted when a local TokenMessenger is added
* @param localTokenMessenger address of local TokenMessenger
* @notice Emitted when a local TokenMessenger is added
*/
... | contract TokenMinter is ITokenMinter, TokenController, Pausable, Rescuable {
// ============ Events ============
/**
* @notice Emitted when a local TokenMessenger is added
* @param localTokenMessenger address of local TokenMessenger
* @notice Emitted when a local TokenMessenger is added
*/
... | 42,847 |
57 | // Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5.05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between | * Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view vir... | * Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view vir... | 59,208 |
39 | // Amount of rewards (in wei) already paid out to a certain address | mapping (address => uint) public paidOut;
| mapping (address => uint) public paidOut;
| 47,859 |
23 | // Do the fixed-point inversion inline to save gas. The numerator is SCALESCALE. | unchecked {
result = 1e36 / exp2(-x);
}
| unchecked {
result = 1e36 / exp2(-x);
}
| 8,623 |
52 | // Checks if an address is a member of the merkle tree/root the root of the merkle tree/addr The address to check/pos The position to check, index starting at 0/proof Merkle proof required for validation of the address/ return Returns true if the address is in the set | function checkAddrInSet(
bytes32 root,
address addr,
uint256 pos,
bytes32[] calldata proof
| function checkAddrInSet(
bytes32 root,
address addr,
uint256 pos,
bytes32[] calldata proof
| 43,446 |
185 | // External interface // Flash loan receiver interface / | interface IFlashloanReceiver {
function executeOperation(
address sender,
address underlying,
uint256 amount,
uint256 fee,
bytes calldata params
) external;
}
| interface IFlashloanReceiver {
function executeOperation(
address sender,
address underlying,
uint256 amount,
uint256 fee,
bytes calldata params
) external;
}
| 18,324 |
618 | // column19_row8214/ mload(0x38a0), Numerator: point - trace_generator^(8192(trace_length / 8192 - 1)). val = numerators[9]. | val := mulmod(val, mload(0x4d80), PRIME)
| val := mulmod(val, mload(0x4d80), PRIME)
| 20,890 |
103 | // This token is worth less than the ESD | highAmount = estimate;
targetID = i;
| highAmount = estimate;
targetID = i;
| 7,995 |
290 | // removing old holder's reserve price | votingTokens -= _amount;
reserveTotal -= _amount * fromPrice;
| votingTokens -= _amount;
reserveTotal -= _amount * fromPrice;
| 9,699 |
124 | // Metadata |
string private __name;
string private __symbol;
string private __tokenUriPrefix;
constructor(string memory _name,
|
string private __name;
string private __symbol;
string private __tokenUriPrefix;
constructor(string memory _name,
| 35,051 |
20 | // Advances the epoch (if needed) and redeems the max amount of coupons possibleAlso frees CHI tokens to save on gas (requires that msg.sender has CHI tokens in theiraccount and has approved this contract to spend their CHI)._user The user whose coupons will attempt to be redeemed_epoch The epoch in which the coupons w... | function advanceAndRedeemMax(address _user, uint256 _epoch, uint256 _targetEpoch) external useCHI {
// End execution early if tx is mined too early
uint256 targetEpochStartTime = getEpochStartTime(_targetEpoch);
if (block.timestamp < targetEpochStartTime) { return; }
// adva... | function advanceAndRedeemMax(address _user, uint256 _epoch, uint256 _targetEpoch) external useCHI {
// End execution early if tx is mined too early
uint256 targetEpochStartTime = getEpochStartTime(_targetEpoch);
if (block.timestamp < targetEpochStartTime) { return; }
// adva... | 31,955 |
110 | // Calculating the fee in tokens | function _getValues(uint256 tAmount) private view returns (uint256, uint256) {
uint256 tDev = tAmount*_TotalFee/100;
uint256 tTransferAmount = tAmount.sub(tDev);
return (tTransferAmount, tDev);
}
| function _getValues(uint256 tAmount) private view returns (uint256, uint256) {
uint256 tDev = tAmount*_TotalFee/100;
uint256 tTransferAmount = tAmount.sub(tDev);
return (tTransferAmount, tDev);
}
| 11,080 |
5 | // configuration | function getReserveConfiguration(address _reserve)
external
view
returns (
uint256,
uint256,
uint256,
bool
);
| function getReserveConfiguration(address _reserve)
external
view
returns (
uint256,
uint256,
uint256,
bool
);
| 16,907 |
25 | // Safe dmm transfer function, just in case if rounding error causes pool to not have enough SUSHIs. | function safeBankTransfer(address _to, uint256 _amount) internal {
uint256 poolBal = bank.balanceOf(address(this));
bank.transfer(_to, Math.min(poolBal, _amount));
}
| function safeBankTransfer(address _to, uint256 _amount) internal {
uint256 poolBal = bank.balanceOf(address(this));
bank.transfer(_to, Math.min(poolBal, _amount));
}
| 34,470 |
101 | // OwnablePausableUpgradeableBundles Access Control, Pausable and Upgradeable contracts in one./ | abstract contract OwnablePausableUpgradeable is IOwnablePausable, PausableUpgradeable, AccessControlUpgradeable {
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
/**
* @dev Modifier for checking whether the caller is an admin.
*/
modifier onlyAdmin() {
require(hasRole(DEFAUL... | abstract contract OwnablePausableUpgradeable is IOwnablePausable, PausableUpgradeable, AccessControlUpgradeable {
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
/**
* @dev Modifier for checking whether the caller is an admin.
*/
modifier onlyAdmin() {
require(hasRole(DEFAUL... | 51,034 |
81 | // Gets the Loan to Value of the NFT self The NFT configurationreturn The loan to value / | function getLtv(DataTypes.NftConfigurationMap storage self) internal view returns (uint256) {
return self.data & ~LTV_MASK;
}
| function getLtv(DataTypes.NftConfigurationMap storage self) internal view returns (uint256) {
return self.data & ~LTV_MASK;
}
| 74,783 |
7 | // ClaimableContract The ClaimableContract contract is a copy of Claimable Contract by Zeppelin./ | contract ClaimableContract is ProxyStorage {
function owner() public view returns (address) {
return owner_;
}
function pendingOwner() public view returns (address) {
return pendingOwner_;
}
event OwnershipTransferred(
address indexed previousOwner,
address indexed... | contract ClaimableContract is ProxyStorage {
function owner() public view returns (address) {
return owner_;
}
function pendingOwner() public view returns (address) {
return pendingOwner_;
}
event OwnershipTransferred(
address indexed previousOwner,
address indexed... | 37,191 |
18 | // 校验账户目前没有僵尸 | require(ownerZombieCount[msg.sender] > 0, "You can create a zombie for free.");
| require(ownerZombieCount[msg.sender] > 0, "You can create a zombie for free.");
| 3,545 |
53 | // Version of withdraw that extracts the dividends and sends the Ether to the caller. This is only used in the case when there is no transaction data, and that should be quite rare unless interacting directly with the smart contract. | function withdrawOld(address to) public {
// Retrieve the dividends associated with the address the request came from.
var balance = dividends(msg.sender);
// Update the payouts array, incrementing the request address by `balance`.
payouts[msg.sender] += (int256) (balance * scaleFactor);
// Increase th... | function withdrawOld(address to) public {
// Retrieve the dividends associated with the address the request came from.
var balance = dividends(msg.sender);
// Update the payouts array, incrementing the request address by `balance`.
payouts[msg.sender] += (int256) (balance * scaleFactor);
// Increase th... | 10,151 |
11 | // Get the total supply of LP tokens | uint256 totalLPSupply = lpPool.totalSupply();
| uint256 totalLPSupply = lpPool.totalSupply();
| 29,097 |
42 | // ===================================================================/ Auto-generated getter functions from public state variables |
function beneficiary() external view returns (address );
function expirationDuration() external view returns (uint256 );
function freeTrialLength() external view returns (uint256 );
function isAlive() external view returns (bool );
function keyPrice() external view returns (uint256 );
|
function beneficiary() external view returns (address );
function expirationDuration() external view returns (uint256 );
function freeTrialLength() external view returns (uint256 );
function isAlive() external view returns (bool );
function keyPrice() external view returns (uint256 );
| 76,450 |
55 | // this is redundant with granularity and windowSize, but stored for gas savings & informational purposes. | uint public constant periodSize = 1800;
address[] internal _pairs;
mapping(address => bool) internal _known;
| uint public constant periodSize = 1800;
address[] internal _pairs;
mapping(address => bool) internal _known;
| 11,308 |
14 | // Grouping token owner | uint256 public MYFILockedCommunityOne;
uint256 public MYFILockedCommunityTwo;
address public owner;
ERC20 public MYFIToken;
| uint256 public MYFILockedCommunityOne;
uint256 public MYFILockedCommunityTwo;
address public owner;
ERC20 public MYFIToken;
| 34,561 |
14 | // Add 2 modifiers to check if the item is shipped already, and that the person calling this function | verifyCaller(items[sku].buyer){
items[sku].state = (uint) (State.Received);
emit LogReceived(sku);
}
| verifyCaller(items[sku].buyer){
items[sku].state = (uint) (State.Received);
emit LogReceived(sku);
}
| 29,679 |
33 | // Activates rebasingOne way function, cannot be undone, callable by anyone | function activateRebasing() public {
require(timeOfTwapInit > 0, 'activateRebasing: twap wasnt intitiated, call init_twap()');
// cannot enable prior to end of rebaseDelay
require(getNow() >= timeOfTwapInit + rebaseDelay, 'activateRebasing: !end_delay');
rebasingActive = true;
}
| function activateRebasing() public {
require(timeOfTwapInit > 0, 'activateRebasing: twap wasnt intitiated, call init_twap()');
// cannot enable prior to end of rebaseDelay
require(getNow() >= timeOfTwapInit + rebaseDelay, 'activateRebasing: !end_delay');
rebasingActive = true;
}
| 17,805 |
0 | // Create a new add two-side optimal strategy instance./_router The Uniswap router smart contract. | constructor(IUniswapV2Router02 _router, address _goblin, address _fToken) public {
factory = IUniswapV2Factory(_router.factory());
router = _router;
weth = _router.WETH();
goblin = _goblin;
fToken_ = _fToken;
}
| constructor(IUniswapV2Router02 _router, address _goblin, address _fToken) public {
factory = IUniswapV2Factory(_router.factory());
router = _router;
weth = _router.WETH();
goblin = _goblin;
fToken_ = _fToken;
}
| 2,560 |
57 | // num: num of 4, odds: num of 4 | matched = 0;
for (k = 0; k < 3; k++) {
if (nums[k] == 4) {
matched += 1;
}
| matched = 0;
for (k = 0; k < 3; k++) {
if (nums[k] == 4) {
matched += 1;
}
| 12,721 |
27 | // Mint real one | _mint(msg.sender,mobTokenId+MOB_OFFSET);
bool mintNewMob = true;
if(mobTokenIds[3] < TOTAL_MOB_COUNT){
mobTokenIds[_mobIndex] = ++mobTokenIds[3];
}else{
| _mint(msg.sender,mobTokenId+MOB_OFFSET);
bool mintNewMob = true;
if(mobTokenIds[3] < TOTAL_MOB_COUNT){
mobTokenIds[_mobIndex] = ++mobTokenIds[3];
}else{
| 59,519 |
9 | // sibblingOffset := COMMITMENT_SIZE_IN_BYTESlsb(siblingIndex). | let sibblingOffset := mulmod(
siblingIndex,
COMMITMENT_SIZE_IN_BYTES,
TWO_COMMITMENTS_SIZE_IN_BYTES
)
| let sibblingOffset := mulmod(
siblingIndex,
COMMITMENT_SIZE_IN_BYTES,
TWO_COMMITMENTS_SIZE_IN_BYTES
)
| 27,294 |
120 | // caller gives owner approval to operate token/ | if (isAllowListRequiredMapping[id]) {
require(
isOnAllowlist(id, _msgSender()),
"You are not allowed to mint this token"
);
if (tokenIdtoTokenMaxSupply[id] > 0) {
require(
tota... | if (isAllowListRequiredMapping[id]) {
require(
isOnAllowlist(id, _msgSender()),
"You are not allowed to mint this token"
);
if (tokenIdtoTokenMaxSupply[id] > 0) {
require(
tota... | 32,154 |
353 | // Extension of the ERC20 token contract to support token wrapping. Users can deposit and withdraw "underlying tokens" and receive a matching number of "wrapped tokens". This is useful | * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the
* wrapping of an existing "basic" ERC20 into a governance token.
*
* _Available since v4.2._
*/
abstract contract ERC20Wrapper is ERC20 {
IERC20 public immutable underlying;
constructor(IER... | * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the
* wrapping of an existing "basic" ERC20 into a governance token.
*
* _Available since v4.2._
*/
abstract contract ERC20Wrapper is ERC20 {
IERC20 public immutable underlying;
constructor(IER... | 35,906 |
77 | // Allows spinwin to update uint setting when there is a token exchange transaction exchangeAmount The converted exchange amount / | function spinwinUpdateExchangeMetric(uint256 exchangeAmount) public onlySpinwin {
_uintSettings['contractBalance'] = _uintSettings['contractBalance'].sub(exchangeAmount);
_setMaxProfit(false);
}
| function spinwinUpdateExchangeMetric(uint256 exchangeAmount) public onlySpinwin {
_uintSettings['contractBalance'] = _uintSettings['contractBalance'].sub(exchangeAmount);
_setMaxProfit(false);
}
| 3,997 |
1 | // Mapping from layer to item ID to index of the owner items list | mapping(uint256 => mapping(uint256 => uint256)) private _ownedItemsIndex;
| mapping(uint256 => mapping(uint256 => uint256)) private _ownedItemsIndex;
| 20,156 |
87 | // Release the tokens from the Voting Escrow contract when the lock expires./_recipient Address to send the tokens to | function release(address _recipient) external onlyGovernance {
IVotingEscrowMav(veToken).unstake(0);
uint256 _balance = IERC20(token).balanceOf(address(this));
IERC20(token).safeTransfer(_recipient, _balance);
emit Released(msg.sender, IERC20(token).balanceOf(address(this)));
}... | function release(address _recipient) external onlyGovernance {
IVotingEscrowMav(veToken).unstake(0);
uint256 _balance = IERC20(token).balanceOf(address(this));
IERC20(token).safeTransfer(_recipient, _balance);
emit Released(msg.sender, IERC20(token).balanceOf(address(this)));
}... | 27,330 |
22 | // staking function which receives AXN and creates the stake - takes as param the amount of AXN and the number of days to be stakedstaking days need to be >0 and lower than max days which is 5555 | // @param amount {uint256} - AXN amount to be staked
// @param stakingDays {uint256} - number of days to be staked
function stake(uint256 amount, uint256 stakingDays) external pausable {
require(stakingDays != 0, 'Staking: Staking days < 1');
require(stakingDays <= 5555, 'Staking: Staking da... | // @param amount {uint256} - AXN amount to be staked
// @param stakingDays {uint256} - number of days to be staked
function stake(uint256 amount, uint256 stakingDays) external pausable {
require(stakingDays != 0, 'Staking: Staking days < 1');
require(stakingDays <= 5555, 'Staking: Staking da... | 37,807 |
52 | // hacker get its reward via vesting contract | tokenLock = tokenLockFactory.createTokenLock(
address(HAT),
0x000000000000000000000000000000000000dEaD, //this address as owner, so it can do nothing.
_beneficiary,
hackerReward,
| tokenLock = tokenLockFactory.createTokenLock(
address(HAT),
0x000000000000000000000000000000000000dEaD, //this address as owner, so it can do nothing.
_beneficiary,
hackerReward,
| 29,131 |
115 | // HOOTS | string[4] memory parts = [
string(abi.encodePacked
(
'<pattern id="e" viewBox="13,-1,10,15" width="15%" height="95%"><polygon points="-99,-99 -99,99 99,99 99,-99" fill ="', colors[rug.background],'"/> <g stroke="black" stroke-width="0.75"><polygon points="... | string[4] memory parts = [
string(abi.encodePacked
(
'<pattern id="e" viewBox="13,-1,10,15" width="15%" height="95%"><polygon points="-99,-99 -99,99 99,99 99,-99" fill ="', colors[rug.background],'"/> <g stroke="black" stroke-width="0.75"><polygon points="... | 51,766 |
9 | // each GTAP1 holder can mint 2 | mapping(address => uint256) public gtapHolderMintCount;
| mapping(address => uint256) public gtapHolderMintCount;
| 825 |
28 | // Splitting | error SplittingUnapprovedPosition(address thrower, address caller, uint positionId);
error InvalidSplitAmount(address thrower, uint originalPositionAmount, uint splitAmount);
error ResultingOriginalPositionLiquidatable(address thrower, OptionPosition position, uint spotPrice);
error ResultingNewPositionLiquidat... | error SplittingUnapprovedPosition(address thrower, address caller, uint positionId);
error InvalidSplitAmount(address thrower, uint originalPositionAmount, uint splitAmount);
error ResultingOriginalPositionLiquidatable(address thrower, OptionPosition position, uint spotPrice);
error ResultingNewPositionLiquidat... | 15,733 |
71 | // Perform an ERC20 token transfer. Designed to be called by transfer functions possessingthe onlyProxy or optionalProxy modifiers. / | function _transfer_byProxy(address from, address to, uint value) internal returns (bool) {
return _internalTransfer(from, to, value);
}
| function _transfer_byProxy(address from, address to, uint value) internal returns (bool) {
return _internalTransfer(from, to, value);
}
| 26,564 |
3 | // a += e is equivalent to a = a + e.The operators -=, =, /=, %=, a |=, &= and ^= are defined accordingly. | a += 5; // a = 11+5 = 16
| a += 5; // a = 11+5 = 16
| 36,696 |
11 | // Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the riskthat someone may use both the old and the new allowance by unfortunatetransaction ordering. One possib... | function approve(address spender, uint256 amount) external returns (bool);
| function approve(address spender, uint256 amount) external returns (bool);
| 32,491 |
7 | // Ohm (3, 3) makes your code more efficient WGMI | revert(3, 3)
| revert(3, 3)
| 82,382 |
42 | // Adding to existing lock, or if a lock is expired - creating a new one |
require(_canConvertInt128(_value), "!convertInt128");
_locked.amount += int128(uint128(_value));
if (unlockTime != 0) {
_locked.end = unlockTime;
}
|
require(_canConvertInt128(_value), "!convertInt128");
_locked.amount += int128(uint128(_value));
if (unlockTime != 0) {
_locked.end = unlockTime;
}
| 16,291 |
91 | // helper functions | function wrap1 (address _token_addr, bytes32 _hash, uint256 _start, uint256 _end) internal pure
| function wrap1 (address _token_addr, bytes32 _hash, uint256 _start, uint256 _end) internal pure
| 18,588 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.