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
45
// Assert that the implementation was set properly.
vm.prank(alice); address impl = proxy.implementation(); assertEq(impl, address(clasher));
vm.prank(alice); address impl = proxy.implementation(); assertEq(impl, address(clasher));
42,333
9
// Gets current max wallet percentage based on elapsed time/ return Current max wallet percentage
function _currentMaxWalletPercentage( uint256 elapsed
function _currentMaxWalletPercentage( uint256 elapsed
8,818
39
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
196
13
// Getter of the current `_allocationRatio`return The `_allocationRatio` array /
function getAllocationRatio() external view returns (uint16[3] memory);
function getAllocationRatio() external view returns (uint16[3] memory);
79,111
13
// Get the current token count/ return the created token count
function tokenCount() public view returns (uint256) { return _tokenCount.current(); }
function tokenCount() public view returns (uint256) { return _tokenCount.current(); }
37,650
3
// Store value in array _id, _idTransactionton, _evento, _message/
function addEvent(uint _id, string memory _idTransaction, string memory _evento, string memory _message) public ownerOnly { eventsArray[_id].push(Event(_id, _idTransaction, _evento, _message)); }
function addEvent(uint _id, string memory _idTransaction, string memory _evento, string memory _message) public ownerOnly { eventsArray[_id].push(Event(_id, _idTransaction, _evento, _message)); }
18,170
120
// data setup
address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); uint256 _referralBonus = SafeMath.div(_undividedDividends, 3); uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus); uint256 _taxedEthereum = Safe...
address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); uint256 _referralBonus = SafeMath.div(_undividedDividends, 3); uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus); uint256 _taxedEthereum = Safe...
29,633
40
// Retrieve all contracts that msg.sender is either broker, client or owner for /
function getMyPolicies() public view returns (address[]) { return policiesByParticipant[msg.sender]; }
function getMyPolicies() public view returns (address[]) { return policiesByParticipant[msg.sender]; }
19,025
42
// View functions returning the combined ratefrom aave supply APY and wiseLending borrow APYof a pool. /
function getLendingRate( address _underlyingAssert ) external view returns (uint256)
function getLendingRate( address _underlyingAssert ) external view returns (uint256)
15,829
50
// flag is true, update interest, reward all handlers
marketManager.applyInterestHandlers(userAddr, _handlerID, flag);
marketManager.applyInterestHandlers(userAddr, _handlerID, flag);
13,947
169
// send the percentage of funds to a shareholder´s wallet
function _withdraw(address payable account, uint256 amount) internal { (bool sent, ) = account.call{value: amount}(""); require(sent, "Failed to send Ether"); }
function _withdraw(address payable account, uint256 amount) internal { (bool sent, ) = account.call{value: amount}(""); require(sent, "Failed to send Ether"); }
15,640
129
// In case a new uniswap router version is released
function setUniswapRouter(address _uniswapRouter) public onlyOwner { uniswapRouter = _uniswapRouter; }
function setUniswapRouter(address _uniswapRouter) public onlyOwner { uniswapRouter = _uniswapRouter; }
5,154
1
// solhint-disable const-name-snakecase
uint8 constant public decimals = 18; string constant public name = "0x Protocol Token"; string constant public symbol = "RDX";
uint8 constant public decimals = 18; string constant public name = "0x Protocol Token"; string constant public symbol = "RDX";
20,222
477
// @inheritdoc IHotPotV2FundFactory
address public override immutable WETH9;
address public override immutable WETH9;
61,411
23
// Number of voters that approved should be more thatn 50% voters
require(thisRequest.yesVotes > numberOfDonors /2);
require(thisRequest.yesVotes > numberOfDonors /2);
20,233
44
// Emits a {RoleAdminChanged} event/
function _setRoleAdmin( bytes32 role, bytes32 adminRole )internal virtual { mapping(bytes32=>mixinAccessControl.RoleData) storage mr = mixinAccessControl.storageAccessControl(
function _setRoleAdmin( bytes32 role, bytes32 adminRole )internal virtual { mapping(bytes32=>mixinAccessControl.RoleData) storage mr = mixinAccessControl.storageAccessControl(
31,256
53
// Require registration fee
require(msg.value >= REGISTRATION_FEE, "Registration fee is required"); uint8[3] memory indexes = generateIndexes(msg.sender); oracles[msg.sender] = Oracle({ isRegistered: true, indexes: indexes ...
require(msg.value >= REGISTRATION_FEE, "Registration fee is required"); uint8[3] memory indexes = generateIndexes(msg.sender); oracles[msg.sender] = Oracle({ isRegistered: true, indexes: indexes ...
4,090
36
// Contract Address Locator Holder. Hold a contract address locator, which maps a unique identifier to every contract address in the system. Any contract which inherits from this contract can retrieve the address of any contract in the system. Thus, any contract can remain "oblivious" to the replacement of any other co...
contract ContractAddressLocatorHolder { bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource"; bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ; bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ; bytes32 inte...
contract ContractAddressLocatorHolder { bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource"; bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ; bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ; bytes32 inte...
13,605
5
// Usado para detener el contrato (parte de implementación de circuit-breakers)
bool private stopped = false;
bool private stopped = false;
45,051
29
// This wrapper safely handles non-standard ERC-20 tokens that do not return a value./
function doTransferIn(address asset, address from, uint amount) internal returns (Exception) { IERC20NONStandard token = IERC20NONStandard(asset); bool result; // Should we use Helper.safeTransferFrom? require(token.allowance(from, address(this)) >= amount, 'Not enough allowance from...
function doTransferIn(address asset, address from, uint amount) internal returns (Exception) { IERC20NONStandard token = IERC20NONStandard(asset); bool result; // Should we use Helper.safeTransferFrom? require(token.allowance(from, address(this)) >= amount, 'Not enough allowance from...
54,514
120
// Interface for making arbitrary calls during swap
interface IAggregationExecutor { /// @notice Make calls on `msgSender` with specified data function callBytes(address msgSender, bytes calldata data) external payable; // 0x2636f7f8 }
interface IAggregationExecutor { /// @notice Make calls on `msgSender` with specified data function callBytes(address msgSender, bytes calldata data) external payable; // 0x2636f7f8 }
2,863
40
// Since underlyngTokens are WETH, unwrap them then send the ethers to the receiver.
_withdrawEthAndSend(weth, receiver, closeQuantity); return (inputRedeems, inputOptions, outUnderlyings);
_withdrawEthAndSend(weth, receiver, closeQuantity); return (inputRedeems, inputOptions, outUnderlyings);
39,611
75
// Internal function to mint a new tokenReverts if the given token ID already exists to address the beneficiary that will own the minted token tokenId uint256 ID of the token to be minted /
function _mint(address to, uint256 tokenId) internal { super._mint(to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId); }
function _mint(address to, uint256 tokenId) internal { super._mint(to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId); }
22,964
197
// Time of TWAP initialization
uint256 public rebaseActivatedTime; bool public rebasePrepared = false;
uint256 public rebaseActivatedTime; bool public rebasePrepared = false;
28,173
13
// 从 Kitty 合约中获取它的基因
(, , , , , , , , , kittyDna) = kittyContract.getKitty(_kittyId); feedAndMultiply(_zombieId, kittyDna, "kitty");
(, , , , , , , , , kittyDna) = kittyContract.getKitty(_kittyId); feedAndMultiply(_zombieId, kittyDna, "kitty");
41,640
0
// Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encodedfunction call, and allows initializating the storage of the proxy like a Solidity constructor. /
constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _upgradeToAndCall(_logic, _data, false); }
constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _upgradeToAndCall(_logic, _data, false); }
17,779
113
// Returns an URI for a given token ID. Throws if the token ID does not exist. May return an empty string.tokenId uint256 ID of the token to query/
function tokenName(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); //master for static calls BuilderMaster bm = BuilderMaster(masterBuilderContract); uint nifty_type = bm.getNiftyTypeId(tokenId); ...
function tokenName(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); //master for static calls BuilderMaster bm = BuilderMaster(masterBuilderContract); uint nifty_type = bm.getNiftyTypeId(tokenId); ...
5,661
8
// Get all the entities in the directory. /
function getAllEntities() external view
function getAllEntities() external view
7,305
3
// Enables to set halt to true /
function halt() public { haltedRound = getCurrentRound(); haltedQuarter = getCurrentQuarter(); halted = true; emit Halted(haltedRound, haltedQuarter); }
function halt() public { haltedRound = getCurrentRound(); haltedQuarter = getCurrentQuarter(); halted = true; emit Halted(haltedRound, haltedQuarter); }
15,305
28
// set after deployment of Registrar contract
address registrar = 0x5f68698245e8c8949450E68B8BD8acef37faaE7D;
address registrar = 0x5f68698245e8c8949450E68B8BD8acef37faaE7D;
31,776
132
// Calculate the sum of top 5 heroes power a player owns. The gas usage increased with the number of heroes a player owned, roughly 500 x hero count. This is used in transport function only to calculate the required tranport fee. /
function calculateTop5HeroesPower(address _address, uint _dungeonId) public view returns (uint) { uint heroCount = heroTokenContract.balanceOf(_address); if (heroCount == 0) { return 0; } // Get the dungeon difficulty to factor in the super power boost w...
function calculateTop5HeroesPower(address _address, uint _dungeonId) public view returns (uint) { uint heroCount = heroTokenContract.balanceOf(_address); if (heroCount == 0) { return 0; } // Get the dungeon difficulty to factor in the super power boost w...
56,698
185
// Total supply which is counted for distributionsIt only represents already distributed tokens This function should be overloaded to exclude tokens locked in loans /
function distributionTotalSupply() public view returns(uint256){ return totalSupply(); }
function distributionTotalSupply() public view returns(uint256){ return totalSupply(); }
8,748
156
// IERC2981Royalties/Interface for the ERC2981 - Token Royalty standard
interface IERC2981Royalties { /// @notice Called with the sale price to determine how much royalty // is owed and to whom. /// @param _tokenId - the NFT asset queried for royalty information /// @param _value - the sale price of the NFT asset specified by _tokenId /// @return _receiver - ad...
interface IERC2981Royalties { /// @notice Called with the sale price to determine how much royalty // is owed and to whom. /// @param _tokenId - the NFT asset queried for royalty information /// @param _value - the sale price of the NFT asset specified by _tokenId /// @return _receiver - ad...
23,958
30
// Return the total number of tokens. /
function tokenSize() external view returns (uint256) { return tokens.length; }
function tokenSize() external view returns (uint256) { return tokens.length; }
71,208
0
// Global variables: addresses of other contracts to call. These are set at contract initialization and can only be modified by a (timelock) admin// Address of the mmo token contract (this never changes again after initialization) /
address mmoTokenAddress;
address mmoTokenAddress;
38,823
113
// DyDX
address weth_address=0xd0A1E359811322d97991E03f863a0C30C2cF029C; address weth_router=0xd0A1E359811322d97991E03f863a0C30C2cF029C; uint addval=100000000000000000;// ile kredit vzyonc DYDX
address weth_address=0xd0A1E359811322d97991E03f863a0C30C2cF029C; address weth_router=0xd0A1E359811322d97991E03f863a0C30C2cF029C; uint addval=100000000000000000;// ile kredit vzyonc DYDX
5,271
238
// Stacking MUN RESETS the staking time
function stakeMUN(uint256 _amount) public { // Check allowance uint256 allowance = IERC20(mun).allowance(msg.sender, address(this)); require(allowance >= _amount, 'NFTManager: You have to approve the required token amount to stake'); IERC20(mun).transferFrom(msg.sender, address(this)...
function stakeMUN(uint256 _amount) public { // Check allowance uint256 allowance = IERC20(mun).allowance(msg.sender, address(this)); require(allowance >= _amount, 'NFTManager: You have to approve the required token amount to stake'); IERC20(mun).transferFrom(msg.sender, address(this)...
18,876
8
// INuCypherStakingEscrow/Interface for NuCypher StakingEscrow contract
interface INuCypherStakingEscrow { /// @notice Slash the staker's stake and reward the investigator /// @param staker Staker's address /// @param penalty Penalty /// @param investigator Investigator /// @param reward Reward for the investigator function slashStaker( address staker, ...
interface INuCypherStakingEscrow { /// @notice Slash the staker's stake and reward the investigator /// @param staker Staker's address /// @param penalty Penalty /// @param investigator Investigator /// @param reward Reward for the investigator function slashStaker( address staker, ...
2,275
80
// SaleRounds(key) : RoundInfo(value) map Since solidity does not support enum as key of map, converted enum to uint8
mapping(uint8 => RoundInfo) public roundInfos;
mapping(uint8 => RoundInfo) public roundInfos;
29,242
6
// UniDirectionalPayment udp = UniDirectionalPayment(pay);
(bool success,) = pay.call.value(msg.value)(""); require(success, "Failed to send Ether"); userApiStore[_name] = _provableInfoAddress; return _provableInfoAddress;
(bool success,) = pay.call.value(msg.value)(""); require(success, "Failed to send Ether"); userApiStore[_name] = _provableInfoAddress; return _provableInfoAddress;
13,769
239
// Deploys a paymaster contract and deposits WETH, enabling gas relaying
function deployGasRelayPaymaster() external onlyOwnerNotRelayable { require( getGasRelayPaymaster() == address(0), "deployGasRelayPaymaster: Paymaster already deployed" ); bytes memory constructData = abi.encodeWithSignature("init(address)", getVaultProxy()); ...
function deployGasRelayPaymaster() external onlyOwnerNotRelayable { require( getGasRelayPaymaster() == address(0), "deployGasRelayPaymaster: Paymaster already deployed" ); bytes memory constructData = abi.encodeWithSignature("init(address)", getVaultProxy()); ...
31,858
6
// Allows for refunds to take place, rejecting further deposits. /
function enableRefunds() public onlyPrimary { require(_state == State.Active, "RefundEscrow: can only enable refunds while active"); _state = State.Refunding; emit RefundsEnabled(); }
function enableRefunds() public onlyPrimary { require(_state == State.Active, "RefundEscrow: can only enable refunds while active"); _state = State.Refunding; emit RefundsEnabled(); }
3,807
41
// Allows anyone to transfer the SelfPayToken tokens once trading has started _to the recipient address of the tokens. _value number of tokens to be transfered. /
function transfer(address _to, uint _value) hasStartedTrading public returns (bool){ return super.transfer(_to, _value); }
function transfer(address _to, uint _value) hasStartedTrading public returns (bool){ return super.transfer(_to, _value); }
23,762
29
// Implement our derived equation to get the amount of Dai to transfer to the member as ROI
uint256 Bt = _esusuStorage.GetEsusuCycleTotalBeneficiaries(esusuCycleId); uint256 Ta = totalMembers.sub(Bt); uint256 Troi = overallGrossDaiBalance.sub(_esusuStorage.GetEsusuCycleTotalAmountDeposited(esusuCycleId).sub(_esusuStorage.GetEsusuCycleTotalCapitalWithdrawn(esusuCycleId))); uin...
uint256 Bt = _esusuStorage.GetEsusuCycleTotalBeneficiaries(esusuCycleId); uint256 Ta = totalMembers.sub(Bt); uint256 Troi = overallGrossDaiBalance.sub(_esusuStorage.GetEsusuCycleTotalAmountDeposited(esusuCycleId).sub(_esusuStorage.GetEsusuCycleTotalCapitalWithdrawn(esusuCycleId))); uin...
20,968
1
// Mapping from extension name => `Extension` i.e. extension metadata and functions.
mapping(string => IExtension.Extension) extensions;
mapping(string => IExtension.Extension) extensions;
10,207
191
// bcdc.mint(teamAddr, bcdcReward.div(10));bcdc.mint(address(this), bcdcReward);
pool.accBcdcPerShare = pool.accBcdcPerShare.add(bcdcReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
pool.accBcdcPerShare = pool.accBcdcPerShare.add(bcdcReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
2,096
52
// Update reward accrued in iTokens by the holders regardless of paused or not _holders The account to update _iTokens The _iTokens to update /
function updateRewardBatch( address[] memory _holders, address[] memory _iTokens
function updateRewardBatch( address[] memory _holders, address[] memory _iTokens
15,481
28
// 初始分发
totalSupply=INIT_SUPPLY; balances[msg.sender] = INIT_SUPPLY; Transfer(0x0, msg.sender, INIT_SUPPLY);
totalSupply=INIT_SUPPLY; balances[msg.sender] = INIT_SUPPLY; Transfer(0x0, msg.sender, INIT_SUPPLY);
72,029
22
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
_balances[account] += amount;
30,171
38
// sale contract to which we forward funds
iEthealSale public sale; EthealWhitelist public whitelist; event LogDeposited(address indexed beneficiary, uint256 weiAmount, uint256 id); event LogRefunded(address indexed beneficiary, uint256 weiAmount, uint256 id); event LogForwarded(address indexed beneficiary, uint256 weiAmount, uint256 id);
iEthealSale public sale; EthealWhitelist public whitelist; event LogDeposited(address indexed beneficiary, uint256 weiAmount, uint256 id); event LogRefunded(address indexed beneficiary, uint256 weiAmount, uint256 id); event LogForwarded(address indexed beneficiary, uint256 weiAmount, uint256 id);
44,008
8
// Add audit information
function addAudit(bytes32 _codeHash, uint _level, bytes32 _ipfsHash) public { address auditor = msg.sender; require(auditedContracts[auditor][_codeHash].insertedBlock == 0); auditedContracts[auditor][_codeHash] = DS.Proof({ level: _level, auditedBy: auditor, insertedBlock: block.n...
function addAudit(bytes32 _codeHash, uint _level, bytes32 _ipfsHash) public { address auditor = msg.sender; require(auditedContracts[auditor][_codeHash].insertedBlock == 0); auditedContracts[auditor][_codeHash] = DS.Proof({ level: _level, auditedBy: auditor, insertedBlock: block.n...
11,612
2
// A new group has been created -event
event NewGroup(address groupAddress, bytes32 groupName);
event NewGroup(address groupAddress, bytes32 groupName);
47,425
18
// Account contributes by: 1. calling GZE.approve(landRushAddress, tokens) 2. calling this.purchaseWithGze(tokens)
function purchaseWithGze(uint256 tokens) public { require(gzeToken.allowance(msg.sender, this) >= tokens); receiveApproval(msg.sender, tokens, gzeToken, ""); }
function purchaseWithGze(uint256 tokens) public { require(gzeToken.allowance(msg.sender, this) >= tokens); receiveApproval(msg.sender, tokens, gzeToken, ""); }
35,513
513
// Claim all the wpc accrued by holder in all markets holder The address to claim WPC for /
function claimWpc(address holder) public { return claimWpc(holder, comptroller.getAllMarkets()); }
function claimWpc(address holder) public { return claimWpc(holder, comptroller.getAllMarkets()); }
18,555
7
// Clone, register and initialize allowlist
address allowlistAddress = IAllowlistFactory(factoryAddress).cloneAllowlist( originName, protocolOwnerAddress ); allowlistAddressByOriginName[originName] = allowlistAddress;
address allowlistAddress = IAllowlistFactory(factoryAddress).cloneAllowlist( originName, protocolOwnerAddress ); allowlistAddressByOriginName[originName] = allowlistAddress;
56,485
44
// Point the new address to the member id and clean up the old pointer.
addressToMember_[_newMemberAddress] = addressToMember_[msg.sender]; delete addressToMember_[msg.sender];
addressToMember_[_newMemberAddress] = addressToMember_[msg.sender]; delete addressToMember_[msg.sender];
24,983
42
// owner withdraw eth reserved from comissions /
function WithdrawReserve(address tokenAddress) onlyOwner public
function WithdrawReserve(address tokenAddress) onlyOwner public
21,539
1
// Array position not initialized, so use position
indices[index] = totalSize - 1;
indices[index] = totalSize - 1;
51,714
15
// when there is alreay a bonus program with the same bonus token, make sure the program has ended properly
require( bonuses[i].endTime + WEEK < block.timestamp, "BonusRewards: last bonus period hasn't ended" ); require( bonuses[i].remBonus == 0, "BonusRewards: last bonus not all claimed" ...
require( bonuses[i].endTime + WEEK < block.timestamp, "BonusRewards: last bonus period hasn't ended" ); require( bonuses[i].remBonus == 0, "BonusRewards: last bonus not all claimed" ...
19,320
88
// buy ticket
uint tickets = round_[rID_].tickets; uint groups = (tickets + _tickets - 1) / grouptotal_ - tickets / grouptotal_; uint offset = tickets / grouptotal_; if (groups == 0){ if (((tickets + _tickets) % grouptotal_) == 0){ orders[rID_][_pID][offset] = calu...
uint tickets = round_[rID_].tickets; uint groups = (tickets + _tickets - 1) / grouptotal_ - tickets / grouptotal_; uint offset = tickets / grouptotal_; if (groups == 0){ if (((tickets + _tickets) % grouptotal_) == 0){ orders[rID_][_pID][offset] = calu...
42,606
113
// increase total against votes of the proposal
proposal.totalVotesAgainst = proposal.totalVotesAgainst.add(voteAmount);
proposal.totalVotesAgainst = proposal.totalVotesAgainst.add(voteAmount);
19,859
208
// ERC1155 token with pausable token transfers, minting and burning. Useful for scenarios such as preventing trades until the end of an evaluationperiod, or having an emergency switch for freezing all token transfers in theevent of a large bug. _Available since v3.1._ /
abstract contract ERC1155PausableUpgradeable is Initializable, ERC1155Upgradeable, PausableUpgradeable { function __ERC1155Pausable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __Pausable_init_unchained(); __ERC1155Pausable_init_unchained(); ...
abstract contract ERC1155PausableUpgradeable is Initializable, ERC1155Upgradeable, PausableUpgradeable { function __ERC1155Pausable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __Pausable_init_unchained(); __ERC1155Pausable_init_unchained(); ...
38,708
8
// VIEW & PURE FUNCTIONS // Return the stored value of base Swap's virtual price. Ifvalue was updated past BASE_CACHE_EXPIRE_TIME, then read it directlyfrom the base Swap contract. metaSwapStorage MetaSwap struct to read fromreturn base Swap's virtual price /
function _getBaseVirtualPrice(MetaSwap storage metaSwapStorage) internal view returns (uint256)
function _getBaseVirtualPrice(MetaSwap storage metaSwapStorage) internal view returns (uint256)
21,500
1
// 경매 생성 함수
function createAuction(uint _auctionLength, uint _startingPrice) public returns(address)
function createAuction(uint _auctionLength, uint _startingPrice) public returns(address)
36,572
124
// Validates a hash with the `Wallet` signature type./hash Message hash that is signed./signature Proof of signing./ return magicValue `bytes4(0xb0671381)` if the signature check succeeds.
function isValidSignature( bytes32 hash, bytes calldata signature ) external view returns (bytes4 magicValue);
function isValidSignature( bytes32 hash, bytes calldata signature ) external view returns (bytes4 magicValue);
33,069
4
// トークンごとのロックを設定する関数
function lockToken(uint256 _tokenId) external { require(ownerOf(_tokenId) == msg.sender, "Not Owner of Token"); tokenLocks[_tokenId] = true; emit LockStatusChanged(msg.sender, _tokenId, true); }
function lockToken(uint256 _tokenId) external { require(ownerOf(_tokenId) == msg.sender, "Not Owner of Token"); tokenLocks[_tokenId] = true; emit LockStatusChanged(msg.sender, _tokenId, true); }
357
47
// Manual end vested time
function endVesting(address _user) public ownerOnly { vestings[_user].endTime = now; }
function endVesting(address _user) public ownerOnly { vestings[_user].endTime = now; }
2,418
141
// Transfer tokens from one address to another and then execute a callback on recipient. from The address which you want to send tokens from to The address which you want to transfer to value The amount of tokens to be transferred data Additional data with no specified formatreturn A boolean that indicates if the opera...
function transferFromAndCallData(address from, address to, uint256 value, bytes memory data) public override returns (bool) { transferFrom(from, to, value); require(_checkAndCallTransfer(from, to, value, data), "ERC1363: _checkAndCallTransfer reverts"); return true; }
function transferFromAndCallData(address from, address to, uint256 value, bytes memory data) public override returns (bool) { transferFrom(from, to, value); require(_checkAndCallTransfer(from, to, value, data), "ERC1363: _checkAndCallTransfer reverts"); return true; }
21,731
38
// Pays profit (if any) of underlying option owner address of owner tokenId tokenId strike price at which the asset was protected amount principal amount that was protectedreturn profit profit of exercised option /
function _payProfit(address owner, uint tokenId, uint strike, uint amount, uint underlyingCurrentPrice) internal returns (uint profit)
function _payProfit(address owner, uint tokenId, uint strike, uint amount, uint underlyingCurrentPrice) internal returns (uint profit)
39,236
108
// return the address of the primary. /
function primary() public view returns (address) { return _primary; }
function primary() public view returns (address) { return _primary; }
8,378
85
// File: contracts\REFLECT.sol
contract REFLECT is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) pri...
contract REFLECT is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) pri...
24,540
129
// Dev fee - percentage, set to 1%
uint256 public feeDivisor;
uint256 public feeDivisor;
8,555
18
// Account has a local currency cash claim denominated in liquidity tokens. We first extract that here.
( transfer.netLocalCurrencyLiquidator, transfer.netLocalCurrencyPayer, fc.localNetAvailable, localCurrencyRequired ) = _liquidateLocalLiquidityTokens( payer, rateParam.localCurrency, l...
( transfer.netLocalCurrencyLiquidator, transfer.netLocalCurrencyPayer, fc.localNetAvailable, localCurrencyRequired ) = _liquidateLocalLiquidityTokens( payer, rateParam.localCurrency, l...
32,879
1
// We are multiplying here instead of shifting to ensure that harmonicMeanLiquidity doesn't overflow uint128
uint192 secondsAgoX160 = uint192(secondsAgo) * uint160(-1); harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32));
uint192 secondsAgoX160 = uint192(secondsAgo) * uint160(-1); harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32));
20,138
4
// minting function; subject to WL constraints
function mint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable nonReentrant { require(!paused, "Minting on this Contract is currently paused"); uint256 supply = totalToken(); require(_mintAmount > 0, "User must mint at least 1 NFT"); require( _mintAmou...
function mint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable nonReentrant { require(!paused, "Minting on this Contract is currently paused"); uint256 supply = totalToken(); require(_mintAmount > 0, "User must mint at least 1 NFT"); require( _mintAmou...
45,815
8
// agent has not signed up with Byzantic
return 1000;
return 1000;
23,360
4
// Returns the commission amount (mintFee, ownerPerks). /
function commissionByQuantity( address collection, uint256 quantity
function commissionByQuantity( address collection, uint256 quantity
21,526
86
// AirSaveTravelToken /
contract AirSaveTravelTokens is ERC20Freezable, ERC20Pausable, ERC20Burnable { string private constant _name = "AirSaveTravel Tokens"; string private constant _symbol = "ASTC"; uint8 private constant _decimals = 18; /** * @dev AirSaveTravelToken constructor method */ constructor () public...
contract AirSaveTravelTokens is ERC20Freezable, ERC20Pausable, ERC20Burnable { string private constant _name = "AirSaveTravel Tokens"; string private constant _symbol = "ASTC"; uint8 private constant _decimals = 18; /** * @dev AirSaveTravelToken constructor method */ constructor () public...
51,352
90
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); preMigrationTransferrable[owner()] = tru...
excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); preMigrationTransferrable[owner()] = tru...
31,206
198
// Update the given pool's SPUD allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; }
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; }
9,308
53
// send the system coin bid back to the high bidder in case there was at least one bid
safeEngine.transferInternalCoins(address(this), bids[id].highBidder, bids[id].bidAmount);
safeEngine.transferInternalCoins(address(this), bids[id].highBidder, bids[id].bidAmount);
11,695
19
// MigratableHelper contract to support intialization and migration schemes betweendifferent implementations of a contract in the context of upgradeability.To use it, replace the constructor with a function that has the`isInitializer` modifier starting with `"0"` as `migrationId`.When you want to apply some migration c...
contract Migratable { /** * @dev Emitted when the contract applies a migration. * @param contractName Name of the Contract. * @param migrationId Identifier of the migration applied. */ event Migrated(string contractName, string migrationId); /** * @dev Mapping of the already applied migrations. ...
contract Migratable { /** * @dev Emitted when the contract applies a migration. * @param contractName Name of the Contract. * @param migrationId Identifier of the migration applied. */ event Migrated(string contractName, string migrationId); /** * @dev Mapping of the already applied migrations. ...
8,523
117
// RTRAND tokens created per block.
uint256 public RTRANDPerBlock;
uint256 public RTRANDPerBlock;
6,560
54
// This emits when token contract is added /
event TokenAdded(address indexed _token);
event TokenAdded(address indexed _token);
47,978
416
// versionNumber SemVer of Melon protocol version/ofGovernance Address of Melon governance contract/ofMelonAsset Address of Melon asset contract
function Version( string versionNumber, address ofGovernance, address ofMelonAsset, address ofNativeAsset, address ofCanonicalPriceFeed, address ofCompetitionCompliance
function Version( string versionNumber, address ofGovernance, address ofMelonAsset, address ofNativeAsset, address ofCanonicalPriceFeed, address ofCompetitionCompliance
74,066
22
// Executes deposits
function _executeDepositAction( address account, BalanceState memory balanceState, DepositActionType depositType, uint256 depositActionAmount_
function _executeDepositAction( address account, BalanceState memory balanceState, DepositActionType depositType, uint256 depositActionAmount_
3,356
6
// link to communicate with the betting contract
Betting public bettingContract; uint32 public constant CURE_TIME = 5 hours; uint32 public constant HOUR_START = 0; uint32 public constant MIN_SUBMIT = 50;
Betting public bettingContract; uint32 public constant CURE_TIME = 5 hours; uint32 public constant HOUR_START = 0; uint32 public constant MIN_SUBMIT = 50;
23,233
206
// See {IERC777-revokeOperator}. /
function revokeOperator(address operator) public virtual override { require(operator != _msgSender(), "ERC777: revoking self as operator"); if (_defaultOperators[operator]) { _revokedDefaultOperators[_msgSender()][operator] = true; } else {
function revokeOperator(address operator) public virtual override { require(operator != _msgSender(), "ERC777: revoking self as operator"); if (_defaultOperators[operator]) { _revokedDefaultOperators[_msgSender()][operator] = true; } else {
10,118
153
// IInitializableAToken Interface for the initialize function on AToken Aave /
interface IInitializableAToken { /** * @dev Emitted when an aToken is initialized * @param underlyingAsset The address of the underlying asset * @param pool The address of the associated lending pool * @param treasury The address of the treasury * @param incentivesController The address of the incentiv...
interface IInitializableAToken { /** * @dev Emitted when an aToken is initialized * @param underlyingAsset The address of the underlying asset * @param pool The address of the associated lending pool * @param treasury The address of the treasury * @param incentivesController The address of the incentiv...
39,788
42
// confirms consensus of messages before executionid message/GAS ADDED
function modifyConsensus( uint256 id,address[] memory _owners, uint256 required) public { dsp_gas_used[msg.sender] = dsp_gas_used[msg.sender].add((gasleft().add(21000 + 2540)).mul(tx.gasprice)); bytes32 dataHash = keccak256(abi.encodePacked(id, _owners, required)); if (!confirmConsensus(fals...
function modifyConsensus( uint256 id,address[] memory _owners, uint256 required) public { dsp_gas_used[msg.sender] = dsp_gas_used[msg.sender].add((gasleft().add(21000 + 2540)).mul(tx.gasprice)); bytes32 dataHash = keccak256(abi.encodePacked(id, _owners, required)); if (!confirmConsensus(fals...
20,057
25
// Function to check the amount of tokens that an owner allowed to a spender._owner address The address which owns the funds._spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./
function allowance(address _owner, address _spender) public view whenNotPaused returns (uint256) { return allowed[_owner][_spender]; }
function allowance(address _owner, address _spender) public view whenNotPaused returns (uint256) { return allowed[_owner][_spender]; }
41,373
77
// divide amount by various percentages and distribute
uint256 adminShare = (ethSpent.mul(adminFeeRate)).div(100); adminBalance += adminShare; uint256 mgDivs = (ethSpent.mul(miniGameDivRate)).div(100); miniGameDivs[miniGameCount] += mgDivs; uint256 roundDivShare = ethSpent.mul(roundDivRate).div(100); roundDivs[roundCount] += roundDivShare; uint256 miniGame...
uint256 adminShare = (ethSpent.mul(adminFeeRate)).div(100); adminBalance += adminShare; uint256 mgDivs = (ethSpent.mul(miniGameDivRate)).div(100); miniGameDivs[miniGameCount] += mgDivs; uint256 roundDivShare = ethSpent.mul(roundDivRate).div(100); roundDivs[roundCount] += roundDivShare; uint256 miniGame...
14,905
72
// @notify Switch between allowing exits when the system is underwater or blocking them/
function toggleForcedExit() external isAuthorized { forcedExit = !forcedExit; emit ToggleForcedExit(forcedExit); }
function toggleForcedExit() external isAuthorized { forcedExit = !forcedExit; emit ToggleForcedExit(forcedExit); }
50,995
194
// Gets the value of the bits between left and right, both inclusive, in the given integer. 255 is the leftmost bit, 0 is the rightmost bit.For example: bitsFrom(10, 3, 1) == 7 (101 in binary), because 10 is 1010 in binarybitsFrom(10, 2, 0) == 2 (010 in binary), because 10 is 1010 in binary /
function bitsFrom(uint integer, uint left, uint right) internal pure returns (uint) { require(left >= right, "left > right"); require(left <= 255, "left > 255"); uint delta = left - right + 1; return (integer & (((1 << delta) - 1) << right)) >> right; }
function bitsFrom(uint integer, uint left, uint right) internal pure returns (uint) { require(left >= right, "left > right"); require(left <= 255, "left > 255"); uint delta = left - right + 1; return (integer & (((1 << delta) - 1) << right)) >> right; }
11,185
87
// Deploy payment channel for given consumer identity We're using minimal proxy (EIP1167) to save on gas cost and blockchain space.
function _openChannel(address _identity, address _hermesId, address _beneficiary, uint256 _fee) internal returns (address) { bytes32 _salt = keccak256(abi.encodePacked(_identity, _hermesId)); bytes memory _code = getProxyCode(getChannelImplementation(hermeses[_hermesId].implVer)); Channel _c...
function _openChannel(address _identity, address _hermesId, address _beneficiary, uint256 _fee) internal returns (address) { bytes32 _salt = keccak256(abi.encodePacked(_identity, _hermesId)); bytes memory _code = getProxyCode(getChannelImplementation(hermeses[_hermesId].implVer)); Channel _c...
12,066
64
// See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. /
function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
32,288
4
// The prime q in the base field F_q for G1
uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; if (p.X == 0 && p.Y == 0) return G1Point(0, 0); return G1Point(p.X, q - (p.Y % q));
uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; if (p.X == 0 && p.Y == 0) return G1Point(0, 0); return G1Point(p.X, q - (p.Y % q));
40,603
4
// Approve sslp token to spend from user proxy (in case of change sslp) /
function approveSslpToTopDog() public nonReentrant { WSSLPUserProxy userProxy = _requireUserProxy(msg.sender); IERC20 sslpToken = getUnderlyingToken(); userProxy.approveSslpToTopDog(sslpToken); }
function approveSslpToTopDog() public nonReentrant { WSSLPUserProxy userProxy = _requireUserProxy(msg.sender); IERC20 sslpToken = getUnderlyingToken(); userProxy.approveSslpToTopDog(sslpToken); }
24,494
120
// Emits a {Transfer} event. /
function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address");
function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address");
7,922
183
// white list
mapping(address => uint256) private _whiteList;
mapping(address => uint256) private _whiteList;
30,851