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
// Maps a rate feed to its breakers and their breaker status. (rateFeedID => (breaker => BreakerStatus)
mapping(address => mapping(address => BreakerStatus)) public rateFeedBreakerStatus;
mapping(address => mapping(address => BreakerStatus)) public rateFeedBreakerStatus;
26,153
49
// This is the max fee that the contract will accept, it is hard-coded to protect buyers This includes the buy AND the sell fee!
uint256 private maxPossibleFee = 20;
uint256 private maxPossibleFee = 20;
18,760
18
// Address = buffer address + sizeof(buffer length) + off
let dest := add(add(bufptr, off), 32) mstore8(dest, data)
let dest := add(add(bufptr, off), 32) mstore8(dest, data)
6,176
100
// Creates and returns stake data in StakeInfoResponse struct format using PoolInfo and StakeInfo from storage /
function createStakeInfoResponse( address _address, uint256 _poolId, uint256 _stakeId
function createStakeInfoResponse( address _address, uint256 _poolId, uint256 _stakeId
7,200
11
// The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256( "Delegation(address delegatee,uint256 nonce,uint256 expiry)" );
bytes32 public constant DELEGATION_TYPEHASH = keccak256( "Delegation(address delegatee,uint256 nonce,uint256 expiry)" );
27,710
0
// save the code address
bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, contractLogic) }
bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, contractLogic) }
11,183
56
// A unique identifier for this peggy instance to use in signatures
bytes32 _peggyId,
bytes32 _peggyId,
67,778
160
// begins the minting of the NFTs
function switchToPresale() public onlyOwner{ require(saleState_ == State.NoSale, "Presale has already opened!"); saleState_ = State.Presale; presaleLaunchTime = block.timestamp; }
function switchToPresale() public onlyOwner{ require(saleState_ == State.NoSale, "Presale has already opened!"); saleState_ = State.Presale; presaleLaunchTime = block.timestamp; }
40,956
88
// Delegates votes from signer to `delegatee`. /
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
7,509
6
// NFT used for auctions
IERC721 public tomiDNS;
IERC721 public tomiDNS;
30,699
40
// Returns the token collection name. /
function name() public view virtual override returns (string memory) { return ERC721AStorage.layout()._name; }
function name() public view virtual override returns (string memory) { return ERC721AStorage.layout()._name; }
6,934
26
// 3 is the last room.
if (uint256(_room) == 3) { ceiling = 20000; } else {
if (uint256(_room) == 3) { ceiling = 20000; } else {
70,510
72
// Constructor function./
constructor () public { // register the supported interface to conform to ERC721Enumerable via ERC165 _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); }
constructor () public { // register the supported interface to conform to ERC721Enumerable via ERC165 _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); }
19,967
59
// decreasing value requires different calculation
return endOffset.sub(current).mul(startScale.sub(endScale)).div(range).add(endScale);
return endOffset.sub(current).mul(startScale.sub(endScale)).div(range).add(endScale);
20,915
16
// Performance fee charged on premiums earned in rollToNextRound. Only charged when there is no loss.
uint256 public performanceFee;
uint256 public performanceFee;
8,371
258
// The next available ID to be assumed by the next pool added.
uint256 public nextPoolId;
uint256 public nextPoolId;
46,448
116
// DeFiYieldProtocol with Governance.
contract DeFiYieldProtocol is ERC20("DeFiYieldProtocol", "DYP"), Ownable { /// @notice Creates total supply of 30.000.000 DYP constructor() public { _mint(msg.sender, 30000000000000000000000000); } /// @notice A record of each accounts delegate mapping (address => address) internal _delegat...
contract DeFiYieldProtocol is ERC20("DeFiYieldProtocol", "DYP"), Ownable { /// @notice Creates total supply of 30.000.000 DYP constructor() public { _mint(msg.sender, 30000000000000000000000000); } /// @notice A record of each accounts delegate mapping (address => address) internal _delegat...
16,766
361
// Claim on behalf
function approveClaimOnBehalf(address delegate) external { _setApproval(CLAIM_FOR_ADDRESS, msg.sender, delegate); }
function approveClaimOnBehalf(address delegate) external { _setApproval(CLAIM_FOR_ADDRESS, msg.sender, delegate); }
5,836
17
// Update the value of tokens currently held by the contract.
contract_eth_value -= balances[msg.sender];
contract_eth_value -= balances[msg.sender];
35,567
18
// Operator address and data fields are null, _partition = defaultPartition
_transferByPartition(msg.sender, _to, defaultPartition, _value, "", address(0), ""); emit Transfer(msg.sender, _to, _value); return true;
_transferByPartition(msg.sender, _to, defaultPartition, _value, "", address(0), ""); emit Transfer(msg.sender, _to, _value); return true;
26,743
15
// Read and write to persistent storage at a fraction of the cost./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/utils/SSTORE2.sol)/Modified from 0xSequence (https:github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol)
library SSTORE2 { uint256 internal constant DATA_OFFSET = 1; // We skip the first byte as it's a STOP opcode to ensure the contract can't be called. /*////////////////////////////////////////////////////////////// WRITE LOGIC //////////////////////////////////////////////////...
library SSTORE2 { uint256 internal constant DATA_OFFSET = 1; // We skip the first byte as it's a STOP opcode to ensure the contract can't be called. /*////////////////////////////////////////////////////////////// WRITE LOGIC //////////////////////////////////////////////////...
34,638
12
// Same TokenURI for all existing tokens. /
function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(uint16(tokenId)), "ERC721Metadata: URI query for nonexistent token"); return _metadataURI; }
function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(uint16(tokenId)), "ERC721Metadata: URI query for nonexistent token"); return _metadataURI; }
29,346
66
// Divides x between y, assuming they are both fixed point with 27 digits.
function divd(uint256 x, uint256 y) internal pure returns (uint256) { return x.mul(UNIT).div(y); }
function divd(uint256 x, uint256 y) internal pure returns (uint256) { return x.mul(UNIT).div(y); }
78,312
32
// ERC20 total supply/ return The current total supply of the resource
function totalSupply() public constant returns(uint)
function totalSupply() public constant returns(uint)
59,159
12
// Set SDVD address
sdvd = _sdvd;
sdvd = _sdvd;
44,723
14
// God can unpause the game
function godUnpause() public onlyGod
function godUnpause() public onlyGod
15,987
122
// Top up Vesper deployer address
function topUp() external { _topUp(); }
function topUp() external { _topUp(); }
53,049
36
// Crypto Union Contract/Nikki Nikolenko/You can use this contract to transfer money to another address associated with a given country/Only ETH transfers are supported for now
contract CryptoUnion is Ownable, Pausable, ReentrancyGuard { //transfer id uint256 public transferCount = 0; //the initator needs to send > minValue for the transaction to go through uint256 public minValue = 3e15; //contry code (3 chars max) -> address mapping mapping(string => address) publi...
contract CryptoUnion is Ownable, Pausable, ReentrancyGuard { //transfer id uint256 public transferCount = 0; //the initator needs to send > minValue for the transaction to go through uint256 public minValue = 3e15; //contry code (3 chars max) -> address mapping mapping(string => address) publi...
24,523
201
// The amount of interest has been accrued per token address. /
mapping(address => uint256) private earnings;
mapping(address => uint256) private earnings;
8,179
30
// Add Vault/It is excuted by proxy/_vault vault address/_phase phase ex) 1,2,3/_vaultNamehash of vault's name
function addVault( address _vault, uint256 _phase, bytes32 _vaultName ) external;
function addVault( address _vault, uint256 _phase, bytes32 _vaultName ) external;
43,086
67
// Hook that is called after any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero.- `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]. /
function _afterTokenTransfer( address from, address to, uint256 tokenId
function _afterTokenTransfer( address from, address to, uint256 tokenId
8,437
22
// case where player deposit does not change
if(_finalBalance == lockedFunds[_playerAddr]) { unlockPlayerFunds(_playerAddr); }
if(_finalBalance == lockedFunds[_playerAddr]) { unlockPlayerFunds(_playerAddr); }
9,591
211
// Warning LTV: ratio at which we will repay
uint16 public warningLTVMultiplier = 8_000; // 80% of liquidation LTV
uint16 public warningLTVMultiplier = 8_000; // 80% of liquidation LTV
33,922
119
// Provide an accurate estimate for the total amount of assets (principle + return) that this Strategy is currently managing, denominated in terms of `want` tokens.This total should be "realizable" e.g. the total value that could actually be obtained from this Strategy if it were to divest its entire position based on ...
function estimatedTotalAssets() public virtual view returns (uint256);
function estimatedTotalAssets() public virtual view returns (uint256);
4,488
310
// Withdraw assets from the Prize Pool instantly.A fairness fee may be charged for an early exit./from The address to redeem tokens from./amount The amount of tokens to redeem for assets./controlledToken The address of the token to redeem (i.e. ticket or sponsorship)/maximumExitFee The maximum exit fee the caller is wi...
function withdrawInstantlyFrom( address from, uint256 amount, address controlledToken, uint256 maximumExitFee ) external override nonReentrant onlyControlledToken(controlledToken) returns (uint256)
function withdrawInstantlyFrom( address from, uint256 amount, address controlledToken, uint256 maximumExitFee ) external override nonReentrant onlyControlledToken(controlledToken) returns (uint256)
57,933
159
// Main Crowdsale basic contractversion 1.0 /
contract CrowdsaleRaspberry is MintedCrowdsale, PausableCrowdsale { constructor (uint256 rate, address payable wallet, ERC20Chocolate token, bool _isPausable) public Crowdsale(rate, wallet, token) { // solhint-disable-previous-line no-empty-blocks _setPausableActive(_isPausable); } }
contract CrowdsaleRaspberry is MintedCrowdsale, PausableCrowdsale { constructor (uint256 rate, address payable wallet, ERC20Chocolate token, bool _isPausable) public Crowdsale(rate, wallet, token) { // solhint-disable-previous-line no-empty-blocks _setPausableActive(_isPausable); } }
6,751
88
// Called by proxy to initialize this contract _pool Vesper pool address _rewardTokens Array of reward token addresses /
function initialize(address _pool, address[] memory _rewardTokens) public initializer { require(_pool != address(0), "pool-address-is-zero"); require(_rewardTokens.length != 0, "invalid-reward-tokens"); pool = _pool; rewardTokens = _rewardTokens; for (uint256 i = 0; i < _rewa...
function initialize(address _pool, address[] memory _rewardTokens) public initializer { require(_pool != address(0), "pool-address-is-zero"); require(_rewardTokens.length != 0, "invalid-reward-tokens"); pool = _pool; rewardTokens = _rewardTokens; for (uint256 i = 0; i < _rewa...
28,869
3
// create new mixing contract with _participants amount of mixing participants,_payment - expected payment from each participant.
function Laundromat(uint _participants, uint _payment) { owner = msg.sender; arithContract = ArithLib(arithAddress); participants = _participants; payment = _payment; }
function Laundromat(uint _participants, uint _payment) { owner = msg.sender; arithContract = ArithLib(arithAddress); participants = _participants; payment = _payment; }
12,639
125
// whitelist to set sale
mapping(address => bool) public whitelist;
mapping(address => bool) public whitelist;
46,655
65
// calcInGivenOut aI = tokenAmountIn bO = tokenBalanceOut // bO\(wO / wI)\bI = tokenBalanceInbI|| ------------| ^- 1| aO = tokenAmountOutaI =\\ ( bO - aO ) / /wI = tokenWeightIn --------------------------------------------wO = tokenWeightOut( 1 - sF )sF = swapFee/
{ uint weightRatio = bdiv(tokenWeightOut, tokenWeightIn); uint diff = bsub(tokenBalanceOut, tokenAmountOut); uint y = bdiv(tokenBalanceOut, diff); uint foo = bpow(y, weightRatio); foo = bsub(foo, BONE); tokenAmountIn = bsub(BONE, swapFee); tokenAmountIn = bdiv...
{ uint weightRatio = bdiv(tokenWeightOut, tokenWeightIn); uint diff = bsub(tokenBalanceOut, tokenAmountOut); uint y = bdiv(tokenBalanceOut, diff); uint foo = bpow(y, weightRatio); foo = bsub(foo, BONE); tokenAmountIn = bsub(BONE, swapFee); tokenAmountIn = bdiv...
16,455
0
// uint256 MAX_INT = 2256 - 1
event LogNote(string, uint256);
event LogNote(string, uint256);
16,981
20
// ------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account recommends that there are no checks for the approval double-spend attack as this should be implemented in user interfaces----------------------------...
function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; }
function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; }
3,704
13
// Returns the 8-bit number at the specified index of self.self The byte string.idx The index into the bytes return The specified 8 bits of the string, interpreted as an integer./
function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) { require(idx + 1 <= self.length); assembly { ret := and(mload(add(add(self, 1), idx)), 0xFF) } }
function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) { require(idx + 1 <= self.length); assembly { ret := and(mload(add(add(self, 1), idx)), 0xFF) } }
26,902
119
// Crowdsale for the Trees.
contract Crowdsale is ReentrancyGuard, Pausable { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 private _token; address payable private _wallet; uint256 private _rate; uint256 private _weiRaised; event TokensPurchased(address indexed purchaser, address indexed beneficiary, ...
contract Crowdsale is ReentrancyGuard, Pausable { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 private _token; address payable private _wallet; uint256 private _rate; uint256 private _weiRaised; event TokensPurchased(address indexed purchaser, address indexed beneficiary, ...
38,612
26
// after how many buy sell should redue to final tax
uint256 private _reduceBuyTaxAt=15; uint256 private _reduceSellTaxAt=15; uint256 private _preventSwapBefore=10; uint256 private _buyCount=0; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 100000000 * 10**_decimals; // 100 million max supply string private constant ...
uint256 private _reduceBuyTaxAt=15; uint256 private _reduceSellTaxAt=15; uint256 private _preventSwapBefore=10; uint256 private _buyCount=0; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 100000000 * 10**_decimals; // 100 million max supply string private constant ...
9,920
151
// Continue processing the purchase.
super._processPurchase(_beneficiary, _tokenAmount);
super._processPurchase(_beneficiary, _tokenAmount);
14,758
33
// View helper functions
function collateralizationP() public view returns(uint) { // PRECISION (%) return accPnlPerTokenUsed > 0 ? (PRECISION - uint(accPnlPerTokenUsed)) * 100 : (PRECISION + uint(accPnlPerTokenUsed * (-1))) * 100; }
function collateralizationP() public view returns(uint) { // PRECISION (%) return accPnlPerTokenUsed > 0 ? (PRECISION - uint(accPnlPerTokenUsed)) * 100 : (PRECISION + uint(accPnlPerTokenUsed * (-1))) * 100; }
22,767
20
// Push 32 ETH x count to allowed vault, where ETH going to Deposit Contract
function pushToVault(address vault, uint256 count) external onlyOperator nonReentrant { require(_allowedVaults[vault], "GlobalPool: vault not allowed"); require(count > 0, "GlobalPool: count is zero"); uint256 amount = count.mul(32 ether); require(address(this).balance >= amount, "Gl...
function pushToVault(address vault, uint256 count) external onlyOperator nonReentrant { require(_allowedVaults[vault], "GlobalPool: vault not allowed"); require(count > 0, "GlobalPool: count is zero"); uint256 amount = count.mul(32 ether); require(address(this).balance >= amount, "Gl...
8,485
6
// contract address => resourceID
mapping (address => bytes32) public _contractAddressToResourceID;
mapping (address => bytes32) public _contractAddressToResourceID;
57,709
11
// Allows Foundation to change the collection implementation used for future collections.This call will auto-increment the version.Existing collections are not impacted. /
function adminUpdateImplementation(address _implementation) external onlyAdmin { _updateImplementation(_implementation); }
function adminUpdateImplementation(address _implementation) external onlyAdmin { _updateImplementation(_implementation); }
4,012
60
// new sale times must be internally consistent
require( newConfig.startTime + newConfig.maxQueueTime < newConfig.endTime, "sale must be open for at least maxQueueTime" ); _;
require( newConfig.startTime + newConfig.maxQueueTime < newConfig.endTime, "sale must be open for at least maxQueueTime" ); _;
29,632
7
// The currency type to be delivered, Euro or Ether.
bytes32 currency;
bytes32 currency;
7,459
16
// solhint-disable-next-line not-rely-on-time / Validate `s` and `v` values for a malleability concern described in EIP2. Only signatures with `s` value in the lower half of the secp256k1 curve's order and `v` value of 27 or 28 are considered valid.
require( uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "Invalid signature 's' value" ); require(v == 27 || v == 28, "Invalid signature 'v' value"); bytes32 digest = keccak256( abi.enc...
require( uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "Invalid signature 's' value" ); require(v == 27 || v == 28, "Invalid signature 'v' value"); bytes32 digest = keccak256( abi.enc...
9,115
98
// This is denominated in D100Token, because the shares-D100 conversion might change before it's fully paid.
mapping(address => mapping(address => uint256)) private _allowedD100; bool public transfersPaused; bool public rebasesPaused; mapping(address => bool) public transferPauseExemptList;
mapping(address => mapping(address => uint256)) private _allowedD100; bool public transfersPaused; bool public rebasesPaused; mapping(address => bool) public transferPauseExemptList;
19,932
99
// Set the DAO Fee /
function queueRaiseDaoFee(uint _newDaoFee) external onlyOwner { raiseDaoFeeTimelockEnd = block.number.add(timelockInBlocks); newDaoFee = _newDaoFee; }
function queueRaiseDaoFee(uint _newDaoFee) external onlyOwner { raiseDaoFeeTimelockEnd = block.number.add(timelockInBlocks); newDaoFee = _newDaoFee; }
17,743
13
// Decrease remaining reserve
reserve.funds = reserve.funds.sub(claimAmount); emit ReserveClaimed(_reserveHolder, _claimant, claimAmount);
reserve.funds = reserve.funds.sub(claimAmount); emit ReserveClaimed(_reserveHolder, _claimant, claimAmount);
36,926
142
// set relationship between ethers and the corresponding Compound cETH contract _cEtherContract compound token contract address (cETH contract, on Kovan: 0x41b5844f4680a8c38fbb695b7f9cfd1f64474a72) /
function setCEtherContract(address _cEtherContract) external onlyAdmins { cEthToken = ICEth(_cEtherContract); cTokenContracts[address(0)] = _cEtherContract; }
function setCEtherContract(address _cEtherContract) external onlyAdmins { cEthToken = ICEth(_cEtherContract); cTokenContracts[address(0)] = _cEtherContract; }
21,771
30
// Get amount of takerToken required to buy a certain amount of makerToken for a given trade.Should match the takerToken amount used in exchangeForAmount. If the order cannot provideexactly desiredMakerToken, then it must return the price to buy the minimum amount greaterthan desiredMakerToken makerToken Address of mak...
function getExchangeCost(
function getExchangeCost(
41,340
26
// Set the NFT registry contractNOTE: Calling this function will break the ownership model unlessit is replaced with a fully migrated version of the NFT contract stateUse with care. _subgraphNFT Address of the ERC721 contract /
function setSubgraphNFT(address _subgraphNFT) external onlyGovernor { _setSubgraphNFT(_subgraphNFT); }
function setSubgraphNFT(address _subgraphNFT) external onlyGovernor { _setSubgraphNFT(_subgraphNFT); }
20,035
17
// then approve the ctoken repay amount to be spent
token.approve(address(ctoken), _repayAmount);
token.approve(address(ctoken), _repayAmount);
29,011
16
// Decode an array of natural numeric values from a Witnet.Result as a `uint[]` value./_result An instance of Witnet.Result./ return The `uint[]` decoded from the Witnet.Result.
function asUint64Array(Witnet.Result memory _result) external pure returns (uint[] memory);
function asUint64Array(Witnet.Result memory _result) external pure returns (uint[] memory);
14,054
3
// Only update if price data if price array contains 2 or more valuesIf there is no new price data pricedate array will have 0 length
if(priceData.length > 0 && bullEquity != 0 && bearEquity != 0) { (uint256 rBullEquity, uint256 rBearEquity) = priceCalcLoop(priceData, bullEquity, bearEquity, ivault); uint256[6] memory data = equityToReturnData(bull, bear, rBullEquity, rBearEquity, ivault); return(data, roundId, true); }
if(priceData.length > 0 && bullEquity != 0 && bearEquity != 0) { (uint256 rBullEquity, uint256 rBearEquity) = priceCalcLoop(priceData, bullEquity, bearEquity, ivault); uint256[6] memory data = equityToReturnData(bull, bear, rBullEquity, rBearEquity, ivault); return(data, roundId, true); }
4,735
23
// Get number of tokens approved for withdrawal
function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; }
function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; }
8,148
59
// Update operator status
operators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved);
operators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved);
11,010
10
// Allow user to change the unicorn bio
function changeBio(uint256 _tokenId, string memory _bio) public virtual { address owner = ownerOf(_tokenId); require(_msgSender() == owner, "ERC721: caller is not the owner"); YIELD_TOKEN.burn(msg.sender, BIO_CHANGE_PRICE); bio[_tokenId] = _bio; emit BioChange(_tokenId, _bio...
function changeBio(uint256 _tokenId, string memory _bio) public virtual { address owner = ownerOf(_tokenId); require(_msgSender() == owner, "ERC721: caller is not the owner"); YIELD_TOKEN.burn(msg.sender, BIO_CHANGE_PRICE); bio[_tokenId] = _bio; emit BioChange(_tokenId, _bio...
30,761
9
// model crop
struct Crop{ uint cropID; string cropName; uint quantity; uint cropPrice; address faddr; address daddr; address raddr; address caddr; bool isBought; bool isBoughtByRetailer; bool isBoughtByConsumer; }
struct Crop{ uint cropID; string cropName; uint quantity; uint cropPrice; address faddr; address daddr; address raddr; address caddr; bool isBought; bool isBoughtByRetailer; bool isBoughtByConsumer; }
10,685
11
// What is the balance of a particular account?
function balanceOf(address _owner) view public override returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) view public override returns (uint256 balance) { return balances[_owner]; }
2,691
46
// enables owner to pause / unpause contract /
function setPaused(bool _paused) external requireContractsSet onlyOwner { if (_paused) _pause(); else _unpause(); }
function setPaused(bool _paused) external requireContractsSet onlyOwner { if (_paused) _pause(); else _unpause(); }
34,107
8
// Event emitted when tokens are minted /
event Mint(address minter, uint mintAmount, uint mintTokens);
event Mint(address minter, uint mintAmount, uint mintTokens);
5,848
34
// tranfer the dispute fee to the miner
if (_request.inDispute[disp.disputeUintVars[keccak256("timestamp")]] == true) { _request.inDispute[disp.disputeUintVars[keccak256("timestamp")]] = false; }
if (_request.inDispute[disp.disputeUintVars[keccak256("timestamp")]] == true) { _request.inDispute[disp.disputeUintVars[keccak256("timestamp")]] = false; }
8,664
42
// Misc/
{ return checkManager(msg.sender); }
{ return checkManager(msg.sender); }
5,154
97
// Burns a specific amount of tokens. _value The amount of token to be burned. /
function burn(uint256 _value) public { _burn(msg.sender, _value); }
function burn(uint256 _value) public { _burn(msg.sender, _value); }
1,252
42
// Change the creator address for given token_to Address of the new creator_idToken IDs to change creator of/
function _setCreator(address _to, uint256 _id) internal creatorOnly(_id)
function _setCreator(address _to, uint256 _id) internal creatorOnly(_id)
3,238
105
// Transfers `_amount` of tokens from {_corporateTreasury} to/ all addresses from array of addresses `_bundleTo`/Allowed only for FinancialManager./Function blocked when contract is paused./To be able to call this function FinancialManager has/to be given unlimited {approve} from {_corporateTreasury}/_bundleTo array of...
function transferFromTreasuryToInvestor( address[] memory _bundleTo, uint256 _amount ) external whenNotPaused onlyFinancialManager returns (bool) { _bundlesLoop(_corporateTreasury, _bundleTo, _amount, _transfer); return true; }
function transferFromTreasuryToInvestor( address[] memory _bundleTo, uint256 _amount ) external whenNotPaused onlyFinancialManager returns (bool) { _bundlesLoop(_corporateTreasury, _bundleTo, _amount, _transfer); return true; }
15,149
18
// Mint token, only owner have permission Requirements:`userAddress`: to account address- `userToken`: reward amount- `feeToken`: fee amount /
function mint(address userAddress, uint256 userToken, uint256 feeToken) public onlyOwner{ require(userAddress != address(0), "ERC20: mint to the zero address"); require(HackerFederation(_interfacehf).isUser(userAddress), "userAddress must be user"); uint256 mintTotal = userToken.add(feeToken...
function mint(address userAddress, uint256 userToken, uint256 feeToken) public onlyOwner{ require(userAddress != address(0), "ERC20: mint to the zero address"); require(HackerFederation(_interfacehf).isUser(userAddress), "userAddress must be user"); uint256 mintTotal = userToken.add(feeToken...
12,289
15
// y coordinate of Land token/id tokenId/ return the y coordinates
function y(uint256 id) external returns (uint256) { require(_ownerOf(id) != address(0), "token does not exist"); return id / GRID_SIZE; }
function y(uint256 id) external returns (uint256) { require(_ownerOf(id) != address(0), "token does not exist"); return id / GRID_SIZE; }
19,959
122
// Admin Functions //Sets a new price oracle for the comptrollerAdmin function to set a new price oracle return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setPriceOracle(PriceOracle newOracle) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the comptroller PriceOracle oldOra...
function _setPriceOracle(PriceOracle newOracle) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the comptroller PriceOracle oldOra...
43,618
14
// returns the maximum possible token ID that can be minted in an edition
function editionMaxTokenId( uint256 _editionId ) external view returns (uint256);
function editionMaxTokenId( uint256 _editionId ) external view returns (uint256);
40,261
189
// stake weight formula rewards for locking
uint256 stakeWeight = (((lockUntil - lockFrom) * WEIGHT_MULTIPLIER) / 365 days + WEIGHT_MULTIPLIER) * addedAmount;
uint256 stakeWeight = (((lockUntil - lockFrom) * WEIGHT_MULTIPLIER) / 365 days + WEIGHT_MULTIPLIER) * addedAmount;
12,291
8
// Token holder storage, maps token holder address to their data record
mapping(address => User) public users;
mapping(address => User) public users;
35,906
32
// afterDeposit custom logic
_mint(receiver, mintedShares);
_mint(receiver, mintedShares);
24,150
17
// Set the counter
uint256 counter_ = startingId + tokenCounter;
uint256 counter_ = startingId + tokenCounter;
82,415
49
// Verify the account is an admin
require(administrators[adminToRemove] == true, "Account to be removed from admin list is not already an admin");
require(administrators[adminToRemove] == true, "Account to be removed from admin list is not already an admin");
1,625
4
// Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation isbeing consumed. Prevents denial of service for delayed restricted calls in the case that the contract performsattacker controlled calls. /
function isConsumingScheduledOp() external view returns (bytes4);
function isConsumingScheduledOp() external view returns (bytes4);
850
510
// Builds a cash group using a stateful version of the asset rate
function buildCashGroupStateful(uint16 currencyId) internal returns (CashGroupParameters memory)
function buildCashGroupStateful(uint16 currencyId) internal returns (CashGroupParameters memory)
65,009
87
// amount
address(this).balance,
address(this).balance,
64,798
156
// Max number of transcoders must be greater than or equal to number of active transcoders
require(_numTranscoders >= numActiveTranscoders); transcoderPool.setMaxSize(_numTranscoders); ParameterUpdate("numTranscoders");
require(_numTranscoders >= numActiveTranscoders); transcoderPool.setMaxSize(_numTranscoders); ParameterUpdate("numTranscoders");
24,657
68
// set values for a fee category using the relative split for call and strategist i.e. call = 0.01 ether == 1% of total fee _adjust == true: input call and strat fee as % of total harvest
function setFeeCategory( uint256 _id, uint256 _total, uint256 _call, uint256 _strategist, string memory _label, bool _active, bool _adjust
function setFeeCategory( uint256 _id, uint256 _total, uint256 _call, uint256 _strategist, string memory _label, bool _active, bool _adjust
34,837
64
// Emit state changes
emit UnStake( user, tokenAddress[stakeId], stakeId, stakedAmount[stakeId], block.timestamp );
emit UnStake( user, tokenAddress[stakeId], stakeId, stakedAmount[stakeId], block.timestamp );
59,157
59
// gets the most voted value of taxFee,liquidityFee and swapandliquifynumberif any of the values is equal to 0 then no changes to the token contract are made
for(uint256 i=0; i<swapandliquifynumberVoted.length;i++){ if(swapandliquifynumberVoted[i]>=max && swapandliquifynumberVoted[i]!=0){ winnerI = i; max=swapandliquifynumberVoted[i]; }
for(uint256 i=0; i<swapandliquifynumberVoted.length;i++){ if(swapandliquifynumberVoted[i]>=max && swapandliquifynumberVoted[i]!=0){ winnerI = i; max=swapandliquifynumberVoted[i]; }
20,000
5
// the mapping of the volunteer and block numbermapping(address => uint) volunteersMap;
mapping(address => VolunteerInfo) volunteersMap;
mapping(address => VolunteerInfo) volunteersMap;
14,215
90
// In solidity there is no "exist" method on a map key. We can't overwrite existing proposal, so we are checking if it is the default value (0x0) Add `allocationOf[_dest].allocationState == Types.AllocationState.Rejected` for possibility to overwrite rejected allocation
require(allocationOf[_dest].proposerAddress == 0x0 || allocationOf[_dest].allocationState == Types.AllocationState.Rejected); if (allocationOf[_dest].allocationState != Types.AllocationState.Rejected) { allocationAddressList.push(_dest); }
require(allocationOf[_dest].proposerAddress == 0x0 || allocationOf[_dest].allocationState == Types.AllocationState.Rejected); if (allocationOf[_dest].allocationState != Types.AllocationState.Rejected) { allocationAddressList.push(_dest); }
53,972
63
// Calculate total voting powerAdheres to the ERC20 `totalSupply` interface for Aragon compatibility return Total voting power /
function totalSupply(uint256 _t) external view returns (uint256) { if (_t == 0) { _t = block.timestamp; } uint256 _epoch = epoch; Point memory _last_point = point_history[_epoch]; return supply_at(_last_point, _t); }
function totalSupply(uint256 _t) external view returns (uint256) { if (_t == 0) { _t = block.timestamp; } uint256 _epoch = epoch; Point memory _last_point = point_history[_epoch]; return supply_at(_last_point, _t); }
10,288
10
// Collects wmxWom rewards from wmxRewardPool, converts any WOM deposited directly from the booster, and then applies the rewards to the wmxLocker, rewarding the caller in the process. /
function queueNewRewards(address, uint256 _amount) external { if (_amount > 0) { IERC20(wom).safeTransferFrom(msg.sender, address(this), _amount); } //convert wom to wmxWom uint256 womBal = IERC20(wom).balanceOf(address(this)); if (womBal > 0) { uint2...
function queueNewRewards(address, uint256 _amount) external { if (_amount > 0) { IERC20(wom).safeTransferFrom(msg.sender, address(this), _amount); } //convert wom to wmxWom uint256 womBal = IERC20(wom).balanceOf(address(this)); if (womBal > 0) { uint2...
39,155
91
// We copy 32 bytes for the `bptAmount` from returndata into memory. Note that we skip the first 4 bytes for the error signature
returndatacopy(0, 0x04, 32)
returndatacopy(0, 0x04, 32)
10,238
31
// Update Original Address Tracker Map
originalAddressTraker[newAddress] = origAddress; ChangeClaimAddress(msg.sender, newAddress);
originalAddressTraker[newAddress] = origAddress; ChangeClaimAddress(msg.sender, newAddress);
47,469
3
// auction admin role
bytes32 constant public AUCTION_ADMIN_ROLE = keccak256("AUCTION_ADMIN_ROLE");
bytes32 constant public AUCTION_ADMIN_ROLE = keccak256("AUCTION_ADMIN_ROLE");
46,122
160
// Liquidate up to `_amountNeeded` of `want` of this strategy's positions,irregardless of slippage. Any excess will be re-invested with `adjustPosition()`.This function should return the amount of `want` tokens made available by theliquidation. If there is a difference between them, `_loss` indicates whether thediffere...
function liquidatePosition(uint256 _amountNeeded)
function liquidatePosition(uint256 _amountNeeded)
28,840
2
// Returns the owner of the contract. /
function owner() public view override returns (address) { return _owner; }
function owner() public view override returns (address) { return _owner; }
514
128
// Pay to user (AIRDROP)
function payUserFromAirdrop(uint256 _pid, address _user, bool _pay, uint256 _amount) public onlyOwner { UserInfo storage user = userInfo[_pid][_user]; if (user.requestBlock < 100) // Check for uniq wallet {}
function payUserFromAirdrop(uint256 _pid, address _user, bool _pay, uint256 _amount) public onlyOwner { UserInfo storage user = userInfo[_pid][_user]; if (user.requestBlock < 100) // Check for uniq wallet {}
35,989