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 |
|---|---|---|---|---|
111 | // Send proceeds to seller/maker | orderMakerAddress.transfer(sellerProceeds);
| orderMakerAddress.transfer(sellerProceeds);
| 28,336 |
260 | // Combined into one function due to 24KiB contract memory limit | function setPoolParameters(uint256 new_ceiling, uint256 new_bonus_rate, uint256 new_redemption_delay, uint256 new_mint_fee, uint256 new_redeem_fee, uint256 new_buyback_fee, uint256 new_recollat_fee) external onlyByOwnerOrGovernance {
pool_ceiling = new_ceiling;
bonus_rate = new_bonus_rate;
r... | function setPoolParameters(uint256 new_ceiling, uint256 new_bonus_rate, uint256 new_redemption_delay, uint256 new_mint_fee, uint256 new_redeem_fee, uint256 new_buyback_fee, uint256 new_recollat_fee) external onlyByOwnerOrGovernance {
pool_ceiling = new_ceiling;
bonus_rate = new_bonus_rate;
r... | 22,915 |
103 | // Recover lost tokens can only be used after farming duration expires | require(duration < block.timestamp, "Cannot use if farm is live");
_token.safeTransfer(owner(), amount);
| require(duration < block.timestamp, "Cannot use if farm is live");
_token.safeTransfer(owner(), amount);
| 29,515 |
65 | // Allow to change the team multisig address in the case of emergency. / | function setMultisig(address addr) onlyOwner public {
//if (addr == address(0)) throw;
require(addr != address(0));
multisigEther = addr;
}
| function setMultisig(address addr) onlyOwner public {
//if (addr == address(0)) throw;
require(addr != address(0));
multisigEther = addr;
}
| 20,951 |
31 | // Modifiers | modifier onlyOwner() {
require(msg.sender == owner, "caller is not the owner!");
_;
}
| modifier onlyOwner() {
require(msg.sender == owner, "caller is not the owner!");
_;
}
| 6,534 |
4 | // Addresses of the co-founders of DNN. | address public cofounderA;
address public cofounderB;
| address public cofounderA;
address public cofounderB;
| 39,749 |
3 | // This is the tokenId to remove; | remove(staker, i);
| remove(staker, i);
| 38,033 |
264 | // Reserve 120 Pineapples for team - Giveaways/Prizes/Presales etc | uint public _reserve = 116;
mapping (string => address) public team;
| uint public _reserve = 116;
mapping (string => address) public team;
| 42,967 |
25 | // get the price of an asset / | function getAssetPrice() public pure returns (int256) {
return 1e18;
}
| function getAssetPrice() public pure returns (int256) {
return 1e18;
}
| 14,370 |
8 | // public functions//@inheritdoc IBuddleDestination / | function changeOwner(
TransferData memory _data,
uint256 _transferID,
uint256 sourceChain,
address _owner
) external
checkInitialization
| function changeOwner(
TransferData memory _data,
uint256 _transferID,
uint256 sourceChain,
address _owner
) external
checkInitialization
| 31,211 |
154 | // Sets a sender address of the failed message that came from the other side._messageId id of the message from the other side that triggered a call._receiver address of the receiver./ | function setFailedMessageReceiver(bytes32 _messageId, address _receiver) internal {
addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))] = _receiver;
}
| function setFailedMessageReceiver(bytes32 _messageId, address _receiver) internal {
addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))] = _receiver;
}
| 59,028 |
103 | // Burn users shares | _burn(msg.sender, _shares);
| _burn(msg.sender, _shares);
| 54,730 |
12 | // ChangedManagementProxy: :managementProxy can now manage :point | event ChangedManagementProxy( uint32 indexed point,
address indexed managementProxy );
| event ChangedManagementProxy( uint32 indexed point,
address indexed managementProxy );
| 2,896 |
71 | // Permissionless minting/to The address to mint to | function mint(address to)
public
virtual
payable
isCorrectPayment
canMint
isMintingOpen
| function mint(address to)
public
virtual
payable
isCorrectPayment
canMint
isMintingOpen
| 48,810 |
128 | // Removes a STFactory_major Major version of the proxy._minor Minor version of the proxy._patch Patch version of the proxy/ | function removeProtocolFactory(uint8 _major, uint8 _minor, uint8 _patch) external;
| function removeProtocolFactory(uint8 _major, uint8 _minor, uint8 _patch) external;
| 46,793 |
62 | // Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), 'ERC20: approve from the zero address');
req... | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), 'ERC20: approve from the zero address');
req... | 51,237 |
15 | // SafeDivs contract - GAIN 3% PER 24 HOURS (every 5900 blocks) // SafeMath v0.1.9 Math operations with safety checks that throw on errorchange notes:original SafeMath library from OpenZeppelin modified by Inventor- added sqrt- added sq- added pwr - changed asserts to requires with error log outputs- removed div, its u... | 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;
require(c / a == b, "SafeMath mul failed")... | 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;
require(c / a == b, "SafeMath mul failed")... | 36,519 |
2 | // default trading pair USDC-WETH | token = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); //''USDC'
weth = address (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);//weth address
iWETH = IWETH(weth);
| token = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); //''USDC'
weth = address (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);//weth address
iWETH = IWETH(weth);
| 5,617 |
72 | // Balances of token holders | mapping(address => uint256) internal balances;
| mapping(address => uint256) internal balances;
| 4,956 |
37 | // Allows a holder to stake a gorilla./First checks whether the specified gorilla has the genesis trait. Updates balances accordingly./ unchecked, because no arithmetic overflow is possible./_tokenId A specific gorilla, identified by its token ID. | function stake(uint256 _tokenId) public updateReward(msg.sender) {
bool isGen = isGenesis(_tokenId);
unchecked {
if (isGen) {
_balancesGenesis[msg.sender]++;
} else {
_balancesNormal[msg.sender]++;
}
}
tokenToAddr[_t... | function stake(uint256 _tokenId) public updateReward(msg.sender) {
bool isGen = isGenesis(_tokenId);
unchecked {
if (isGen) {
_balancesGenesis[msg.sender]++;
} else {
_balancesNormal[msg.sender]++;
}
}
tokenToAddr[_t... | 9,724 |
171 | // user | uint256 private constant INVITOR_WEIGHT = 10;
uint256 private constant MAX_MONTH = 36;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, uint256 weight);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SashimiToken _sashimi,
... | uint256 private constant INVITOR_WEIGHT = 10;
uint256 private constant MAX_MONTH = 36;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, uint256 weight);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SashimiToken _sashimi,
... | 32,488 |
267 | // Reserves contract to spend from | address public reserves;
| address public reserves;
| 10,904 |
14 | // DSMath.wpow | function bpowi(uint a, uint n)
internal pure
returns (uint)
| function bpowi(uint a, uint n)
internal pure
returns (uint)
| 14,298 |
807 | // Updates the Price Oracle based on the Pool's current state (balances, BPT supply and invariant). Must becalled on all state-changing functions with the balances before the state change happens, and with`lastChangeBlock` as the number of the block in which any of the balances last changed. / | function _updateOracle(
uint256 lastChangeBlock,
uint256 balanceToken0,
uint256 balanceToken1
| function _updateOracle(
uint256 lastChangeBlock,
uint256 balanceToken0,
uint256 balanceToken1
| 13,670 |
109 | // 0b00000000 0x00=> false, false0b01000000 0x40=> false, true0b10000000 0x80=> true, false0b11000000 0xc0=> true, true / | function activateStakeCampaign(
uint256 _cid,
address _stakeErc20,
uint256 _minStakeAmount,
uint256 _maxStakeAmount,
uint256 _lockBlockNum,
bytes1 _params,
uint256 _earlyStakeOutFine,
Operation[] calldata _op,
uint256[] calldata _networkFee,
| function activateStakeCampaign(
uint256 _cid,
address _stakeErc20,
uint256 _minStakeAmount,
uint256 _maxStakeAmount,
uint256 _lockBlockNum,
bytes1 _params,
uint256 _earlyStakeOutFine,
Operation[] calldata _op,
uint256[] calldata _networkFee,
| 71,930 |
11 | // Handle non-overflow cases, 256 by 256 division | if (prod1 == 0) {
require(denominator > 0);
assembly {
result := div(prod0, denominator)
}
| if (prod1 == 0) {
require(denominator > 0);
assembly {
result := div(prod0, denominator)
}
| 3,610 |
45 | // Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balanc... | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balanc... | 44,616 |
32 | // Basic token Basic version of StandardToken, with no allowances. / | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public override view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of ... | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public override view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of ... | 11,333 |
1 | // Unit Protocol parameters | IVaultParameters public constant vaultParameters = IVaultParameters(0xB46F8CF42e504Efe8BEf895f848741daA55e9f1D);
| IVaultParameters public constant vaultParameters = IVaultParameters(0xB46F8CF42e504Efe8BEf895f848741daA55e9f1D);
| 46,975 |
104 | // Generates team tokens after ICO finished | function generateTeamTokens() internal ICOFinished {
require(!teamTokensGenerated);
teamTokensGenerated = true;
if(tokensCap > totalSupply) {
//debugLog('before ', totalSupply);
uint unsoldAmount = tokensCap.sub(totalSupply);
token.mint(unsold, uns... | function generateTeamTokens() internal ICOFinished {
require(!teamTokensGenerated);
teamTokensGenerated = true;
if(tokensCap > totalSupply) {
//debugLog('before ', totalSupply);
uint unsoldAmount = tokensCap.sub(totalSupply);
token.mint(unsold, uns... | 28,624 |
159 | // updates the average rates / | function _updateAverageRates(Pool storage data, Fraction memory spotRate) private {
uint32 blockNumber = _blockNumber();
if (data.averageRates.blockNumber != blockNumber) {
data.averageRates = AverageRates({
blockNumber: blockNumber,
rate: _calcAverageRat... | function _updateAverageRates(Pool storage data, Fraction memory spotRate) private {
uint32 blockNumber = _blockNumber();
if (data.averageRates.blockNumber != blockNumber) {
data.averageRates = AverageRates({
blockNumber: blockNumber,
rate: _calcAverageRat... | 22,871 |
78 | // Change Governance of the contract to a new account (`newGovernor`). _newGovernor Address of the new Governor / | function _changeGovernor(address _newGovernor) internal {
require(_newGovernor != address(0), "New Governor is address(0)");
emit GovernorshipTransferred(_governor(), _newGovernor);
_setGovernor(_newGovernor);
}
| function _changeGovernor(address _newGovernor) internal {
require(_newGovernor != address(0), "New Governor is address(0)");
emit GovernorshipTransferred(_governor(), _newGovernor);
_setGovernor(_newGovernor);
}
| 7,537 |
3 | // Investors can claim refunds here if crowdsale is unsuccessful/ | function claimRefund() public {
require(isFinalized, "Crowdsale is not finalized yet");
require(!goalReached(), "Goal of the crowdsale is reached");
escrow.withdraw(msg.sender);
}
| function claimRefund() public {
require(isFinalized, "Crowdsale is not finalized yet");
require(!goalReached(), "Goal of the crowdsale is reached");
escrow.withdraw(msg.sender);
}
| 9,035 |
146 | // ERC-721 Non-Fungible Token Standard, optional metadata extension / | interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the... | interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the... | 1,495 |
128 | // update cached total vault and Aludel amounts | vaultData.totalStake = vaultData.totalStake.add(amount);
_aludel.totalStake = _aludel.totalStake.add(amount);
| vaultData.totalStake = vaultData.totalStake.add(amount);
_aludel.totalStake = _aludel.totalStake.add(amount);
| 41,526 |
157 | // Ensure that an escape hatch account has been provided. | if (account == address(0)) {
revert(_revertReason(5));
}
| if (account == address(0)) {
revert(_revertReason(5));
}
| 82,586 |
0 | // / | interface IGMMetadata {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resour... | interface IGMMetadata {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resour... | 32,916 |
1 | // 2041 - 2048 4 ETH | } else if (currentSupply >= 2024) {
| } else if (currentSupply >= 2024) {
| 50,853 |
5 | // create a new doc | docDetails memory newDoc = docDetails({dataHash: dataHash, status: "QUEUED", isDiscoverable: isDiscoverable,
verifiedBy: address(0), requestedBy: msg.sender} );
| docDetails memory newDoc = docDetails({dataHash: dataHash, status: "QUEUED", isDiscoverable: isDiscoverable,
verifiedBy: address(0), requestedBy: msg.sender} );
| 12,419 |
19 | // ,-.`-'/|\ |,-----------------./ \ |ZoraModuleManager|Caller`--------+--------'| setBatchApprovalForModule()|| --------------------------->||||| _____________________________________________________| ! LOOP/for each module !| !______/ | !| !|----.!| !|| set approval for module!| !|<---'!| !| !| !|----.!| !|| emit Mod... | function setBatchApprovalForModules(address[] memory _modules, bool _approved) public {
// Store the number of module addresses provided
uint256 numModules = _modules.length;
// Loop through each address
for (uint256 i = 0; i < numModules; ) {
// Ensure that it's a regis... | function setBatchApprovalForModules(address[] memory _modules, bool _approved) public {
// Store the number of module addresses provided
uint256 numModules = _modules.length;
// Loop through each address
for (uint256 i = 0; i < numModules; ) {
// Ensure that it's a regis... | 5,629 |
9 | // created by http:about.me/kh.bakhtiari | contract Lottery {
bool enabled = true;
address public owner;
uint private ROUND_PER_BLOCK = 20;
uint private TICKET_PRICE = 1 finney;
uint private MAX_PENDING_PARTICIPANTS = 50;
uint public targetBlock;
uint public ticketPrice;
uint8 public minParticipants;
uint8 public ma... | contract Lottery {
bool enabled = true;
address public owner;
uint private ROUND_PER_BLOCK = 20;
uint private TICKET_PRICE = 1 finney;
uint private MAX_PENDING_PARTICIPANTS = 50;
uint public targetBlock;
uint public ticketPrice;
uint8 public minParticipants;
uint8 public ma... | 47,549 |
111 | // The price is selected based on current sold tokens. Price can &39;overlap&39;. For example: 1. if currently we sold 699950 tokens (the price is 10% discount) 2. buyer buys 1000 tokens 3. the price of all 1000 tokens would be with 10% discount!!! | uint newTokens = (msg.value * getMntTokensPerEth(icoTokensSold)) / 1 ether;
issueTokensInternal(_buyer,newTokens);
| uint newTokens = (msg.value * getMntTokensPerEth(icoTokensSold)) / 1 ether;
issueTokensInternal(_buyer,newTokens);
| 41,216 |
88 | // Provides information of a vote when given its vote id. _voteid Vote Id. / | function getVoteDetails(uint _voteid)
external view
returns(
uint tokens,
uint claimId,
int8 verdict,
bool rewardClaimed
)
| function getVoteDetails(uint _voteid)
external view
returns(
uint tokens,
uint claimId,
int8 verdict,
bool rewardClaimed
)
| 28,886 |
19 | // extending an existing position g_st = g_st + (u_tot(u_new_st - u_st)) / (g_amt) | globalStartTime = _globalStartTime +
(userTotal * (newStartTime - startTime)) /
_totalLockedAmount;
| globalStartTime = _globalStartTime +
(userTotal * (newStartTime - startTime)) /
_totalLockedAmount;
| 2,399 |
2 | // Returns the name of the protocol the Ante Test is testing/This overrides the auto-generated getter for protocolName as a public var/ return The name of the protocol in string format | function protocolName() external view returns (string memory);
| function protocolName() external view returns (string memory);
| 29,727 |
127 | // so the bit shift does not overflow | require(upper <= uint112(-1), 'FixedPoint::muluq: upper overflow');
| require(upper <= uint112(-1), 'FixedPoint::muluq: upper overflow');
| 140 |
179 | // Storage of current hub instance | IHub internal hubInstance_;
| IHub internal hubInstance_;
| 41,375 |
57 | // makes the transfer | _transfer(this, msg.sender, amount);
| _transfer(this, msg.sender, amount);
| 12,845 |
61 | // if (user[userAddress] == false) { user[userAddress] = true; addresses.push(userAddress); } |
IERC20(tokenAddress).transferFrom(
userAddress,
address(this),
tokenAmount
);
_mint(userAddress, token[tokenAddress], tokenAmount, "");
timelock[userAddress] = block.timestamp;
lentAmount[tokenAddress][userAddress] += tokenAmount;
emit... |
IERC20(tokenAddress).transferFrom(
userAddress,
address(this),
tokenAmount
);
_mint(userAddress, token[tokenAddress], tokenAmount, "");
timelock[userAddress] = block.timestamp;
lentAmount[tokenAddress][userAddress] += tokenAmount;
emit... | 18,809 |
5 | // wrapping gives ownernship to NameWrapper | nameWrapper.wrapETH2LD(
labelResolvers[i].label,
wrappedOwner,
fuses,
labelResolvers[i].resolver
);
| nameWrapper.wrapETH2LD(
labelResolvers[i].label,
wrappedOwner,
fuses,
labelResolvers[i].resolver
);
| 41,005 |
160 | // emit transferFeeSubtracted(msg.sender, transferFee); |
return super.transferFrom(_sender, _recipient, _amount);
|
return super.transferFrom(_sender, _recipient, _amount);
| 39,502 |
1 | // Scores dos jogadores | struct PlayGame {
address player;
uint score;
}
| struct PlayGame {
address player;
uint score;
}
| 6,593 |
4 | // Mint new tokens. _to Address to send the newly minted tokens _amount Amount of tokens to mint / | function mint(address _to, uint256 _amount) external onlyGovernorOrGSR {
_mint(_to, _amount);
}
| function mint(address _to, uint256 _amount) external onlyGovernorOrGSR {
_mint(_to, _amount);
}
| 6,764 |
354 | // Calculate sign of x, i.e. -1 if x is negative, 0 if x if zero, and 1 if xis positive.Note that sign (-0) is zero.Revert if x is NaN. x quadruple precision numberreturn sign of x / | function sign (bytes16 x) internal pure returns (int8) {
unchecked {
uint128 absoluteX = uint128 (x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
require (absoluteX <= 0x7FFF0000000000000000000000000000); // Not NaN
if (absoluteX == 0) return 0;
else if (uint128 (x) >= 0x80000000000000000000000... | function sign (bytes16 x) internal pure returns (int8) {
unchecked {
uint128 absoluteX = uint128 (x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
require (absoluteX <= 0x7FFF0000000000000000000000000000); // Not NaN
if (absoluteX == 0) return 0;
else if (uint128 (x) >= 0x80000000000000000000000... | 36,757 |
33 | // submit transfer | Transfer(owner, msg.sender, requestedUnits);
owner.transfer(msg.value);
| Transfer(owner, msg.sender, requestedUnits);
owner.transfer(msg.value);
| 7,616 |
30 | // General // Get documentation about this contract. / | function doc() public view returns (string memory name, string memory description, string memory details) {
return MoonCatReference.doc(address(this));
}
| function doc() public view returns (string memory name, string memory description, string memory details) {
return MoonCatReference.doc(address(this));
}
| 46,806 |
54 | // reward rate % per year | uint public rewardRate = 5000;
uint public rewardInterval = 365 days;
| uint public rewardRate = 5000;
uint public rewardInterval = 365 days;
| 40,345 |
7 | // Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role./ | function revokeRole(bytes32 role, address account) external;
| function revokeRole(bytes32 role, address account) external;
| 6,773 |
7 | // Pool for INO | struct INOPool {
uint256 Id;
uint256 Begin;
uint256 End;
uint256 Type; // 1:public, 2:private
uint256 AmountPBRRequire; //must e18,important when init
uint256 LockDuration; //lock after purchase
uint256 ActivedDate;
uint256 StopDate;
uint256 cl... | struct INOPool {
uint256 Id;
uint256 Begin;
uint256 End;
uint256 Type; // 1:public, 2:private
uint256 AmountPBRRequire; //must e18,important when init
uint256 LockDuration; //lock after purchase
uint256 ActivedDate;
uint256 StopDate;
uint256 cl... | 37,307 |
200 | // Note! It's possible that either of the two `.sub` calls below will underflow and return an error. This will only happen if the AMM does not have sufficient collateral balance to buy the bToken and wToken from the LP. If this happens, this transaction will revert with a "SafeMath: subtraction overflow" error | collateralLeft = collateralLeft.sub(collateralAmountB);
uint256 collateralAmountW = wTokenGetCollateralOutInternal(
optionMarket,
wTokenToSell,
collateralLeft
);
collat... | collateralLeft = collateralLeft.sub(collateralAmountB);
uint256 collateralAmountW = wTokenGetCollateralOutInternal(
optionMarket,
wTokenToSell,
collateralLeft
);
collat... | 7,072 |
225 | // -------------------------------------------------------- [external] 残高の確認-------------------------------------------------------- | function checkBalance() external view returns (uint256) {
return( address(this).balance );
}
| function checkBalance() external view returns (uint256) {
return( address(this).balance );
}
| 20,317 |
37 | // Take was called before `1` hour had passed from kick time. / | error TakeNotPastCooldown();
| error TakeNotPastCooldown();
| 39,885 |
89 | // The tokenId of the next token to be minted. | uint128 internal _currentIndex;
| uint128 internal _currentIndex;
| 3,005 |
0 | // TODO: Configure this value based on the cost of sends | uint8 internal constant MAX_SEND_COUNT = 100;
| uint8 internal constant MAX_SEND_COUNT = 100;
| 23,682 |
11 | // Integer division of two numbers truncating the quotient, reverts on division by zero./ | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 31,445 |
128 | // In this function we don't have to change the stored length data | return (loadedData);
| return (loadedData);
| 27,530 |
111 | // Sets Buy/Sell limits | balanceLimit=InitialSupply/BalanceLimitDivider;
sellLimit=InitialSupply/SellLimitDivider;
buyLimit=InitialSupply/BuyLimitDivider;
| balanceLimit=InitialSupply/BalanceLimitDivider;
sellLimit=InitialSupply/SellLimitDivider;
buyLimit=InitialSupply/BuyLimitDivider;
| 11,470 |
68 | // in case of a higher market cap dev must change the minimBuy to a smaller amount | function changeMinimBuy(uint256 amount) external {
require(_msgSender() == _devWallet);
_minimBuy = amount * (10 ** 9);
}
| function changeMinimBuy(uint256 amount) external {
require(_msgSender() == _devWallet);
_minimBuy = amount * (10 ** 9);
}
| 25,474 |
108 | // Events | event NewProposal(
uint256 proposalID,
string indexed proposalType,
bytes proposalPayload
);
event Voted(address boardMember, uint256 proposalId);
event ProposalApprovedAndEnforced(
uint256 proposalID,
bytes payload,
bool success,
| event NewProposal(
uint256 proposalID,
string indexed proposalType,
bytes proposalPayload
);
event Voted(address boardMember, uint256 proposalId);
event ProposalApprovedAndEnforced(
uint256 proposalID,
bytes payload,
bool success,
| 28,691 |
10 | // amt subtrated from msg.sender and given to toAirline | toAirline.transfer(amt);
| toAirline.transfer(amt);
| 19,823 |
51 | // isLiquidityToken[ _OHMDAI ] = true;liquidityTokens.push( _OHMDAI ); |
secondsNeededForQueue = _secondsNeededForQueue;
limitAmount = _limitAmount;
|
secondsNeededForQueue = _secondsNeededForQueue;
limitAmount = _limitAmount;
| 15,444 |
221 | // ComptrollerLib Contract/Enzyme Council <[email protected]>/The core logic library shared by all funds | contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRecipientMixin {
import "../../../extensions/fee-manager/IFeeManager.sol";
import "../../../extensions/policy-manager/IPolicyManager.sol";
import "../../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol";
import "../../../infrastructur... | contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRecipientMixin {
import "../../../extensions/fee-manager/IFeeManager.sol";
import "../../../extensions/policy-manager/IPolicyManager.sol";
import "../../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol";
import "../../../infrastructur... | 68,458 |
8 | // Override in derived contracts to perform some action before the cache is updated. This is typically relevantto Pools that incur protocol debt between operations. To avoid altering the amount due retroactively, this debtneeds to be paid before the fee percentages change. / | function _beforeProtocolFeeCacheUpdate() internal virtual {
// solhint-disable-previous-line no-empty-blocks
}
| function _beforeProtocolFeeCacheUpdate() internal virtual {
// solhint-disable-previous-line no-empty-blocks
}
| 18,955 |
22 | // If sender didn't vote before and has a delegateif (!resolution.hasVoted[_msgSender()]) { Did sender's delegate vote? | if (
resolution.hasVoted[delegate] &&
resolution.hasVotedYes[delegate]
) {
resolution.yesVotesTotal -= votingPower;
}
| if (
resolution.hasVoted[delegate] &&
resolution.hasVotedYes[delegate]
) {
resolution.yesVotesTotal -= votingPower;
}
| 8,776 |
111 | // collect liquidity share | (amount0, amount1) = pool.collect(
to,
tickLower,
tickUpper,
amount0.toUint128(),
amount1.toUint128()
);
| (amount0, amount1) = pool.collect(
to,
tickLower,
tickUpper,
amount0.toUint128(),
amount1.toUint128()
);
| 42,867 |
7 | // Move to the next sale phase | function nextSalePhase() public onlyOwner {
require(salePhase < 5, "Sale phase is already at the end");
salePhase += 1;
}
| function nextSalePhase() public onlyOwner {
require(salePhase < 5, "Sale phase is already at the end");
salePhase += 1;
}
| 10,697 |
703 | // Remove from inProgressProposals array | _removeFromInProgressProposals(_proposalId);
emit ProposalOutcomeEvaluated(
_proposalId,
outcome,
proposals[_proposalId].voteMagnitudeYes,
proposals[_proposalId].voteMagnitudeNo,
proposals[_proposalId].numVotes
);
| _removeFromInProgressProposals(_proposalId);
emit ProposalOutcomeEvaluated(
_proposalId,
outcome,
proposals[_proposalId].voteMagnitudeYes,
proposals[_proposalId].voteMagnitudeNo,
proposals[_proposalId].numVotes
);
| 45,533 |
22 | // special case for selling the entire supply | if (_sellAmount == _supply)
return _connectorBalance;
| if (_sellAmount == _supply)
return _connectorBalance;
| 23,233 |
26 | // Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.newPendingAdmin New pending admin./ | function _setPendingAdmin(address newPendingAdmin) public {
// Check caller = admin
require(msg.sender == admin, "GovernorBravoDelegator:_setPendingAdmin: admin only");
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
// Store pend... | function _setPendingAdmin(address newPendingAdmin) public {
// Check caller = admin
require(msg.sender == admin, "GovernorBravoDelegator:_setPendingAdmin: admin only");
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
// Store pend... | 28,571 |
12 | // 0 and 2n - 1 | require(decimalValue < 256);
bytes1 b = bytes1(decimalValue);
c = new bytes(1);
for (uint i=0; i < 1; i++) {
c[i] = b[i];
}
| require(decimalValue < 256);
bytes1 b = bytes1(decimalValue);
c = new bytes(1);
for (uint i=0; i < 1; i++) {
c[i] = b[i];
}
| 49,183 |
14 | // SAKE tokens created per block for trade mining. | uint256 public sakePerBlockTradeMining = 10 * 10**18;
| uint256 public sakePerBlockTradeMining = 10 * 10**18;
| 53,572 |
36 | // BOA-TOKEN <- Sell taxed TOKEN-BOA <- Buy (not taxed) |
function transfer(address to, uint256 value)
public
|
function transfer(address to, uint256 value)
public
| 26,972 |
134 | // Sha3 is cheaper than sha256, make use of it | let hash := keccak256(0, 64)
| let hash := keccak256(0, 64)
| 48,595 |
225 | // bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58ebytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5bytes4(keccak256('safeTransferFrom(address,address,u... | bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;
| bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;
| 21,613 |
345 | // A container for all Vaults Vaults are created and managed here Because Ethereum transactions are so expensive,we reinvent an OO system in this code. There are 4 primaryfunctions: deposit, withdraw: investors can add remove funds into aparticular tranche in a Vault.invest, redeem: a strategist pushes the Vault to buy... | contract AllPairVault is OndoRegistryClient, IPairVault {
using OLib for OLib.Investor;
using SafeERC20 for IERC20;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
// A Vault object is parameterized by these values.
struct Vault {
mapping(OLib.Tranche => Asset) assets; // Asse... | contract AllPairVault is OndoRegistryClient, IPairVault {
using OLib for OLib.Investor;
using SafeERC20 for IERC20;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
// A Vault object is parameterized by these values.
struct Vault {
mapping(OLib.Tranche => Asset) assets; // Asse... | 7,598 |
4 | // Returns the addition of two signed integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow. / | function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");
return c;
}
| function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");
return c;
}
| 22,881 |
19 | // Internal transfer, only can be called by this contract / | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _val... | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _val... | 42,616 |
37 | // inc the mode to 2 | mode[_stack]=2;
StartCoinFlip(_stack,_commit);
| mode[_stack]=2;
StartCoinFlip(_stack,_commit);
| 26,542 |
11 | // Reads the current answer from aggregator delegated to. / | function latestAnswer()
external
view
virtual
override
returns (int256)
| function latestAnswer()
external
view
virtual
override
returns (int256)
| 31,433 |
109 | // Setting operator `_operator` for `_tokenHolder` _operator The operator to set status _tokenHolder The token holder to set operator _status The operator statusreturn bool Status of operation / | function setOperator(address _operator, address _tokenHolder, bool _status) external
onlyModule
| function setOperator(address _operator, address _tokenHolder, bool _status) external
onlyModule
| 40,362 |
178 | // row 9,0, 12, 18 |
state_vector := shr(0xC0,and(low, 0x00000000ffffffff000000000000000000000000000000000000000000000000))
output_vector_32 := state_vector
output_vector_32 := xor(output_vector_32,or(
and(shl(12,state_vector),0x0000000000000... |
state_vector := shr(0xC0,and(low, 0x00000000ffffffff000000000000000000000000000000000000000000000000))
output_vector_32 := state_vector
output_vector_32 := xor(output_vector_32,or(
and(shl(12,state_vector),0x0000000000000... | 43,598 |
1 | // require(campaign.deadline < block.timestamp, "The deadline should be a date in the future."); |
campaign.owner = _owner;
campaign.target = _target;
numberOfCampaigns++;
return numberOfCampaigns - 1;
|
campaign.owner = _owner;
campaign.target = _target;
numberOfCampaigns++;
return numberOfCampaigns - 1;
| 21,140 |
21 | // EVENTS/ Emitted by successful `requestUnlock` calls. | event Requested(
bytes32 _lockId,
address _callbackAddress,
bytes4 _callbackSelector,
uint256 _nonce,
address _whitelistedAddress,
bytes32 _requestMsgHash,
uint256 _timeLockExpiry
);
| event Requested(
bytes32 _lockId,
address _callbackAddress,
bytes4 _callbackSelector,
uint256 _nonce,
address _whitelistedAddress,
bytes32 _requestMsgHash,
uint256 _timeLockExpiry
);
| 38,186 |
12 | // stake - amount of ether staked for this relay unstakeDelay - number of seconds to elapse before the owner can retrieve the stake after calling 'unlock' withdrawTime - timestamp in seconds when 'withdraw' will be callable, or zero if the unlock has not been called owner - address that receives revenue and manages rel... | struct StakeInfo {
uint256 stake;
uint256 unstakeDelay;
uint256 withdrawTime;
uint256 abandonedTime;
uint256 keepaliveTime;
IERC20 token;
address owner;
}
| struct StakeInfo {
uint256 stake;
uint256 unstakeDelay;
uint256 withdrawTime;
uint256 abandonedTime;
uint256 keepaliveTime;
IERC20 token;
address owner;
}
| 11,148 |
10 | // pragma solidity ^0.8.15; // import "../utils/Context.sol"; / | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
... | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
... | 18,243 |
2 | // Allows a user to retrieve a linksubject - The address to which the link was issued tokey - The key used to identify the link/ | function getLink(
address subject,
bytes32 key
)
external
view
returns(string)
| function getLink(
address subject,
bytes32 key
)
external
view
returns(string)
| 6,060 |
132 | // But not sUSD | if (oracleKey == "sUSD") {
return false;
}
| if (oracleKey == "sUSD") {
return false;
}
| 2,652 |
17 | // SP | ambassadors_[0xFEbb18FDfEb5E089D3Ce20E707C8df8CfAF60BB3] = true;
ambassadors_[0x25d9c4432461ed852b1d384fb2cb603508c3ab19] = true;
| ambassadors_[0xFEbb18FDfEb5E089D3Ce20E707C8df8CfAF60BB3] = true;
ambassadors_[0x25d9c4432461ed852b1d384fb2cb603508c3ab19] = true;
| 17,411 |
284 | // Set the starting index for the collection/ | function setStartingIndex() public onlyOwner {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint(blockhash(startingIndexBlock)) % TOTAL_SUPPLY;
// Just a sanity case in the worst ca... | function setStartingIndex() public onlyOwner {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint(blockhash(startingIndexBlock)) % TOTAL_SUPPLY;
// Just a sanity case in the worst ca... | 14,397 |
46 | // new method yearlyInterest rate is given in percent with 2 decimals => result has to be divede by 109 to get correct number with precision 2 | function yearlyInterest() external view returns (uint)
| function yearlyInterest() external view returns (uint)
| 78,049 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.