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
1
// TimeLockMock Generic TimeLock Cyril Lapinte - <cyril@openfiz.com> Guillaume Goutaudier - <ggoutaudier@swissledger.io>SPDX-License-Identifier: MIT Error messages /
contract TimeLockMock is TimeLock { constructor(address payable _target, uint64 _lockedUntil) TimeLock(_target, _lockedUntil) {} function setLockedUntilTest(uint64 _lockedUntil) public returns (bool) { lockedUntil_ = _lockedUntil; return true; } }
contract TimeLockMock is TimeLock { constructor(address payable _target, uint64 _lockedUntil) TimeLock(_target, _lockedUntil) {} function setLockedUntilTest(uint64 _lockedUntil) public returns (bool) { lockedUntil_ = _lockedUntil; return true; } }
4,478
22
// Increase the amount of ETH that an owner allowed to a spender. approve should be called when allowed[msg.sender][spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.solEmits an Approval event. _spender The addre...
function increaseAllowance(address _spender, uint _addedValue) public returns (bool) { require(_spender != address(0), "Spender address is 0"); allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);...
function increaseAllowance(address _spender, uint _addedValue) public returns (bool) { require(_spender != address(0), "Spender address is 0"); allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);...
38,123
4
// total amount of SPOOL token vested
uint256 public override total;
uint256 public override total;
34,593
57
// This will remove the liquidity tokens
assets[0] = Common.Asset( CASH_GROUP, 0, maturity,
assets[0] = Common.Asset( CASH_GROUP, 0, maturity,
32,538
3
// Allows the admin to withdraw the performance fee, if applicable. This function can be called only by the contract's admin./Cannot be called before the game ends.
function adminFeeWithdraw() external override onlyOwner whenGameIsCompleted
function adminFeeWithdraw() external override onlyOwner whenGameIsCompleted
26,205
4
// undate fee percentage for claim ape for compound fee new fee percentage /
function setClaimApeForCompoundFee(uint256 fee) external;
function setClaimApeForCompoundFee(uint256 fee) external;
22,556
3
// A record of the highest bid
mapping (uint => Bid) public phaycBids;
mapping (uint => Bid) public phaycBids;
10,203
53
// calculate new accumulated reward per share new acc. reward per share = current acc. reward per share + (newly accumulated rewards / totalStakedAmount)
liquidityMiningPools[tokenAddress].accRewardPerShare = liquidityMiningPools[tokenAddress].accRewardPerShare + ((liquidityMiningPools[tokenAddress].totalRewardAmount - liquidityMiningPools[tokenAddress].lastRewardAmount) * _DIV_PRECISION) / liquidityMiningPools[tokenAddr...
liquidityMiningPools[tokenAddress].accRewardPerShare = liquidityMiningPools[tokenAddress].accRewardPerShare + ((liquidityMiningPools[tokenAddress].totalRewardAmount - liquidityMiningPools[tokenAddress].lastRewardAmount) * _DIV_PRECISION) / liquidityMiningPools[tokenAddr...
33,238
20
// If the user sent a 0 ETH transaction, withdraw their SNT.
if(msg.value == 0) { withdraw(); }
if(msg.value == 0) { withdraw(); }
25,262
10
// update holding info for `from`
staker.setHoldingInfoData(from, uint32(id), holding);
staker.setHoldingInfoData(from, uint32(id), holding);
26,697
115
// can be called only once
require(!isPreallocated);
require(!isPreallocated);
50,438
45
// Deduct fee (currenly 3%)
uint _trueInchToSell = _inchToSell.mul(conserveRate).div(conserveRateDigits);
uint _trueInchToSell = _inchToSell.mul(conserveRate).div(conserveRateDigits);
78,275
520
// PerpetualLiquidatable Adds logic to a position-managing contract that enables callers to liquidate an undercollateralized position. The liquidation has a liveness period before expiring successfully, during which someone can "dispute" theliquidation, which sends a price request to the relevant Oracle to settle the f...
contract PerpetualLiquidatable is PerpetualPositionManager { using FixedPoint for FixedPoint.Unsigned; using SafeMath for uint256; using SafeERC20 for IERC20; /**************************************** * LIQUIDATION DATA STRUCTURES * ****************************************/ // B...
contract PerpetualLiquidatable is PerpetualPositionManager { using FixedPoint for FixedPoint.Unsigned; using SafeMath for uint256; using SafeERC20 for IERC20; /**************************************** * LIQUIDATION DATA STRUCTURES * ****************************************/ // B...
5,853
8
// Sell OUSD for USDC/amount Amount of OUSD to sell, in 18 fixed decimals.
function sellOusdForUsdc(uint256 amount) external { require(amount <= MAXIMUM_PER_TRADE, "Amount too large"); require(usdc.transfer(msg.sender, amount / 1e12)); require(ousd.transferFrom(msg.sender, address(this), amount)); }
function sellOusdForUsdc(uint256 amount) external { require(amount <= MAXIMUM_PER_TRADE, "Amount too large"); require(usdc.transfer(msg.sender, amount / 1e12)); require(ousd.transferFrom(msg.sender, address(this), amount)); }
21,620
70
// encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath and slicedPath have elements that are each one hex character (1 nibble)
bytes memory partialPath = _getNibbleArray(encodedPartialPath); bytes memory slicedPath = new bytes(partialPath.length);
bytes memory partialPath = _getNibbleArray(encodedPartialPath); bytes memory slicedPath = new bytes(partialPath.length);
40,392
77
// How much system liquidity is provided by this asset
function _utilization(address token, uint amount) internal view returns (uint) { address _pair = UniswapFactory(UNI.factory()).getPair(token, address(this)); uint _ratio = BASE.sub(BASE.mul(balanceOf(_pair).add(amount)).div(totalSupply())); if (_ratio == 0) { return MAX; ...
function _utilization(address token, uint amount) internal view returns (uint) { address _pair = UniswapFactory(UNI.factory()).getPair(token, address(this)); uint _ratio = BASE.sub(BASE.mul(balanceOf(_pair).add(amount)).div(totalSupply())); if (_ratio == 0) { return MAX; ...
56,960
103
// withdraw non-invoice tokens
function withdrawTokens(address _token) external nonReentrant { if (_token == token) { withdraw(); } else { require(block.timestamp > terminationTime, "!terminated"); uint256 balance = IERC20(_token).balanceOf(address(this)); require(balance > 0, "balance is 0"); IERC20(token).s...
function withdrawTokens(address _token) external nonReentrant { if (_token == token) { withdraw(); } else { require(block.timestamp > terminationTime, "!terminated"); uint256 balance = IERC20(_token).balanceOf(address(this)); require(balance > 0, "balance is 0"); IERC20(token).s...
9,302
5
// returns roundId, answer, startedAt, updatedAt, answeredInRound
function getRoundData(uint80 _roundId) public override view returns (uint80, int256, uint256, uint256, uint80)
function getRoundData(uint80 _roundId) public override view returns (uint80, int256, uint256, uint256, uint80)
49,053
6
// Gets the Merkle root associated with the current sale/ return The Merkle root, as a bytes32 hash
function getMerkleRoot() external view returns (bytes32) { return _merkleRoot; }
function getMerkleRoot() external view returns (bytes32) { return _merkleRoot; }
55,029
29
// Before mutate strategyTokens, convert current strategy tokens to ETH
uint256 ethConverted = _convertStrategyTokensToEth(totalTokenStored(), deadline); delete _strategyTokens; for (uint8 i = 0; i < strategyTokens_.length; i++) { _strategyTokens.push(StategyToken(strategyTokens_[i], tokenPercentage_[i])); }
uint256 ethConverted = _convertStrategyTokensToEth(totalTokenStored(), deadline); delete _strategyTokens; for (uint8 i = 0; i < strategyTokens_.length; i++) { _strategyTokens.push(StategyToken(strategyTokens_[i], tokenPercentage_[i])); }
71,887
28
// Return ERC20 balance
uint256 balance = REWARD_TOKEN.balanceOf(address(this)); if (STAKE_TOKEN == REWARD_TOKEN) { return balance - totalStaked; }
uint256 balance = REWARD_TOKEN.balanceOf(address(this)); if (STAKE_TOKEN == REWARD_TOKEN) { return balance - totalStaked; }
24,989
19
// Execute a successful proposal. This requires the quorum to be reached, the vote to be successful, and thedeadline to be reached. Emits a {ProposalExecuted} event. Note: some module can modify the requirements for execution, for example by adding an additional timelock. /
function execute(
function execute(
20,517
231
// ========== MUTATIVE FUNCTIONS ========== // Process the latest pending action of the strategy it yields amount of funds processed as well as the reward buffer of the strategy.The function will auto-compound rewards if requested and supported. Requirements: - the slippages provided must be valid in length- if the red...
function process(uint256[] calldata slippages, bool redeposit, SwapData[] calldata swapData) external override
function process(uint256[] calldata slippages, bool redeposit, SwapData[] calldata swapData) external override
65,171
26
// Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol_spender The address which will spend the funds....
function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool)
function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool)
6,450
71
// _relayer New relayer addressOnly the owner can install a new relayer
function installRelayer(address _relayer) onlyOwner public { require(!relayers[_relayer], "Relayer is already installed."); require(_relayer != address(this), "The relay contract cannot be installed as a relayer."); relayers[_relayer] = true; emit RelayerInstalled(_relayer); }
function installRelayer(address _relayer) onlyOwner public { require(!relayers[_relayer], "Relayer is already installed."); require(_relayer != address(this), "The relay contract cannot be installed as a relayer."); relayers[_relayer] = true; emit RelayerInstalled(_relayer); }
10,005
6
// : Owner can add, delete or update Receiver requirements /
function updateReceiverRequirements(bytes32[] _attributes, bytes32[] _values) public onlyOwner { uint256 pairsNumber = _attributes.length; require( pairsNumber == _values.length); pairs memory newPair; receiverRequirements.length = 0; if (pairsNumber == 0) emit ReceiverRequirementsUpdated("...
function updateReceiverRequirements(bytes32[] _attributes, bytes32[] _values) public onlyOwner { uint256 pairsNumber = _attributes.length; require( pairsNumber == _values.length); pairs memory newPair; receiverRequirements.length = 0; if (pairsNumber == 0) emit ReceiverRequirementsUpdated("...
14,189
111
// Request VIT token contract to mint the requested tokens for the buyer.
assert(vitToken.mint(_recipient, _tokens)); TokensIssued(_recipient, _tokens);
assert(vitToken.mint(_recipient, _tokens)); TokensIssued(_recipient, _tokens);
14,419
120
// the maximum percentage of a Seen.Haus sale or auction that will be paid as a royalty
uint16 maxRoyaltyPercentage; // 1.75% = 175, 100% = 10000
uint16 maxRoyaltyPercentage; // 1.75% = 175, 100% = 10000
34,668
12
// add a chapter TODO: deposit TODO: PRECONDICION comprobar el numero de capitulos; TODO: EVENTO
function addChapter(string _alias, string _chaptertext, string _chaptertitle) external { //comprobacion ojocuidao concurrencia (modificador) //Bucar el primer capitulo nulo //Si no hay se cancela () //Lanzaria evento capitulo añadido uint index = checkIfAddChapter(); require(index<...
function addChapter(string _alias, string _chaptertext, string _chaptertitle) external { //comprobacion ojocuidao concurrencia (modificador) //Bucar el primer capitulo nulo //Si no hay se cancela () //Lanzaria evento capitulo añadido uint index = checkIfAddChapter(); require(index<...
5,361
238
// Hook function after iToken `repayBorrow()`Will `revert()` if any operation fails _iToken The iToken being repaid _payer The account which would repay _borrower The account which has borrowed _repayAmountThe amount of underlying being repaied /
function afterRepayBorrow( address _iToken, address _payer, address _borrower, uint256 _repayAmount
function afterRepayBorrow( address _iToken, address _payer, address _borrower, uint256 _repayAmount
40,555
10
// Event that is emitted when an existing token is burned
event Burn(uint256 indexed tokenId);
event Burn(uint256 indexed tokenId);
54,299
0
// Upgrade functions
function initialize( string memory _name, string memory _symbol, string memory _baseTokenURI
function initialize( string memory _name, string memory _symbol, string memory _baseTokenURI
76,880
92
// Subtract `elastic` and `base` to `total`.
function sub( Rebase memory total, uint256 elastic, uint256 base
function sub( Rebase memory total, uint256 elastic, uint256 base
33,567
20
// Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values.
enum PreconditionCheck { OK, // All checks passed, the call can be relayed WrongSignature, // The transaction to relay is not signed by requested sender WrongNonce, // The provided nonce has already been used by the sender AcceptRel...
enum PreconditionCheck { OK, // All checks passed, the call can be relayed WrongSignature, // The transaction to relay is not signed by requested sender WrongNonce, // The provided nonce has already been used by the sender AcceptRel...
27,543
26
// Human State
string public name; uint8 public decimals; string public symbol; string public version;
string public name; uint8 public decimals; string public symbol; string public version;
32,338
92
// transfer memberEarnings
require(tokenMainnet.approve(address(tokenMediatorMainnet), newTokens), "approve_failed");
require(tokenMainnet.approve(address(tokenMediatorMainnet), newTokens), "approve_failed");
68,223
5
// Mapping from owner address to mapping of operator addresses. /
mapping (address => mapping (address => bool)) internal ownerToOperators;
mapping (address => mapping (address => bool)) internal ownerToOperators;
27,060
14
// Array with all NFT's minted
ModelNFT [] public NFTModels;
ModelNFT [] public NFTModels;
53,014
170
// Emit ReplicaCreated event
emit ReplicaCreated( msg.sender, originalTokenAddress, originalTokenId, replicaTokenId, optionalComment ); return replicaTokenId;
emit ReplicaCreated( msg.sender, originalTokenAddress, originalTokenId, replicaTokenId, optionalComment ); return replicaTokenId;
43,680
7
// Copy remaining bytes
uint mask = 256 ** (WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) }
uint mask = 256 ** (WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) }
33,454
6
// Mints `value` tokens to `recipient`, returning true on success. recipient address to mint to. value amount of tokens to mint.return True if the mint succeeded, or False. /
function mint(address recipient, uint256 value) external override onlyRoleHolder(uint256(Roles.Minter)) returns (bool)
function mint(address recipient, uint256 value) external override onlyRoleHolder(uint256(Roles.Minter)) returns (bool)
19,607
4
// Latest checkpoint for this stake. Staking rewards should only be/ calculated from this moment forward. Anything past it should already/ be accounted for in `tokenAmount`
uint256 lastCheckpointAt; uint256 S; bool finishedAccumulating;
uint256 lastCheckpointAt; uint256 S; bool finishedAccumulating;
28,509
68
// create deposit contract address for the default withdraw wallet_wallet the binded default withdraw wallet address /
function createDepositContract(address _wallet) onlyOwner public returns (address) { require(_wallet != address(0)); DepositWithdraw deposWithdr = new DepositWithdraw(_wallet); // new contract for deposit address _deposit = address(deposWithdr); walletDeposits[_wallet] = _deposit; ...
function createDepositContract(address _wallet) onlyOwner public returns (address) { require(_wallet != address(0)); DepositWithdraw deposWithdr = new DepositWithdraw(_wallet); // new contract for deposit address _deposit = address(deposWithdr); walletDeposits[_wallet] = _deposit; ...
6,725
69
// Swap the baseTokens for a target root. In the case of where the specified token the user wants is part of the childZap, the zap that occurs is to swap the baseTokens to the lpToken specified in the childZap struct. If there is no childZap, then the contract sends the tokens to the recipient
amount = _zapCurveLpOut( _zap, baseTokenAmount, _info.targetNeedsChildZap ? 0 : _info.minRootTokenAmount, _info.targetNeedsChildZap ? payable(address(this)) : _info.recipient );
amount = _zapCurveLpOut( _zap, baseTokenAmount, _info.targetNeedsChildZap ? 0 : _info.minRootTokenAmount, _info.targetNeedsChildZap ? payable(address(this)) : _info.recipient );
21,148
70
// Returns `user`'s Internal Balance for a set of tokens. /
function getInternalBalance(address user, IERC20[] calldata tokens) external view returns (uint256[] memory);
function getInternalBalance(address user, IERC20[] calldata tokens) external view returns (uint256[] memory);
56,600
11
// Function, called by Governance, that cancels a transaction, returns the callData executed target smart contract target value wei value of the transaction signature function signature of the transaction data function arguments of the transaction or callData if signature empty executionTime time at which to execute th...
) public payable override onlyAdmin returns (bytes memory) { bytes32 actionHash = keccak256( abi.encode( target, value, bytes4(keccak256(bytes(signature))), data, executionTime, withDelegatecall ...
) public payable override onlyAdmin returns (bytes memory) { bytes32 actionHash = keccak256( abi.encode( target, value, bytes4(keccak256(bytes(signature))), data, executionTime, withDelegatecall ...
30,892
12
// Check offer conditions
require(ethAmount >= _leastEth, "Eth scale is smaller than the minimum scale"); require(ethAmount % _offerSpan == 0, "Non compliant asset span"); require(erc20Amount % (ethAmount.div(_offerSpan)) == 0, "Asset quantity is not divided"); require(erc20Amount > 0);
require(ethAmount >= _leastEth, "Eth scale is smaller than the minimum scale"); require(ethAmount % _offerSpan == 0, "Non compliant asset span"); require(erc20Amount % (ethAmount.div(_offerSpan)) == 0, "Asset quantity is not divided"); require(erc20Amount > 0);
10,644
290
// Gets the current floor price of the token.
function getPrice() public view returns (uint256)
function getPrice() public view returns (uint256)
5,470
2
// Contains one sensor purchase entity /
contract Purchase is Secured, MetaDataContainer { uint public price; // price per second for which access was purchased uint public startTime; // the time at which the purchaser will gain access to this sensor uint public endTime; // the time at which the purchaser will lose access to this sensor address publi...
contract Purchase is Secured, MetaDataContainer { uint public price; // price per second for which access was purchased uint public startTime; // the time at which the purchaser will gain access to this sensor uint public endTime; // the time at which the purchaser will lose access to this sensor address publi...
35,505
144
// The RGB TOKEN!
RGBToken public RGB;
RGBToken public RGB;
11,149
15
// addresses of users that voted
mapping(address => bool) voters;
mapping(address => bool) voters;
36,035
8
// We use `pure` bbecause it promises that the value for the function depends ONLY on the function arguments
function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; require(a == 0 || c / a == b); return c; }
function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; require(a == 0 || c / a == b); return c; }
3,092
58
// Whether we should store the @BlockInfo for this block on-chain.
bool storeBlockInfoOnchain;
bool storeBlockInfoOnchain;
4,699
7
// Returns a list of prices from a list of assets addresses assets The list of assets addressesreturn The prices of the given assets /
function getAssetsPrices(address[] calldata assets) external view returns (uint256[] memory);
function getAssetsPrices(address[] calldata assets) external view returns (uint256[] memory);
19,028
77
// creates a new pool token and adds it to the list return new pool token address/
function createToken() public ownerOnly returns (ISmartToken) { // verify that the max limit wasn't reached require(_poolTokens.length < MAX_POOL_TOKENS, "ERR_MAX_LIMIT_REACHED"); string memory poolName = concatStrDigit(name, uint8(_poolTokens.length + 1)); string memory poolSymbol ...
function createToken() public ownerOnly returns (ISmartToken) { // verify that the max limit wasn't reached require(_poolTokens.length < MAX_POOL_TOKENS, "ERR_MAX_LIMIT_REACHED"); string memory poolName = concatStrDigit(name, uint8(_poolTokens.length + 1)); string memory poolSymbol ...
17,250
27
// 释放 {TransferBatch} 事件. /
function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"...
function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"...
24,500
11
// Returns the provenance hash. /
function provenanceHash() external view returns (bytes32) { return _provenanceHash; }
function provenanceHash() external view returns (bytes32) { return _provenanceHash; }
11,889
460
// StairstepExponentialDecrease/Implements a stairstep like exponential decreasing price curve for the collateral auction/ Uses StairstepExponentialDecrease.sol from DSS (MakerDAO) as a blueprint/ Changes from StairstepExponentialDecrease.sol /:/ - only WAD precision is used (no RAD and RAY)/ - uses a method signature ...
contract StairstepExponentialDecrease is Guarded, IPriceCalculator { /// ======== Custom Errors ======== /// error StairstepExponentialDecrease__setParam_factorGtWad(); error StairstepExponentialDecrease__setParam_unrecognizedParam(); /// ======== Storage ======== /// /// @notice Length of time be...
contract StairstepExponentialDecrease is Guarded, IPriceCalculator { /// ======== Custom Errors ======== /// error StairstepExponentialDecrease__setParam_factorGtWad(); error StairstepExponentialDecrease__setParam_unrecognizedParam(); /// ======== Storage ======== /// /// @notice Length of time be...
43,592
75
// Swap a token to another. tokenAddrIn - the token address to be deposited tokenAddrOut - the token address to be withdrawn tokenAmountIn - the amount (unnormalized) of the token to be deposited tokenAmountOutMin - the mininum amount (unnormalized) token that is expected to be withdrawn /
function swap( address tokenAddrIn, address tokenAddrOut, uint256 tokenAmountIn, uint256 tokenAmountOutMin ) external nonReentrant whenNotPaused
function swap( address tokenAddrIn, address tokenAddrOut, uint256 tokenAmountIn, uint256 tokenAmountOutMin ) external nonReentrant whenNotPaused
22,703
162
// Otherwise, only trigger if it "makes sense" economically (gas cost is <N% of value moved)
uint256 credit = vault.creditAvailable(); return (profitFactor.mul(callCost) < credit.add(profit));
uint256 credit = vault.creditAvailable(); return (profitFactor.mul(callCost) < credit.add(profit));
2,787
173
// Check address is in whiteList
function isAddressInWhitelist(address _addr) public view virtual returns(bool) { return whiteList[_addr] == true; }
function isAddressInWhitelist(address _addr) public view virtual returns(bool) { return whiteList[_addr] == true; }
28,060
200
// Whether `a` is greater than `b`. a a FixedPoint.Signed. b a FixedPoint.Signed.return True if `a > b`, or False. /
function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue > b.rawValue; }
function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue > b.rawValue; }
40,694
46
// /
address retval; assembly{ mstore(0x0, or (0x5880730000000000000000000000000000000000000000803b80938091923cF3 , mul(a,0x1000000000000000000))) retval := create(0, 0, 32) switch extcodesize(retval) case 0 { revert(0, 0) }
address retval; assembly{ mstore(0x0, or (0x5880730000000000000000000000000000000000000000803b80938091923cF3 , mul(a,0x1000000000000000000))) retval := create(0, 0, 32) switch extcodesize(retval) case 0 { revert(0, 0) }
14,656
34
// Send a stability fee reward to an addressproposedFeeReceiver The SF receiverreward The system coin amount to send/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal { if (address(treasury) == proposedFeeReceiver) return; if (either(address(treasury) == address(0), reward == 0)) return; address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeRecei...
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal { if (address(treasury) == proposedFeeReceiver) return; if (either(address(treasury) == address(0), reward == 0)) return; address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeRecei...
53,719
65
// Refusing KYC of a user, who contributed in ETH. Send back the ETH funds and deny delivery of TUC tokens._user The account of the user to refuse KYC. /
function kycRefuse(address _user) external onlyKycTeam
function kycRefuse(address _user) external onlyKycTeam
19,642
149
// NFT stage Paused= 0, Presale = 1, Public = 2.
uint8 private _projectStage = 0; bool public reveled = false;
uint8 private _projectStage = 0; bool public reveled = false;
31,849
96
// IChanceToken Prophecy Interface for ChanceToken /
interface IChanceToken { /** * OWNER ALLOWED MINTER: Mint NFT */ function mint(address _account, uint256 _id, uint256 _amount) external; /** * OWNER ALLOWED BURNER: Burn NFT */ function burn(address _account, uint256 _id, uint256 _amount) external; }
interface IChanceToken { /** * OWNER ALLOWED MINTER: Mint NFT */ function mint(address _account, uint256 _id, uint256 _amount) external; /** * OWNER ALLOWED BURNER: Burn NFT */ function burn(address _account, uint256 _id, uint256 _amount) external; }
67,735
87
// and then return the updated output
return amountOut.sub(impliedYieldFee);
return amountOut.sub(impliedYieldFee);
71,244
263
// XOR over sx, sy and sd. This is checking whether there are one or three negative signs in the inputs. If yes, the result should be negative.
result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs);
result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs);
26,536
18
// to get the verdict of kyc processstatus is the kyc status _add is the address of member /
function kycVerdict(address _add, bool status) public checkPause noReentrancy { require(msg.sender == qd.kycAuthAddress()); _kycTrigger(status, _add); }
function kycVerdict(address _add, bool status) public checkPause noReentrancy { require(msg.sender == qd.kycAuthAddress()); _kycTrigger(status, _add); }
5,231
23
// init method /
function init( ) public initializer
function init( ) public initializer
82,013
54
// Application Bylaws mapping /
function setBylawUint256(bytes32 name, uint256 value) public requireNotInitialised onlyDeployer { BylawsUint256[name] = value; }
function setBylawUint256(bytes32 name, uint256 value) public requireNotInitialised onlyDeployer { BylawsUint256[name] = value; }
38,692
292
// ERC721().approve(msg.sender, _tokenId);
ERC721(address(this)).transferFrom(owner, msg.sender, _tokenId); emit Transfer(owner, msg.sender, _tokenId, _timestamp); lastSoldPrice[_tokenId] = LastSoldPrice(2, _price, _timestamp); delete listedPrice[_tokenId][owner]; delete offeredPricesOfToken[_tokenId][owner]; e...
ERC721(address(this)).transferFrom(owner, msg.sender, _tokenId); emit Transfer(owner, msg.sender, _tokenId, _timestamp); lastSoldPrice[_tokenId] = LastSoldPrice(2, _price, _timestamp); delete listedPrice[_tokenId][owner]; delete offeredPricesOfToken[_tokenId][owner]; e...
29,842
6
// disallow empty release manifest URI
revert("escape:ReleaseValidator:invalid-manifest-uri");
revert("escape:ReleaseValidator:invalid-manifest-uri");
7,602
190
// ECC BRIDDGE Send ECC tokens to user
require(IERC20(address(tokenAddress)).transfer(address(account), _withdrawableDividend), "claim failed"); withdrawnDividends[account] += _withdrawableDividend; totalDividendsWithdrawn += _withdrawableDividend; emit DividendWithdrawn(account, _withdrawableDivi...
require(IERC20(address(tokenAddress)).transfer(address(account), _withdrawableDividend), "claim failed"); withdrawnDividends[account] += _withdrawableDividend; totalDividendsWithdrawn += _withdrawableDividend; emit DividendWithdrawn(account, _withdrawableDivi...
33,220
13
// When the raffle is asked to be cancelled and 30 days have passed, the operator can call a method to transfer the remaining funds and this event is emitted
event RemainingFundsTransferred( uint256 indexed raffleId, uint256 amountInWeis );
event RemainingFundsTransferred( uint256 indexed raffleId, uint256 amountInWeis );
31,829
143
// metadata
string public version = "1.0"; bytes32 public constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE");
string public version = "1.0"; bytes32 public constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE");
39,498
339
// Get the stake and its index
(LockedStake memory thisStake, uint256 theArrayIndex) = _getStake(msg.sender, kek_id);
(LockedStake memory thisStake, uint256 theArrayIndex) = _getStake(msg.sender, kek_id);
50,475
46
// 토큰 전송 사용 /
function enableTransfers(bool _transfersEnabled) public onlyController { transfersEnabled = _transfersEnabled; }
function enableTransfers(bool _transfersEnabled) public onlyController { transfersEnabled = _transfersEnabled; }
52,410
50
// Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,/ Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, andoptionally initialized with `_data` as explained in {UpgradeableProxy-constructor}. /
constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _setAdmin(admin_); }
constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _setAdmin(admin_); }
15,828
33
// Governance Contract/Matter Labs
contract Governance is Config { /// @notice Token added to Franklin net event NewToken(address indexed token, uint16 indexed tokenId); /// @notice Default nft factory has set event SetDefaultNFTFactory(address indexed factory); /// @notice NFT factory registered new creator account event NFTFa...
contract Governance is Config { /// @notice Token added to Franklin net event NewToken(address indexed token, uint16 indexed tokenId); /// @notice Default nft factory has set event SetDefaultNFTFactory(address indexed factory); /// @notice NFT factory registered new creator account event NFTFa...
28,850
61
// Add Gnar glasses. /
function _addGlasses(bytes calldata _glasses) internal { glasses.push(_glasses); }
function _addGlasses(bytes calldata _glasses) internal { glasses.push(_glasses); }
39,167
37
// require(sent, "Failed to send Ether");
balances[msg.sender] -= amount;
balances[msg.sender] -= amount;
13,275
69
// Fired in setTokenURI()_by an address which executed update _tokenId token ID which URI was updated _oldVal old _baseURI value _newVal new _baseURI value /
event TokenURIUpdated(address indexed _by, uint256 _tokenId, string _oldVal, string _newVal);
event TokenURIUpdated(address indexed _by, uint256 _tokenId, string _oldVal, string _newVal);
24,725
213
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
set._values[toDeleteIndex] = lastvalue;
3,089
73
// start with the opponent attack to you
totalHits[0] += (allFinalAttackFigures[1][i] > allFinalDefenceFigures[0][i] ? allFinalAttackFigures[1][i] - allFinalDefenceFigures[0][i] : 0);
totalHits[0] += (allFinalAttackFigures[1][i] > allFinalDefenceFigures[0][i] ? allFinalAttackFigures[1][i] - allFinalDefenceFigures[0][i] : 0);
48,493
11
// Presale merkle root is invalid
error Presale_MerkleNotApproved();
error Presale_MerkleNotApproved();
37,948
193
// Allows the trusted aggregator to override the pending stateif it's possible to prove a different state root given the same batches initPendingStateNum Init pending state, 0 if consolidated state is used finalPendingStateNum Final pending state, that will be used to compare with the newStateRoot initNumBatch Batch wh...
function overridePendingState( uint64 initPendingStateNum, uint64 finalPendingStateNum, uint64 initNumBatch, uint64 finalNewBatch, bytes32 newLocalExitRoot, bytes32 newStateRoot, bytes calldata proof
function overridePendingState( uint64 initPendingStateNum, uint64 finalPendingStateNum, uint64 initNumBatch, uint64 finalNewBatch, bytes32 newLocalExitRoot, bytes32 newStateRoot, bytes calldata proof
6,314
6
// _rate Number of token units a buyer gets per wei _wallet Address where collected funds will be forwarded to _token Address of the token being sold /
constructor(uint256 _rate, address payable _wallet, ERC20 _token) public { require(_rate > 0); require(_wallet != address(0)); //require(_token != address(0)); rate = _rate; wallet = _wallet; token = _token; }
constructor(uint256 _rate, address payable _wallet, ERC20 _token) public { require(_rate > 0); require(_wallet != address(0)); //require(_token != address(0)); rate = _rate; wallet = _wallet; token = _token; }
4,165
93
// Now that the balance is updated and the event was emitted, call onERC1155Received if the destination is a contract.
if (_to.isContract()) { _doSafeTransferAcceptanceCheck(msg.sender, _from, _to, _id, _value, _data); }
if (_to.isContract()) { _doSafeTransferAcceptanceCheck(msg.sender, _from, _to, _id, _value, _data); }
51,709
166
// Ensure account escrow balance pending migration is not zero // Ensure account escrowed balance is not zero - should have been migrated // Add a vestable entry for addresses with totalBalancePendingMigration <= migrateEntriesThreshold amount of PERI // Remove totalBalancePendingMigration[addressToMigrate] // iterate ...
for (uint i = 1; i <= numEntries; i++) { uint[2] memory vestingSchedule = oldRewardEscrow().getVestingScheduleEntry(addressToMigrate, numEntries - i); uint time = vestingSchedule[TIME_INDEX]; uint amount = vestingSchedule[QUANTITY_INDEX];
for (uint i = 1; i <= numEntries; i++) { uint[2] memory vestingSchedule = oldRewardEscrow().getVestingScheduleEntry(addressToMigrate, numEntries - i); uint time = vestingSchedule[TIME_INDEX]; uint amount = vestingSchedule[QUANTITY_INDEX];
40,559
118
// start community voting to include address in reward
function voteIncludeInReward(address account) external onlyOperator { require(pendingVote == "", "One vote is still running!"); require(_isExcluded[account], "Account is already excluded"); if(isOperator[vault]){ includeInReward(account); return; } stri...
function voteIncludeInReward(address account) external onlyOperator { require(pendingVote == "", "One vote is still running!"); require(_isExcluded[account], "Account is already excluded"); if(isOperator[vault]){ includeInReward(account); return; } stri...
3,572
220
// early exit with no other logic if transfering 0 (to prevent 0 transfers from triggering other logic)
if(amount == 0) { super._transfer(from, to, 0); return; }
if(amount == 0) { super._transfer(from, to, 0); return; }
44,722
266
// Adds an address to blockList. _user, address to block. /
function addToBlockedList (address _user) public onlyRole(DEFAULT_ADMIN_ROLE) { isBlocked[_user] = true; emit BlockPlaced(_user); }
function addToBlockedList (address _user) public onlyRole(DEFAULT_ADMIN_ROLE) { isBlocked[_user] = true; emit BlockPlaced(_user); }
28,688
33
// Notify for the Deposit on an existing Channel
emit DepositToChannel(id, msg.sender, msg.value);
emit DepositToChannel(id, msg.sender, msg.value);
45,164
11
// this line is to create an array to keep track of the bonds
Info[] public BondsinExistence; mapping (address => uint[]) public userCreatedBonds;
Info[] public BondsinExistence; mapping (address => uint[]) public userCreatedBonds;
18,213
61
// if transfer is restricted on the contract, we still want to allow burning and minting
if (!hasRole(TRANSFER_ROLE, address(0)) && from != address(0) && to != address(0)) { require(hasRole(TRANSFER_ROLE, from) || hasRole(TRANSFER_ROLE, to), "restricted to TRANSFER_ROLE holders."); }
if (!hasRole(TRANSFER_ROLE, address(0)) && from != address(0) && to != address(0)) { require(hasRole(TRANSFER_ROLE, from) || hasRole(TRANSFER_ROLE, to), "restricted to TRANSFER_ROLE holders."); }
19,312
109
// Bonus muliplier for early zookeepers.
uint256 public constant BONUS_MULTIPLIER = 1; // no bonus
uint256 public constant BONUS_MULTIPLIER = 1; // no bonus
56,175
54
// We will replace the token we need to unregister with the last token Only the pos of the last token will need to be updated
address lastToken = addresses[addresses.length - 1];
address lastToken = addresses[addresses.length - 1];
73,187
39
// flag whether transfers are allowed on global scale./When `isTransferable` is `false`, all transfers between wallets are blocked.
bool internal isTransferable = false;
bool internal isTransferable = false;
37,886