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
658
// returns the address of the new owner candidate /
function newOwner() external view returns (address) { return _newOwner; }
function newOwner() external view returns (address) { return _newOwner; }
3,681
69
// A token holder contract that will allow a beneficiary to extract thetokens after a given release time. Useful for simple vesting schedules like "advisors get all of their tokensafter 1 year". /
contract TokenTimelock { using SafeERC20 for IERC20; // ERC20 basic token contract being held IERC20 private _token; // beneficiary of tokens after they are released address private _beneficiary; // timestamp when token release is enabled uint256 private _releaseTime; constructor (IE...
contract TokenTimelock { using SafeERC20 for IERC20; // ERC20 basic token contract being held IERC20 private _token; // beneficiary of tokens after they are released address private _beneficiary; // timestamp when token release is enabled uint256 private _releaseTime; constructor (IE...
6,931
1
// owner => operator => approved
mapping(address => mapping(address => bool)) internal _operatorApprovals;
mapping(address => mapping(address => bool)) internal _operatorApprovals;
40,321
4
// Get the time at which a given schedule entry will vest./
function getVestingTime(address account, uint index) external view returns (uint);
function getVestingTime(address account, uint index) external view returns (uint);
21,559
159
// TODO: Add execution times param type?
bytes32 constant public EMPTY_PARAM_HASH = keccak256(uint256(0)); address constant ANY_ENTITY = address(-1);
bytes32 constant public EMPTY_PARAM_HASH = keccak256(uint256(0)); address constant ANY_ENTITY = address(-1);
76,619
8
// check user isExist
for(uint _i = 1; _i <= starterCount; _i++){ if(starterUsers[_i].userAddress == msg.sender){ revert("User already registered as Starter"); }
for(uint _i = 1; _i <= starterCount; _i++){ if(starterUsers[_i].userAddress == msg.sender){ revert("User already registered as Starter"); }
20,855
25
// Allows the current owner to transfer control of the contract to a newOwner.newOwner The address to transfer ownership to./
function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); owner = newOwner; }
function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); owner = newOwner; }
50,286
48
// Safety method in case user sends in ETH
function ownerWithdrawAllETH() public onlyOwner
function ownerWithdrawAllETH() public onlyOwner
28,993
21
// Function to queue a proposal to the timelock. /
function queue( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash
function queue( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash
18,610
232
// only owner
function reveal() public onlyOwner { revealed = true; }
function reveal() public onlyOwner { revealed = true; }
335
61
// dictionary which shows if ether account is owner
mapping (address => bool) internal isOwner;
mapping (address => bool) internal isOwner;
34,136
5
// Equivalent to x to the power of y because xy = (eln(x))y = e(ln(x)y)
return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.
return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.
22,105
0
// Derives initial state of the asset terms and stores together withterms, schedule, ownership, engine, admin of the asset in the contract types specific AssetRegistry. terms asset specific terms schedule schedule of the asset ownership ownership of the asset engine address of the ACTUS engine used for the spec. Contra...
function initialize( STKTerms calldata terms, bytes32[] calldata schedule, AssetOwnership calldata ownership, address engine, address admin, address extension ) external {
function initialize( STKTerms calldata terms, bytes32[] calldata schedule, AssetOwnership calldata ownership, address engine, address admin, address extension ) external {
46,814
51
// return the price as number of tokens released for each ether
function price() public view returns(uint);
function price() public view returns(uint);
22,646
60
// Calculate the pending non-cliff installments to pay based on current time
uint256 installments = ((currInterval * tokenGenInterval) - cliff) / vestingPeriod; uint256 installmentsToPay = installments + 1 - paidInstallments;
uint256 installments = ((currInterval * tokenGenInterval) - cliff) / vestingPeriod; uint256 installmentsToPay = installments + 1 - paidInstallments;
11,143
2
// the address oftorn relayer registry contract
address immutable public TORN_RELAYER_REGISTRY;
address immutable public TORN_RELAYER_REGISTRY;
36,144
389
// Call the implementation. out and outsize are 0 because we don't know the size yet.
let result := delegatecall( gas, implementation, 0, calldatasize, 0, 0 )
let result := delegatecall( gas, implementation, 0, calldatasize, 0, 0 )
9,717
37
// Mapping from owner to number of owned token
mapping (address => Counters.Counter) private _ownedTokensCount;
mapping (address => Counters.Counter) private _ownedTokensCount;
45,956
27
// (abondDebt()debtShare) / EXP_SCALE
uint256 forfeits = abondDebt().mul(debtShare).div(EXP_SCALE);
uint256 forfeits = abondDebt().mul(debtShare).div(EXP_SCALE);
63,201
74
// Internal function to delegate votes from `delegator` to `delegatee` delegator The address that delegates its votes delegatee The address to delegate votes to /
function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates[delegator]; delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, balanceOf(delegator)); ...
function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates[delegator]; delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, balanceOf(delegator)); ...
39,609
49
// ChainLink's USD Price oracles return results in 8 decimal places
uint256 private constant ORACLE_PRICE_MULTIPLIER = 10**8; event DeltaSet(uint256 oldDelta, uint256 newDelta, address indexed owner); event StepSet(uint256 oldStep, uint256 newStep, address indexed owner); constructor( address _optionsPremiumPricer, uint256 _delta, uint256 _step...
uint256 private constant ORACLE_PRICE_MULTIPLIER = 10**8; event DeltaSet(uint256 oldDelta, uint256 newDelta, address indexed owner); event StepSet(uint256 oldStep, uint256 newStep, address indexed owner); constructor( address _optionsPremiumPricer, uint256 _delta, uint256 _step...
49,909
13
// Presale toggle
bool public isPresaleActive = false;
bool public isPresaleActive = false;
6,836
218
// Transfers the funds out of the contract to the owners wallet.
function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); emit WithdrawBalance(msg.sender, balance); }
function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); emit WithdrawBalance(msg.sender, balance); }
70,155
22
// used by a new owner to accept an ownership transfer /
function acceptOwnership() public override { require(msg.sender == newOwner, "ERR_ACCESS_DENIED"); emit OwnerUpdate(owner, newOwner); owner = newOwner; newOwner = address(0); }
function acceptOwnership() public override { require(msg.sender == newOwner, "ERR_ACCESS_DENIED"); emit OwnerUpdate(owner, newOwner); owner = newOwner; newOwner = address(0); }
23,048
119
// differentiate between buy/sell/transfer to apply different taxes/restrictions
bool isBuy=sender==_uniswapV2PairAddress|| sender == uniswapV2Router; bool isSell=recipient==_uniswapV2PairAddress|| recipient == uniswapV2Router;
bool isBuy=sender==_uniswapV2PairAddress|| sender == uniswapV2Router; bool isSell=recipient==_uniswapV2PairAddress|| recipient == uniswapV2Router;
16,505
2
// Investors&39; dividents increase goals due to a bank growth
uint bank1 = 5e20; // 500 eth uint bank2 = 15e20; // 1500 eth uint bank3 = 25e20; // 2500 eth uint bank4 = 7e21; // 7000 eth uint bank5 = 15e20; // 15000 eth
uint bank1 = 5e20; // 500 eth uint bank2 = 15e20; // 1500 eth uint bank3 = 25e20; // 2500 eth uint bank4 = 7e21; // 7000 eth uint bank5 = 15e20; // 15000 eth
43,404
12
// FEES
function updateMiningFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); miningFeeNumerator = numerator; miningFeeDenominator = denominator; }
function updateMiningFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); miningFeeNumerator = numerator; miningFeeDenominator = denominator; }
65,472
207
// Appends a bytes20 to the buffer. Resizes if doing so would exceedthe capacity of the buffer.buf The buffer to append to.data The data to append. return The original buffer, for chhaining./
function appendBytes20( buffer memory buf, bytes20 data ) internal pure returns ( buffer memory )
function appendBytes20( buffer memory buf, bytes20 data ) internal pure returns ( buffer memory )
14,594
7
// Unpauses contract.Requirements: - the caller must be the owner. /
function unpause() external virtual onlyOwner whenPaused { _unpause(); }
function unpause() external virtual onlyOwner whenPaused { _unpause(); }
37,604
16
// SMART CONTRACT FUNCTIONS / /Add an airline to the registration queueCan only be called from FlightSuretyApp contract/
function registerAirline(address airline) external requireIsOperational returns (bool)
function registerAirline(address airline) external requireIsOperational returns (bool)
39,719
12
// Math Assorted math operations /
library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uin...
library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uin...
6,416
8
// Checking the size of `offer_gasbase` is necessary to prevent a) data loss when copied to an `OfferDetail` struct, and b) overflow when used in calculations. /+clear+
locals[outbound_tkn][inbound_tkn] = locals[outbound_tkn][inbound_tkn].offer_gasbase(offer_gasbase); emit SetGasbase(outbound_tkn, inbound_tkn, offer_gasbase);
locals[outbound_tkn][inbound_tkn] = locals[outbound_tkn][inbound_tkn].offer_gasbase(offer_gasbase); emit SetGasbase(outbound_tkn, inbound_tkn, offer_gasbase);
32,050
442
// Emit event with asset, old collateral factor, and new collateral factor
emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa); return uint(Error.NO_ERROR);
emit NewCollateralFactor(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa); return uint(Error.NO_ERROR);
21,150
0
// data structure of a single tweet
struct Tweet { uint timestamp; string tweetString; }
struct Tweet { uint timestamp; string tweetString; }
51,982
5
// Keeps track of how much an address allows any other address to spend on its behalf
mapping (address => mapping (address => uint256)) private allowances;
mapping (address => mapping (address => uint256)) private allowances;
12,672
102
// ETH case
if ( token == address(0) || token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) ) { return address(this).balance; }
if ( token == address(0) || token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) ) { return address(this).balance; }
27,482
38
// Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], butwith `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ /
function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address...
function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address...
144
315
// Add reward to existing epoch or crete a new one protocol Protocol for reward token Reward token epoch Epoch number - can be 0 to create new Epoch amount Amount of Reward token to deposit /
function _addReward(address protocol, address token, uint256 epoch, uint256 amount) internal { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; uint256 epochsLength = ri.epochs.length; require(epochsLength > 0, "RewardVesting: protocol or to...
function _addReward(address protocol, address token, uint256 epoch, uint256 amount) internal { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; uint256 epochsLength = ri.epochs.length; require(epochsLength > 0, "RewardVesting: protocol or to...
8,573
41
// Returns the state and configuration of the reserve asset The address of the underlying asset of the reservereturn The state and configuration data of the reserve /
function getReserveData(address asset) external view returns (DataTypes.ReserveData memory);
function getReserveData(address asset) external view returns (DataTypes.ReserveData memory);
25,484
6
// Sample buy quotes from Bancor. Unimplemented/paths The paths to check for Bancor. Only the best is used/takerToken Address of the taker token (what to sell)./makerToken Address of the maker token (what to buy)./makerTokenAmounts Maker token buy amount for each sample./ return bancorNetwork the Bancor Network address...
function sampleBuysFromBancor( address[][] memory paths, address takerToken, address makerToken, uint256[] memory makerTokenAmounts ) public view returns (address bancorNetwork, address[] memory path, uint256[] memory takerTokenAmounts)
function sampleBuysFromBancor( address[][] memory paths, address takerToken, address makerToken, uint256[] memory makerTokenAmounts ) public view returns (address bancorNetwork, address[] memory path, uint256[] memory takerTokenAmounts)
30,189
57
// Perform the payments to the given addresses and amounts, public method. _payments The array of the Payment data. Available to send ETH or ERC20. /
function performMultiPayment(Payment[] calldata _payments) external payable nonReentrant { _performMultiPayment(_payments); refundETH(); }
function performMultiPayment(Payment[] calldata _payments) external payable nonReentrant { _performMultiPayment(_payments); refundETH(); }
28,032
74
// Token to be locked (ERC-20)
IERC20 public immutable token;
IERC20 public immutable token;
67,557
26
// When migration process is finished (1 year from Goldmint blockchain launch), then transaction fee is 1% GOLD.
if (_isMigrationFinished) { return (_value / 100); }
if (_isMigrationFinished) { return (_value / 100); }
11,540
18
// reference to refined EON for if EonOnlyMints are enabled (all raw eon mined)
IEON public eon;
IEON public eon;
54,480
20
// WithdrawValidatorCommission defines an Event emitted when validator commissions are being withdrawn/validatorAddress is the address of the validator/commission is the total commission earned by the validator
event WithdrawValidatorCommission( string indexed validatorAddress, uint256 commission );
event WithdrawValidatorCommission( string indexed validatorAddress, uint256 commission );
32,020
11
// This function checks all requirements for claiming, updates batches and balances and transfers tokens /
function claim( bytes32 batchId, address owner, uint256 shares, address recipient
function claim( bytes32 batchId, address owner, uint256 shares, address recipient
18,029
49
// king should on original pos
if (move.sourceSq != 4){ return false; }
if (move.sourceSq != 4){ return false; }
97
4
// Issuers
mapping(address => address) internal _issuerTreasury; mapping(address => bool) internal _issuerStatus; mapping(bytes32 => bool) internal _issuerAttributePermission; address[] internal _issuers;
mapping(address => address) internal _issuerTreasury; mapping(address => bool) internal _issuerStatus; mapping(bytes32 => bool) internal _issuerAttributePermission; address[] internal _issuers;
40,157
210
// IMarketControllerManages configuration and consignments used by the Seen.Haus contract suite. Contributes its events and functions to the IMarketController interface The ERC-165 identifier for this interface is: 0x57f9f26d/
interface IMarketConfig { /// Events event NFTAddressChanged(address indexed nft); event EscrowTicketerAddressChanged(address indexed escrowTicketer, SeenTypes.Ticketer indexed ticketerType); event StakingAddressChanged(address indexed staking); event MultisigAddressChanged(address indexed multisig...
interface IMarketConfig { /// Events event NFTAddressChanged(address indexed nft); event EscrowTicketerAddressChanged(address indexed escrowTicketer, SeenTypes.Ticketer indexed ticketerType); event StakingAddressChanged(address indexed staking); event MultisigAddressChanged(address indexed multisig...
18,246
32
// Calculates the chunk rebalance size. This can be used by external contracts and keeper bots to calculate the optimal exchange to rebalance with.Note: this function does not take into account timestamps, so it may return a nonzero value even when shouldRebalance would return ShouldRebalance.NONE forall exchanges (sin...
function getChunkRebalanceNotional( string[] calldata _exchangeNames ) external view returns(uint256[] memory sizes, address sellAsset, address buyAsset)
function getChunkRebalanceNotional( string[] calldata _exchangeNames ) external view returns(uint256[] memory sizes, address sellAsset, address buyAsset)
29,164
35
// Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change On more values are added or removed. Requirements:
* - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; }
* - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; }
290
5
// Get all redeemed ticket addresses. Useful for ethers client to get the entire array at once. /
function getAllRedeemedTickets() external view returns (address[MAX_SUPPLY] memory)
function getAllRedeemedTickets() external view returns (address[MAX_SUPPLY] memory)
3,848
96
// When token is released to be transferable, prohibit new token creation. /
function releaseTokenTransfer() public onlyReleaseAgent { mintingFinished = true; super.releaseTokenTransfer(); }
function releaseTokenTransfer() public onlyReleaseAgent { mintingFinished = true; super.releaseTokenTransfer(); }
28,327
15
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
uint64 startTimestamp;
18,385
234
// Save Original minters
minters[_realIndex] = msg.sender;
minters[_realIndex] = msg.sender;
17,969
104
// it is a new sanity rate contract
if (sanityRateContract.length == 0) { sanityRateContract.push(_sanityRate); } else {
if (sanityRateContract.length == 0) { sanityRateContract.push(_sanityRate); } else {
641
44
// Withdraw all LP tokens from the farm and claim available UBE rewardsNeed to restake remaining LP tokens later
IStakingRewards(farmAddress).exit();
IStakingRewards(farmAddress).exit();
14,408
1
// do this shit with safe math or whateverif this is the officially best way to write this then i am disappointed
owner = msg.sender; AURGov = IAURGov(govaddy); govContract = govaddy;
owner = msg.sender; AURGov = IAURGov(govaddy); govContract = govaddy;
27,486
12
// -----
uint256 public totalSupply; uint256 public icoSalesSupply = 0; // Needed when burning tokens uint256 public icoReserveSupply = 0; uint256 public softCap = 5000000 * 10**decimals; uint256 public hardCap = 2150000...
uint256 public totalSupply; uint256 public icoSalesSupply = 0; // Needed when burning tokens uint256 public icoReserveSupply = 0; uint256 public softCap = 5000000 * 10**decimals; uint256 public hardCap = 2150000...
42,960
70
// get voting mechanism
function getVotingMechanism() constant returns (IVotingMechanism addy); event DeployedToken(address _payoutToken, address _backerToken, address _rewardToken);
function getVotingMechanism() constant returns (IVotingMechanism addy); event DeployedToken(address _payoutToken, address _backerToken, address _rewardToken);
21,503
137
// Mapping from partition to controllers for the partition. [NOT TOKEN-HOLDER-SPECIFIC]
mapping (bytes32 => address[]) internal _controllersByPartition;
mapping (bytes32 => address[]) internal _controllersByPartition;
23,812
8
// 配列の長さを短縮
StakingUser[] memory trimmedUsers = new StakingUser[](userCount); for (uint256 i = 0; i < userCount; i++) { trimmedUsers[i] = stakingUsers[i]; }
StakingUser[] memory trimmedUsers = new StakingUser[](userCount); for (uint256 i = 0; i < userCount; i++) { trimmedUsers[i] = stakingUsers[i]; }
8,535
119
// Sets the paused failsafe. Can only be called by owner _setPaused - paused state /
function setPaused(bool _setPaused) public onlyOwner { return (_setPaused) ? _pause() : _unpause(); }
function setPaused(bool _setPaused) public onlyOwner { return (_setPaused) ? _pause() : _unpause(); }
22,263
114
// delete the last selector
ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop(); delete ds.selectorToFacetAndPosition[_selector];
ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop(); delete ds.selectorToFacetAndPosition[_selector];
16,849
2
// return The Address of the implementation. /
function _implementation() virtual internal view returns (address);
function _implementation() virtual internal view returns (address);
4,950
21
// Get the current weights of the LBP/ return tokenWeight/ return collateralWeight
function getWeights() external view returns (uint tokenWeight, uint collateralWeight) { tokenWeight = pool.getNormalizedWeight(tokenAddress); collateralWeight = pool.getNormalizedWeight(collateralAddress); }
function getWeights() external view returns (uint tokenWeight, uint collateralWeight) { tokenWeight = pool.getNormalizedWeight(tokenAddress); collateralWeight = pool.getNormalizedWeight(collateralAddress); }
18,199
130
// Updates address where strategist fee earnings will go. _strategist new strategist address. /
function setStrategist(address _strategist) external { require(msg.sender == strategist, "!strategist"); strategist = _strategist; }
function setStrategist(address _strategist) external { require(msg.sender == strategist, "!strategist"); strategist = _strategist; }
37,217
0
// Pool Id
uint256 public pid;
uint256 public pid;
1,840
36
// The total amount of tokens which are in the auxiliary buffer.
uint256 public totalBuffered;
uint256 public totalBuffered;
40,995
142
// etherATM-DeFi /
contract etherATM_DeFi_v1 is ERC20, Ownable { using SafeMath for uint256; using Address for address; event Reserved(address indexed from, uint256 value); uint256 private _currentSupply = 0; uint256 private _softLimit = 99999000000000000000000; uint256 private _hardLimit = 999990000000000000...
contract etherATM_DeFi_v1 is ERC20, Ownable { using SafeMath for uint256; using Address for address; event Reserved(address indexed from, uint256 value); uint256 private _currentSupply = 0; uint256 private _softLimit = 99999000000000000000000; uint256 private _hardLimit = 999990000000000000...
59,874
7
// make execute() calls to the proxy voter
function _proxyCall(address _to, bytes memory _data) internal{ (bool success,) = IStaker(proxy).execute(_to,uint256(0),_data); require(success, "Proxy Call Fail"); }
function _proxyCall(address _to, bytes memory _data) internal{ (bool success,) = IStaker(proxy).execute(_to,uint256(0),_data); require(success, "Proxy Call Fail"); }
7,670
37
// reject the buyer from contract
require(!isContract(msg.sender)); require(Remain>0);
require(!isContract(msg.sender)); require(Remain>0);
1,605
265
// Changes the creator for the current sender, in the event weneed to be able to mint new tokens from an existing digital mediaprint production. When changing creator, the old creator willno longer be able to mint tokens. A creator may need to be changed:1. If we want to allow a creator to take control over their token...
function changeCreator(address _creator, address _newCreator) external { address approvedCreator = changedCreators[_creator]; require(msg.sender != address(0) && _creator != address(0), "Creator must be valid non 0x0 address."); require(msg.sender == _creator || msg.sender == approvedCreator...
function changeCreator(address _creator, address _newCreator) external { address approvedCreator = changedCreators[_creator]; require(msg.sender != address(0) && _creator != address(0), "Creator must be valid non 0x0 address."); require(msg.sender == _creator || msg.sender == approvedCreator...
2,149
50
// Update boost contract address and max boost factor./_newBoostContract The new address for handling all the share boosts.
function updateBoostContract(address _newBoostContract) external onlyOwner { require( _newBoostContract != address(0) && _newBoostContract != boostContract, "MasterChefV2: New boost contract address must be valid" ); boostContract = _newBoostContract; emit Up...
function updateBoostContract(address _newBoostContract) external onlyOwner { require( _newBoostContract != address(0) && _newBoostContract != boostContract, "MasterChefV2: New boost contract address must be valid" ); boostContract = _newBoostContract; emit Up...
10,815
394
// if amount is equal to uint(-1), the user wants to redeem everything
if (amount == type(uint256).max) { amountToWithdraw = userBalance; }
if (amount == type(uint256).max) { amountToWithdraw = userBalance; }
15,361
31
// jhhong/node가 체인에 연결된 상태인지를 확인한다./node 체인 연결 여부를 확인할 노드 주소/ return 연결 여부 (boolean), true: 연결됨(linked), false: 연결되지 않음(unlinked)
function isLinked(address node) public view returns (bool) { if(_slist.count == 1 && _slist.head == node && _slist.tail == node) { return true; } else { return (_slist.map[node].prev == address(0) && _slist.map[node].next == address(0))? (false) :(true); } }
function isLinked(address node) public view returns (bool) { if(_slist.count == 1 && _slist.head == node && _slist.tail == node) { return true; } else { return (_slist.map[node].prev == address(0) && _slist.map[node].next == address(0))? (false) :(true); } }
46,235
52
// Deposit an amount of `token` represented in either `amount` or `share`./token_ The ERC-20 token to deposit./from which account to pull the tokens./to which account to push the tokens./amount Token amount in native representation to deposit./share Token amount represented in shares to deposit. Takes precedence over `...
function deposit( address token_, address from, address to, uint256 amount, uint256 share ) external payable returns (uint256 amountOut, uint256 shareOut);
function deposit( address token_, address from, address to, uint256 amount, uint256 share ) external payable returns (uint256 amountOut, uint256 shareOut);
1,490
335
// Synthetic token created by this contract.
ExpandedIERC20 public tokenCurrency;
ExpandedIERC20 public tokenCurrency;
17,239
135
// Adds two `Signed`s, reverting on overflow. a a FixedPoint.Signed. b a FixedPoint.Signed.return the sum of `a` and `b`. /
function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return Signed(a.rawValue.add(b.rawValue)); }
function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return Signed(a.rawValue.add(b.rawValue)); }
45,857
565
// to change max number of AB members allowed _val is the new value to be set /
function changeMaxABCount(uint _val) external onlyInternal { maxABCount = _val; }
function changeMaxABCount(uint _val) external onlyInternal { maxABCount = _val; }
28,741
288
// Batch mint._accounts Array of all addresses to mint to._amounts Array of all values to mint./
function batchMint(address[] memory _accounts, uint256[] memory _amounts) public{ require(_accounts.length == _amounts.length, "SygnumToken: values and recipients are not equal."); require(_accounts.length < BATCH_LIMIT, "SygnumToken: batch count is greater than BATCH_LIMIT."); for(uint256 i...
function batchMint(address[] memory _accounts, uint256[] memory _amounts) public{ require(_accounts.length == _amounts.length, "SygnumToken: values and recipients are not equal."); require(_accounts.length < BATCH_LIMIT, "SygnumToken: batch count is greater than BATCH_LIMIT."); for(uint256 i...
8,210
137
// Withdraws the ether distributed to the sender./It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function withdrawDividend() public virtual override { _withdrawDividendOfUser(payable(msg.sender)); }
function withdrawDividend() public virtual override { _withdrawDividendOfUser(payable(msg.sender)); }
16,274
6
// Withdraw asset from AlphaHomora _recipient Address to receive withdrawn asset _asset Address of asset to withdraw _amount Amount of asset to withdraw /
function withdraw( address _recipient, address _asset, uint256 _amount
function withdraw( address _recipient, address _asset, uint256 _amount
44,393
28
// Admin withdraw event
event AdminEarnings(address indexed user, uint value, uint time);
event AdminEarnings(address indexed user, uint value, uint time);
4,934
11
// Represents a constituent call of a batch sell.
struct BatchSellSubcall { // The function to call. MultiplexSubcall id; // Amount of input token to sell. If the highest bit is 1, // this value represents a proportion of the total // `sellAmount` of the batch sell. See `_normalizeSellAmount` // for details. ...
struct BatchSellSubcall { // The function to call. MultiplexSubcall id; // Amount of input token to sell. If the highest bit is 1, // this value represents a proportion of the total // `sellAmount` of the batch sell. See `_normalizeSellAmount` // for details. ...
49,200
31
// Verifies if claim signature is valid. _signer address of signer. _claim Signed Keccak-256 hash. _signature Signature data. /
function isValidSignature( address _signer, bytes32 _claim, SignatureData memory _signature ) public pure returns (bool)
function isValidSignature( address _signer, bytes32 _claim, SignatureData memory _signature ) public pure returns (bool)
45,898
15
// Allows RigoBlock Dao to set the parameters for a group./groupAddress Address of the pool's group./ratio Value of the ratio between assets and performance reward for a group./inflationFactor Value of the reward factor for a group./onlyRigoblockDao can set ratio.
function setGroupParams( address groupAddress, uint256 ratio, uint256 inflationFactor ) external override onlyRigoblockDao isApprovedFactory(groupAddress)
function setGroupParams( address groupAddress, uint256 ratio, uint256 inflationFactor ) external override onlyRigoblockDao isApprovedFactory(groupAddress)
35,902
36
// totalSupply New total token supply /
function rebase(uint256 totalSupply) public onlyValueHolder { _totalSupply = totalSupply; _gonsPerFragment = _totalGons.div(_totalSupply); emit LogRebase(_totalSupply); }
function rebase(uint256 totalSupply) public onlyValueHolder { _totalSupply = totalSupply; _gonsPerFragment = _totalGons.div(_totalSupply); emit LogRebase(_totalSupply); }
43,655
41
// Can be overridden to add finalization logic. The overriding function should call super.finalization() to ensure the chain of finalization is executed entirely./
function finalization() internal {} }
function finalization() internal {} }
5,597
17
// IERC20Standard.decimals() will revert if the collateral contract has not implemented the decimals() method, which is possible since the method is only an OPTIONAL method in the ERC20 standard: https:eips.ethereum.org/EIPS/eip-20methods.
function _getSyntheticDecimals(address _collateralAddress) public view returns (uint8 decimals) { try IERC20Standard(_collateralAddress).decimals() returns (uint8 _decimals) { return _decimals; } catch { return 18; } }
function _getSyntheticDecimals(address _collateralAddress) public view returns (uint8 decimals) { try IERC20Standard(_collateralAddress).decimals() returns (uint8 _decimals) { return _decimals; } catch { return 18; } }
16,154
172
// Determine the higher generation number of the two parents
uint16 parentGen = matron.generation; if (sire.generation > matron.generation) { parentGen = sire.generation; }
uint16 parentGen = matron.generation; if (sire.generation > matron.generation) { parentGen = sire.generation; }
14,635
726
// IBlockReceiver/Brecht Devos - <brecht@loopring.org>
abstract contract IBlockReceiver
abstract contract IBlockReceiver
24,664
31
// An event to make the transfer easy to find on the blockchain
emit Transfer(_from, _to, _amount); return true;
emit Transfer(_from, _to, _amount); return true;
1,155
243
// Get the earned rewards and withdraw staked tokens
function exit() external { getReward(); withdraw(balanceOf(msg.sender)); }
function exit() external { getReward(); withdraw(balanceOf(msg.sender)); }
56,953
8
// The length for testing
uint expectedLength_empty = 0; uint expectedLength_array = 4; string expected_t3 = "t3"; string expected_t1 = "t1";
uint expectedLength_empty = 0; uint expectedLength_array = 4; string expected_t3 = "t3"; string expected_t1 = "t1";
21,193
14
// pool index => swapped amount of token0
mapping(uint256 => uint256) public swappedAmount0P;
mapping(uint256 => uint256) public swappedAmount0P;
15,937
54
// Redeem PIPT
_redeem_pipt(); _refundLeftoverEth();
_redeem_pipt(); _refundLeftoverEth();
29,022
12
// Locked Staking Factory/Creates new LockedStaking Contracts
contract LockedStakingFactory is EIP712, IMYCStakingFactory { /** * @dev Emitted when withdawing MYC `reward` fees for `poolAddress` */ event WithdrawnMYCFees(address indexed poolAddress, uint256 reward); error SignatureMismatch(); error TransactionOverdue(); error DatesSort(); error ...
contract LockedStakingFactory is EIP712, IMYCStakingFactory { /** * @dev Emitted when withdawing MYC `reward` fees for `poolAddress` */ event WithdrawnMYCFees(address indexed poolAddress, uint256 reward); error SignatureMismatch(); error TransactionOverdue(); error DatesSort(); error ...
34,828
314
// Get the old combined weight
old_combined_weight = _combined_weights[account];
old_combined_weight = _combined_weights[account];
11,715
296
// our supply rate is:comp + lend - borrow
supplyRate = compRate.add(supplyRate); if(supplyRate > borrowRate){ supply = supplyRate.sub(borrowRate); }else{
supplyRate = compRate.add(supplyRate); if(supplyRate > borrowRate){ supply = supplyRate.sub(borrowRate); }else{
11,427