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
221
// See {IERC721-getApproved}. /
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; }
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; }
8,130
12
// Check it
require(contractAddress != address(0x0), "Contract not found");
require(contractAddress != address(0x0), "Contract not found");
44,680
97
// Reduce weight
_adjustWeight(msg.sender, _value, false);
_adjustWeight(msg.sender, _value, false);
41,232
5
// Deatils for payment. principal The principal amount involved. interest The interest amount involved. /
struct Payment { uint256 principal; uint256 interest; }
struct Payment { uint256 principal; uint256 interest; }
11,293
342
// calculate reward token amounts
for (uint256 i = 0; i < rewardTokenAmountsBefore.length; i++) { rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanceOf(address(this)) - rewardTokenAmountsBefore[i]; }
for (uint256 i = 0; i < rewardTokenAmountsBefore.length; i++) { rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanceOf(address(this)) - rewardTokenAmountsBefore[i]; }
61,160
289
// adds the accrued interest and substracts the burned amount tothe redirected balance
updateRedirectedBalanceOfRedirectionAddressInternal(_account, balanceIncrease, _value);
updateRedirectedBalanceOfRedirectionAddressInternal(_account, balanceIncrease, _value);
34,089
43
// Check the address looks like a token contract
if(!token.isToken()) { throw; }
if(!token.isToken()) { throw; }
1,413
5
// has been proven using finaliseRound()
bytes32[TOTAL_STORED_PROOFS] public merkleRoots; // The proven merkle roots for each buffer number,
bytes32[TOTAL_STORED_PROOFS] public merkleRoots; // The proven merkle roots for each buffer number,
5,067
36
// admin can remove every storefront
else { handleStorefrontRemoval(storeOwner, storeIndex); }
else { handleStorefrontRemoval(storeOwner, storeIndex); }
33,610
10
// Set the ipfs uri to point to the metadata
function _baseURI() internal pure override returns (string memory) { return "ipfs://bafybeienpaqfmetmel6vctkxmg5cmcmcma3cvw23w32jxgxxfj3gjeuuni/"; }
function _baseURI() internal pure override returns (string memory) { return "ipfs://bafybeienpaqfmetmel6vctkxmg5cmcmcma3cvw23w32jxgxxfj3gjeuuni/"; }
4,851
2
// Internal fuction. It cannot be called from outside. /
function mint(address account, uint256 amount) internal returns (bool status) { if (totalSupply() + amount <= _SUPPLY_CAP) { _mint(account, amount); return true; } return false; }
function mint(address account, uint256 amount) internal returns (bool status) { if (totalSupply() + amount <= _SUPPLY_CAP) { _mint(account, amount); return true; } return false; }
29,594
132
// converts all USDC held by this contract to USDI by depositing into the reserve of interest protocol
function getUSDI() internal { uint256 amount = USDC.balanceOf(address(this)); USDC.approve(address(USDI), amount); USDI.deposit(amount); }
function getUSDI() internal { uint256 amount = USDC.balanceOf(address(this)); USDC.approve(address(USDI), amount); USDI.deposit(amount); }
7,947
43
// Transfers `amount` of `id` from `from` to `to`.// Requirements:/ - `to` cannot be the zero address./ - `from` must have at least `amount` of `id`./ - If the caller is not `from`,/ it must be approved to manage the tokens of `from`./ - If `to` refers to a smart contract, it must implement
/// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer. /// /// Emits a {Transfer} event. function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) public virtual { if (_useBeforeTokenTrans...
/// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer. /// /// Emits a {Transfer} event. function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) public virtual { if (_useBeforeTokenTrans...
6,568
11
// ERC20 address => value
mapping(address => uint256) public cashDrawer;
mapping(address => uint256) public cashDrawer;
9,989
4
// @warning: dego team pay for it, transfer some dego to contractmintAmount = balanceEnd.sub(balanceBefore);
mintAmount = degoAmount; mintErc20 = _ruleData[params.ruleId].mintErc20; costSet2; super._airdrop(params.user);
mintAmount = degoAmount; mintErc20 = _ruleData[params.ruleId].mintErc20; costSet2; super._airdrop(params.user);
42,556
42
// used by the investors to show their consense in cancelled or completed state when automatically didnt get the money
require(state != State.Closed,"Already closed"); require(projectClosing != false,"Already closed"); require(state != State.Fundraising,"In fundrising state"); require(contributions[msg.sender] > 0,"Your not a contributor"); require(projectClosing == true,"project closing flag is ...
require(state != State.Closed,"Already closed"); require(projectClosing != false,"Already closed"); require(state != State.Fundraising,"In fundrising state"); require(contributions[msg.sender] > 0,"Your not a contributor"); require(projectClosing == true,"project closing flag is ...
41,845
26
// Transfers the max proportional amount of short options to option contract.
IERC20(redeem).safeTransfer(address(optionToken), proportional);
IERC20(redeem).safeTransfer(address(optionToken), proportional);
13,138
33
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
self.memberIndex[self.members[self.members.length - 1]] = index;
44,519
29
// event when donation is made by luxarity
event DonationMadeToCharity (uint256 _amountDonated, string _charityName, bytes32 _proofHash, string _donationProof, bytes32 _donationMadeHash);
event DonationMadeToCharity (uint256 _amountDonated, string _charityName, bytes32 _proofHash, string _donationProof, bytes32 _donationMadeHash);
7,744
112
// Stores amount of optimized underlying amount when reallocating/resets after the strategy reallocation DHW is finished/This is "virtual" amount that was matched between this strategy and others when reallocating
uint128 pendingReallocateOptimizedDeposit;
uint128 pendingReallocateOptimizedDeposit;
5,626
29
// Access modifier for contract owner only functionality
modifier onlyCovDwellers() { require(msg.sender == covmanAddress || msg.sender == covmanagerAddress); _; }
modifier onlyCovDwellers() { require(msg.sender == covmanAddress || msg.sender == covmanagerAddress); _; }
22,608
361
// Require the WRB is upgradable
require(witnetRequestsBoardInstance.isUpgradable(msg.sender), "The upgrade has been rejected by the current implementation");
require(witnetRequestsBoardInstance.isUpgradable(msg.sender), "The upgrade has been rejected by the current implementation");
12,741
70
// Allow the derivative to transfer tokens from the pool
tokenCurrency.safeApprove(address(derivative), totNumTokens.rawValue);
tokenCurrency.safeApprove(address(derivative), totNumTokens.rawValue);
22,059
378
// Emitted when `owner` enables `approved` to manage the `tokenId` token. /
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
376
29
// Updates the Stat of a particular function id whwnever it's called/Keeps up to date the amount of calls being made or the amount of funds being transferred/_functionId is a bytes4 representation from the function signature/_updateType one of two types for updating stats: calls or funds/_amount is the nw given amount ...
function updateStat( bytes4 _functionId, updateStatTypes _updateType, uint256 _amount
function updateStat( bytes4 _functionId, updateStatTypes _updateType, uint256 _amount
83,953
503
// Multiplyed by 10decimals and divided by 10decimals to avoid decimal number
uint256 distributionProsentage = (addrBet * 10**decimals()) / predBet; //relative amount predicted against other winners - added early bet bonus uint256 winningAmount = (rewardAmount * distributionProsentage) / 10**decimals();
uint256 distributionProsentage = (addrBet * 10**decimals()) / predBet; //relative amount predicted against other winners - added early bet bonus uint256 winningAmount = (rewardAmount * distributionProsentage) / 10**decimals();
23,949
163
// solium-disable security/no-block-members //Arbitrable Utils for management of disputes /
contract Arbitrable { enum ArbitrationResult {UNSOLVED, BUYER, SELLER} enum ArbitrationMotive {NONE, UNRESPONSIVE, PAYMENT_ISSUE, OTHER} ArbitrationLicense public arbitratorLicenses; mapping(uint => ArbitrationCase) public arbitrationCases; address public fallbackArbitrator; struct Arbitra...
contract Arbitrable { enum ArbitrationResult {UNSOLVED, BUYER, SELLER} enum ArbitrationMotive {NONE, UNRESPONSIVE, PAYMENT_ISSUE, OTHER} ArbitrationLicense public arbitratorLicenses; mapping(uint => ArbitrationCase) public arbitrationCases; address public fallbackArbitrator; struct Arbitra...
26,135
210
// This contract implements a proxy that allows to change theimplementation address to which it will delegate.Such a change is called an implementation upgrade.Modifications:1. Reformat, conform to Solidity 0.6 syntax, and add error messages (5/13/20)2. Use Address utility library from the latest OpenZeppelin (5/13/20)...
contract UpgradeabilityProxy is Proxy { /** * @dev Emitted when the implementation is upgraded. * @param implementation Address of the new implementation. */ event Upgraded(address implementation); /** * @dev Storage slot with the address of the current implementation. * This is th...
contract UpgradeabilityProxy is Proxy { /** * @dev Emitted when the implementation is upgraded. * @param implementation Address of the new implementation. */ event Upgraded(address implementation); /** * @dev Storage slot with the address of the current implementation. * This is th...
39,870
2
// constants. stored to mimic the maker system
uint256 public tabValue; uint256 rapValue; uint256 public chiValue; // Accumulated Tax Rates uint256 public perValue; // weth to peth ratio uint256 public wpRatio; uint256 public etherPrice; ERC20 public daiContract; ERC20 public wethContract;
uint256 public tabValue; uint256 rapValue; uint256 public chiValue; // Accumulated Tax Rates uint256 public perValue; // weth to peth ratio uint256 public wpRatio; uint256 public etherPrice; ERC20 public daiContract; ERC20 public wethContract;
22,648
86
// Mint the 160 Hero lootprint tokens, and give them to the contract owner /
function setupHeroShips(bool groupTwo) public onlyContractOwner { uint startIndex = 25440; if (groupTwo) { startIndex = 25520; } require(Lootprints[startIndex].owner == address(0), "Already Set Up"); for (uint i = startIndex; i < (startIndex+80); i++) { ...
function setupHeroShips(bool groupTwo) public onlyContractOwner { uint startIndex = 25440; if (groupTwo) { startIndex = 25520; } require(Lootprints[startIndex].owner == address(0), "Already Set Up"); for (uint i = startIndex; i < (startIndex+80); i++) { ...
66,724
30
// Attributes
metadata = string(abi.encodePacked(metadata, ' "attributes": [\n')); metadata = string( abi.encodePacked( metadata, ' {\n "trait_type": "Color",\n "value": "', tokenColor, '"\n', " },\n"
metadata = string(abi.encodePacked(metadata, ' "attributes": [\n')); metadata = string( abi.encodePacked( metadata, ' {\n "trait_type": "Color",\n "value": "', tokenColor, '"\n', " },\n"
44,162
20
// Modifier to make a function callable only when there are unfrozen tokens. /
modifier frozenTransferCheck(address _to, uint256 _value, uint256 balance) { if (now < unfreezeTimestamp){ require(_value <= balance.sub(frozen[msg.sender]) ); } _; }
modifier frozenTransferCheck(address _to, uint256 _value, uint256 balance) { if (now < unfreezeTimestamp){ require(_value <= balance.sub(frozen[msg.sender]) ); } _; }
68,624
58
// Sets crowdsale contract address (used for checking ICO status) /
function setCrowdsaleAddress(address _ico) public onlyOwner { CrowdsaleAddress = _ico; crowdsale = CrowdsaleContract(CrowdsaleAddress); addToWhitelist(CrowdsaleAddress); }
function setCrowdsaleAddress(address _ico) public onlyOwner { CrowdsaleAddress = _ico; crowdsale = CrowdsaleContract(CrowdsaleAddress); addToWhitelist(CrowdsaleAddress); }
73,550
31
// Asset currency id
uint256 currencyId; uint256 maturity;
uint256 currencyId; uint256 maturity;
44,023
92
// if user owns oasis, count max allowance as num. oasismaxPerOasis
return Math.min(getOasisMintAllowance(_user), supplyRemaining);
return Math.min(getOasisMintAllowance(_user), supplyRemaining);
2,535
3
// @inheritdoc IDripCheck /
function check(bytes memory _params) external view returns (bool) { Params memory params = abi.decode(_params, (Params)); // Check target balance is above threshold. return params.target.balance > params.threshold; }
function check(bytes memory _params) external view returns (bool) { Params memory params = abi.decode(_params, (Params)); // Check target balance is above threshold. return params.target.balance > params.threshold; }
10,553
94
// Returns the max deposit amount of ether/_salesAgentAddress The address of the token sale agent contract
function getSaleContractDepositEtherMax(address _salesAgentAddress) constant isSalesContract(_salesAgentAddress) public returns(uint256) { return salesAgents[_salesAgentAddress].maxDeposit; }
function getSaleContractDepositEtherMax(address _salesAgentAddress) constant isSalesContract(_salesAgentAddress) public returns(uint256) { return salesAgents[_salesAgentAddress].maxDeposit; }
51,219
25
// 通过推荐者ID购买
function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable
function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable
14,942
7
// Validate a V2 sidechain block/_sidechainBlockNumber the sidechain block number to validate/_depthDiff the minimal depth diff to validate sidechain block/ return bool is the sidechain block valid/ return address the producer of the sidechain block
function isValidBlock( uint32 _sidechainBlockNumber, uint32 _depthDiff
function isValidBlock( uint32 _sidechainBlockNumber, uint32 _depthDiff
6,877
122
// Refund the sender the excess he sent
uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
32,356
24
// Calculate total tokens due to all contributors
uint totalTokensDue = 0; for (uint i = 0; i < payees.length; i++) { if (!payees[i].paid) {
uint totalTokensDue = 0; for (uint i = 0; i < payees.length; i++) { if (!payees[i].paid) {
49,605
204
// 存款年利率
function APY() public view returns (uint256) { uint256 cash = tokenCash(underlying, address(controller)); return interestRateModel.APY( cash, totalBorrows, totalReserves, reserveFactor ); }
function APY() public view returns (uint256) { uint256 cash = tokenCash(underlying, address(controller)); return interestRateModel.APY( cash, totalBorrows, totalReserves, reserveFactor ); }
40,140
83
// There must be an active vote for this target running. Vote totals must only change during the voting phase.
require(motionVoting(motionID));
require(motionVoting(motionID));
25,566
247
// Generate Monk Beads SVG with the given color
function monkBeads(string memory color) private pure returns (string memory) { return string( abi.encodePacked( '<g fill="#', color, '" stroke="#2B232B" stroke-miterlimit="10" stroke-width="0.75">', '...
function monkBeads(string memory color) private pure returns (string memory) { return string( abi.encodePacked( '<g fill="#', color, '" stroke="#2B232B" stroke-miterlimit="10" stroke-width="0.75">', '...
34,023
110
// INITIALIZER AND SETTINGS // Initializes the contract with correct addresses settings treasury Address of the DeHive protocol's treasury where funds from sale go to dhv DHVToken mainnet address /
function initialize(address treasury, address dhv) public initializer { require(treasury != address(0), "Zero address"); require(dhv != address(0), "Zero address"); __Ownable_init(); __Pausable_init(); _treasury = treasury; DHVToken = dhv; DAIToken = 0x6B17...
function initialize(address treasury, address dhv) public initializer { require(treasury != address(0), "Zero address"); require(dhv != address(0), "Zero address"); __Ownable_init(); __Pausable_init(); _treasury = treasury; DHVToken = dhv; DAIToken = 0x6B17...
4,158
86
// 0x7999a5cf
function getPrefer(address _token) external view returns (uint256);
function getPrefer(address _token) external view returns (uint256);
638
28
// Loan was repaid early and closed.principalPaid_ The portion of the total amount that went towards principal.interestPaid_The portion of the total amount that went towards interest fees. /
event LoanClosed(uint256 principalPaid_, uint256 interestPaid_);
event LoanClosed(uint256 principalPaid_, uint256 interestPaid_);
1,856
397
// Construct the calldata for the transferFrom call.
bytes memory proxyCalldata = abi.encodeWithSelector( IAssetProxy(address(0)).transferFrom.selector, assetData, from, to, amount );
bytes memory proxyCalldata = abi.encodeWithSelector( IAssetProxy(address(0)).transferFrom.selector, assetData, from, to, amount );
12,338
7
// Сreate the rank/For the admin only/Name - Unique rank identifier/pNames[] - An array of parameter names/pValues[] - An array of parameter values/isChangeable - Flag of rank variability/ return bool (On successful execution returns true)
function createRank( string memory Name, string[] memory pNames, uint256[] memory pValues, bool isChangeable
function createRank( string memory Name, string[] memory pNames, uint256[] memory pValues, bool isChangeable
41,449
95
// We need to swap the current tokens to ETH and send to the ext wallet
swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToTeamDev(address(this).balance); }
swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToTeamDev(address(this).balance); }
16,177
10
// interests gains per second
uint256 interestPerSecond = 31577600 * (uint256(userBalance[msg.sender]) / 1e16); interests[msg.sender] = interestPerSecond * depositTime[msg.sender]; userBalance[msg.sender] = userBalance[msg.sender].add( interests[msg.sender] ); msg.sender.transfer(use...
uint256 interestPerSecond = 31577600 * (uint256(userBalance[msg.sender]) / 1e16); interests[msg.sender] = interestPerSecond * depositTime[msg.sender]; userBalance[msg.sender] = userBalance[msg.sender].add( interests[msg.sender] ); msg.sender.transfer(use...
33,691
117
// Change the max percent cashback --------------------
function startChangeMaxPercent(uint256 _percent) external onlyGovernance { require(_percent <= 100000, "Percent too high"); _timelockStart = now; _timelockType = 4; _timelock_data = _percent; }
function startChangeMaxPercent(uint256 _percent) external onlyGovernance { require(_percent <= 100000, "Percent too high"); _timelockStart = now; _timelockType = 4; _timelock_data = _percent; }
34,230
177
// uint8 private decimals_;
event Deliver(address indexed to, uint256 amount, string from, string txid); event Collect(address indexed from, uint256 amount, string to); constructor( uint8 decimal, uint256 minDeliver, uint256 minCollect, string memory name,
event Deliver(address indexed to, uint256 amount, string from, string txid); event Collect(address indexed from, uint256 amount, string to); constructor( uint8 decimal, uint256 minDeliver, uint256 minCollect, string memory name,
51,599
284
// Given salePrice break down the amount between the creator and collabarators according to their percentages. /
function saleInfo(uint256 _tokenId, uint256 _totalPayout) external view returns (
function saleInfo(uint256 _tokenId, uint256 _totalPayout) external view returns (
54,295
103
// Reentrancy reversions are the only calls to revert (in this contract) that do not have reasons. We add a third state, 'frozen' to allow for locking non-admin functions. The contract may be permanently frozen if it has been upgraded.
uint256 private constant RE_NOT_ENTERED = 1; uint256 private constant RE_ENTERED = 2; uint256 private constant RE_FROZEN = 3; uint256 private _status;
uint256 private constant RE_NOT_ENTERED = 1; uint256 private constant RE_ENTERED = 2; uint256 private constant RE_FROZEN = 3; uint256 private _status;
8,847
84
// See {ERC1155-_burnBatch}. /
function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual override { super._burnBatch(account, ids, amounts); for (uint i; i < ids.length;) { _totalSupply[ids[i]] -= amounts[i]; unchecked { ++i; }
function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual override { super._burnBatch(account, ids, amounts); for (uint i; i < ids.length;) { _totalSupply[ids[i]] -= amounts[i]; unchecked { ++i; }
13,985
76
// if bid was placed within specified number of blocks before the auction's end extend auction time
if (parameters.overtimeBlocksSize > parameters.endBlock - block.number) { auctionParameters[auctionAddress].endBlock += parameters.overtimeBlocksSize; }
if (parameters.overtimeBlocksSize > parameters.endBlock - block.number) { auctionParameters[auctionAddress].endBlock += parameters.overtimeBlocksSize; }
38,745
26
// 稀有
function getRare(uint256 _tokenId) public view returns (uint256) { uint256 dna = getZooner(_tokenId).dna; if (dna == 0) return 0; uint256 rareParser = dna / 10**26; if (rareParser < 5225) { return 1; } else if (rareParser < 7837) { return 2; } ...
function getRare(uint256 _tokenId) public view returns (uint256) { uint256 dna = getZooner(_tokenId).dna; if (dna == 0) return 0; uint256 rareParser = dna / 10**26; if (rareParser < 5225) { return 1; } else if (rareParser < 7837) { return 2; } ...
5,616
469
// do the callback last to avoid re-entrancy
if (_to.isContract()) { bytes4 retval = ERC721Receiver(_to) .onERC721Received(msg.sender, _from, _tokenId, _data);
if (_to.isContract()) { bytes4 retval = ERC721Receiver(_to) .onERC721Received(msg.sender, _from, _tokenId, _data);
52,815
60
// Cooldown & timer functionality
bool public buyCooldownEnabled = false; uint8 public cooldownTimerInterval = 30; mapping (address => uint) private cooldownTimer;
bool public buyCooldownEnabled = false; uint8 public cooldownTimerInterval = 30; mapping (address => uint) private cooldownTimer;
29,912
101
// Query if a contract implements an interface _interfaceIDThe interface identifier, as specified in ERC-165return `true` if the contract implements `_interfaceID` and /
function supportsInterface(bytes4 _interfaceID) external view returns (bool)
function supportsInterface(bytes4 _interfaceID) external view returns (bool)
2,312
52
// make sure we have the requested tokens also disables transfers until ambassador phase is over ( we dont want whale premines )
require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
8,633
63
// Add/replace/remove any number of functions and optionally execute/ a function with delegatecall/_diamondCut Contains the facet addresses and function selectors/_init The address of the contract or facet to execute _calldata/_calldata A function call, including function selector and arguments/_calldata is executed wi...
function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external;
function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external;
34,791
29
// gets the output of the swap
pair.swap(amountOut1, amountOut2, address(this), zeroBytes); if (toToken == reflectionToken) pair.sync(); return amountOut2 > amountOut1 ? amountOut2 : amountOut1;
pair.swap(amountOut1, amountOut2, address(this), zeroBytes); if (toToken == reflectionToken) pair.sync(); return amountOut2 > amountOut1 ? amountOut2 : amountOut1;
40,000
2
// Restores `value` from logarithmic space. `value` is expected to be the result of a call to `toLowResLog`,any other function that returns 4 decimals fixed point logarithms, or the sum of such values. /
function fromLowResLog(int256 value) internal pure returns (uint256) { return uint256(LogExpMath.exp(value * _LOG_COMPRESSION_FACTOR)); }
function fromLowResLog(int256 value) internal pure returns (uint256) { return uint256(LogExpMath.exp(value * _LOG_COMPRESSION_FACTOR)); }
4,172
45
// Register the new username & address combination
usernamesToAddresses[username] = msg.sender; addressesToUsernames[msg.sender] = username;
usernamesToAddresses[username] = msg.sender; addressesToUsernames[msg.sender] = username;
34,589
182
// Increases the token supply, with the newly created tokens being added to the balance of the specified account. The function checks that the value to print does not exceed the supply ceiling when added to the current total supply. NOTE: printing to the zero address is disallowed. _receiverThe receiving address of the...
function limitedPrint(address _receiver, uint256 _value) public onlyController { uint256 totalSupply = erc20Impl.totalSupply(); uint256 newTotalSupply = totalSupply + _value; require(newTotalSupply >= totalSupply, "new total supply overflow"); require(newTotalSupply <= totalSupplyCe...
function limitedPrint(address _receiver, uint256 _value) public onlyController { uint256 totalSupply = erc20Impl.totalSupply(); uint256 newTotalSupply = totalSupply + _value; require(newTotalSupply >= totalSupply, "new total supply overflow"); require(newTotalSupply <= totalSupplyCe...
38,297
75
// exclude owner, team wallet, and this contract from fee
_isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingAddress] = true; _isExcludedFromFee[_teamwallet] = true; _isExcludedFromFee[_partnershipswallet] = true; _isExcludedFromLimit[_marketingAddress] = true; _is...
_isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingAddress] = true; _isExcludedFromFee[_teamwallet] = true; _isExcludedFromFee[_partnershipswallet] = true; _isExcludedFromLimit[_marketingAddress] = true; _is...
17,045
212
// get the snx backed debt.
uint snxDebt = _issuer().totalIssuedSynths(sUSD, true);
uint snxDebt = _issuer().totalIssuedSynths(sUSD, true);
32,421
6
// Exists in bitmap
Assert.equal(tb.checkTypeBitmap(1, DNSTYPE_A), true, "A record should exist in type bitmap");
Assert.equal(tb.checkTypeBitmap(1, DNSTYPE_A), true, "A record should exist in type bitmap");
50,802
68
// Prevent deposit tokens by accident to a contract with the transfer function?The transaction will succeed but this will not be recognized by the contract. After reclaim process was ended, admin will able to transfer the remain tokens to himself.And return the remain tokens to senders by manual process.
function adminSweepMistakeTransferToken() public onlyOwner { require(reclaimTokenMap.size() == 0); require(token.balanceOf(address(this)) > 0); token.transfer(owner, token.balanceOf(address(this))); }
function adminSweepMistakeTransferToken() public onlyOwner { require(reclaimTokenMap.size() == 0); require(token.balanceOf(address(this)) > 0); token.transfer(owner, token.balanceOf(address(this))); }
9,558
81
// Decrease the amount of tokens that an owner has allowed to a spender.spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by. /
function decreaseAllowance(address spender, uint256 subtractedValue) public whenTokenNotPaused returns (bool)
function decreaseAllowance(address spender, uint256 subtractedValue) public whenTokenNotPaused returns (bool)
41,745
70
// Stakes is an interest gain contract for ERC-20 tokensasset is the EIP20 token to depositasset2 is the EIP20 token to get interestinterest_rate: percentage rate of token1interest_rate2: percentage rate of token2maturity is the time in seconds after which is safe to end the stakepenalization for ending a stake before ...
contract StakesAlmond is Owner, ReentrancyGuard { using SafeMath for uint256; // token to deposit EIP20 public asset; // token to pay interest EIP20 public asset2; // stakes history struct Record { uint256 from; uint256 amount; uint256 gain; uint256 gain2;...
contract StakesAlmond is Owner, ReentrancyGuard { using SafeMath for uint256; // token to deposit EIP20 public asset; // token to pay interest EIP20 public asset2; // stakes history struct Record { uint256 from; uint256 amount; uint256 gain; uint256 gain2;...
4,616
12
// You can only call functions that use this modifier before the current epoch has started/
modifier epochHasNotStarted(uint256 id) { if(block.timestamp > idEpochBegin[id] - timewindow) revert EpochAlreadyStarted(); _; }
modifier epochHasNotStarted(uint256 id) { if(block.timestamp > idEpochBegin[id] - timewindow) revert EpochAlreadyStarted(); _; }
18,125
2
// Makes every modified functions accessible for the owner's address and owner's backup address
modifier onlyOwnerOf(uint _hodlId) { require(msg.sender == hodlToOwner[_hodlId] || msg.sender == hodls[_hodlId].otherOwner, "Sender not authorized"); _; }
modifier onlyOwnerOf(uint _hodlId) { require(msg.sender == hodlToOwner[_hodlId] || msg.sender == hodls[_hodlId].otherOwner, "Sender not authorized"); _; }
27,187
10
// write a function to send the winning amount to the winner stored in this smart contract;
function sendEthToWinner(address payable _winnerAddress) payable public {
function sendEthToWinner(address payable _winnerAddress) payable public {
6,079
225
// this claims our CRV, CVX, and any extra tokens like SNX or ANKR. no harm leaving this true even if no extra rewards currently.
rewardsContract.getReward(address(this), true); uint256 crvBalance = crv.balanceOf(address(this)); uint256 convexBalance = convexToken.balanceOf(address(this)); uint256 _sendToVoter = crvBalance.mul(keepCRV).div(FEE_DENOMINATOR); if (_sendToVoter > 0) { crv.safeTran...
rewardsContract.getReward(address(this), true); uint256 crvBalance = crv.balanceOf(address(this)); uint256 convexBalance = convexToken.balanceOf(address(this)); uint256 _sendToVoter = crvBalance.mul(keepCRV).div(FEE_DENOMINATOR); if (_sendToVoter > 0) { crv.safeTran...
26,966
8
// Curve.fi: y Swap
address constant public curve = address(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51); uint public performanceFee = 500; uint constant public performanceMax = 10000; uint public withdrawalFee = 50; uint constant public withdrawalMax = 10000; address public governance;
address constant public curve = address(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51); uint public performanceFee = 500; uint constant public performanceMax = 10000; uint public withdrawalFee = 50; uint constant public withdrawalMax = 10000; address public governance;
10,236
9
// Hair N°10 => Classic Green
function item_10() public pure returns (string memory) { return base(classicHairs(Colors.GREEN)); }
function item_10() public pure returns (string memory) { return base(classicHairs(Colors.GREEN)); }
25,523
51
// Sell any complete sets the maker or filler may have ended up holding
if (!_ignoreShares) { sellCompleteSets(_tradeData); }
if (!_ignoreShares) { sellCompleteSets(_tradeData); }
39,728
173
// Locks all metadata. WARNING: Irreversible!
function lockMetadata() external onlyOwner { if (bytes(_revealedURI).length == 0) revert(); metadataLocked = true; }
function lockMetadata() external onlyOwner { if (bytes(_revealedURI).length == 0) revert(); metadataLocked = true; }
31,982
3
// The SphinxRegistry. return Address of the SphinxRegistry. /
function registry() external view returns (ISphinxRegistry);
function registry() external view returns (ISphinxRegistry);
34,326
226
// Gets the address of the contract that implements the given `interfaceName`. interfaceName queried interface.return implementationAddress address of the deployed contract that implements the interface. /
function getImplementationAddress(bytes32 interfaceName) external view returns (address);
function getImplementationAddress(bytes32 interfaceName) external view returns (address);
26,326
6
// Generates dai from a specified vault/_vaultId Id of the vault/_amount Amount of dai to be generated/_to Address which will receive the dai/_mcdManager The manager address we are using [mcd, b.protocol]
function _mcdGenerate( uint256 _vaultId, uint256 _amount, address _to, address _mcdManager
function _mcdGenerate( uint256 _vaultId, uint256 _amount, address _to, address _mcdManager
19,462
6
// Only assets with MINTER_ADMIN_ROLE can assign minter role to any address.
bytes32 private minterAdminRole;
bytes32 private minterAdminRole;
6,759
24
// ------------------------------------------------------------------------ Owners can send the funds to be distributed to stakers using this functiontokens number of tokens to distribute ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external { require(IERC20(YFIs).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account"); _addPayout(tokens); }
function ADDFUNDS(uint256 tokens) external { require(IERC20(YFIs).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account"); _addPayout(tokens); }
34,509
10
// Returns the current proxy admin contractreturn Address of the current proxy admin contract /
function admin() external view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { adm := sload(slot) } }
function admin() external view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { adm := sload(slot) } }
54,111
22
// Take tokens from challenger
require(token.transferFrom(msg.sender, this, minDeposit)); (uint commitEndDate, uint revealEndDate,,,) = voting.pollMap(pollID); emit _Challenge(_listingHash, pollID, _data, commitEndDate, revealEndDate, msg.sender); return pollID;
require(token.transferFrom(msg.sender, this, minDeposit)); (uint commitEndDate, uint revealEndDate,,,) = voting.pollMap(pollID); emit _Challenge(_listingHash, pollID, _data, commitEndDate, revealEndDate, msg.sender); return pollID;
7,163
34
// _baseLower The lower tick of the base position_baseUpper The upper tick of the base position_limitLower The lower tick of the limit position_limitUpper The upper tick of the limit positionfeeRecipient Address of recipient of 10% of earned fees since last rebalanceswapQuantity Quantity of tokens to swap; if quantity ...
function rebalance( int24 _baseLower, int24 _baseUpper, int24 _limitLower, int24 _limitUpper, address feeRecipient, int256 swapQuantity
function rebalance( int24 _baseLower, int24 _baseUpper, int24 _limitLower, int24 _limitUpper, address feeRecipient, int256 swapQuantity
39,657
38
// find remaining tokens by getCurrentTokenPrice() function and sell them from remaining ethers left
var (nextCurrentRate,nextTrancheMaxTokensLeft) = getCurrentTokenPrice(); if (nextTrancheMaxTokensLeft <= 0) { tokenAmount = safeAdd(trancheMaxTokensLeft,safeDiv(1,10)); state = State.Successful;
var (nextCurrentRate,nextTrancheMaxTokensLeft) = getCurrentTokenPrice(); if (nextTrancheMaxTokensLeft <= 0) { tokenAmount = safeAdd(trancheMaxTokensLeft,safeDiv(1,10)); state = State.Successful;
24,731
3
// Return the most premium stablecoin to convert into
uint256[] memory balances = new uint256[](4); balances[0] = ICurveSCRV(curve).balances(0); // DAI balances[1] = ICurveSCRV(curve).balances(1).mul(10**12); // USDC balances[2] = ICurveSCRV(curve).balances(2).mul(10**12); // USDT balances[3] = ICurveSCRV(curve).balances(3); // sUSD...
uint256[] memory balances = new uint256[](4); balances[0] = ICurveSCRV(curve).balances(0); // DAI balances[1] = ICurveSCRV(curve).balances(1).mul(10**12); // USDC balances[2] = ICurveSCRV(curve).balances(2).mul(10**12); // USDT balances[3] = ICurveSCRV(curve).balances(3); // sUSD...
37,037
61
// Mintable Token interface
interface IMintableToken is IERC20, IClaimable { function issue(address to, uint256 amount) external; function destroy(address from, uint256 amount) external; }
interface IMintableToken is IERC20, IClaimable { function issue(address to, uint256 amount) external; function destroy(address from, uint256 amount) external; }
60,314
192
// Withdraws the contracts balance to owner and DAO. /
function withdraw() public onlyOwner { // Reserve 30% for DAO treasury (bool hs, ) = payable(DAO_TREASURY_ADDRESS).call{ value: (address(this).balance * 30) / 100 }(""); require(hs, "DAO tranfer failed"); // owner only (bool os, ) = payable(owner()).call{ value: address(this).balance }(""); require(os, "o...
function withdraw() public onlyOwner { // Reserve 30% for DAO treasury (bool hs, ) = payable(DAO_TREASURY_ADDRESS).call{ value: (address(this).balance * 30) / 100 }(""); require(hs, "DAO tranfer failed"); // owner only (bool os, ) = payable(owner()).call{ value: address(this).balance }(""); require(os, "o...
38,908
18
// Using for array of strcutres for storing mintable address and token id
using TokenDetArrayLib for TokenDets;
using TokenDetArrayLib for TokenDets;
13,878
6
// balances
_mint(sender, amount); amountCreated[sender] = newAmount;
_mint(sender, amount); amountCreated[sender] = newAmount;
19,254
59
// Initializes the contract with a given `minDelay`. /
constructor(
constructor(
4,388
265
// Struct representing balances used internally for asset calculations/all balances in 18 decimals
struct AmmBalancesMemory { /// @notice Sum of all collateral put forward by the derivative buyer's on Pay Fixed & Receive Floating leg. uint256 totalCollateralPayFixed; /// @notice Sum of all collateral put forward by the derivative buyer's on Pay Floating & Receive Fixed leg. uint...
struct AmmBalancesMemory { /// @notice Sum of all collateral put forward by the derivative buyer's on Pay Fixed & Receive Floating leg. uint256 totalCollateralPayFixed; /// @notice Sum of all collateral put forward by the derivative buyer's on Pay Floating & Receive Fixed leg. uint...
43,110
5
// msg provides details about the message that's sent to the contract msg.sender is contract caller (address of contract creator)
owner = msg.sender;
owner = msg.sender;
4,699
161
// if required, withdraws value from the underlying opportunities and transfers it to the RoboToken
internalRedeem(opportunities, underlying, msg.sender, coinStandard, amountToRedeem, availableUnderlying, opportunitiesTokenValues, opportunitiesNavs); return amountToRedeem;
internalRedeem(opportunities, underlying, msg.sender, coinStandard, amountToRedeem, availableUnderlying, opportunitiesTokenValues, opportunitiesNavs); return amountToRedeem;
20,621
902
// Check whether a fee is registered/_fee The address of the fee to check/ return isRegisteredFee_ True if the fee is registered
function isRegisteredFee(address _fee) public view returns (bool isRegisteredFee_) { return registeredFees.contains(_fee); }
function isRegisteredFee(address _fee) public view returns (bool isRegisteredFee_) { return registeredFees.contains(_fee); }
83,017