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
7
// Requests randomness /
function getRandomNumber() public returns (bytes32 requestId) { LINK.transferFrom(msg.sender, address(this), fee); // 1 LINK require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet"); return requestRandomness(keyHash, fee); }
function getRandomNumber() public returns (bytes32 requestId) { LINK.transferFrom(msg.sender, address(this), fee); // 1 LINK require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet"); return requestRandomness(keyHash, fee); }
42,572
80
// Restrict access to governor executing address. Some module might override the _executor function to makesure this modifier is consistant with the execution model. /
modifier onlyGovernance() { require(_msgSender() == _executor(), "Governor: onlyGovernance"); _; }
modifier onlyGovernance() { require(_msgSender() == _executor(), "Governor: onlyGovernance"); _; }
30,110
14
// Includes excluded account to earning fees protocol. Account inclusion mustn't change the rate. If account inclusion changesthe rate we can face situation when all other included balances get a lowerouter balance after the function call. Function changes inner representation of the outer balance, resetting itusing th...
* Emits a {AccountIncluded} event. * * Requirements: * * - `account` - must be excluded * - `msg.sender` is the owner. */ function includeAccount(address account) external onlyOwner { require(_isExcluded[account], "FYFToken::account is not excluded"); uint256 rate...
* Emits a {AccountIncluded} event. * * Requirements: * * - `account` - must be excluded * - `msg.sender` is the owner. */ function includeAccount(address account) external onlyOwner { require(_isExcluded[account], "FYFToken::account is not excluded"); uint256 rate...
2,627
122
// Overriding CrowdsalevalidPurchase to add min contribution logic/_weiAmount Contribution amount in wei/ return true if contribution is okay
function validPurchase(uint256 _weiAmount) internal constant returns (bool) { bool nonEnded = !hasEnded(); bool nonZero = _weiAmount != 0; bool enoughContribution = _weiAmount >= minContribution; return nonEnded && nonZero && enoughContribution; }
function validPurchase(uint256 _weiAmount) internal constant returns (bool) { bool nonEnded = !hasEnded(); bool nonZero = _weiAmount != 0; bool enoughContribution = _weiAmount >= minContribution; return nonEnded && nonZero && enoughContribution; }
6,950
8
// (bool sent, ) = payable(campaign.owner).call{value: amount}("");
if(sent) { campaign.amountCollected = campaign.amountCollected + tokenAmount; }
if(sent) { campaign.amountCollected = campaign.amountCollected + tokenAmount; }
26,493
196
// Switch key if plural
if(s1 == pos.noun1p) return pos.noun1; else if(s1 == pos.noun2p) return pos.noun2; else if(s1 == pos.noun3p) return pos.noun3; return s1;
if(s1 == pos.noun1p) return pos.noun1; else if(s1 == pos.noun2p) return pos.noun2; else if(s1 == pos.noun3p) return pos.noun3; return s1;
23,517
98
// invitee's supply 10% deposit weight to its invitor
uint256 public constant INVITOR_WEIGHT = 10;
uint256 public constant INVITOR_WEIGHT = 10;
41,063
145
// update partially unstaked stake
vaultData.stakes[out.newStakesCount.sub(1)].amount = out.lastStakeAmount;
vaultData.stakes[out.newStakesCount.sub(1)].amount = out.lastStakeAmount;
10,842
48
// currency needs to be converted to tokenAmount with current token price
uint redeemInToken = 0; uint supplyInToken = 0; if(tokenPrice_ > 0) { supplyInToken = rdiv(epochSupplyOrderCurrency, tokenPrice_); redeemInToken = safeDiv(safeMul(epochRedeemOrderCurrency, ONE), tokenPrice_); }
uint redeemInToken = 0; uint supplyInToken = 0; if(tokenPrice_ > 0) { supplyInToken = rdiv(epochSupplyOrderCurrency, tokenPrice_); redeemInToken = safeDiv(safeMul(epochRedeemOrderCurrency, ONE), tokenPrice_); }
31,494
2,942
// 1473
entry "virologically" : ENG_ADVERB
entry "virologically" : ENG_ADVERB
22,309
42
// remove an account's access to this role /
function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; }
function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; }
6,854
110
// Use 'Assert' methods: https:remix-ide.readthedocs.io/en/latest/assert_library.html
Assert.ok(2 == 2, 'should be true'); Assert.greaterThan(uint(2), uint(1), "2 should be greater than to 1"); Assert.lesserThan(uint(2), uint(3), "2 should be lesser than to 3");
Assert.ok(2 == 2, 'should be true'); Assert.greaterThan(uint(2), uint(1), "2 should be greater than to 1"); Assert.lesserThan(uint(2), uint(3), "2 should be lesser than to 3");
18,078
29
// get the final underlying surplus on the dToken.
finalSurplus = dToken.getSurplusUnderlying();
finalSurplus = dToken.getSurplusUnderlying();
28,874
23
// The base interest rate which is the y-intercept when utilization rate is 0 /
uint public baseRatePerBlock;
uint public baseRatePerBlock;
10,703
40
// verify there is enough items available to buy the amount verifies sale is in active state under the hood
require(itemsAvailable() >= _amount, "inactive sale or not enough items available");
require(itemsAvailable() >= _amount, "inactive sale or not enough items available");
39,441
17
// Getter the address of the guardian, that can mainly cancel proposalsreturn The address of the guardian /
function getGuardian() external view override returns (address) { return _guardian; }
function getGuardian() external view override returns (address) { return _guardian; }
10,023
15
// Add one type with a range of token idid new id type from first id for this type to last id for this type data array bytes containing: - the erc20 addres to lock (in first 20 bytes) - the amount to lock (in following 32 bytes) /
function _addType( uint256 id, uint256 from, uint256 to, bytes calldata data
function _addType( uint256 id, uint256 from, uint256 to, bytes calldata data
42,028
22
// function transferTokensOnClaim( address _receiver, uint256 _quantity, uint256 _obycLabsTokenId
// ) internal override returns (uint256) { // obyclabs.safeTransferFrom( // address(_receiver), // address(0xEa5BB994bF067Ce974D1b9E90fC371EAEEd1CFCC), // _obycLabsTokenId, // 1, // localBytes // ); // // Use the rest of the inherit...
// ) internal override returns (uint256) { // obyclabs.safeTransferFrom( // address(_receiver), // address(0xEa5BB994bF067Ce974D1b9E90fC371EAEEd1CFCC), // _obycLabsTokenId, // 1, // localBytes // ); // // Use the rest of the inherit...
20,513
31
// account_ The address to be included /
function includeAccount(address account_) external onlyOwner() { require(!_isExcludedFromTax[account_], "Already Included"); _isExcludedFromTax[account_] = true; }
function includeAccount(address account_) external onlyOwner() { require(!_isExcludedFromTax[account_], "Already Included"); _isExcludedFromTax[account_] = true; }
16,654
69
// LuckyNumber Implementation
contract LuckyNumberImp is LuckyNumber, Mortal, Random { // Initialize state +.+.+. function LuckyNumberImp() { owned(); // defaults cost = 20000000000000000; // 0.02 ether // 20 finney max = 15; // generate number between 1 and 15 waitTime = 3; // 3 blocks } ...
contract LuckyNumberImp is LuckyNumber, Mortal, Random { // Initialize state +.+.+. function LuckyNumberImp() { owned(); // defaults cost = 20000000000000000; // 0.02 ether // 20 finney max = 15; // generate number between 1 and 15 waitTime = 3; // 3 blocks } ...
40,940
109
// calculate pending rewards and apply the rewards multiplier
uint32 multiplier = _rewardsMultiplier(provider, providerRewards.effectiveStakingTime, program); uint256 fullReward = _applyMultiplier(providerRewards.pendingBaseRewards.add(newBaseRewards), multiplier);
uint32 multiplier = _rewardsMultiplier(provider, providerRewards.effectiveStakingTime, program); uint256 fullReward = _applyMultiplier(providerRewards.pendingBaseRewards.add(newBaseRewards), multiplier);
48,881
43
// called by the owner to stop the ICO/
function stopICO() external onlyOwner { icoStart = false; }
function stopICO() external onlyOwner { icoStart = false; }
44,909
1,093
// Timestamp of the latest withdrawal request. A withdrawal request is pending if `requestPassTimestamp != 0`.
uint256 requestPassTimestamp;
uint256 requestPassTimestamp;
30,511
57
// If the oracle exists, try to update it
if (_oraclesByPair[pair][_period] != address(0)) { OracleSimple(_oraclesByPair[pair][_period]).update(); oracleAddr = _oraclesByPair[pair][_period]; return oracleAddr; }
if (_oraclesByPair[pair][_period] != address(0)) { OracleSimple(_oraclesByPair[pair][_period]).update(); oracleAddr = _oraclesByPair[pair][_period]; return oracleAddr; }
54,891
5
// Approves another address to transfer the given token IDThe zero address indicates there is no approved address.There can only be one approved address per token at a given time.Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenId uint256 ID of the tok...
function approve(address to, uint256 tokenId) public override (ERC721Enumerable, ERC721Metadata, ERC721){ super.approve(to, tokenId); }
function approve(address to, uint256 tokenId) public override (ERC721Enumerable, ERC721Metadata, ERC721){ super.approve(to, tokenId); }
5,968
10
// allows the owner to delete a property on the blockchain /pin pin of the property the owner wants to delete/ return true to notify everything went well
function deleteProperty(uint pin) public onlyAdmin() returns(bool success) { require(properties[pin].owner!=address(0),"This PIN doens't exist"); uint rowToDelete = properties[pin].listPointer; uint keyToMove = propertyList[propertyList.length-1]; properties[pin].owner=address(0); propertyList[r...
function deleteProperty(uint pin) public onlyAdmin() returns(bool success) { require(properties[pin].owner!=address(0),"This PIN doens't exist"); uint rowToDelete = properties[pin].listPointer; uint keyToMove = propertyList[propertyList.length-1]; properties[pin].owner=address(0); propertyList[r...
5,164
395
// Set COMP borrow and supply speeds for the specified markets. cTokens The markets whose COMP speed to update. supplySpeeds New supply-side COMP speed for the corresponding market. borrowSpeeds New borrow-side COMP speed for the corresponding market. /
function _setCompSpeeds(CToken[] memory cTokens, uint[] memory supplySpeeds, uint[] memory borrowSpeeds) public { require(adminOrInitializing(), "only admin can set comp speed"); uint numTokens = cTokens.length; require(numTokens == supplySpeeds.length && numTokens == borrowSpeeds.length, "...
function _setCompSpeeds(CToken[] memory cTokens, uint[] memory supplySpeeds, uint[] memory borrowSpeeds) public { require(adminOrInitializing(), "only admin can set comp speed"); uint numTokens = cTokens.length; require(numTokens == supplySpeeds.length && numTokens == borrowSpeeds.length, "...
23,726
73
// Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). /
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "undeflow"); return a - b; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "undeflow"); return a - b; }
40,626
40
// exercise option
(uint profit, uint amount, uint underlyingCurrentPrice) = _exercise(tokenId, owner);
(uint profit, uint amount, uint underlyingCurrentPrice) = _exercise(tokenId, owner);
39,237
134
// Liquidate as much as possible to `want`, up to `_amountNeeded`
uint256 amountFreed; (amountFreed, _loss) = liquidatePosition(_amountNeeded);
uint256 amountFreed; (amountFreed, _loss) = liquidatePosition(_amountNeeded);
4,535
9
// Return whether the oracle supports evaluating collateral value of the given token./token ERC1155 token address to check for support/id ERC1155 token id to check for support
function supportWrappedToken(address token, uint id) external view override returns (bool) { if (!whitelistERC1155[token]) return false; address tokenUnderlying = IERC20Wrapper(token).getUnderlyingToken(id); return tokenFactors[tokenUnderlying].liqIncentive != 0; }
function supportWrappedToken(address token, uint id) external view override returns (bool) { if (!whitelistERC1155[token]) return false; address tokenUnderlying = IERC20Wrapper(token).getUnderlyingToken(id); return tokenFactors[tokenUnderlying].liqIncentive != 0; }
47,521
72
// Creating locked balances
struct LockBox { address beneficiary; uint256 lockedBalance; uint256 unlockTime; bool locked; }
struct LockBox { address beneficiary; uint256 lockedBalance; uint256 unlockTime; bool locked; }
52,453
75
// deployar el contrato "Deploy"con el address del gobierno
contract Deploy is GobernanceFunctions{ constructor() public { owner = msg.sender; forTesting(); } function forTesting() internal{ addBank(0x14723a09acff6d2a60dcdf7aa4aff308fddc160c,1); addBank(0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db,1); addTokensToBank(0x14723a09...
contract Deploy is GobernanceFunctions{ constructor() public { owner = msg.sender; forTesting(); } function forTesting() internal{ addBank(0x14723a09acff6d2a60dcdf7aa4aff308fddc160c,1); addBank(0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db,1); addTokensToBank(0x14723a09...
48,120
432
// =================v2 start============== eventId => state, state: 0- not open, 1- open
mapping(string => uint256) private _lockEventState;
mapping(string => uint256) private _lockEventState;
24,371
24
// Contactable token Basic version of a contactable contract, allowing the owner to provide a string with theircontact information. /
contract Contactable is Ownable{ string public contactInformation; /** * @dev Allows the owner to set a string with their contact information. * @param info The contact information to attach to the contract. */ function setContactInformation(string info) onlyOwner public { contactI...
contract Contactable is Ownable{ string public contactInformation; /** * @dev Allows the owner to set a string with their contact information. * @param info The contact information to attach to the contract. */ function setContactInformation(string info) onlyOwner public { contactI...
11,614
284
// Mints tokens/
function mintCryptoSquatches(uint256 numberOfTokens) external payable { require(saleIsActive, "Sale must be active to mint"); require(numberOfTokens <= maxToMint, "Invalid amount to mint per once"); require(totalSupply().add(numberOfTokens) <= MAX_CRYPTO_SQUATCH_SUPPLY, "Purchase would excee...
function mintCryptoSquatches(uint256 numberOfTokens) external payable { require(saleIsActive, "Sale must be active to mint"); require(numberOfTokens <= maxToMint, "Invalid amount to mint per once"); require(totalSupply().add(numberOfTokens) <= MAX_CRYPTO_SQUATCH_SUPPLY, "Purchase would excee...
37,369
7
// return old bid value
payable(latestBid.sender).transfer(latestBid.value);
payable(latestBid.sender).transfer(latestBid.value);
16,069
103
// check USDP limit for token
require(tokenDebts[asset] <= vaultParameters.tokenDebtLimit(asset), "Unit Protocol: ASSET_DEBT_LIMIT"); USDP(usdp).mint(user, amount); return debts[asset][user];
require(tokenDebts[asset] <= vaultParameters.tokenDebtLimit(asset), "Unit Protocol: ASSET_DEBT_LIMIT"); USDP(usdp).mint(user, amount); return debts[asset][user];
25,399
52
// MultiOwnable contract. /
contract MultiOwnableContract { MultiSigWallet public wallet; event MultiOwnableWalletSet( address indexed _contract, address indexed _wallet ); constructor(address _wallet) { wallet = MultiSigWallet(_wallet); emit MultiOwnableWalletSet(address(this), _wallet); } ...
contract MultiOwnableContract { MultiSigWallet public wallet; event MultiOwnableWalletSet( address indexed _contract, address indexed _wallet ); constructor(address _wallet) { wallet = MultiSigWallet(_wallet); emit MultiOwnableWalletSet(address(this), _wallet); } ...
14,426
107
// balance check is not needed because sub(a, b) will throw if a<b
data.setBalances(src, Math.sub(data.balances(src), wad)); data.setBalances(dst, Math.add(data.balances(dst), wad)); return true;
data.setBalances(src, Math.sub(data.balances(src), wad)); data.setBalances(dst, Math.add(data.balances(dst), wad)); return true;
85,744
4
// Update address of Aave LendingPoolAddressesProvider We will use new address to fetch lendingPool address and update that too. /
function updateAddressesProvider(address _newAddressesProvider) external onlyGovernor { _updateAddressesProvider(_newAddressesProvider); }
function updateAddressesProvider(address _newAddressesProvider) external onlyGovernor { _updateAddressesProvider(_newAddressesProvider); }
22,936
64
// make correction to keep dividends of user
if (not_first_minting) { user.funds_correction = user.funds_correction.add(int(tokens.mul(shared_profit) / total_supply)); }
if (not_first_minting) { user.funds_correction = user.funds_correction.add(int(tokens.mul(shared_profit) / total_supply)); }
40,048
482
// Shh - currently unused
minter; mintAmount; if (!markets[cToken].isListed) { return uint(Error.MARKET_NOT_LISTED); }
minter; mintAmount; if (!markets[cToken].isListed) { return uint(Error.MARKET_NOT_LISTED); }
31,045
81
// Returns true if this contract implements the interface defined by`interfaceId`. See the correspondingto learn more about how these ids are created. This function call must use less than 30 000 gas. /
function supportsInterface(bytes4 interfaceId) external view returns (bool);
function supportsInterface(bytes4 interfaceId) external view returns (bool);
31,040
73
// ERC721Receiver implementation copied and modified from: https:github.com/GustasKlisauskas/ERC721Receiver/blob/master/ERC721Receiver.sol
function onERC721Received(address, address, uint256 tokenId, bytes calldata) public pure returns(bytes4) { return this.onERC721Received.selector; }
function onERC721Received(address, address, uint256 tokenId, bytes calldata) public pure returns(bytes4) { return this.onERC721Received.selector; }
40,361
19
// {address} address of the token return {uint256} total amount of token/
function getTotalToken(IERC20 _token) external view returns (uint256) { return _token.balanceOf(address(this)); }
function getTotalToken(IERC20 _token) external view returns (uint256) { return _token.balanceOf(address(this)); }
16,892
317
// An implementation of Store that can accept Oracle fees in ETH or any arbitrary ERC20 token. /
contract Store is StoreInterface, Withdrawable, Testable { using SafeMath for uint256; using FixedPoint for FixedPoint.Unsigned; using FixedPoint for uint256; using SafeERC20 for IERC20; /**************************************** * INTERNAL VARIABLES AND STORAGE * *******************...
contract Store is StoreInterface, Withdrawable, Testable { using SafeMath for uint256; using FixedPoint for FixedPoint.Unsigned; using FixedPoint for uint256; using SafeERC20 for IERC20; /**************************************** * INTERNAL VARIABLES AND STORAGE * *******************...
51,767
22
// Initialize basic configuration./ Even though these are defaults, we cannot set them in the constructor because/ each instance of this contract will need to have the storage initialized/ to read from these values (this is the implementation contract pointed to by a proxy)
minimumOptionDuration = 1 days; minBidIncrementBips = 50; settlementAuctionStartOffset = 1 days; marketPaused = false;
minimumOptionDuration = 1 days; minBidIncrementBips = 50; settlementAuctionStartOffset = 1 days; marketPaused = false;
39,528
0
// Mapping from a signed request UID => whether the request is processed.
mapping(bytes32 => bool) private executed;
mapping(bytes32 => bool) private executed;
29,445
8
// Declare message in outbox
MessageBus.declareMessage( messageBox, GATEWAY_LINK_TYPEHASH, messages[messageHash_], _signature );
MessageBus.declareMessage( messageBox, GATEWAY_LINK_TYPEHASH, messages[messageHash_], _signature );
14,625
2
// Event emitted when gov is changed /
event NewGov(address oldGov, address newGov);
event NewGov(address oldGov, address newGov);
3,091
26
// Transfer the remaining tokens to the treasury, this includes the swell treasury percentage and if there are any remainder tokens after NO distribution
swellTreasuryRewards = balanceOf(address(this)); if (swellTreasuryRewards != 0) { _transfer( address(this), AccessControlManager.SwellTreasury(), swellTreasuryRewards ); }
swellTreasuryRewards = balanceOf(address(this)); if (swellTreasuryRewards != 0) { _transfer( address(this), AccessControlManager.SwellTreasury(), swellTreasuryRewards ); }
38,863
19
// creates a variable called u_lid, which adds a one to the number of loans the user has made.
uint u_lid = u.numLoans++; u.loans[u_lid] = lid;
uint u_lid = u.numLoans++; u.loans[u_lid] = lid;
9,133
11
// Lets users deposit into the pool. Stops owner from changing price of token X or withdrawing tokens from the pool but lets owner deposit additional tokens to the pool
require(roundStatus == Status.New, "The round have ended or is active already."); roundStatus = Status.Active;
require(roundStatus == Status.New, "The round have ended or is active already."); roundStatus = Status.Active;
15,696
176
// Ever increasing rewardPerToken rate, based on % of total supply
uint256 public rewardPerTokenStored = 0; mapping(address => UserData) public userData;
uint256 public rewardPerTokenStored = 0; mapping(address => UserData) public userData;
13,452
23
// mapping (address => uint256)
mstore(p, caller()) mstore(add(p, 32), hash) hash := keccak256(p, 64) sstore(hash, 1) mstore(p, id) mstore(add(p, 32), 1) log4(p, 64, 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62, caller(), 0, caller(...
mstore(p, caller()) mstore(add(p, 32), hash) hash := keccak256(p, 64) sstore(hash, 1) mstore(p, id) mstore(add(p, 32), 1) log4(p, 64, 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62, caller(), 0, caller(...
21,500
31
// See `GSNBouncerBase._approveRelayedCall`. This overload forwards `context` to _preRelayedCall and _postRelayedCall. /
function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) { return (RELAYED_CALL_ACCEPTED, context); }
function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) { return (RELAYED_CALL_ACCEPTED, context); }
17,292
29
// Update the postJoinExitInvariant to the value of the currentInvariant, zeroing out any protocol swap fees.
_updatePostJoinExit(getInvariant());
_updatePostJoinExit(getInvariant());
25,870
231
// Returns the base URI set via {_setBaseURI}. This will be automatically added as a prefix in {tokenURI} to each token's URI, or to the token ID if no specific URI is set for that token ID./
function baseURI() public view virtual returns (string memory) { return _baseURI; }
function baseURI() public view virtual returns (string memory) { return _baseURI; }
30,514
42
// Set R bit if X bit is set
xwr = xwr | (xwr >> 2);
xwr = xwr | (xwr >> 2);
38,334
190
// could be revoked wantonly with a malicious certificate, should track callback too not any longer, revocation is tied to specific cert used, not last
database_.ocspUpdateEID(cbObj.sender, true); database_.emitLinkEvent(cbObj.sender, 4, 0x04); return;
database_.ocspUpdateEID(cbObj.sender, true); database_.emitLinkEvent(cbObj.sender, 4, 0x04); return;
48,090
217
// `subUInt` can only return MathError.INTEGER_UNDERFLOW but we know `earnings[tokenAddress]`is at least as big as `amount`. /
assert(vars.mathErr == MathError.NO_ERROR); emit TakeEarnings(tokenAddress, amount); require(IERC20(tokenAddress).transfer(msg.sender, amount), "token transfer failure");
assert(vars.mathErr == MathError.NO_ERROR); emit TakeEarnings(tokenAddress, amount); require(IERC20(tokenAddress).transfer(msg.sender, amount), "token transfer failure");
8,193
2
// Constants section
uint256 constant BASE_UNIT = 10 ** ABEToken.decimals() * 10000;//10 ** 18; // ABEToken.decimals() * 10000
uint256 constant BASE_UNIT = 10 ** ABEToken.decimals() * 10000;//10 ** 18; // ABEToken.decimals() * 10000
11,136
24
// Divide an amount by a fixed point factor with 27 decimals
function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = (x * 1e27) / y; }
function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = (x * 1e27) / y; }
29,468
192
// Remove the iToken from the account's borrowed list _iToken The iToken to remove _account The address of the account to modify /
function _removeFromBorrowed(address _account, address _iToken) internal { // remove() will return false if iToken does not exist in account's borrowed list if (accountsData[_account].borrowed.remove(_iToken)) { emit BorrowedRemoved(_iToken, _account); } }
function _removeFromBorrowed(address _account, address _iToken) internal { // remove() will return false if iToken does not exist in account's borrowed list if (accountsData[_account].borrowed.remove(_iToken)) { emit BorrowedRemoved(_iToken, _account); } }
50,579
65
// Variables/
mapping(address => AddressInfo) private addressInfos; address public latestAddress;
mapping(address => AddressInfo) private addressInfos; address public latestAddress;
44,869
0
// Initialiazes a burn redeem with base parameters /
function initialize( address creatorContractAddress, uint8 creatorContractVersion, uint256 instanceId, IBurnRedeemCore.BurnRedeem storage burnRedeemInstance, IBurnRedeemCore.BurnRedeemParameters calldata burnRedeemParameters
function initialize( address creatorContractAddress, uint8 creatorContractVersion, uint256 instanceId, IBurnRedeemCore.BurnRedeem storage burnRedeemInstance, IBurnRedeemCore.BurnRedeemParameters calldata burnRedeemParameters
19,628
85
// This function permits anybody to withdraw the funds they havecontributed if and only if the deadline has passed and thefunding goal was not reached. /
function safeWithdrawal() external afterDeadline nonReentrant { if (!fundingGoalReached) { uint amount = balanceOf[msg.sender]; balanceOf[msg.sender] = 0; if (amount > 0) { msg.sender.transfer(amount); FundTransfer(msg.sender, amount, false...
function safeWithdrawal() external afterDeadline nonReentrant { if (!fundingGoalReached) { uint amount = balanceOf[msg.sender]; balanceOf[msg.sender] = 0; if (amount > 0) { msg.sender.transfer(amount); FundTransfer(msg.sender, amount, false...
35,814
115
// Transfers from the tier must be pausable.
if (_tier.transfersPausable) {
if (_tier.transfersPausable) {
33,576
21
// return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
assembly ("memory-safe") { // solhint-disable-line no-inline-assembly let ptr := mload(0x40) mstore(ptr, 0x1901000000000000000000000000000000000000000000000000000000000000) // "\x19\x01" mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) ...
assembly ("memory-safe") { // solhint-disable-line no-inline-assembly let ptr := mload(0x40) mstore(ptr, 0x1901000000000000000000000000000000000000000000000000000000000000) // "\x19\x01" mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) ...
25,924
12
// member1
address payable public member1Address;
address payable public member1Address;
66,394
4
// VotingSession mock VotingSession mockCyril Lapinte - <cyril.lapinte@openfiz.com>SPDX-License-Identifier: MIT Error messagesVSM01: Session is already closed /
contract VotingSessionMock is VotingSession { /** * @dev constructor */ constructor(ITokenProxy _token) public VotingSession(_token) { } /** * @dev nextSessionStepTest */ function nextSessionStepTest() public returns (bool) { return nextStepTest(currentSessionId()); } /** * @dev ...
contract VotingSessionMock is VotingSession { /** * @dev constructor */ constructor(ITokenProxy _token) public VotingSession(_token) { } /** * @dev nextSessionStepTest */ function nextSessionStepTest() public returns (bool) { return nextStepTest(currentSessionId()); } /** * @dev ...
42,003
0
// version 2.0.0
return "2.0.0";
return "2.0.0";
18,481
51
// Whitelist Spotter to read the Osm data (only necessary if it is the first time the token is being added to an ilk) !!!!!!!! Only if PIP_UNI = Osm or PIP_UNI = Median and hasn't been already whitelisted due a previous deployed ilk
OsmAbstract(PIP_UNI).kiss(MCD_SPOT);
OsmAbstract(PIP_UNI).kiss(MCD_SPOT);
15,533
207
// Now remove all entries, even if no reclaim and no rebate
exchangeState().removeEntries(from, currencyKey);
exchangeState().removeEntries(from, currencyKey);
27,331
13
// Return raw price (without fees)
uint256 amountOut = amountsOut[amountsOut.length - 1]; uint256 feeBips = 30; // .3% per swap amountOut = (amountOut * 10000) / (10000 - (feeBips * numberOfJumps)); return amountOut;
uint256 amountOut = amountsOut[amountsOut.length - 1]; uint256 feeBips = 30; // .3% per swap amountOut = (amountOut * 10000) / (10000 - (feeBips * numberOfJumps)); return amountOut;
18,206
41
// move tokens changed tradeValues to 0
tokens[tradeAddresses[0]][tradeAddresses[3]] = tokens[tradeAddresses[0]][tradeAddresses[3]].sub(tradeValues[0]); tokens[tradeAddresses[0]][tradeAddresses[2]] = tokens[tradeAddresses[0]][tradeAddresses[2]].add(tradeValues[0]);
tokens[tradeAddresses[0]][tradeAddresses[3]] = tokens[tradeAddresses[0]][tradeAddresses[3]].sub(tradeValues[0]); tokens[tradeAddresses[0]][tradeAddresses[2]] = tokens[tradeAddresses[0]][tradeAddresses[2]].add(tradeValues[0]);
12,275
10
// 創建實體,註冊創建者
function MinerShare() { owner = msg.sender; }
function MinerShare() { owner = msg.sender; }
12,933
0
// Here we will not pass the Logger address but our honeypot address
logger = Logger(_logger);
logger = Logger(_logger);
40,969
38
// Private function to register quantity and age of batches from sender and receiver (TokenWithDates)
function updateBatches(address _from,address _to,uint _value) private { // Discounting tokens from batches AT SOURCE uint count = _value; uint i = minIndex[_from]; while(count > 0) { // To iterate over the mapping. // && i < maxIndex is just a protection from infinite loop, that sho...
function updateBatches(address _from,address _to,uint _value) private { // Discounting tokens from batches AT SOURCE uint count = _value; uint i = minIndex[_from]; while(count > 0) { // To iterate over the mapping. // && i < maxIndex is just a protection from infinite loop, that sho...
37,071
97
// Processing tokens from contract
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { swapTokensForETH(contractTokenBalance); uint256 contractETH = address(this).balance; sendToWallet(Wallet_Dev,contractETH); }
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { swapTokensForETH(contractTokenBalance); uint256 contractETH = address(this).balance; sendToWallet(Wallet_Dev,contractETH); }
4,870
325
// Amount of token0 held as unused balance.
function _balance0() internal view returns (uint256) { return IERC20(token0).balanceOf(address(this)).sub(protocolFees0); }
function _balance0() internal view returns (uint256) { return IERC20(token0).balanceOf(address(this)).sub(protocolFees0); }
4,229
1
// This declares a state variable that The whitelist of security experts
IRegistry public registry;
IRegistry public registry;
41,200
5
// STATE //tokenId => Side => OrderBook
mapping(uint256 => mapping(Side => OrderBook)) internal markets;
mapping(uint256 => mapping(Side => OrderBook)) internal markets;
22,684
62
// Pull any remainder required from the base strategy.
if (_withdrawFromBaseStrategyAmount > 0) {
if (_withdrawFromBaseStrategyAmount > 0) {
35,595
40
// Stop rewards. /
function stopRewards() external onlySecurity { rewardEndBlock = block.number; emit RewardsStop(); }
function stopRewards() external onlySecurity { rewardEndBlock = block.number; emit RewardsStop(); }
26,315
48
// Locks all the managed contracts /governance function called only by the migrationManager or registryAdmin/When set all onlyWhenActive functions will revert
function lockContracts() external /* onlyAdminOrMigrationManager */;
function lockContracts() external /* onlyAdminOrMigrationManager */;
7,177
202
// MasterChef is the master of Sushi. He can make Sushi and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once SUSHI is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully ...
contract MasterChef is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some f...
contract MasterChef is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some f...
2,214
17
// Modern, minimalist, and gas efficient ERC-721 implementation./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)/Note that balanceOf does not revert if passed the zero address, in defiance of the ERC.
abstract contract ERC721 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed id); event Approval(address ind...
abstract contract ERC721 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed id); event Approval(address ind...
21,243
190
// set the new player bool to true
_eventData_.compressedData = _eventData_.compressedData + 1;
_eventData_.compressedData = _eventData_.compressedData + 1;
35,694
155
// whether a certain entity has a permission
mapping (bytes32 => bytes32) permissions; // 0 for no permission, or parameters id mapping (bytes32 => Param[]) public permissionParams;
mapping (bytes32 => bytes32) permissions; // 0 for no permission, or parameters id mapping (bytes32 => Param[]) public permissionParams;
13,066
12
// SMART CONTRACT FUNCTIONS // Check Airline Vote /
function checkVote(address airline, address voter) public view returns (bool)
function checkVote(address airline, address voter) public view returns (bool)
9,348
4
// Grill the pool and send all Tendies to the caller
tendiesContract.grillPool(); tendiesContractERC20.safeTransfer(_msgSender(), tendiesContractERC20.balanceOf(address(this)));
tendiesContract.grillPool(); tendiesContractERC20.safeTransfer(_msgSender(), tendiesContractERC20.balanceOf(address(this)));
46,322
3
// If the sender is not the owner and if trading is not allowed yet, throw an exception
if (sender != owner() && !isTradable) { require(isTradable, "Transfers are not allowed at the moment"); }
if (sender != owner() && !isTradable) { require(isTradable, "Transfers are not allowed at the moment"); }
8,050
79
// Remove fees for transfers to and from charity account or to excluded account
bool takeFee = true; if (_isCharity[sender] || _isCharity[recipient] || _isExcluded[recipient]) { takeFee = false; }
bool takeFee = true; if (_isCharity[sender] || _isCharity[recipient] || _isExcluded[recipient]) { takeFee = false; }
38,396
8
// paybacks to claim pawnticket => address => balance
mapping(uint256 => mapping(address => uint256)) private _loanPaymentBalances;
mapping(uint256 => mapping(address => uint256)) private _loanPaymentBalances;
9,986
151
// update the weiRaised
weiRaised.add(_expectedTokens);
weiRaised.add(_expectedTokens);
16,016
42
// Key remainder was larger than the key for our last node. The value within our last node is therefore going to be shifted into a branch value slot.
newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));
newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));
22,994
82
// Internal function to burn a specific tokenReverts if the token does not exist owner owner of the token to burn tokenId uint256 ID of the token being burned by the msg.sender /
function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } }
function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } }
5,960
110
// ======== EVENTS ======== // ======== STATE VARIABLES ======== // ======== STRUCTS ======== / Info for creating new bonds
struct Terms { uint controlVariable; // scaling variable for price uint vestingTerm; // in blocks uint minimumPrice; // vs principle value. 4 decimals (1500 = 0.15) uint maxPayout; // in thousandths of a %. i.e. 500 = 0.5% uint maxDebt; // 9 decimal debt ratio, max % total su...
struct Terms { uint controlVariable; // scaling variable for price uint vestingTerm; // in blocks uint minimumPrice; // vs principle value. 4 decimals (1500 = 0.15) uint maxPayout; // in thousandths of a %. i.e. 500 = 0.5% uint maxDebt; // 9 decimal debt ratio, max % total su...
27,642