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
4
// Prevents delegatecall into the modified method
modifier noDelegateCall() { checkNotDelegateCall(); _; }
modifier noDelegateCall() { checkNotDelegateCall(); _; }
24,961
14
// 마켓이 구동중일때만
modifier whenMarketRunning() { require(marketPaused != true); _; }
modifier whenMarketRunning() { require(marketPaused != true); _; }
17,265
11
// [NOT MANDATORY FOR ERC1400 STANDARD] Approve the passed address to spend the specified amount of tokens on behalf of 'msg.sender'.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mit...
function approve(address spender, uint256 value) external returns (bool) { require(spender != address(0), "A5"); // Transfer Blocked - Sender not eligible _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
function approve(address spender, uint256 value) external returns (bool) { require(spender != address(0), "A5"); // Transfer Blocked - Sender not eligible _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
16,701
5
// 요정 소유주만
modifier onlyMasterOf(uint256 fairyId) { require(msg.sender == ownerOf(fairyId)); _; }
modifier onlyMasterOf(uint256 fairyId) { require(msg.sender == ownerOf(fairyId)); _; }
43,540
13
// Returns random numbers as two a digits array /
function getDoubleDigits() public view returns(uint[MAX_DIGITS / 2] memory digits){ uint number = randomNumbers[randomNumbers.length - 1]; uint i = 0; while (number > 0 && i < MAX_DIGITS / 2) { uint digit = uint(number % 100); number = number / 100; digits...
function getDoubleDigits() public view returns(uint[MAX_DIGITS / 2] memory digits){ uint number = randomNumbers[randomNumbers.length - 1]; uint i = 0; while (number > 0 && i < MAX_DIGITS / 2) { uint digit = uint(number % 100); number = number / 100; digits...
22,280
8
// A mapping from owner address to count of tokens that address owns
mapping (address => uint256) ownershipTokenCount;
mapping (address => uint256) ownershipTokenCount;
15,084
80
// Generate the requestId
requestId = generateRequestId(); address mainPayee; int256 mainExpectedAmount;
requestId = generateRequestId(); address mainPayee; int256 mainExpectedAmount;
80,505
34
// requirements independent of current auction state:
require( currentTime <= bidInput.deadline, "AuctionBase::assertBidInputsOK: payment deadline expired" ); if (_isSellerRegistrationRequired) { require( _isRegisteredSeller[bidInput.seller], "AuctionBase::assertBidInputsOK: seller...
require( currentTime <= bidInput.deadline, "AuctionBase::assertBidInputsOK: payment deadline expired" ); if (_isSellerRegistrationRequired) { require( _isRegisteredSeller[bidInput.seller], "AuctionBase::assertBidInputsOK: seller...
26,401
4
// give approval or grant transaction permission to start
setApprovalForAll(contractAddress, true); emit TokenCreated(newItemId);
setApprovalForAll(contractAddress, true); emit TokenCreated(newItemId);
15,203
47
// Require that the owner didn't change after the LSP1 Call (Pending owner didn't automate the acceptOwnership call through LSP1)
require( currentOwner == owner(), "LSP14: newOwner MUST accept ownership in a separate transaction" );
require( currentOwner == owner(), "LSP14: newOwner MUST accept ownership in a separate transaction" );
22,889
3
// calculate the amounts to migrate to v3
uint256 amount0V2ToMigrate = amount0V2.mul(params.percentageToMigrate) / 100; uint256 amount1V2ToMigrate = amount1V2.mul(params.percentageToMigrate) / 100;
uint256 amount0V2ToMigrate = amount0V2.mul(params.percentageToMigrate) / 100; uint256 amount1V2ToMigrate = amount1V2.mul(params.percentageToMigrate) / 100;
15,548
68
// This method can be used by the controller to extract mistakenly/sent tokens to this contract./_token The address of the token contract that you want to recover/set to 0 in case you want to extract ether.
function _claimStdTokens(address _token, address payable to) internal { if (_token == address(0x0)) { to.transfer(address(this).balance); return; } uint balance = IERC20(_token).balanceOf(address(this)); (bool status,) = _token.call(abi.encodeWithSignature("tra...
function _claimStdTokens(address _token, address payable to) internal { if (_token == address(0x0)) { to.transfer(address(this).balance); return; } uint balance = IERC20(_token).balanceOf(address(this)); (bool status,) = _token.call(abi.encodeWithSignature("tra...
1,178
191
// Distribute funds in escrow from blocked balance to the target address. _projectEscrowContractAddress An `address` of project`s escrow. _distributionTargetAddress Target `address`. _amount An `uint` amount to distribute. _tokenAddress An `address` of a token. /
function distributeFundsInEscrow( address _projectEscrowContractAddress, address _distributionTargetAddress, uint _amount, address _tokenAddress ) internal
function distributeFundsInEscrow( address _projectEscrowContractAddress, address _distributionTargetAddress, uint _amount, address _tokenAddress ) internal
54,779
88
// Transfer the yield tokens to the recipient.
TokenUtils.safeTransfer(yieldToken, recipient, amountYieldTokens); return amountYieldTokens;
TokenUtils.safeTransfer(yieldToken, recipient, amountYieldTokens); return amountYieldTokens;
44,134
216
// ========== RESTRICTED FUNCTIONS ========== /
function collectDaoShare(uint256 amount, address to) external { require(hasRole(DAO_SHARE_COLLECTOR, msg.sender)); require(amount <= daoShare, "amount<=daoShare"); IDEIStablecoin(dei_contract_address).pool_mint(to, amount); daoShare -= amount; emit daoShareCollected(amount, to); }
function collectDaoShare(uint256 amount, address to) external { require(hasRole(DAO_SHARE_COLLECTOR, msg.sender)); require(amount <= daoShare, "amount<=daoShare"); IDEIStablecoin(dei_contract_address).pool_mint(to, amount); daoShare -= amount; emit daoShareCollected(amount, to); }
35,487
17
// Contain all polls. Index - poll number.
Poll[] public polls;
Poll[] public polls;
53,915
17
// Token Setup
string public constant name = "CrimsonShares"; string public constant symbol = "RIM"; uint8 public constant decimals = 4; uint256 private supply; uint256 public icoPrice = 0.000001 ether; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address in...
string public constant name = "CrimsonShares"; string public constant symbol = "RIM"; uint8 public constant decimals = 4; uint256 private supply; uint256 public icoPrice = 0.000001 ether; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address in...
38,036
164
// Permanently disable the "escape hatch" mechanism for this smartwallet. This function call will revert if the smart wallet has alreadycalled `permanentlyDisableEscapeHatch` at any point in the past. No valueis returned from this function - it will either succeed or revert. minimumActionGas uint256 The minimum amount ...
function permanentlyDisableEscapeHatch( uint256 minimumActionGas, bytes calldata userSignature, bytes calldata dharmaSignature
function permanentlyDisableEscapeHatch( uint256 minimumActionGas, bytes calldata userSignature, bytes calldata dharmaSignature
31,339
77
// A proxy for Lido Ethereum 2.0 withdrawals manager contract. Though the Beacon chain already supports setting withdrawal credentials pointing to a smartcontract, the withdrawals specification is not yet final and might change before withdrawalsare enabled in the Merge network. This means that Lido cannot deploy the f...
contract WithdrawalsManagerProxy is ERC1967Proxy { /** * @dev The address of Lido DAO Voting contract. */ address internal constant LIDO_VOTING = 0x2e59A20f205bB85a89C53f1936454680651E618e; /** * @dev Storage slot with the admin of the contract. * * Equals `bytes32(uint256(keccak25...
contract WithdrawalsManagerProxy is ERC1967Proxy { /** * @dev The address of Lido DAO Voting contract. */ address internal constant LIDO_VOTING = 0x2e59A20f205bB85a89C53f1936454680651E618e; /** * @dev Storage slot with the admin of the contract. * * Equals `bytes32(uint256(keccak25...
81,006
11
// two functions - one that returns tokenByIndex andanother one that returns tokenOfOwnerByIndex
function tokenByIndex(uint256 index) public override view returns(uint256) { // make sure that the index is not out of bounds of the total supply require(index < totalSupply(), 'global index is out of bounds!'); return _allTokens[index]; }
function tokenByIndex(uint256 index) public override view returns(uint256) { // make sure that the index is not out of bounds of the total supply require(index < totalSupply(), 'global index is out of bounds!'); return _allTokens[index]; }
37,535
50
// remove uint32 from whitelist. /
function removeWhiteListUint32(uint32[] storage whiteList,uint32 temp)internal returns (bool) { uint256 len = whiteList.length; uint256 i=0; for (;i<len;i++){ if (whiteList[i] == temp) break; } if (i<len){ if (i!=len-1) { ...
function removeWhiteListUint32(uint32[] storage whiteList,uint32 temp)internal returns (bool) { uint256 len = whiteList.length; uint256 i=0; for (;i<len;i++){ if (whiteList[i] == temp) break; } if (i<len){ if (i!=len-1) { ...
70,605
2
// Integer division of two numbers, truncating the quotient. /
function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) { if (b == 0) { return (MathError.DIVISION_BY_ZERO, 0); } return (MathError.NO_ERROR, a / b); }
function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) { if (b == 0) { return (MathError.DIVISION_BY_ZERO, 0); } return (MathError.NO_ERROR, a / b); }
33,028
107
// Check for approval and valid ownership
require(_approvedFor(msg.sender, _tokenId)); require(_owns(_from, _tokenId));
require(_approvedFor(msg.sender, _tokenId)); require(_owns(_from, _tokenId));
15,107
502
// To receive MATIC from swapRouter when swapping
receive() external payable {} /** * @dev Update the transfer tax rate. * Can only be called by the current operator. */ function updateTransferTaxRate(uint16 _transferTaxRate) public onlyOperator { require(_transferTaxRate <= MAXIMUM_TRANSFER_TAX_RATE, "::updateTransferTaxRate: Trans...
receive() external payable {} /** * @dev Update the transfer tax rate. * Can only be called by the current operator. */ function updateTransferTaxRate(uint16 _transferTaxRate) public onlyOperator { require(_transferTaxRate <= MAXIMUM_TRANSFER_TAX_RATE, "::updateTransferTaxRate: Trans...
698
136
// Verify the liquidity lock of the given address return bool: Is it locked return uint256 : time remaining 0 if unlocked return uint256 : The amount that is locked/
function checkLiquidityLock(address addy) external view returns (bool, uint256, uint256) {//is Locked, time remaining, how much is locked uint256 time = liquidityUnlockTime[addy]; time = (block.timestamp < time) ? time - block.timestamp : 0; bool locked = false; uint256 amt = 0; ...
function checkLiquidityLock(address addy) external view returns (bool, uint256, uint256) {//is Locked, time remaining, how much is locked uint256 time = liquidityUnlockTime[addy]; time = (block.timestamp < time) ? time - block.timestamp : 0; bool locked = false; uint256 amt = 0; ...
6,459
13
// Structs// Keeps track of balance amounts in the balances array/
struct Balance { address owner; uint amount; }
struct Balance { address owner; uint amount; }
21,283
41
// or 0-9
(_temp[i] > 0x2f && _temp[i] < 0x3a), "string contains invalid characters" );
(_temp[i] > 0x2f && _temp[i] < 0x3a), "string contains invalid characters" );
10,304
19
// increments the value of latestTokenId /
function _incrementTokenId() private { latestTokenId++; }
function _incrementTokenId() private { latestTokenId++; }
13,815
96
// Transfer the ownership of a proxy owned Safe/manager address - Safe Manager/safe uint - Safe Id/usr address - Owner of the safe
function transferSAFEOwnership( address manager, uint safe, address usr
function transferSAFEOwnership( address manager, uint safe, address usr
80,853
11
// Pauses all token transfers.
// * See {ERC20Pausable} and {Pausable-_pause}. // * // * Requirements: // * // * - the caller must have the `PAUSER_ROLE`. // */ // function pause() public virtual { // require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause"); // ...
// * See {ERC20Pausable} and {Pausable-_pause}. // * // * Requirements: // * // * - the caller must have the `PAUSER_ROLE`. // */ // function pause() public virtual { // require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause"); // ...
45,038
14
// Uh oh: the patient should not be able to deposit the prescription a second time, obtaining more refills than authorized!
int prescriptionID2 = pharmacy2.depositPrescription(prescription); pharmacy2.fillPrescription(prescriptionID2);
int prescriptionID2 = pharmacy2.depositPrescription(prescription); pharmacy2.fillPrescription(prescriptionID2);
20,485
29
// check if bid duration is closed
Auction memory auction = auctionRegistry[_auctionId];
Auction memory auction = auctionRegistry[_auctionId];
31,268
24
// Open0x Ownable (by 0xInuarashi)
abstract contract Ownable { address public owner; event OwnershipTransferred(address indexed oldOwner_, address indexed newOwner_); constructor() { owner = msg.sender; } modifier onlyOwner { require(owner == msg.sender, "Ownable: caller is not the owner"); _; } function _transfer...
abstract contract Ownable { address public owner; event OwnershipTransferred(address indexed oldOwner_, address indexed newOwner_); constructor() { owner = msg.sender; } modifier onlyOwner { require(owner == msg.sender, "Ownable: caller is not the owner"); _; } function _transfer...
14,008
131
// Implementation of the basic standard multi-token. _Available since v3.1._ /
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using SafeMath for uint256; using Address for address; // Mapping from token ID to account balances mapping (uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping (ad...
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using SafeMath for uint256; using Address for address; // Mapping from token ID to account balances mapping (uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping (ad...
23,215
199
// IdleToken V5 updates Fee for flash loan
uint256 public flashLoanFee;
uint256 public flashLoanFee;
72,557
6
// Governance info methods
function lockedValue(address user, uint256 poolId) external view returns (uint256); function totalLockedValue(uint256 poolId) external view returns (uint256); function normalizedAPY(uint256 poolId) external view returns (uint256);
function lockedValue(address user, uint256 poolId) external view returns (uint256); function totalLockedValue(uint256 poolId) external view returns (uint256); function normalizedAPY(uint256 poolId) external view returns (uint256);
43,337
124
// Emitted when a new fee type is registered.
event ProtocolFeeTypeRegistered(uint256 indexed feeType, string name, uint256 maximumPercentage);
event ProtocolFeeTypeRegistered(uint256 indexed feeType, string name, uint256 maximumPercentage);
29,104
30
// ---------------------------------------------------------------------------- Withdraw Confirmation contract ----------------------------------------------------------------------------
contract WithdrawConfirmation is Owned { event Confirmation(address indexed sender, uint indexed withdrawId); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); event WithdrawCreated(address indexed destination, uint indexed value, uint indexed id); event Execution(uint index...
contract WithdrawConfirmation is Owned { event Confirmation(address indexed sender, uint indexed withdrawId); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); event WithdrawCreated(address indexed destination, uint indexed value, uint indexed id); event Execution(uint index...
19,559
23
// Allows the nft owner to redeem or burn the piNFT. _tokenId The Id of the token. _nftReceiver The receiver of the nft after the function call. _erc20Receiver The receiver of the validator funds after the function call. _erc20Contract The address of the deposited validator funds. burnNFT Boolean to determine redeeming...
function redeemOrBurnPiNFT( uint256 _tokenId, address _nftReceiver, address _erc20Receiver, address _erc20Contract, bool burnNFT
function redeemOrBurnPiNFT( uint256 _tokenId, address _nftReceiver, address _erc20Receiver, address _erc20Contract, bool burnNFT
6,290
5
// Calculate protocol fee based on mint ratio
function protocolFee() public view override returns (uint) { return mintRatio() * factory.maxProtocolFee() / factory.PRECISION(); }
function protocolFee() public view override returns (uint) { return mintRatio() * factory.maxProtocolFee() / factory.PRECISION(); }
31,660
1
// Deposit HEX and bridged HEX on whichever network you are on to mint CHEX. 1 CHEX = 1 eHEX + 1 pHEX. You must grant this contract the appropriate approvals. Transaction must include the flat rate arbitrage throttle, paid in ETH or PLS.
function mint(uint256 amount) external payable nonReentrant{ require(msg.value == arbitrage_throttle, "Transaction must include the arbitrage throttle."); IERC20(HEX_ADDRESS).transferFrom(msg.sender, address(this), amount); IERC20(getAddress()).transferFrom(msg.sender, address(this), amount)...
function mint(uint256 amount) external payable nonReentrant{ require(msg.value == arbitrage_throttle, "Transaction must include the arbitrage throttle."); IERC20(HEX_ADDRESS).transferFrom(msg.sender, address(this), amount); IERC20(getAddress()).transferFrom(msg.sender, address(this), amount)...
36,303
15
// NFTSalesBNB - NFT sale in BNB
contract NFTSalesBNB is ERC1155Holder, Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; struct Token { bool resolved; uint256 price; IUniV2PriceOracle priceOracle; } struct Collectible { uint256 price; // in usd } IERC1155Collectible public...
contract NFTSalesBNB is ERC1155Holder, Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; struct Token { bool resolved; uint256 price; IUniV2PriceOracle priceOracle; } struct Collectible { uint256 price; // in usd } IERC1155Collectible public...
43,029
125
// Hook that is called after a set of serially-ordered token ids have been transferred. This includesminting.And also called after one token has been burned. startTokenId - the first token id to be transferredquantity - the amount to be transferred Calling conditions: - When `from` and `to` are both non-zero, `from`'s ...
function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity
function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity
3,008
13
// Check the last exchange rate without any state changes
function peek(bytes calldata) public view override returns (bool, uint256) { return (success, rate); }
function peek(bytes calldata) public view override returns (bool, uint256) { return (success, rate); }
43,045
36
// This function can release ERC20-tokens `_tokensToWithdraw`, which/ got stuck in this smart contract (were transferred here by the mistake)/Allowed only for SuperAdmin./Transfers all balance of stuck `_tokensToWithdraw` from
/// this contract to {_corporateTreasury} wallet /// @param _tokensToWithdraw address of ERC20-token to withdraw function withdrawStuckTokens( address _tokensToWithdraw ) external onlySuperAdmin { address from = address(this); uint256 amount = IERC20(_tokensToWithdraw).balan...
/// this contract to {_corporateTreasury} wallet /// @param _tokensToWithdraw address of ERC20-token to withdraw function withdrawStuckTokens( address _tokensToWithdraw ) external onlySuperAdmin { address from = address(this); uint256 amount = IERC20(_tokensToWithdraw).balan...
24,134
354
// Address of the media contract that can call this market
address public mediaContract;
address public mediaContract;
75,780
3
// initialize variables
taskOwner = tOwner; TaskId = TID; TaskOpen = true; numLabelers = nLabelers; totalAmount = amount; rewardPerLabeler = totalAmount / numLabelers; numLabelersPaid = 0;
taskOwner = tOwner; TaskId = TID; TaskOpen = true; numLabelers = nLabelers; totalAmount = amount; rewardPerLabeler = totalAmount / numLabelers; numLabelersPaid = 0;
14,170
4
// need to approve this contract first
function claim() public { uint256 approved = token.allowance(msg.sender, this); uint256 amount = token.balanceOf(msg.sender); if (approved > amount) { approved = amount; } uint256 availableBalance = this.balance; uint256 weiBack = convertBalance(approved); if (availableBalance < weiB...
function claim() public { uint256 approved = token.allowance(msg.sender, this); uint256 amount = token.balanceOf(msg.sender); if (approved > amount) { approved = amount; } uint256 availableBalance = this.balance; uint256 weiBack = convertBalance(approved); if (availableBalance < weiB...
41,400
52
// only enable if no plan to airdrop
function enableTrading() external onlyOwner { require(!tradingActive, "Cannot reEnable trading"); tradingActive = true; swapEnabled = true; tradingActiveBlock = block.number; emit EnabledTrading(); }
function enableTrading() external onlyOwner { require(!tradingActive, "Cannot reEnable trading"); tradingActive = true; swapEnabled = true; tradingActiveBlock = block.number; emit EnabledTrading(); }
4,783
10
// Emitted when MOMA is claimed by user
event MomaClaimed(address claimer, address recipient, AccountType accountType, uint claimed, uint left);
event MomaClaimed(address claimer, address recipient, AccountType accountType, uint claimed, uint left);
48,548
11
// emergency case
function rescueFund(IERC20 token) public onlyOwner { if (address(token) == address(0)) { (bool success, ) = msg.sender.call{value: address(this).balance}(''); require(success, 'TOKordinator: fail to rescue Ether'); } else { token.safeTransfer(msg.sender, token.bal...
function rescueFund(IERC20 token) public onlyOwner { if (address(token) == address(0)) { (bool success, ) = msg.sender.call{value: address(this).balance}(''); require(success, 'TOKordinator: fail to rescue Ether'); } else { token.safeTransfer(msg.sender, token.bal...
14,230
232
// Market dynamic variables.
struct MarketStatus { uint128 commitmentsTotal; bool finalized; bool usePointList; }
struct MarketStatus { uint128 commitmentsTotal; bool finalized; bool usePointList; }
56,259
380
// calc debt
(uint256 oldUserDebtBalance, uint256 totalAssetSupplyInUsd) = debtSystem.GetUserDebtBalanceInUsd(user); uint256 newTotalAssetSupply = totalAssetSupplyInUsd.add(amount);
(uint256 oldUserDebtBalance, uint256 totalAssetSupplyInUsd) = debtSystem.GetUserDebtBalanceInUsd(user); uint256 newTotalAssetSupply = totalAssetSupplyInUsd.add(amount);
9,846
31
// Used to update the name and symbol of a local token _canonical - The canonical id and domain to remove _name - The new name _symbol - The new symbol /
function updateDetails( TokenId calldata _canonical, string memory _name, string memory _symbol
function updateDetails( TokenId calldata _canonical, string memory _name, string memory _symbol
19,217
169
// Round up after scaling.
redeemable = stakeScaled .mul(address(this).balance) .sub(1) .div(SCALING_FACTOR) .add(1);
redeemable = stakeScaled .mul(address(this).balance) .sub(1) .div(SCALING_FACTOR) .add(1);
42,064
428
// activates a reserve_reserve the address of the reserve/
function activateReserve(address _reserve) external onlyLendingPoolConfigurator { CoreLibrary.ReserveData storage reserve = reserves[_reserve]; require( reserve.lastLiquidityCumulativeIndex > 0 && reserve.lastVariableBorrowCumulativeIndex > 0, "Reserve has no...
function activateReserve(address _reserve) external onlyLendingPoolConfigurator { CoreLibrary.ReserveData storage reserve = reserves[_reserve]; require( reserve.lastLiquidityCumulativeIndex > 0 && reserve.lastVariableBorrowCumulativeIndex > 0, "Reserve has no...
9,242
59
// confirm claim
_confirmClaim(processId, CLAIM_ID, payoutAmount); emit LogDepegClaimConfirmed(processId, CLAIM_ID, claim.claimAmount, depegBalance, payoutAmount);
_confirmClaim(processId, CLAIM_ID, payoutAmount); emit LogDepegClaimConfirmed(processId, CLAIM_ID, claim.claimAmount, depegBalance, payoutAmount);
40,739
125
// payable(gov).transfer(cost);
(bool success,) = payable(gov).call{value:cost}("");
(bool success,) = payable(gov).call{value:cost}("");
25,304
7
// action performed on the module during a transfer action this function is used to update variables of the module upon transfer if it is required if the module does not require state updates in case of transfer, this function remains empty This function can be called ONLY by the compliance contract itself (_compliance...
function moduleTransferAction(address _from, address _to, uint256 _value) external;
function moduleTransferAction(address _from, address _to, uint256 _value) external;
223
0
// Immutable state/Functions that return immutable state of the router
interface IPeripheryImmutableState { /// @return Returns the address of the Mauve factory function factory() external view returns (address); /// @return Returns the address of WETH9 function WETH9() external view returns (address); }
interface IPeripheryImmutableState { /// @return Returns the address of the Mauve factory function factory() external view returns (address); /// @return Returns the address of WETH9 function WETH9() external view returns (address); }
31,449
69
// MUST fully redeem a past stake, CD gets destroyed
newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSecCalculated); stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn); if(lastStake.stakingShares > sharesLeftToBurn){ sharesLeftToBurn = 0; } else {
newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSecCalculated); stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn); if(lastStake.stakingShares > sharesLeftToBurn){ sharesLeftToBurn = 0; } else {
24,081
59
// Helper method for the frontend, returns all the subscribed CDPs paginated/_page What page of subscribers you want/_perPage Number of entries per page/ return List of all subscribers for that page
function getSubscribersByPage(uint _page, uint _perPage) public view returns (CompoundHolder[] memory) { CompoundHolder[] memory holders = new CompoundHolder[](_perPage); uint start = _page * _perPage; uint end = start + _perPage; end = (end > holders.length) ? holders.length : end...
function getSubscribersByPage(uint _page, uint _perPage) public view returns (CompoundHolder[] memory) { CompoundHolder[] memory holders = new CompoundHolder[](_perPage); uint start = _page * _perPage; uint end = start + _perPage; end = (end > holders.length) ? holders.length : end...
5,997
110
// Function for the frontend to dynamically retrieve the price scaling of buy orders. /
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns(uint256)
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns(uint256)
26,535
12
// The Ballot will authorize the amount in the user's wallet at time of registration. Ensure all funds to be used for voting are present in wallet before registering
function registerToVote() public { require(registered[msg.sender] == false, "Already registered"); registered[msg.sender] = true; Voter storage sender = voters[msg.sender]; sender.registrationDate = block.timestamp; //TODO: set total votes to current balance or approval value...
function registerToVote() public { require(registered[msg.sender] == false, "Already registered"); registered[msg.sender] = true; Voter storage sender = voters[msg.sender]; sender.registrationDate = block.timestamp; //TODO: set total votes to current balance or approval value...
27,606
11
// Mapping of wrapped assets data(wrappedAddress => WrappedAsset)
mapping(address => WrappedAsset) public wrappedAssetData;
mapping(address => WrappedAsset) public wrappedAssetData;
21,867
19
// Transfer token for a specified address to The address to transfer to. value The amount to be transferred. comment The transfer comment.return True if the transaction succeeds. /
function transferWithComment( address to, uint256 value, string calldata comment
function transferWithComment( address to, uint256 value, string calldata comment
23,016
301
// update reallocation batch
reallocationBatch.depositedReallocation = depositOptimizedAmount; reallocationBatch.depositedReallocationSharesReceived = newShares; strategy.totalUnderlying[processingIndex].amount = stratTotalUnderlying;
reallocationBatch.depositedReallocation = depositOptimizedAmount; reallocationBatch.depositedReallocationSharesReceived = newShares; strategy.totalUnderlying[processingIndex].amount = stratTotalUnderlying;
65,227
14
// Check cliffing duration
if (currentTime() < tokenGrant.vestingStartTime) { return (0, 0); }
if (currentTime() < tokenGrant.vestingStartTime) { return (0, 0); }
49,923
29
// An event emitted when a proposal has been canceled
event ProposalCanceled(uint256 id); event NewAdmin(address indexed newAdmin);
event ProposalCanceled(uint256 id); event NewAdmin(address indexed newAdmin);
14,078
26
// check message is from the correct source chain position
require(key.this_chain_id == _slot0.bridgedChainPosition, "Lane: InvalidSourceChainId");
require(key.this_chain_id == _slot0.bridgedChainPosition, "Lane: InvalidSourceChainId");
11,688
50
// Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
244
7
// takeSnapshot will update latestSnapshotInfo
(uint256 bk2, string memory cid2) = snapper.latestSnapshotInfo(); assertEq(bk2, snapshotBlock); assertEq(cid2, CID1);
(uint256 bk2, string memory cid2) = snapper.latestSnapshotInfo(); assertEq(bk2, snapshotBlock); assertEq(cid2, CID1);
32,858
8
// Emitted when customer enrolls for loyalty program
event ItemAdded(uint itemId, string itemName, uint price, uint points, address sellerAddress);
event ItemAdded(uint itemId, string itemName, uint price, uint points, address sellerAddress);
24,626
389
// Calling this function governor commits proposed whitelist if timelock interval of proposal was passed
function commitWhitelist() public onlyGovernor { // Check if proposal was made require(proposalTime != 0, "Didn't proposed yet"); // Check if timelock interval was passed require((proposalTime + timeLockInterval) < now, "Can't commit yet"); // Set new whitelist and ...
function commitWhitelist() public onlyGovernor { // Check if proposal was made require(proposalTime != 0, "Didn't proposed yet"); // Check if timelock interval was passed require((proposalTime + timeLockInterval) < now, "Can't commit yet"); // Set new whitelist and ...
47,118
287
// Accumulator for sequencer inbox messages; tail represents hash of the current state; each element represents the inclusion of a new message.
function sequencerInboxAccs(uint256) external view returns (bytes32);
function sequencerInboxAccs(uint256) external view returns (bytes32);
11,400
291
// Valid TokenMessengers on remote domains
mapping(uint32 => bytes32) public remoteTokenMessengers;
mapping(uint32 => bytes32) public remoteTokenMessengers;
17,085
3
// Only smart contracts will be affected by this modifier
modifier defense() { require( (msg.sender == tx.origin), // If it is a normal user and not smart contract "This smart contract has been grey listed" // make sure that it is not on our greyList. ); _; }
modifier defense() { require( (msg.sender == tx.origin), // If it is a normal user and not smart contract "This smart contract has been grey listed" // make sure that it is not on our greyList. ); _; }
20,029
28
// This call allows anyone owed money by the contract to collect it by initiating a transfer to their account. /
function WithdrawFromPool() external payable hasMoneyInWithdrawPool { address payable callerAddress = payable(msg.sender); uint256 amt = withDrawPool[msg.sender]; withDrawPool[msg.sender] = 0; Erc20Utils.moveTokensFromContract(tokenAddress, callerAddress, amt); }
function WithdrawFromPool() external payable hasMoneyInWithdrawPool { address payable callerAddress = payable(msg.sender); uint256 amt = withDrawPool[msg.sender]; withDrawPool[msg.sender] = 0; Erc20Utils.moveTokensFromContract(tokenAddress, callerAddress, amt); }
15,805
16
// Check if request still be able to take (not bigger than insuredSumRemaining)
require( _provideCover.fundingSum <= (request.insuredSum - ld.requestIdToInsuredSumTaken(_provideCover.requestId)), "Cover Gateway: Remaining insured sum is insufficient" );
require( _provideCover.fundingSum <= (request.insuredSum - ld.requestIdToInsuredSumTaken(_provideCover.requestId)), "Cover Gateway: Remaining insured sum is insufficient" );
19,237
33
// 1st year effective annual interest rate is 100%
interest = (1000 * maxMintProofOfStake).div(100);
interest = (1000 * maxMintProofOfStake).div(100);
4,921
399
// Creates `amount` new tokens for `to`.
* See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mintTo(address to, uint256 amount) public { require(canMint(amount), "Cannot mint: it would create an asset/liability mismatch"); // This will lock the function down to only the minter super....
* See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mintTo(address to, uint256 amount) public { require(canMint(amount), "Cannot mint: it would create an asset/liability mismatch"); // This will lock the function down to only the minter super....
1,251
10
// 1
uint256 LIQUIDITY_FEE_DENOMINATOR;
uint256 LIQUIDITY_FEE_DENOMINATOR;
20,830
68
// The block number when Ramp mining starts.
uint256 public START_BLOCK;
uint256 public START_BLOCK;
43,308
269
// CVX Locking contract for https:www.convexfinance.com/ CVX locked in this contract will be entitled to voting rights for the Convex Finance platform Based on EPS Staking contract for http:ellipsis.finance/ Based on SNX MultiRewards by iamdefinitelyahuman - https:github.com/iamdefinitelyahuman/multi-rewards
contract CvxLocker is ReentrancyGuard, Ownable { using BoringMath for uint256; using BoringMath224 for uint224; using BoringMath112 for uint112; using BoringMath32 for uint32; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ struct Reward { bool useBoost...
contract CvxLocker is ReentrancyGuard, Ownable { using BoringMath for uint256; using BoringMath224 for uint224; using BoringMath112 for uint112; using BoringMath32 for uint32; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ struct Reward { bool useBoost...
25,362
10
// Put sibling edge if needed
if (parentNode.children[1 - bit].isEmpty()) { parentNode.children[1 - bit].header = siblings[siblings.length - i - 1]; }
if (parentNode.children[1 - bit].isEmpty()) { parentNode.children[1 - bit].header = siblings[siblings.length - i - 1]; }
2,464
265
// Create price sheet
function _createPriceSheet( PriceSheet[] storage sheets, uint accountIndex, uint32 ethNum, uint nestNum1k, uint level_shares, uint tokenAmountPerEth
function _createPriceSheet( PriceSheet[] storage sheets, uint accountIndex, uint32 ethNum, uint nestNum1k, uint level_shares, uint tokenAmountPerEth
37,346
13
// NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. /
function upgradeTo(address newImplementation) external virtual ifAdmin { _upgradeTo(newImplementation); }
function upgradeTo(address newImplementation) external virtual ifAdmin { _upgradeTo(newImplementation); }
2,952
70
// Defines the initial contract
constructor () public ERC20Detailed("MarbleCoin", "MBC", 18) { // Generate 100 million tokens in the contract owner's account mint(msg.sender, 100000000 * MBC); }
constructor () public ERC20Detailed("MarbleCoin", "MBC", 18) { // Generate 100 million tokens in the contract owner's account mint(msg.sender, 100000000 * MBC); }
28,117
67
// withdraw your reward
function withdrawRewards() public { ( uint256 amount, uint256 tax ) = calculateReward(msg.sender); require(amount > 0, "No rewards for this address"); uint256 WithdrawingStartTime = government.getWithdrawingStartTime(); require(now > WithdrawingStartTime, "Can withdraw after staking ...
function withdrawRewards() public { ( uint256 amount, uint256 tax ) = calculateReward(msg.sender); require(amount > 0, "No rewards for this address"); uint256 WithdrawingStartTime = government.getWithdrawingStartTime(); require(now > WithdrawingStartTime, "Can withdraw after staking ...
1,470
309
// Executes a swap on 0x/swapData encoded swap data
function executeZeroExSwap(ExternalSwapData calldata swapData) external payable nonReentrant whenNotPaused isValidReferee(swapData.referee)
function executeZeroExSwap(ExternalSwapData calldata swapData) external payable nonReentrant whenNotPaused isValidReferee(swapData.referee)
30,483
16
// getTokenURI() postfixed with the token ID baseTokenURI(){tokenID}/tokenId Token ID/ return uri where token data can be retrieved
function getTokenURI(uint tokenId) public virtual override view returns (string memory) { return string(abi.encodePacked(getBaseTokenURI(), tokenId)); }
function getTokenURI(uint tokenId) public virtual override view returns (string memory) { return string(abi.encodePacked(getBaseTokenURI(), tokenId)); }
27,166
24
// Fetches the revenue of central bank commission by transaction type _txType transaction typereturn revenue /
function getCBRevnuePerTransactionType(TxType _txType) override public view returns(uint256 revenue) { revenue = CB_Fees[_txType].revenue; return revenue; }
function getCBRevnuePerTransactionType(TxType _txType) override public view returns(uint256 revenue) { revenue = CB_Fees[_txType].revenue; return revenue; }
6,337
210
// Claim rewards from multiple pools. Callable by anyone. _pids An array of pool identifiers. _beneficiary The address to claim for. /
function claimMultiple( uint256[] calldata _pids, address _beneficiary
function claimMultiple( uint256[] calldata _pids, address _beneficiary
33,238
144
// handle the transfer of reward tokens via `transferFrom` to reduce the number of transactions required and ensure correctness of the reward amount
ERC20Upgradeable(_rewardsToken).safeTransferFrom(msg.sender, address(this), reward); if (block.timestamp >= rewardData[_rewardsToken].periodFinish) { rewardData[_rewardsToken].rewardRate = reward / rewardData[_rewardsToken].rewardsDuration; } else {
ERC20Upgradeable(_rewardsToken).safeTransferFrom(msg.sender, address(this), reward); if (block.timestamp >= rewardData[_rewardsToken].periodFinish) { rewardData[_rewardsToken].rewardRate = reward / rewardData[_rewardsToken].rewardsDuration; } else {
42,570
0
// La dirección del contrato de adopción que se probará
Adoption adoption = Adoption(DeployedAddresses.Adoption());
Adoption adoption = Adoption(DeployedAddresses.Adoption());
11,352
134
// no escrow actions - escrow remains on L2
emit WithdrawalCompleted(account, amount);
emit WithdrawalCompleted(account, amount);
42,171
269
// tokenid => creator address
mapping(uint256 => address) public creator; function setBaseURI(string memory baseURI_) external onlyOwner { super._setBaseURI(baseURI_); }
mapping(uint256 => address) public creator; function setBaseURI(string memory baseURI_) external onlyOwner { super._setBaseURI(baseURI_); }
43,707
12
// Sage path
function isSagePathUser(address user) public view returns (bool isIndeed) { return _meetsSagePathThreshold(user); }
function isSagePathUser(address user) public view returns (bool isIndeed) { return _meetsSagePathThreshold(user); }
22,514
38
// This method can be used by the controller to extract mistakenly/sent tokens to this contract./_token The address of the token contract that you want to recover/set to 0 in case you want to extract ether.
function claimTokens(address _token) onlyController { if (_token == 0x0) { controller.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint balance = token.balanceOf(this); token.transfer(controller, balance); ClaimedTokens(_token, controller, balance); }...
function claimTokens(address _token) onlyController { if (_token == 0x0) { controller.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint balance = token.balanceOf(this); token.transfer(controller, balance); ClaimedTokens(_token, controller, balance); }...
19,580
26
// Checks the mint eligibility based on the current phase.return mintEligibility True if the user is eligible to mint, false otherwise. /
function _getWLMintEligibilityAtCurrentPhase( address _user, bytes32[] memory _proof
function _getWLMintEligibilityAtCurrentPhase( address _user, bytes32[] memory _proof
10,436