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
106
// Ensures that collateralAssetAvailable does not go below zero
int256 collateralUnderlyingAvailable = c.factors.collateralCashGroup.assetRate.convertToUnderlying(c.factors.collateralAssetAvailable); if (fCashRiskAdjustedUnderlyingPV > collateralUnderlyingAvailable) {
int256 collateralUnderlyingAvailable = c.factors.collateralCashGroup.assetRate.convertToUnderlying(c.factors.collateralAssetAvailable); if (fCashRiskAdjustedUnderlyingPV > collateralUnderlyingAvailable) {
70,261
199
// uint256 public RESERVED_NFT = 6000;
uint256 public NFT_PRICE = 0.18 ether; uint256 public NFT_PRICE_PRESALE = 0.09 ether; uint256 public MAX_NFT_WALLET_PRESALE = 3; uint256 public MAX_NFT_WALLET = 10; bool public saleIsActive = false; uint256 public publicSaleStartTimestamp;
uint256 public NFT_PRICE = 0.18 ether; uint256 public NFT_PRICE_PRESALE = 0.09 ether; uint256 public MAX_NFT_WALLET_PRESALE = 3; uint256 public MAX_NFT_WALLET = 10; bool public saleIsActive = false; uint256 public publicSaleStartTimestamp;
58,612
220
// It allows owner to set the fee address_feeAddress : fee address /
function setFeeAddress(address _feeAddress)
function setFeeAddress(address _feeAddress)
19,616
44
// if no affiliate code was given or player tried to use their own, lolz
if (_affCode == address(0) || _affCode == msg.sender) {
if (_affCode == address(0) || _affCode == msg.sender) {
31,607
124
// Allow staking at any time without earning undue rewards The following is guaranteed if the next `if` is true: lastUpdateTime == previous _periodEndTime || lastUpdateTime == 0
if (_periodStartTime > lastUpdateTime) {
if (_periodStartTime > lastUpdateTime) {
25,306
59
// the UNIX timestamp start date of the crowdsale
uint public startsAt;
uint public startsAt;
69,231
24
// ------------------------------------------------------------------------ Don't accept ETH ------------------------------------------------------------------------
// function () external payable { // revert(); // }
// function () external payable { // revert(); // }
21,444
17
// , PermissionsEnumerable
contract MySignatureDrop2 is ERC721Drop { /// Add by Joe~ //bytes32 private coverRole; string private _coverUri; // bytes32 public constant COVER_ROLE = keccak256("COVER_ROLE"); bool private isCover = true; constructor( string memory _name, string memory _symbol, addr...
contract MySignatureDrop2 is ERC721Drop { /// Add by Joe~ //bytes32 private coverRole; string private _coverUri; // bytes32 public constant COVER_ROLE = keccak256("COVER_ROLE"); bool private isCover = true; constructor( string memory _name, string memory _symbol, addr...
17,125
14
// Getter to access paused /
function paused() external view override returns (bool) { return _paused; }
function paused() external view override returns (bool) { return _paused; }
22,995
54
// We implicitly trust the ERC20 controller. Send it the ETH we got from the sell.
Address.sendValue(payable(_controller), amt);
Address.sendValue(payable(_controller), amt);
12,907
40
// whitelist proposal
if (proposal.flags[4] == 1) { require(!tokenWhitelist[address(proposal.tributeToken)], "whitelisted"); require(!proposedToWhitelist[address(proposal.tributeToken)], "whitelist proposed"); require(approvedTokens.length < MAX_TOKEN_WHITELIST_COUNT, "whitelist maxed"); ...
if (proposal.flags[4] == 1) { require(!tokenWhitelist[address(proposal.tributeToken)], "whitelisted"); require(!proposedToWhitelist[address(proposal.tributeToken)], "whitelist proposed"); require(approvedTokens.length < MAX_TOKEN_WHITELIST_COUNT, "whitelist maxed"); ...
18,101
37
// Team tokens (10M) locked till Jan 01, 2022 and will be relesed each 3 months by 25% 1640995200= January 1, 2022 12:00:00 AM GMT team tokens: 10,000,000 Token
uint8 teamLockPool = _addVestingPool("Team Lock" , 1640995200, 4, 90 days); _addBeneficiary(teamLockPool, 0x4608f8245258e93aF27A15f9fBA17515149f4435,4000000); // 4,000,000 Tokens _addBeneficiary(teamLockPool, 0x5a4D85F03d9C45907617bABcDc7f4C5599c4cE19,2000000); // 2,000,000 Tokens _addB...
uint8 teamLockPool = _addVestingPool("Team Lock" , 1640995200, 4, 90 days); _addBeneficiary(teamLockPool, 0x4608f8245258e93aF27A15f9fBA17515149f4435,4000000); // 4,000,000 Tokens _addBeneficiary(teamLockPool, 0x5a4D85F03d9C45907617bABcDc7f4C5599c4cE19,2000000); // 2,000,000 Tokens _addB...
14,818
9
// burn a token. Can only be called by token owner or approved address.On burn, calls back to the registered extension's onBurn method /
function burn(uint256 tokenId) external;
function burn(uint256 tokenId) external;
7,638
31
// retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
length := extcodesize(_addr)
10,947
77
// Prevent sells
require(recipient != pair);
require(recipient != pair);
12,544
275
// If we do not have enough collateral, try to get some via COMP This scenario is rare and will happen during last withdraw
if (_amount > cToken.balanceOfUnderlying(address(this))) {
if (_amount > cToken.balanceOfUnderlying(address(this))) {
66,389
126
// check if user gradual has any non-matured tranches_userGradual user gradual structreturn hasTranches true if user has non-matured tranches /
function _hasTranches(UserGradual memory _userGradual) private pure returns (bool hasTranches) { if (_userGradual.oldestTranchePosition.arrayIndex > 0) { hasTranches = true; } }
function _hasTranches(UserGradual memory _userGradual) private pure returns (bool hasTranches) { if (_userGradual.oldestTranchePosition.arrayIndex > 0) { hasTranches = true; } }
39,888
1
// Emitted after the cooldownTime has been updated. rateFeedID The rateFeedID targeted. newCooldownTime The new cooldownTime of the breaker. /
event RateFeedCooldownTimeUpdated(address rateFeedID, uint256 newCooldownTime);
event RateFeedCooldownTimeUpdated(address rateFeedID, uint256 newCooldownTime);
22,666
29
// Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to `transfer`, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a `Transfer` event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balan...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balan...
802
189
// stake CUDO in a specific reward programme that dictates a minimum lockup period
function stake(uint256 _programmeId, address _from, uint256 _amount) external nonReentrant paused notZero(_amount) unkSP { RewardProgramme storage rewardProgramme = rewardProgrammes[_programmeId]; UserInfo storage user = userInfo[_programmeId][_msgSender()]; user.amount = user.amount.add(_...
function stake(uint256 _programmeId, address _from, uint256 _amount) external nonReentrant paused notZero(_amount) unkSP { RewardProgramme storage rewardProgramme = rewardProgrammes[_programmeId]; UserInfo storage user = userInfo[_programmeId][_msgSender()]; user.amount = user.amount.add(_...
46,556
12
// disregard overflows on block.timestamp, see MAX_TIMESTAMP
return dayBase(uint128(block.timestamp));
return dayBase(uint128(block.timestamp));
6,674
180
// Set Public Sale Cost
function setCost(uint256 _newCost) public onlyOwner() { publicCost = _newCost; }
function setCost(uint256 _newCost) public onlyOwner() { publicCost = _newCost; }
76,298
10
// A mapping from CardIDs to the price of the token.
mapping (uint256 => uint256) private cardIndexToPrice;
mapping (uint256 => uint256) private cardIndexToPrice;
886
13
// burn batch function
function burnBatch( address from, uint256[] memory tokenIds, uint256[] memory amounts
function burnBatch( address from, uint256[] memory tokenIds, uint256[] memory amounts
5,336
280
// Calculates final amountOut, and the fee and final amount in
(uint exitFee, uint amountOut) = SmartPoolManager.exitswapPoolAmountIn( IConfigurableRightsPool(address(this)), bPool, tokenOut, poolAmountIn, minAm...
(uint exitFee, uint amountOut) = SmartPoolManager.exitswapPoolAmountIn( IConfigurableRightsPool(address(this)), bPool, tokenOut, poolAmountIn, minAm...
11,696
35
// or the governance wants this to happen
|| msg.sender == governance(), "Buffer exists and the caller is not governance" );
|| msg.sender == governance(), "Buffer exists and the caller is not governance" );
27,995
2
// SPDX-License-Identifier: MIT a library for performing overflow-safe math, updated with awesomeness from of DappHub (https:github.com/dapphub/ds-math)
library BoringMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a + b) >= b, "BoringMath: Add Overflow");} function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a - b) <= a, "BoringMath: Underflow");} function mul(uint256 a, uint256 b) int...
library BoringMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a + b) >= b, "BoringMath: Add Overflow");} function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {require((c = a - b) <= a, "BoringMath: Underflow");} function mul(uint256 a, uint256 b) int...
32,805
6
// REGULAR PRESALE MINTING 0.015 ETHER
uint256 supply = totalSupply(); require( supply + 1 <= 6666 - _reserved, "Exceeds maximum supply" ); require(isPreListed(msg.sender), "user is not eligible for presale"); require( msg.value >= presaleprice * 1, "Ether sent is not correct" ); _safeMint( msg.sender...
uint256 supply = totalSupply(); require( supply + 1 <= 6666 - _reserved, "Exceeds maximum supply" ); require(isPreListed(msg.sender), "user is not eligible for presale"); require( msg.value >= presaleprice * 1, "Ether sent is not correct" ); _safeMint( msg.sender...
23,639
3
// Loads a storage slot from an address (who, slot)
function load(address,bytes32) external returns (bytes32);
function load(address,bytes32) external returns (bytes32);
28,087
1
// Try to reenter `batchExecuteMetaTransactions()`
IMetaTransactionsFeature.MetaTransactionData[] memory mtxs = new IMetaTransactionsFeature.MetaTransactionData[](1); LibSignature.Signature[] memory signatures = new LibSignature.Signature[](1); mtxs[0] = IMetaTransactionsFeature.MetaTransactionData({ s...
IMetaTransactionsFeature.MetaTransactionData[] memory mtxs = new IMetaTransactionsFeature.MetaTransactionData[](1); LibSignature.Signature[] memory signatures = new LibSignature.Signature[](1); mtxs[0] = IMetaTransactionsFeature.MetaTransactionData({ s...
8,893
4
// TODO: check addresses equals to tokens
require(msg.sender == resolver, "Market: FORBIDDEN"); require(_outcome.length == tokens.length, "Market: MISSING_OUTCOMES"); require(block.timestamp >= timestamp, "Market: TOO_EARLY"); uint256 totalIncome = 0; for (uint256 i = 0; i < _outcome.length; i++) { require(_...
require(msg.sender == resolver, "Market: FORBIDDEN"); require(_outcome.length == tokens.length, "Market: MISSING_OUTCOMES"); require(block.timestamp >= timestamp, "Market: TOO_EARLY"); uint256 totalIncome = 0; for (uint256 i = 0; i < _outcome.length; i++) { require(_...
20,323
103
// import {DripsReceiver, SplitsReceiver} from "./Structs.sol"; //On every timestamp `T`, which is a multiple of `cycleSecs`, the receivers/ gain access to drips collected during `T - cycleSecs` to `T - 1`.
uint64 public immutable cycleSecs;
uint64 public immutable cycleSecs;
24,833
10
// query if the _libraryAddress is valid for receiving msgs._userApplication - the user app address on this EVM chain
function getReceiveLibraryAddress( address _userApplication ) external view returns (address);
function getReceiveLibraryAddress( address _userApplication ) external view returns (address);
8,722
79
// NFT上のマーケットへの出品
struct Markets { // 登録時のNFT売手 address seller; // 価格 uint128 marketsPrice; }
struct Markets { // 登録時のNFT売手 address seller; // 価格 uint128 marketsPrice; }
31,576
152
// Remember that the `_staker` staked into `_poolStakingAddress`
address[] storage stakerPools = _stakerPools[_staker]; uint256 index = _stakerPoolsIndexes[_staker][_poolStakingAddress]; if (index >= stakerPools.length || stakerPools[index] != _poolStakingAddress) { _stakerPoolsIndexes[_staker][_poolStakingAddress] = stakerPools.length; ...
address[] storage stakerPools = _stakerPools[_staker]; uint256 index = _stakerPoolsIndexes[_staker][_poolStakingAddress]; if (index >= stakerPools.length || stakerPools[index] != _poolStakingAddress) { _stakerPoolsIndexes[_staker][_poolStakingAddress] = stakerPools.length; ...
6,820
77
// Erase the resolver and owner records
ens.setResolver(node, address(0x0)); ens.setOwner(node, address(0x0));
ens.setResolver(node, address(0x0)); ens.setOwner(node, address(0x0));
39,074
5
// This functions show your current balance in your address
function getFunds () isClient constant returns (uint){ return this.balance; }
function getFunds () isClient constant returns (uint){ return this.balance; }
41,852
230
// res += val(coefficients[56] + coefficients[57]adjustments[7]).
res := addmod(res, mulmod(val, add(/*coefficients[56]*/ mload(0xb40), mulmod(/*coefficients[57]*/ mload(0xb60),
res := addmod(res, mulmod(val, add(/*coefficients[56]*/ mload(0xb40), mulmod(/*coefficients[57]*/ mload(0xb60),
20,734
18
// Warning: you should absolutely sure you want to give up authority!!!
function disableOwnership() public onlyOwner { owner = address(0); emit OwnerUpdate(msg.sender, owner); }
function disableOwnership() public onlyOwner { owner = address(0); emit OwnerUpdate(msg.sender, owner); }
24,010
36
// Initializes the Contract Dependencies as well as the Holiday Mapping for OwnTheDay.io /
function initialize(address _dateTimeAddress, address _tokenAddress, address _otdAddress) public onlyOwner { DateTimeLib_ = DateTime(_dateTimeAddress); CryptoTorchToken_ = CryptoTorchToken(_tokenAddress); OwnTheDayContract_ = OwnTheDayContract(_otdAddress); holidayMap_[0] = "10000110...
function initialize(address _dateTimeAddress, address _tokenAddress, address _otdAddress) public onlyOwner { DateTimeLib_ = DateTime(_dateTimeAddress); CryptoTorchToken_ = CryptoTorchToken(_tokenAddress); OwnTheDayContract_ = OwnTheDayContract(_otdAddress); holidayMap_[0] = "10000110...
64,465
39
// The current price for a single indivisible part of a token. If a buyin happens now, this is/ the highest price per indivisible token part that the buyer will pay. This doesn't/ include the discount which may be available.
function currentPrice() public constant when_active returns (uint weiPerIndivisibleTokenPart) { return (USDWEI * 40000000 / (now - beginTime + 5760) - USDWEI * 5) / DIVISOR; }
function currentPrice() public constant when_active returns (uint weiPerIndivisibleTokenPart) { return (USDWEI * 40000000 / (now - beginTime + 5760) - USDWEI * 5) / DIVISOR; }
7,817
6
// If the last available tokenID is still unused...
if (tokenMatrix[maxIndex - 1] == 0) {
if (tokenMatrix[maxIndex - 1] == 0) {
7,458
141
// Read cToken balance
(oErr, supplyBalance, , exchangeRateMantissa) = cToken.getAccountSnapshot(account); if (oErr != 0) { return (Error.SNAPSHOT_ERROR, 0, 0); }
(oErr, supplyBalance, , exchangeRateMantissa) = cToken.getAccountSnapshot(account); if (oErr != 0) { return (Error.SNAPSHOT_ERROR, 0, 0); }
38,204
3
// correct voting power after initialization, claim, or adjustment
DistributionRecord memory record = records[beneficiary]; uint256 newVotes = record.claimed >= record.total ? 0 : tokensToVotes(record.total - record.claimed); if (currentVotes > newVotes) {
DistributionRecord memory record = records[beneficiary]; uint256 newVotes = record.claimed >= record.total ? 0 : tokensToVotes(record.total - record.claimed); if (currentVotes > newVotes) {
15,003
12
// Get number of tokens currently belonging to given owner._owner address to get number of tokens currently belonging to the owner ofreturn number of tokens currently belonging to the owner of given address /
function balanceOf(address _owner) constant returns (uint256 balance) { return accounts [_owner]; }
function balanceOf(address _owner) constant returns (uint256 balance) { return accounts [_owner]; }
18,357
0
// _l1Bridge Address of the L1 standard bridge. _l2Contract Address of the corresponding L2 NFT contract. _name ERC721 name. _symbol ERC721 symbol. /
constructor( address _l1Bridge, address _l2Contract, string memory _name, string memory _symbol, string memory _baseTokenURI
constructor( address _l1Bridge, address _l2Contract, string memory _name, string memory _symbol, string memory _baseTokenURI
37,737
9
// trigger notification of withdrawal pid pid of the pool rewardAmountusers final rewards withdrawn /
event NotifyRewardAdded(
event NotifyRewardAdded(
24,132
8
// TODO/chain TODO/newBool TODO
function setIsEVM(string calldata chain, bool newBool) external;
function setIsEVM(string calldata chain, bool newBool) external;
2,448
70
// Used when multiple can call./
modifier onlyModules(bytes32 _moduleOne, bytes32 _moduleTwo) { string memory message = string(abi.encodePacked("only module ", _moduleOne.toString()," or ", _moduleTwo.toString()," can call this function")); require(msg.sender == getModule(_moduleOne) || msg.sender == getModule(_moduleTwo), message)...
modifier onlyModules(bytes32 _moduleOne, bytes32 _moduleTwo) { string memory message = string(abi.encodePacked("only module ", _moduleOne.toString()," or ", _moduleTwo.toString()," can call this function")); require(msg.sender == getModule(_moduleOne) || msg.sender == getModule(_moduleTwo), message)...
44,505
26
// Returns the address that signed a hashed message (`hash`) with`signature` or error string. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:this function rejects them by requiring the `s` value to be in the lowerhalf order, and the `v` v...
* be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available s...
* be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available s...
21,735
173
// Events//Variables//Public Functions//Sends a cross domain message to the target messenger. _target Target contract address. _message Message to send to the target. _gasLimit Gas limit for the provided message. /
function sendMessage( address _target, bytes calldata _message, uint32 _gasLimit ) external;
function sendMessage( address _target, bytes calldata _message, uint32 _gasLimit ) external;
37,273
0
// decide if an upkeep is needed and return bool accordingly
return (shouldPerformUpkeep, bytesToSend);
return (shouldPerformUpkeep, bytesToSend);
14,176
2
// randomly set secretNumber with a value between 1 and 10
secretNumber = uint8(sha3(now, block.blockhash(block.number-1))) % 10 + 1;
secretNumber = uint8(sha3(now, block.blockhash(block.number-1))) % 10 + 1;
50,926
50
// Allows admin to launch a new ICO _startTimestamp Start timestamp in epochs _durationSeconds ICO time in seconds(1 day=246060) _coinsPerETH BST price in ETH(1 ETH = ? BST) _maxCap Max ETH capture in wei amount _minAmount Min ETH amount per user in wei amount _isPublic Boolean to represent that the ICO is public or no...
function adminAddICO( uint256 _startTimestamp, uint256 _durationSeconds, uint256 _coinsPerETH, uint256 _maxCap, uint256 _minAmount, uint[] _rewardHours, uint256[] _rewardPercents, bool _isPublic
function adminAddICO( uint256 _startTimestamp, uint256 _durationSeconds, uint256 _coinsPerETH, uint256 _maxCap, uint256 _minAmount, uint[] _rewardHours, uint256[] _rewardPercents, bool _isPublic
17,539
256
// SMMA filter with function: SMMA(i) = (SMMA(i-1)(n-1) + PRICE(i)) / n _prePrice PRICE[n-1] _price PRICE[n]return filtered price /
function smma(uint256 _prePrice, uint256 _price) internal pure returns (uint256) { return (_prePrice * (smmaPeriod - 1) + _price) / smmaPeriod; }
function smma(uint256 _prePrice, uint256 _price) internal pure returns (uint256) { return (_prePrice * (smmaPeriod - 1) + _price) / smmaPeriod; }
17,332
5
// pay the seller
_transferFrom(seller, buyer, _tokenId);
_transferFrom(seller, buyer, _tokenId);
39,527
320
// Initializes the contract in unpaused state. /
constructor() {
constructor() {
1,203
190
// Set base URI. /
function setBaseURI(string memory _baseURI) public onlyOwner { baseURI = _baseURI; }
function setBaseURI(string memory _baseURI) public onlyOwner { baseURI = _baseURI; }
49,859
119
// verify ownership
address tokenOwner = ownerOf[idList[i]]; if (tokenOwner != msg.sender || tokenOwner == BURN_ADDRESS) { revert Error_NotTokenOwner(); }
address tokenOwner = ownerOf[idList[i]]; if (tokenOwner != msg.sender || tokenOwner == BURN_ADDRESS) { revert Error_NotTokenOwner(); }
60,117
206
// Setup Functions/
bool public tradingEnabled; bool public whiteListTrading; address private _liquidityTokenAddress;
bool public tradingEnabled; bool public whiteListTrading; address private _liquidityTokenAddress;
13,630
2
// Integer division of two numbers truncating the quotient, reverts on division by zero./
function div(uint256 a, uint256 b) internal pure returns (uint256) {require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); return c;}
29,870
9
// Claims reward for the sender account
function getReward() public nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { rewards[msg.sender] = 0; uint256 contractBalance = rewardToken.balanceOf(address(this)); if (contractBalance < reward) { rew...
function getReward() public nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { rewards[msg.sender] = 0; uint256 contractBalance = rewardToken.balanceOf(address(this)); if (contractBalance < reward) { rew...
8,177
44
// ICO Contract for the LBC crowdsale/
contract HLBICO is CappedTimedCrowdsale, RefundablePostDeliveryCrowdsale { using SafeMath for uint256; /* ** Global State */ bool public initialized; // default : false /* ** Addresses */ address public _deployingAddress; // should remain the same as deployer's address address ...
contract HLBICO is CappedTimedCrowdsale, RefundablePostDeliveryCrowdsale { using SafeMath for uint256; /* ** Global State */ bool public initialized; // default : false /* ** Addresses */ address public _deployingAddress; // should remain the same as deployer's address address ...
24,516
3
// This is the constructor. It runs only once, when the contract is created.
function MyCoin() public { minter = msg.sender; }
function MyCoin() public { minter = msg.sender; }
49,501
68
// Withdrawable token Token that can be the withdrawal. /
contract WithdrawableToken is BasicToken, Ownable { using SafeMath for uint256; bool public withdrawingFinished = false; event Withdraw(address _from, address _to, uint256 _value); event WithdrawFinished(); modifier canWithdraw() { require(!withdrawingFinished); _; } modi...
contract WithdrawableToken is BasicToken, Ownable { using SafeMath for uint256; bool public withdrawingFinished = false; event Withdraw(address _from, address _to, uint256 _value); event WithdrawFinished(); modifier canWithdraw() { require(!withdrawingFinished); _; } modi...
27,664
172
// Update dev address by the previous dev.
function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; }
function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; }
1,340
261
// Add the d command prior to any bits
if (uint8(input[idx + 1] & dCommandBit) > 0) { outputIdx = addOutput(output, outputIdx, bytes(" "), D_COMMANDS[uint8(input[idx])]); }
if (uint8(input[idx + 1] & dCommandBit) > 0) { outputIdx = addOutput(output, outputIdx, bytes(" "), D_COMMANDS[uint8(input[idx])]); }
19,719
22
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded.
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This ...
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This ...
31,190
73
// Event emitted when an initiative is completed /
event InitiativeCompleted(string indexed initiativeHash);
event InitiativeCompleted(string indexed initiativeHash);
51,661
9
// Withdraw ether from client's account and sent it to the client's address.May only be called by client._value value to withdraw (in Wei)return true if ether was successfully withdrawn, false otherwise /
function withdraw (uint256 _value)
function withdraw (uint256 _value)
37,533
78
// Increment the array (cannot overflow as index starts at 0).
unchecked { ++i; }
unchecked { ++i; }
20,943
35
// We keep the unlock data in a separate mapping to allow channel data structures to be removed when settling uncooperatively. If there are locked pending transfers, we need to store data needed to unlock them at a later time. The key is `keccak256(uint256 channel_identifier, address participant, address partner)` Wher...
mapping(bytes32 => UnlockData) private unlock_identifier_to_unlock_data;
mapping(bytes32 => UnlockData) private unlock_identifier_to_unlock_data;
68,176
57
// `msg.sender` approves `_spender` to spend `_amount` tokens on/its behalf. This is a modified version of the ERC20 approve function/to be a little bit safer/_spender The address of the account able to transfer the tokens/_amount The amount of tokens to be approved for transfer/ return True if the approval was success...
function approve(address _spender, uint256 _amount) returns (bool success) { require(transfersEnabled); // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender,0)` if it is not // already 0 to mitigate the race ...
function approve(address _spender, uint256 _amount) returns (bool success) { require(transfersEnabled); // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender,0)` if it is not // already 0 to mitigate the race ...
33,781
126
// Checks if transfer passes transfer rules.from The address to transfer from.to The address to send tokens to.value The amount of tokens to send./
function authorize( address from, address to, uint256 value ) public view returns (bool)
function authorize( address from, address to, uint256 value ) public view returns (bool)
3,026
12
// SUPPLY CONTROL DATA
address public supplyController;
address public supplyController;
1,073
86
// @notify View function meant to return whether a decrease in the debt ceiling is currently allowed/
function allowsDecrease(uint256 redemptionRate, uint256 currentDebtCeiling, uint256 updatedCeiling) public view returns (bool allowDecrease) { allowDecrease = either(redemptionRate >= RAY, both(redemptionRate < RAY, blockDecreaseWhenDevalue == 0)); allowDecrease = both(currentDebtCeiling >= updatedC...
function allowsDecrease(uint256 redemptionRate, uint256 currentDebtCeiling, uint256 updatedCeiling) public view returns (bool allowDecrease) { allowDecrease = either(redemptionRate >= RAY, both(redemptionRate < RAY, blockDecreaseWhenDevalue == 0)); allowDecrease = both(currentDebtCeiling >= updatedC...
53,736
237
// Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} isused, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s tokens will be transferre...
function _beforeTokenTransfer( address from, address to, uint256 /* firstTokenId */, uint256 batchSize ) internal virtual { if (batchSize > 1) { if (from != address(0)) { _balances[from] -= batchSize; }
function _beforeTokenTransfer( address from, address to, uint256 /* firstTokenId */, uint256 batchSize ) internal virtual { if (batchSize > 1) { if (from != address(0)) { _balances[from] -= batchSize; }
34,388
21
// Function to permit the claiming of an asset to a reserved address./to The intended recipient (reserved address) of the ERC1155 tokens./assetIds The array of IDs of the asset tokens./assetValues The amounts of each token ID to transfer./proof The proof submitted for verification./salt The salt submitted for verificat...
function claimAssets( address to, uint256[] calldata assetIds, uint256[] calldata assetValues, bytes32[] calldata proof, bytes32 salt
function claimAssets( address to, uint256[] calldata assetIds, uint256[] calldata assetValues, bytes32[] calldata proof, bytes32 salt
62,880
596
// Coinvise premium. If premium rate is 0.2%, is would be stored as 0.210^decimals = 20
uint256 public premiumPercentage; uint256 public premiumPercentageDecimals; uint256 public nftListingFee;
uint256 public premiumPercentage; uint256 public premiumPercentageDecimals; uint256 public nftListingFee;
45,387
113
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); ...
uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); ...
13,387
108
// this is mooniswap
IMooniswap lpToken = IMooniswap(lpTokensInfo[_pid].lpToken); IERC20[] memory t = lpToken.getTokens(); return (address(t[0]), address(t[1]));
IMooniswap lpToken = IMooniswap(lpTokensInfo[_pid].lpToken); IERC20[] memory t = lpToken.getTokens(); return (address(t[0]), address(t[1]));
34,522
42
// restrict function to be callable when token is active /
modifier activated() { require(active == true); _; }
modifier activated() { require(active == true); _; }
15,538
44
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0;
_dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0;
43,109
42
// This method will return the release time for upcoming quarter/
function nextReleaseTime() external view returns(uint256 time) { time = quarterSchedule[lastQuarter]; }
function nextReleaseTime() external view returns(uint256 time) { time = quarterSchedule[lastQuarter]; }
15,498
16
// Reject an existing administrator. _admin The administrator's address. /
function reject(address _admin) external onlyOwner { AdminInfo storage adminInfo = adminTable[_admin]; require(adminArray.length > adminInfo.index, "administrator is already rejected"); require(_admin == adminArray[adminInfo.index], "administrator is already rejected"); // at this po...
function reject(address _admin) external onlyOwner { AdminInfo storage adminInfo = adminTable[_admin]; require(adminArray.length > adminInfo.index, "administrator is already rejected"); require(_admin == adminArray[adminInfo.index], "administrator is already rejected"); // at this po...
15,967
76
// Participant must put up the entry fee.
require(msg.value >= _contestToEnter.entryFee);
require(msg.value >= _contestToEnter.entryFee);
48,470
214
// Sanity check: Ensure we were able to retrieve sufficent want from strategy positions If we end up with less than the amount requested, make sure it does not deviate beyond a maximum threshold
if (_postWithdraw < _amount) { uint256 diff = _diff(_amount, _postWithdraw);
if (_postWithdraw < _amount) { uint256 diff = _diff(_amount, _postWithdraw);
10,625
108
// remove an address from the frozenlist _operator addressreturn true if the address was removed from the frozenlist,false if the address wasn't in the frozenlist in the first place /
function removeAddressFromFrozenlist(address _operator) public onlyIssuer { removeRole(_operator, ROLE_FROZENLIST); }
function removeAddressFromFrozenlist(address _operator) public onlyIssuer { removeRole(_operator, ROLE_FROZENLIST); }
57,823
20
// Get airline details return Airline with the provided address /
function getAirlineName(address airline) external view returns(string memory) { return airlines[airline].name; }
function getAirlineName(address airline) external view returns(string memory) { return airlines[airline].name; }
39,823
147
// Approve spender to transfer tokens and then execute a callback on recipient. spender The address allowed to transfer to value The amount allowed to be transferredreturn A boolean that indicates if the operation was successful. /
function approveAndCall(address spender, uint256 value) public override returns (bool) { return approveAndCall(spender, value, ""); }
function approveAndCall(address spender, uint256 value) public override returns (bool) { return approveAndCall(spender, value, ""); }
6,441
284
// providers must provide LBT price caluculator and ERC20 price oracle. /
function setProvider( bytes32 erc20PoolID, address oracleAddress, address
function setProvider( bytes32 erc20PoolID, address oracleAddress, address
13,266
22
// Fixed crowdsale pricing - everybody gets the same price. /
contract PricingStrategy is HasNoEther { using SafeMath for uint; /* How many weis one token costs */ uint256 public oneTokenInWei; address public crowdsaleAddress; function PricingStrategy(address _crowdsale) { crowdsaleAddress = _crowdsale; } modifier onlyCrowdsale() { ...
contract PricingStrategy is HasNoEther { using SafeMath for uint; /* How many weis one token costs */ uint256 public oneTokenInWei; address public crowdsaleAddress; function PricingStrategy(address _crowdsale) { crowdsaleAddress = _crowdsale; } modifier onlyCrowdsale() { ...
39,214
19
// Distribute reward amount equally across the first staker's tokens
if (dao.rewardPerToken > 0) { user.pendingRewards = dao.rewardPerToken; dao.rewardPerToken = _calculateRewardPerToken( 0, dao.rewardPerToken, _amount ); }
if (dao.rewardPerToken > 0) { user.pendingRewards = dao.rewardPerToken; dao.rewardPerToken = _calculateRewardPerToken( 0, dao.rewardPerToken, _amount ); }
4,745
183
// ensures transfer of tokens, taking into account that some ERC-20 implementations don't return true on success but revert on failure instead _token the token to transfer_fromthe address to transfer the tokens from_tothe address to transfer the tokens to_amountthe amount to transfer/
function ensureTransferFrom(IERC20Token _token, address _from, address _to, uint256 _amount) private { // We must assume that functions `transfer` and `transferFrom` do not return anything, // because not all tokens abide the requirement of the ERC20 standard to return success or failure. //...
function ensureTransferFrom(IERC20Token _token, address _from, address _to, uint256 _amount) private { // We must assume that functions `transfer` and `transferFrom` do not return anything, // because not all tokens abide the requirement of the ERC20 standard to return success or failure. //...
20,386
6
// the duration. after this period all tokens will have been unlocked
uint256 public duration;
uint256 public duration;
16,276
0
// stores mapping of addresses
mapping(address => uint) public balanceReceived;
mapping(address => uint) public balanceReceived;
13,098
33
// claim phase 2 jackpot by phase 2 winner /
function claimPhase2Jackpot() public whenNotPaused onlyPhase2 onlyPhase2Revealed onlyPhase2Winner(phase2WinnerTokenID)
function claimPhase2Jackpot() public whenNotPaused onlyPhase2 onlyPhase2Revealed onlyPhase2Winner(phase2WinnerTokenID)
58,756
16
// - both parties can {lock} for `resolver`. /receiver The account that receives funds./resolver The account that unlock funds./token The asset used for funds (note: NFT not supported in BentoBox)./value The amount of funds (note: locker converts to 'shares')./termination Unix time upon which `depositor` can claim back...
function depositBento( address receiver, address resolver, address token, uint256 value, uint256 termination, bool wrapBento, string memory details ) public payable returns (uint256 registration) { require(resolvers[resolver].active, "resolver n...
function depositBento( address receiver, address resolver, address token, uint256 value, uint256 termination, bool wrapBento, string memory details ) public payable returns (uint256 registration) { require(resolvers[resolver].active, "resolver n...
16,322
47
// Force withdraw all msg.sender's CRCL token to recipient's ERC20 token.The function acknowledges the request and records the request time.
* Emits a {Withdraw} event indicating the amount withdrawn. */ function forceWithdraw(address recipient) public withdrawRequested pastTimeLock returns (bool) { require(_withdraw(_msgSender(), recipient, _balances[_msgSender()]), "CRCL: force withdraw error"); setScheduleTime(_msgSender(),...
* Emits a {Withdraw} event indicating the amount withdrawn. */ function forceWithdraw(address recipient) public withdrawRequested pastTimeLock returns (bool) { require(_withdraw(_msgSender(), recipient, _balances[_msgSender()]), "CRCL: force withdraw error"); setScheduleTime(_msgSender(),...
39,349
99
// All reasons being used means the request can't be challenged again, so we can update its status.
submission.status = Status.None; submission.registered = true; submission.submissionTime = uint64(now); request.resolved = true;
submission.status = Status.None; submission.registered = true; submission.submissionTime = uint64(now); request.resolved = true;
13,785