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
12
// Add cumulatively
userValueFromSpending[_contract][_user] = spendableInfos[_contract][_token][_newLevel].amount.add(oldTotalValueFromSpending);
userValueFromSpending[_contract][_user] = spendableInfos[_contract][_token][_newLevel].amount.add(oldTotalValueFromSpending);
14,396
202
// pod state tracker.
mapping(uint256 => bool) private launchStatus;
mapping(uint256 => bool) private launchStatus;
32,897
397
// Ensure that a sufficient amount of authorities have signed to veto this proposal.
bytes32 eip712DomainHash = LibEIP712.hashEIP712Domain(name, version, getChainId(), address(this)); bytes32 vetoHash = LibVeto.getVetoHash(
bytes32 eip712DomainHash = LibEIP712.hashEIP712Domain(name, version, getChainId(), address(this)); bytes32 vetoHash = LibVeto.getVetoHash(
23,885
9
// owner may reserve certain mints for themselves
mapping (address => bool) public reserved;
mapping (address => bool) public reserved;
85,135
35
// Curve Pool Strategy Investment strategy for investing in Curve Pools Origin Protocol Inc Factor Finance 2022 /
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ICurvePool } from "./ICurvePool.sol"; import { IERC20, InitializableAbstractStrategy } from "../utils/InitializableAbstractStrategy.sol"; import { StableMath } from "../utils/StableMath.sol"; import { Helpers } from "../utils...
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ICurvePool } from "./ICurvePool.sol"; import { IERC20, InitializableAbstractStrategy } from "../utils/InitializableAbstractStrategy.sol"; import { StableMath } from "../utils/StableMath.sol"; import { Helpers } from "../utils...
20,967
2
// Deploys a new gauge for a Balancer pool. As anyone can register arbitrary Balancer pools with the Vault,it's impossible to prove onchain that `pool` is a "valid" deployment. Care must be taken to ensure that gauges deployed from this factory are suitable to distribute rewards. It is possible to deploy multiple gauge...
function create(address pool) external returns (address) { address gauge = _create(); IChildChainGauge(gauge).initialize(pool, getProductVersion()); return gauge; }
function create(address pool) external returns (address) { address gauge = _create(); IChildChainGauge(gauge).initialize(pool, getProductVersion()); return gauge; }
14,501
69
// Sets the extra data for token `id` to `value`./ Minting, transferring, burning a token will not change the extra data./ The extra data can be set on a non existent token.
function _setExtraData(uint256 id, uint96 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let packed := sload(o...
function _setExtraData(uint256 id, uint96 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let packed := sload(o...
17,208
38
// skip checks if member is setting the delegate key to their member address
if (newDelegateKey != memberAddr) { require( memberAddresses[newDelegateKey] == address(0x0), "cannot overwrite existing members" ); require( memberAddresses[memberAddressesByDelegatedKey[newDelegateKey]] == ...
if (newDelegateKey != memberAddr) { require( memberAddresses[newDelegateKey] == address(0x0), "cannot overwrite existing members" ); require( memberAddresses[memberAddressesByDelegatedKey[newDelegateKey]] == ...
48,204
23
// Calculate sqrt (x) rounding down.Revert if x < 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number /
function sqrt (int128 x) internal pure returns (int128) { require (x >= 0); return int128 (sqrtu (uint256 (x) << 64, 0x10000000000000000)); }
function sqrt (int128 x) internal pure returns (int128) { require (x >= 0); return int128 (sqrtu (uint256 (x) << 64, 0x10000000000000000)); }
2,497
0
// Stage2( 1525132800,start time 1527811200end time )
public
public
28,504
480
// Possible ways this could break addressed 1) No ageement to terms - added require 2) Adding liquidity after generaion is over - added require 3) Overflow from uint - impossible there isnt that much ETH aviable4) Depositing 0 - not an issue it will just add 0 to tally
function addLiquidity(uint256 amount) public { require(liquidityGenerationOngoing(), "Liquidity Generation Event over"); //require(agreesToTermsOutlinedInLiquidityGenerationParticipationAgreement, "No agreement provided"); // ethContributed[msg.sender] += msg.value; // Overflow protection fr...
function addLiquidity(uint256 amount) public { require(liquidityGenerationOngoing(), "Liquidity Generation Event over"); //require(agreesToTermsOutlinedInLiquidityGenerationParticipationAgreement, "No agreement provided"); // ethContributed[msg.sender] += msg.value; // Overflow protection fr...
21,739
74
// Decrease spender balance by the freezed amount.
balances[_spender] = _newBalance;
balances[_spender] = _newBalance;
4,782
147
// Only accept from Etheria contract
require(_msgSender() == _etheriaAddress, "EW09: ETH sender isn't Etheria contract");
require(_msgSender() == _etheriaAddress, "EW09: ETH sender isn't Etheria contract");
48,312
145
// Deposit LP tokens to Chowswap for CHOW allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accChowPerShare).div(1e12)....
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accChowPerShare).div(1e12)....
21,495
14
// set destination account for handling fees//accountAddress of account receiving the fees/
function setWallet(address account) external ownerOnly { handling_wallet = account; }
function setWallet(address account) external ownerOnly { handling_wallet = account; }
50,070
49
// address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient;
address saleRecipient = _primarySaleRecipient; CurrencyTransferLib.transferCurrency(_currency, msg.sender, saleRecipient, totalPrice);
address saleRecipient = _primarySaleRecipient; CurrencyTransferLib.transferCurrency(_currency, msg.sender, saleRecipient, totalPrice);
26,402
119
// edge case around reward ending periods
if(newbalance > 0){
if(newbalance > 0){
36,809
8
// passedreturns whether Challenge has passed
function passed() public view returns (bool) { require(ended()); // marketIndex 1 == deniedScalar // if proposal is denied, the challenge has passed. return futarchyOracle.getOutcome() == 1; }
function passed() public view returns (bool) { require(ended()); // marketIndex 1 == deniedScalar // if proposal is denied, the challenge has passed. return futarchyOracle.getOutcome() == 1; }
20,264
1
// Emitted when a set of staked token-ids are withdrawn.
event TokensWithdrawn(address indexed staker, uint256 indexed tokenId, uint256 amount);
event TokensWithdrawn(address indexed staker, uint256 indexed tokenId, uint256 amount);
13,789
41
// filtering if the target is a contract with bytecode inside it
require(super.transfer(_to, _value)); // do a normal token transfer if (isContract(_to)) { require(contractFallback(msg.sender, _to, _value, _data)); }
require(super.transfer(_to, _value)); // do a normal token transfer if (isContract(_to)) { require(contractFallback(msg.sender, _to, _value, _data)); }
34,125
30
// Reduce number of active users and team users
teams[userTeamId].numberUsers = teams[userTeamId].numberUsers.sub(1); numberActiveProfiles = numberActiveProfiles.sub(1);
teams[userTeamId].numberUsers = teams[userTeamId].numberUsers.sub(1); numberActiveProfiles = numberActiveProfiles.sub(1);
22,258
13
// Deploys and returns the address of a clone that mimics the behaviour of `implementation`. This function uses the create opcode, which should never revert. /
function clone(address implementation) internal returns (address instance) { // solhint-disable-next-line no-inline-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), sh...
function clone(address implementation) internal returns (address instance) { // solhint-disable-next-line no-inline-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), sh...
884
155
// assert that enough liquidity tokens are available to be minted
require(mintableLiquidity > 0, 'INSUFFICIENT_LIQUIDITY_MINTED');
require(mintableLiquidity > 0, 'INSUFFICIENT_LIQUIDITY_MINTED');
60,948
236
// Construct calldata for finalizeDeposit call
bytes memory message = abi.encodeWithSelector( iOVM_L2ERC20Bridge.finalizeDeposit.selector, address(0), Lib_PredeployAddresses.OVM_ETH, _from, _to, msg.value, _data );
bytes memory message = abi.encodeWithSelector( iOVM_L2ERC20Bridge.finalizeDeposit.selector, address(0), Lib_PredeployAddresses.OVM_ETH, _from, _to, msg.value, _data );
56,831
269
// burn tokens sent
_burn(msg.sender, amount); if (amountToWithdraw > currencyBalance()) { removeLiquidityFromCurve(amountToWithdraw.sub(currencyBalance())); require(amountToWithdraw <= currencyBalance(), "TrueFiPool: Not enough funds were withdrawn from Curve"); }
_burn(msg.sender, amount); if (amountToWithdraw > currencyBalance()) { removeLiquidityFromCurve(amountToWithdraw.sub(currencyBalance())); require(amountToWithdraw <= currencyBalance(), "TrueFiPool: Not enough funds were withdrawn from Curve"); }
22,105
65
// Save the new data
lastPricePerShare = _currentPricePerShare; lastVirtualPrice = _currentVirtualPrice;
lastPricePerShare = _currentPricePerShare; lastVirtualPrice = _currentVirtualPrice;
62,779
46
// shouldn&39;t happen, just in case
function emptyWrongEther() onlyOwner public { uint256 amount = address(this).balance; require(amount > 0); msg.sender.transfer(amount); emit WrongEtherEmptied(msg.sender, amount); }
function emptyWrongEther() onlyOwner public { uint256 amount = address(this).balance; require(amount > 0); msg.sender.transfer(amount); emit WrongEtherEmptied(msg.sender, amount); }
51,728
3
// Ownable contract - base contract with an owner /<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f3979685b3809e928187909c9d878192908796929edd909c9e">[email&160;protected]</a>
contract Ownable { address public owner; function Ownable() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner { if (newOwner != address(0)) { owner = newOwner; } } }
contract Ownable { address public owner; function Ownable() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner { if (newOwner != address(0)) { owner = newOwner; } } }
42,424
93
// ---------------------------------------------------------------------------- BokkyPooBah's Token Teleportation Service Token v1.10 Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence. ----------------------------------------------------------------------------
contract BTTSToken is BTTSTokenInterface { using BTTSLib for BTTSLib.Data; BTTSLib.Data data; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function BTTSToken(address owner,...
contract BTTSToken is BTTSTokenInterface { using BTTSLib for BTTSLib.Data; BTTSLib.Data data; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function BTTSToken(address owner,...
81,546
258
// Number of items you're guaranteed to get, for each class
uint16[NUM_CLASSES] guarantees;
uint16[NUM_CLASSES] guarantees;
17,022
260
// Retrieves the current pending reward for the MasterChef pool
function _getPendingReward() internal view returns (uint256 _pendingReward)
function _getPendingReward() internal view returns (uint256 _pendingReward)
7,319
70
// Allows drago owner to withdraw from an exchange/_exchange Address of the exchange/_token Address of the withdrawn token (null for eth)/_value Number of tokens deposited (0 for eth)
function withdrawFromExchange(address _exchange, address _token, uint _value) public onlyOwner whenApprovedExchange(_exchange)
function withdrawFromExchange(address _exchange, address _token, uint _value) public onlyOwner whenApprovedExchange(_exchange)
412
380
// views
function calcCurrentPayoutERC20(address user, address token) public view returns (uint256) { uint stakeBlock = erc20Stakes[user][token].setupBlock; require(stakeBlock != 0, "User has no stake"); if ((block.timestamp - erc20Stakes[user][token].setupTime) >= BLOCKTIME_PENALTY_THRESHOLD) { // ...
function calcCurrentPayoutERC20(address user, address token) public view returns (uint256) { uint stakeBlock = erc20Stakes[user][token].setupBlock; require(stakeBlock != 0, "User has no stake"); if ((block.timestamp - erc20Stakes[user][token].setupTime) >= BLOCKTIME_PENALTY_THRESHOLD) { // ...
16,172
50
// ico
if (now >= startIco && now < endIco && totalIco < maxIco){ tokens = weiAmount.mul(rateIco); if (maxIco.sub(totalIco) < tokens){ tokens = maxIco.sub(totalIco); weiAmount = tokens.div(rateIco); backAmount = msg.value.sub(weiAmount); }
if (now >= startIco && now < endIco && totalIco < maxIco){ tokens = weiAmount.mul(rateIco); if (maxIco.sub(totalIco) < tokens){ tokens = maxIco.sub(totalIco); weiAmount = tokens.div(rateIco); backAmount = msg.value.sub(weiAmount); }
64,987
35
// See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance ...
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _appro...
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _appro...
45,027
23
// Not infinities of the same sign
require (x != y || absoluteX < 0x7FFF0000000000000000000000000000); if (x == y) return 0; else { bool negativeX = uint128 (x) >= 0x80000000000000000000000000000000; bool negativeY = uint128 (y) >= 0x80000000000000000000000000000000; if (negativeX) { if (negativeY) return absolute...
require (x != y || absoluteX < 0x7FFF0000000000000000000000000000); if (x == y) return 0; else { bool negativeX = uint128 (x) >= 0x80000000000000000000000000000000; bool negativeY = uint128 (y) >= 0x80000000000000000000000000000000; if (negativeX) { if (negativeY) return absolute...
25,701
52
// contract owner can withdraw any ERC-20 token stuck inside the contract and return them to `walletAddress`
IERC20(_tokenAddress).transfer(walletAddress, IERC20(_tokenAddress).balanceOf(address(this))); emit EmergencyWithdrawActivated(_tokenAddress, IERC20(_tokenAddress).balanceOf(walletAddress));
IERC20(_tokenAddress).transfer(walletAddress, IERC20(_tokenAddress).balanceOf(address(this))); emit EmergencyWithdrawActivated(_tokenAddress, IERC20(_tokenAddress).balanceOf(walletAddress));
41,507
6
// Update the SeaDrop drop URI.Only the owner can use this function.dropURI The new drop URI. /
function updateDropURI(string calldata dropURI) external;
function updateDropURI(string calldata dropURI) external;
14,853
121
// Function for updating account's reward checkpoint.account - address of the account to update the reward checkpoint for./
function updateRewardCheckpoint(address account) external returns (bool);
function updateRewardCheckpoint(address account) external returns (bool);
51,053
8
// State changing functions
function charge(uint256 snapId) onlyAdmin public { uint256 balanceBefore = btcb.balanceOf(address(this)); masterContract.charge(snapId); uint256 balanceAfter = btcb.balanceOf(address(this)); chargedAt[snapId] = balanceAfter - balanceBefore; totalSharesAt[snapId] = totalShares...
function charge(uint256 snapId) onlyAdmin public { uint256 balanceBefore = btcb.balanceOf(address(this)); masterContract.charge(snapId); uint256 balanceAfter = btcb.balanceOf(address(this)); chargedAt[snapId] = balanceAfter - balanceBefore; totalSharesAt[snapId] = totalShares...
28,475
27
// The domain separator used in the permit signaturereturn The domain seperator used in encoding of permit signature /
function DOMAIN_SEPARATOR() external view returns (bytes32);
function DOMAIN_SEPARATOR() external view returns (bytes32);
44,805
21
// Ensuring the lottery is within a valid time
require( getCurrentTime() >= allLotteries[_lotteryId].startingTimestamp, "Invalid time for mint:start" ); require( getCurrentTime() < allLotteries[_lotteryId].closingTimestamp, "Invalid time for mint:end" ); if(allLotteries[_lottery...
require( getCurrentTime() >= allLotteries[_lotteryId].startingTimestamp, "Invalid time for mint:start" ); require( getCurrentTime() < allLotteries[_lotteryId].closingTimestamp, "Invalid time for mint:end" ); if(allLotteries[_lottery...
23,447
135
// not enough tokens
if(balance < data.tokensNeededForRefferalNumber) { return; }
if(balance < data.tokensNeededForRefferalNumber) { return; }
10,293
38
// This function makes it easy to get the total number of tokens/ return The total number of tokens
function totalSupply() public constant returns (uint) { return totalSupplyAt(block.number); }
function totalSupply() public constant returns (uint) { return totalSupplyAt(block.number); }
29,749
11
// Returns agreement status between the two parties
function isSigned(uint agreement_id) public view returns(bool) { return agreements[agreement_id].alice_agreed && agreements[agreement_id].bob_agreed; }
function isSigned(uint agreement_id) public view returns(bool) { return agreements[agreement_id].alice_agreed && agreements[agreement_id].bob_agreed; }
18,603
10
// FromからToに送信する
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool success) { require(_value <= allowed[_from][msg.sender]); _transfer(_from, _to, _value); allowed[_from][msg.sender] -= _value; return true; }
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool success) { require(_value <= allowed[_from][msg.sender]); _transfer(_from, _to, _value); allowed[_from][msg.sender] -= _value; return true; }
9,050
19
// using SafeMath for uint;
address payable public owner;
address payable public owner;
14,956
96
// prevents contracts from interacting with fomo3d/
modifier isHuman() {
modifier isHuman() {
30,586
40
// Requests an update of the ownership of the user representing the repository./ See `requestUpdateOwner` for more details./forge The forge where the repository is stored./name The name of the repository./fee The fee in Link to pay for the request./ return userId The ID of the user.
function _requestUpdateOwner(Forge forge, bytes memory name, uint256 fee) internal returns (uint256 userId)
function _requestUpdateOwner(Forge forge, bytes memory name, uint256 fee) internal returns (uint256 userId)
23,077
301
// ------------------------------------------------------------------------------- PRIVATE FUNCTIONS + ADDITIONAL REQUIREMENTS FOR CONTRACT -------------------------------------------------------------------------------
function DestroyWeapons( address tokenOwner, uint256 tokenId, uint256 totalToBurn
function DestroyWeapons( address tokenOwner, uint256 tokenId, uint256 totalToBurn
16,200
11
// add the sold amount, should not exceed daily limit (checked in DetherCore)
ethSellsUserToday[_from][date.day][date.month][date.year] = SafeMath.add(weiSoldToday, _amount); _to.transfer(_amount);
ethSellsUserToday[_from][date.day][date.month][date.year] = SafeMath.add(weiSoldToday, _amount); _to.transfer(_amount);
25,792
170
// File: contracts\patterns\Proxiable.sol
interface Proxiable { /// @dev Complying with EIP-1822: Universal Upgradable Proxy Standard (UUPS) /// @dev See https://eips.ethereum.org/EIPS/eip-1822. function proxiableUUID() external pure returns (bytes32); }
interface Proxiable { /// @dev Complying with EIP-1822: Universal Upgradable Proxy Standard (UUPS) /// @dev See https://eips.ethereum.org/EIPS/eip-1822. function proxiableUUID() external pure returns (bytes32); }
19,749
9
// set baseURI
function setURI(string memory baseURI_) public onlyOwner { baseURI = baseURI_; }
function setURI(string memory baseURI_) public onlyOwner { baseURI = baseURI_; }
35,027
22
// 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 { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(from...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(from...
807
95
// set as marketing wallet
devWallet = 0x5C5Be295AaBb6Be6007b05C8FA8E159605e8856D;
devWallet = 0x5C5Be295AaBb6Be6007b05C8FA8E159605e8856D;
50,995
257
// Function setPresaleActive to activate/desactivate the whitelist/raffle presale/
function setPresaleActive( bool _isActive ) external onlyOwner
function setPresaleActive( bool _isActive ) external onlyOwner
16,656
121
// split & transfer fee for developer
uint developerAccountFee = msg.value / 100 * commission.developer; developerAccount.transfer(developerAccountFee);
uint developerAccountFee = msg.value / 100 * commission.developer; developerAccount.transfer(developerAccountFee);
8,716
37
// Call wrapper that performs `ERC20.permit` on `token`./ Lookup `IERC20.permit`. F6: Parameters can be used front-run the permit and the user's permit will fail (due to nonce or other revert) if part of a batch this could be used to grief once as the second call would not need the permit
function permitToken( IERC20 token, address from, address to, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
function permitToken( IERC20 token, address from, address to, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
32,154
35
// Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
38
8
// Update transfer fee flag for a given bAsset, should it change its fee practice _bAssetPersonal Basset data storage array _bAssetIndexesMapping of bAsset address to their index _bAsset bAsset address _flag Charge transfer fee when its set to 'true', otherwise 'false' /
function setTransferFeesFlag( BassetPersonal[] storage _bAssetPersonal, mapping(address => uint8) storage _bAssetIndexes, address _bAsset, bool _flag
function setTransferFeesFlag( BassetPersonal[] storage _bAssetPersonal, mapping(address => uint8) storage _bAssetIndexes, address _bAsset, bool _flag
31,824
20
// Update a colony's orbitdb address. Can only be called by a colony with a registered subdomain/orbitdb The path of the orbitDB database to be associated with the colony
function updateColonyOrbitDB(string memory orbitdb) public;
function updateColonyOrbitDB(string memory orbitdb) public;
3,459
11
// Signature signers for the early access stage./Removing signers invalidates the corresponding signatures.
EnumerableSet.AddressSet private _signersEarlyAccess;
EnumerableSet.AddressSet private _signersEarlyAccess;
20,386
209
// Methods for minting LP tokens // Return the amount of sUSD should be minted after depositing bTokenAmount into the pool bTokenAmountNormalized - normalized amount of token to be deposited oldBalance - normalized amount of all tokens before the deposit oldTokenBlance - normalized amount of the balance of the token to...
function _getMintAmount( uint256 bTokenAmountNormalized, uint256 oldBalance, uint256 oldTokenBalance, uint256 softWeight, uint256 hardWeight ) internal pure returns (uint256 s)
function _getMintAmount( uint256 bTokenAmountNormalized, uint256 oldBalance, uint256 oldTokenBalance, uint256 softWeight, uint256 hardWeight ) internal pure returns (uint256 s)
79,247
8
// Instantly finalizes a single pool that earned rewards in the previous/epoch, crediting it rewards for members and withdrawing operator's/rewards as WETH. This can be called by internal functions that need/to finalize a pool immediately. Does nothing if the pool is already/finalized or did not earn rewards in the pre...
function finalizePool(bytes32 poolId) external override
function finalizePool(bytes32 poolId) external override
13,403
136
// LogEvent("StartRefund", token.balanceOf(contributor));
uint256 weiRefunded = vault.refundWhenNotClosed(contributor); weiRaised = weiRaised.sub(weiRefunded); calculateWeiForStage(int256(weiRefunded) * -1); RefundRequestCompleted(contributor, weiRefunded, tokenValance);
uint256 weiRefunded = vault.refundWhenNotClosed(contributor); weiRaised = weiRaised.sub(weiRefunded); calculateWeiForStage(int256(weiRefunded) * -1); RefundRequestCompleted(contributor, weiRefunded, tokenValance);
53,085
17
// Send eventual earned darwin to user
uint amountDarwin = masterChef.darwin().balanceOf(address(this)); if (amountDarwin > 0) { masterChef.darwin().transfer(msg.sender, amountDarwin); }
uint amountDarwin = masterChef.darwin().balanceOf(address(this)); if (amountDarwin > 0) { masterChef.darwin().transfer(msg.sender, amountDarwin); }
1,838
24
// dev Decrease the amount of tokens that an owner allowed to a spender.approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds...
function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool)
function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool)
8,209
143
// Users Loans by address
mapping(address => PynthLoanStruct[]) public accountsPynthLoans;
mapping(address => PynthLoanStruct[]) public accountsPynthLoans;
50,045
22
// simulate full execution of a UserOperation (including both validation and target execution)this method will always revert with "ExecutionResult".it performs full validation of the UserOperation, but ignores signature error.an optional target address is called after the userop succeeds, and its value is returned(befo...
function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;
function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;
30,743
49
// Use RSR if needed
if (address(trade.sell) == address(0) && address(trade.buy) != address(0)) { IAsset rsrAsset = components.reg.toAsset(components.rsr); uint192 rsrAvailable = rsrAsset.bal(address(components.trader)).plus( rsrAsset.bal(address(components.stRSR)) ); ...
if (address(trade.sell) == address(0) && address(trade.buy) != address(0)) { IAsset rsrAsset = components.reg.toAsset(components.rsr); uint192 rsrAvailable = rsrAsset.bal(address(components.trader)).plus( rsrAsset.bal(address(components.stRSR)) ); ...
27,026
111
// ERC1155 can call this method during a post transfer event
require(msg.sender == redeemer || msg.sender == address(this), "Unauthorized caller"); uint256 blockTime = block.timestamp; int256 tokensToRedeem = int256(tokensToRedeem_); AccountContext memory context = AccountContextHandler.getAccountContext(redeemer); if (context.mustSettle...
require(msg.sender == redeemer || msg.sender == address(this), "Unauthorized caller"); uint256 blockTime = block.timestamp; int256 tokensToRedeem = int256(tokensToRedeem_); AccountContext memory context = AccountContextHandler.getAccountContext(redeemer); if (context.mustSettle...
63,051
241
// Saves the amount to `PendingInterestWithdrawal` storage. /
setStoragePendingInterestWithdrawal( _property, _user, withdrawableAmount
setStoragePendingInterestWithdrawal( _property, _user, withdrawableAmount
10,423
7
// Destructor
function remove() { if (msg.sender == owner){ selfdestruct(owner); } }
function remove() { if (msg.sender == owner){ selfdestruct(owner); } }
40,806
8
// This contract implements a Factory pattern to create player tokens for a specific market / sport/
contract PlayerTokenFactory is Ownable { // numerical id of the market uint32 public market_id; // market name eg football string public market; string public version = "0.1"; // counter used to assign token ids uint32 public lastId = 0; // list of token addresses that have been created address[] pub...
contract PlayerTokenFactory is Ownable { // numerical id of the market uint32 public market_id; // market name eg football string public market; string public version = "0.1"; // counter used to assign token ids uint32 public lastId = 0; // list of token addresses that have been created address[] pub...
20,182
184
// Removes the admin role from an address The sender must have the admin role _address EOA or contract affected /
function removeAdminRole(address _address) external { revokeRole(DEFAULT_ADMIN_ROLE, _address); emit AdminRoleRemoved(_address, _msgSender()); }
function removeAdminRole(address _address) external { revokeRole(DEFAULT_ADMIN_ROLE, _address); emit AdminRoleRemoved(_address, _msgSender()); }
51,318
9
// Deal with relative offsets
if (_relative == true) { newCursor += _buffer.cursor; }
if (_relative == true) { newCursor += _buffer.cursor; }
11,836
3
// Emits when a stream is successfully cancelled and tokens are transferred back on a pro rata basis. /
event CancelStream(
event CancelStream(
23,956
28
// Get the token ID for a given tier name
function tokenIdByTier(string memory tierName) public view returns (uint256) { require(tiers[tierName].maxSupply >= 0, "Invalid tier name 2"); return _tokenIdCounter.current() - tiers[tierName].maxSupply + tiers[tierName].minted; }
function tokenIdByTier(string memory tierName) public view returns (uint256) { require(tiers[tierName].maxSupply >= 0, "Invalid tier name 2"); return _tokenIdCounter.current() - tiers[tierName].maxSupply + tiers[tierName].minted; }
3,316
99
// @note: to prevent tokens from ever getting "stuck", this contract can only send to itself in a very specific manner. for example, the "withdrawNative" function will output native fuel to a destination. If it was sent to this contract, this function will trigger and know that the msg.sender is the originating kycCont...
if (msg.sender != address(this)) {
if (msg.sender != address(this)) {
21,852
97
// ----------ADMINISTRATOR ONLY FUNCTIONS----------/
{ //require(buyActived && block.timestamp > ROUND0_MIN_DURATION.add(deployedTime), "too early to disable autoBuy"); autoBuy = !autoBuy; }
{ //require(buyActived && block.timestamp > ROUND0_MIN_DURATION.add(deployedTime), "too early to disable autoBuy"); autoBuy = !autoBuy; }
11,228
55
// if head is zero, this bucket was empty should fill head with expireId
b.head = expireId;
b.head = expireId;
80,891
22
// evaluate sale state based on the internal state variables and return
return nextId <= finalId;
return nextId <= finalId;
403
195
// oracle used for calculating the avgAPR with gov tokens
address public oracle;
address public oracle;
19,600
84
// @ Hilmar: maybe do the same for withdrawal
function _depositAndSell(address sellToken, address buyToken, uint256 amount ) private returns(bool)
function _depositAndSell(address sellToken, address buyToken, uint256 amount ) private returns(bool)
28,719
94
// Users most often claim rewards within the same index which can last several months.
endIndex = i - 1; break;
endIndex = i - 1; break;
2,383
3
// Contract responsible for creating metadata from seeds. // /
bool public parametersLocked = false;
bool public parametersLocked = false;
49,517
0
// router address
address public router;
address public router;
44,900
335
// Compound's CCompLikeDelegate Contract CTokens which can 'delegate votes' of their underlying ERC-20 Compound /
contract CCompLikeDelegate is CErc20Delegate { /** * @notice Construct an empty delegate */ constructor() public CErc20Delegate() {} /** * @notice Admin call to delegate the votes of the COMP-like underlying * @param compLikeDelegatee The address to delegate votes to */ function _delegateCompLik...
contract CCompLikeDelegate is CErc20Delegate { /** * @notice Construct an empty delegate */ constructor() public CErc20Delegate() {} /** * @notice Admin call to delegate the votes of the COMP-like underlying * @param compLikeDelegatee The address to delegate votes to */ function _delegateCompLik...
16,150
13
// DEX/ pontus-dev.eth/ DEX.sol with the outline of the coming features/ We want to create an automatic market where our contract will hold reserves of both ETH and 🎈 Balloons. These reserves will provide liquidity that allows anyone to swap between the assets.
contract DEX { IERC20 token; uint256 public totalLiquidity; mapping(address => uint256) public liquidity; ///@notice Emitted when ethToToken() swap transacted event EthToTokenSwap(); ///@notice Emitted when tokenToEth() swap transacted event TokenToEthSwap(); ///@notice Emitted when liquidity provide...
contract DEX { IERC20 token; uint256 public totalLiquidity; mapping(address => uint256) public liquidity; ///@notice Emitted when ethToToken() swap transacted event EthToTokenSwap(); ///@notice Emitted when tokenToEth() swap transacted event TokenToEthSwap(); ///@notice Emitted when liquidity provide...
41,429
17
// TODO: check this. I thought this was already implemented by th.
function onERC721Received( address, address, uint256, bytes calldata
function onERC721Received( address, address, uint256, bytes calldata
13,135
73
// Different amounts to charge as a fee for each protocol.
uint256[] public feePerBase;
uint256[] public feePerBase;
27,435
6
// Send _value amount of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
55,337
1
// Reference to the `CoreBorrow` contract managing the FlashLoan module
function core() external view returns (ICoreBorrow);
function core() external view returns (ICoreBorrow);
18,235
235
// Add a PublicLock template to be used for future calls to `createLock`. This is used to upgrade conytract per version number /
function addLockTemplate(address impl, uint16 version) external;
function addLockTemplate(address impl, uint16 version) external;
16,770
10
// check that the signature is from the matching engine
return recoverSigner(tradeHash, signature) == _matchingEngine;
return recoverSigner(tradeHash, signature) == _matchingEngine;
48,945
9
// map every staked snake ID to reward claimed
mapping(uint => uint) stakedSnakeToRewardPaid;
mapping(uint => uint) stakedSnakeToRewardPaid;
76,479
0
// Constructs the TestnetERC20. _name The name which describes the new token. _symbol The ticker abbreviation of the name. Ideally < 5 chars. _decimals The number of decimals to define token precision. /
constructor( string memory _name, string memory _symbol, uint8 _decimals
constructor( string memory _name, string memory _symbol, uint8 _decimals
30,044
3
// Initialize IStakedTokenIncentivesController _provider the address of the corresponding addresses provider /
function initialize(ILendingPoolAddressesProvider _provider) external initializer { _addressProvider = _provider; }
function initialize(ILendingPoolAddressesProvider _provider) external initializer { _addressProvider = _provider; }
31,080
58
// Function to convert Set Tokens held in vault into underlying components_setThe address of the Set token _quantity The number of tokens to redeem. Should be multiple of natural unit. /
function redeemInVault(
function redeemInVault(
6,999
208
// isStableBorrowRateEnabled = true means users can borrow at a stable rate
bool isStableBorrowRateEnabled;
bool isStableBorrowRateEnabled;
6,871