Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
1
// Promise not to modify or read from the state.
function add(uint256 i, uint256 j) public pure returns (uint256) { return i + j; }
function add(uint256 i, uint256 j) public pure returns (uint256) { return i + j; }
8,832
51
// The total supply available
uint256 maxSupply;
uint256 maxSupply;
298
25
// Internal function to safely mint a new token.Reverts if the given token ID already exists.If the target address is a contract, it must implement `onERC721Received`,which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,the tra...
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
11,414
114
// Mapping owner address to token count
mapping(address => uint256) private _balances;
mapping(address => uint256) private _balances;
33,183
20
// Migrate LP token to another LP contract through the `migrator` contract./_pid The index of the pool. See `poolInfo`.
function migrate(uint256 _pid) public { require(address(migrator) != address(0), "MasterChefV2: no migrator set"); IERC20 _lpToken = lpToken[_pid]; uint256 bal = _lpToken.balanceOf(address(this)); _lpToken.approve(address(migrator), bal); IERC20 newLpToken = migrator.migrate(...
function migrate(uint256 _pid) public { require(address(migrator) != address(0), "MasterChefV2: no migrator set"); IERC20 _lpToken = lpToken[_pid]; uint256 bal = _lpToken.balanceOf(address(this)); _lpToken.approve(address(migrator), bal); IERC20 newLpToken = migrator.migrate(...
10,361
4
// Event is emitted if an operator job execution fails /
event FailedOperatorJob(bytes32 jobHash);
event FailedOperatorJob(bytes32 jobHash);
17,310
1
// Simple send by Checque /
function signerOfSimpleCheque(address _token, address _to, uint256 _amount, bytes _data, uint256 _nonce, bytes _sig) private pure returns (address) { return keccak256(abi.encodePacked(_token, _to, _amount, _data, _nonce)).toEthSignedMessageHash().recover(_sig); }
function signerOfSimpleCheque(address _token, address _to, uint256 _amount, bytes _data, uint256 _nonce, bytes _sig) private pure returns (address) { return keccak256(abi.encodePacked(_token, _to, _amount, _data, _nonce)).toEthSignedMessageHash().recover(_sig); }
14,891
341
// Credit line terms
address public override borrower; uint256 public override limit; uint256 public override interestApr; uint256 public override paymentPeriodInDays; uint256 public override termInDays; uint256 public override lateFeeApr;
address public override borrower; uint256 public override limit; uint256 public override interestApr; uint256 public override paymentPeriodInDays; uint256 public override termInDays; uint256 public override lateFeeApr;
52,776
21
// GENESIS/MOB
function isGenesisMOBOn( uint256 publicPriceWei, uint256 GenesisMobTime
function isGenesisMOBOn( uint256 publicPriceWei, uint256 GenesisMobTime
66,152
2
// Revoke controller permission for an address.
function removeController(address controller) external;
function removeController(address controller) external;
26,958
231
// decreases the total borrows at a stable rate on a specific reserve and updates the average stable rate consequently_reserve the reserve object_amount the amount to substract to the total borrows stable_rate the rate at which the amount has been repaid/
) internal { require(_reserve.totalBorrowsStable >= _amount, "Invalid amount to decrease"); uint256 previousTotalBorrowStable = _reserve.totalBorrowsStable; //updating reserve borrows stable _reserve.totalBorrowsStable = _reserve.totalBorrowsStable.sub(_amount); if (_reser...
) internal { require(_reserve.totalBorrowsStable >= _amount, "Invalid amount to decrease"); uint256 previousTotalBorrowStable = _reserve.totalBorrowsStable; //updating reserve borrows stable _reserve.totalBorrowsStable = _reserve.totalBorrowsStable.sub(_amount); if (_reser...
34,048
61
// Event log.
emit RewardClaimed(_userAddress, _poolToken, userAccumulatedReward);
emit RewardClaimed(_userAddress, _poolToken, userAccumulatedReward);
12,346
162
// Address to pull rewards from. Must have provided an allowance to this contract.
address public immutable REWARDS_TREASURY;
address public immutable REWARDS_TREASURY;
81,151
219
// The fee is expressed as a percentage. E.g. a value of 40 stands for a 40% fee, so the recipient will be charged for 1.4 times the spent amount.
return (gas * gasPrice * (100 + serviceFee)) / 100;
return (gas * gasPrice * (100 + serviceFee)) / 100;
21,315
203
// Check that the transaction batch is well-formed
require( _amounts.length == _destinations.length && _amounts.length == _fees.length, "Malformed batch of transactions" );
require( _amounts.length == _destinations.length && _amounts.length == _fees.length, "Malformed batch of transactions" );
27,714
14
// Returns the addresses of the current and new owner. /
function owner() public view returns (address currentOwner, address newOwner) { currentOwner = _owner; newOwner = _newOwner; }
function owner() public view returns (address currentOwner, address newOwner) { currentOwner = _owner; newOwner = _newOwner; }
18,726
7
// disables a controller by setting its worker to address(0). _controller The controller to disable. /
function removeController(address _controller) public onlyOwner { require( _controller != address(0), "Controller must be a non-zero address" ); require( controllers[_controller] != address(0), "Worker must be a non-zero address" ); ...
function removeController(address _controller) public onlyOwner { require( _controller != address(0), "Controller must be a non-zero address" ); require( controllers[_controller] != address(0), "Worker must be a non-zero address" ); ...
47,496
22
// hxb contract setup
address internal hxbAddress = 0x9BB6fd000109E24Eb38B0Deb806382fF9247E478; IERC20 internal hxbInterface = IERC20(hxbAddress); HXB internal hxbControl = HXB(hxbAddress); address payable public liquidityBuyback = 0xf72842821c58aDe72EDa5ec5399B959b499d4AA4; address public hexDividendContract = 0x7d...
address internal hxbAddress = 0x9BB6fd000109E24Eb38B0Deb806382fF9247E478; IERC20 internal hxbInterface = IERC20(hxbAddress); HXB internal hxbControl = HXB(hxbAddress); address payable public liquidityBuyback = 0xf72842821c58aDe72EDa5ec5399B959b499d4AA4; address public hexDividendContract = 0x7d...
60,725
42
// check whether caller requested for this data
uint k = findIndexOfPriceId(priceIds, priceId);
uint k = findIndexOfPriceId(priceIds, priceId);
14,855
143
// Function to deposit tokens to bridge on specified network
function depositTokens( address token, uint256 amount, uint256 networkId ) public isBridgeNotFrozen isAmountGreaterThanZero(amount) isAssetNotFrozen(token) isPathNotPaused(token, "depositTokens")
function depositTokens( address token, uint256 amount, uint256 networkId ) public isBridgeNotFrozen isAmountGreaterThanZero(amount) isAssetNotFrozen(token) isPathNotPaused(token, "depositTokens")
53,982
37
// Increment the number of bounty created by this user
createdBountyCount[msg.sender]++;
createdBountyCount[msg.sender]++;
1,395
53
// MSJ: Get Contract Balanve
function getContractBalance() public requireIsOperational returns(uint)
function getContractBalance() public requireIsOperational returns(uint)
39,727
61
// units = ((T + B)(tB + Tb))/(4TB) (part1(part2 + part3)) / part4
uint part1 = T.add(B); uint part2 = t.mul(B); uint part3 = T.mul(b); uint numerator = part1.mul((part2.add(part3))); uint part4 = 4 * (T.mul(B)); return numerator.div(part4);
uint part1 = T.add(B); uint part2 = t.mul(B); uint part3 = T.mul(b); uint numerator = part1.mul((part2.add(part3))); uint part4 = 4 * (T.mul(B)); return numerator.div(part4);
48,955
5
// Function to create a new proposal
function createProposal( string memory _goal, uint256 _fundingRequired, uint256 _duration, string memory projectId
function createProposal( string memory _goal, uint256 _fundingRequired, uint256 _duration, string memory projectId
19,417
13
// Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value ...
* allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value ...
7,288
150
// Extend parent behavior requiring beneficiary to be in whitelist. _beneficiary Token beneficiary _weiAmount Amount of wei contributed /
function _preValidatePurchase( address _beneficiary, uint256 _weiAmount ) internal onlyIfWhitelisted(_beneficiary)
function _preValidatePurchase( address _beneficiary, uint256 _weiAmount ) internal onlyIfWhitelisted(_beneficiary)
36,227
11
// bool submitBid = (a.status != AuctionStatus.End && !compareTo(bidder, a.currentBidder) && !compareTo(bidder, a.assetOwner));
return (_auctionId, a.assetName, a.assetOwner, a.basePrice, a.currentBid, a.currentBidder, a.auctionExpiry, a.result, a.status);
return (_auctionId, a.assetName, a.assetOwner, a.basePrice, a.currentBid, a.currentBidder, a.auctionExpiry, a.result, a.status);
43,002
24
// expmods[19] = trace_generator^(251trace_length / 256).
mstore(0x4680, expmod(/*trace_generator*/ mload(0x3a0), div(mul(251, /*trace_length*/ mload(0x80)), 256), PRIME))
mstore(0x4680, expmod(/*trace_generator*/ mload(0x3a0), div(mul(251, /*trace_length*/ mload(0x80)), 256), PRIME))
56,543
11
// Update the given pool's PKKT allocation point. Can only be called by the owner.
function set(Pool.UpdatePoolParameters memory _newSetting, bool _withUpdate) external onlyOwner validatePoolById(_newSetting.pid)
function set(Pool.UpdatePoolParameters memory _newSetting, bool _withUpdate) external onlyOwner validatePoolById(_newSetting.pid)
40,012
41
// pass _parentId = 0 if you want the contract to search free slot for you, else passing non zero _parent id will be considered as desired parent, and will save little gas
function regUser(uint256 _networkId,uint256 _referrerId,uint256 _parentId, uint256 amount) public payable returns(bool)
function regUser(uint256 _networkId,uint256 _referrerId,uint256 _parentId, uint256 amount) public payable returns(bool)
26,727
2
// Fidi.Cash Core Contract Core contract for managing Fidi Offers and Deals /
contract FidiCore { event OfferCreated(address indexed seller, address offer); event DealCreated(address indexed buyer, address deal, address offer); function createOffer(address tokenAddress) public returns (address) { address seller = msg.sender; address offerAddress = address(new Offer(tokenAddress, ...
contract FidiCore { event OfferCreated(address indexed seller, address offer); event DealCreated(address indexed buyer, address deal, address offer); function createOffer(address tokenAddress) public returns (address) { address seller = msg.sender; address offerAddress = address(new Offer(tokenAddress, ...
28,820
20
// liquidationIncentiveMantissa must be no greater than this value
uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5
uint256 internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5
34,867
6
// Testing the getArrayOfNumericalInformation() function for all types of information: price, percent and increment
function testArrayOfNumericalInformation() public { uint[expectedItemCount] memory returnedPriceArray = auction.getArrayOfNumericalInformation(1); uint[expectedItemCount] memory returnedPercentArray = auction.getArrayOfNumericalInformation(2); uint[expectedItemCount] memory returnedIncrementArray = auction....
function testArrayOfNumericalInformation() public { uint[expectedItemCount] memory returnedPriceArray = auction.getArrayOfNumericalInformation(1); uint[expectedItemCount] memory returnedPercentArray = auction.getArrayOfNumericalInformation(2); uint[expectedItemCount] memory returnedIncrementArray = auction....
31,449
283
// Reassign ownership (also clears pending approvals and emits Transfer event).
_transfer(_from, _to, _tokenId);
_transfer(_from, _to, _tokenId);
40,858
113
// Cannot add ABI if name is already used for an existing network contract
require( getAddress( keccak256(abi.encodePacked("contract.address", _name)) ) == address(0x0), "ABI name is already in use" );
require( getAddress( keccak256(abi.encodePacked("contract.address", _name)) ) == address(0x0), "ABI name is already in use" );
7,991
103
// Yeld To receive ETH after converting it from USDC
function () external payable {} function setRetirementYeldTreasury(address payable _treasury) public onlyOwner { retirementYeldTreasury = _treasury; }
function () external payable {} function setRetirementYeldTreasury(address payable _treasury) public onlyOwner { retirementYeldTreasury = _treasury; }
47,189
305
// Address of the Sorbetto's owner
address public governance;
address public governance;
5,322
20
// Responsible for access rights to the contract
MISOAccessControls public accessControls; function setContracts( address _tokenFactory, address _market, address _launcher, address _farmFactory
MISOAccessControls public accessControls; function setContracts( address _tokenFactory, address _market, address _launcher, address _farmFactory
46,581
17
// When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do. Needs the ability to iterate and stop if the minGasToTransferAndStore is not met
function _creditTill(uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds) internal returns (uint256){ uint i = _startIndex; while (i < _tokenIds.length) { // if not enough gas to process, store this index for next loop if (gasleft() < minGasToTra...
function _creditTill(uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds) internal returns (uint256){ uint i = _startIndex; while (i < _tokenIds.length) { // if not enough gas to process, store this index for next loop if (gasleft() < minGasToTra...
13,771
56
// State data for statistical purposes ONLY
uint256 private referralCount; uint256 private totalReferralReward; mapping(address => uint256) private userReferralCount; mapping(address => uint256) private userReferralReward; address public referralCodeRegistrator; // Address who allowed to register code for users (will be used later) addr...
uint256 private referralCount; uint256 private totalReferralReward; mapping(address => uint256) private userReferralCount; mapping(address => uint256) private userReferralReward; address public referralCodeRegistrator; // Address who allowed to register code for users (will be used later) addr...
2,533
267
// The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
1,027
110
// Whether `a` is less than or equal to `b`. a an int256. b a FixedPoint.Signed.return True if `a <= b`, or False. /
function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue <= b.rawValue; }
function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue <= b.rawValue; }
31,660
53
// Send the money back
msg.sender.transfer(weiVal);
msg.sender.transfer(weiVal);
41,266
206
// The amount of tokens from the `_amount` to pay as a fee.
return _amount - PRBMath.mulDiv(_amount, JBConstants.MAX_FEE, _discountedFee + JBConstants.MAX_FEE);
return _amount - PRBMath.mulDiv(_amount, JBConstants.MAX_FEE, _discountedFee + JBConstants.MAX_FEE);
36,205
5
// number of days since unix epoch in UTC
function getDaysSinceEpoch() public view returns (uint256) { (uint256 year, uint256 month, uint256 day) = BokkyPooBahsDateTimeLibrary .timestampToDate(block.timestamp); return BokkyPooBahsDateTimeLibrary._daysFromDate(year, month, day); }
function getDaysSinceEpoch() public view returns (uint256) { (uint256 year, uint256 month, uint256 day) = BokkyPooBahsDateTimeLibrary .timestampToDate(block.timestamp); return BokkyPooBahsDateTimeLibrary._daysFromDate(year, month, day); }
55,639
1
// initialize _avatar the avatar to mint reputation from _reputationReward the total reputation this contract will reward for the token locking _lockingStartTime locking starting period time. _lockingEndTime the locking end time. locking is disable after this time. _redeemEnableTime redeem enable time . redeem reputati...
function initialize( Avatar _avatar, uint256 _reputationReward, uint256 _lockingStartTime, uint256 _lockingEndTime, uint256 _redeemEnableTime,
function initialize( Avatar _avatar, uint256 _reputationReward, uint256 _lockingStartTime, uint256 _lockingEndTime, uint256 _redeemEnableTime,
20,489
19
// returns whether a given address has the admin role for this contract
function isContractAdmin(address _admin) public view override returns (bool) { return _core.hasRole(CONTRACT_ADMIN_ROLE, _admin); }
function isContractAdmin(address _admin) public view override returns (bool) { return _core.hasRole(CONTRACT_ADMIN_ROLE, _admin); }
18,716
26
// To change circuit breaker state
function toggleCircuitBreaker() public onlyAdmin{ stopped = !stopped; }
function toggleCircuitBreaker() public onlyAdmin{ stopped = !stopped; }
36,819
33
// zero all bytes to the right
exp(0x100, sub(32, mlength)) ),
exp(0x100, sub(32, mlength)) ),
5,521
5
// Sells an ERC721 asset to fill the given order./buyOrder The ERC721 buy order./signature The order signature from the maker./erc721TokenId The ID of the ERC721 asset being/sold. If the given order specifies properties,/the asset must satisfy those properties. Otherwise,/it must equal the tokenId in the order./unwrapN...
function sellERC721( LibNFTOrder.ERC721Order memory buyOrder, LibSignature.Signature memory signature, uint256 erc721TokenId, bool unwrapNativeToken, bytes memory callbackData ) public override
function sellERC721( LibNFTOrder.ERC721Order memory buyOrder, LibSignature.Signature memory signature, uint256 erc721TokenId, bool unwrapNativeToken, bytes memory callbackData ) public override
32,083
190
// simplistic. not accurate
change = asset;
change = asset;
21,116
8
// Moves tokens from an address to Solo. Can either repay a borrow or provide additional supply. /
struct DepositArgs { Types.AssetAmount amount; Account.Info account; uint256 market; address from; }
struct DepositArgs { Types.AssetAmount amount; Account.Info account; uint256 market; address from; }
20,508
32
// DODO ERC20V2Factory DODO BreederHelp user to create erc20 token /
contract ERC20V2Factory is InitializableOwnable { // ============ Templates ============ address public immutable _CLONE_FACTORY_; address public _ERC20_TEMPLATE_; address public _CUSTOM_ERC20_TEMPLATE_; uint256 public _CREATE_FEE_; // ============ Events ============ // 0 Std 1 TradeBurn ...
contract ERC20V2Factory is InitializableOwnable { // ============ Templates ============ address public immutable _CLONE_FACTORY_; address public _ERC20_TEMPLATE_; address public _CUSTOM_ERC20_TEMPLATE_; uint256 public _CREATE_FEE_; // ============ Events ============ // 0 Std 1 TradeBurn ...
33,694
1
// Extract the owner from the state object data field
address owner = getOwner(_checkpoint.stateUpdate);
address owner = getOwner(_checkpoint.stateUpdate);
1,686
71
// In case of emgergency - withdrawal all eth.Contract must be offline/
function EmergencyWithdrawalETH() isOffline public returns (bool){ require(!Online, "Contract is not turned off"); require(_deposits_eth[_msgSender()] > 0, "You have no deposits"); _payBackBrrrETH(_balances[_msgSender()], _msgSender(), _deposits_eth[_msgSender()]); return true; ...
function EmergencyWithdrawalETH() isOffline public returns (bool){ require(!Online, "Contract is not turned off"); require(_deposits_eth[_msgSender()] > 0, "You have no deposits"); _payBackBrrrETH(_balances[_msgSender()], _msgSender(), _deposits_eth[_msgSender()]); return true; ...
31,864
26
// Verify the task results signature
function verifyCommitSig(Task task, bytes data, bytes sig) internal returns (address)
function verifyCommitSig(Task task, bytes data, bytes sig) internal returns (address)
7,533
26
// Check whether the address is in the blocklist
function checkBlocklist(address add) public view returns(bool) { return _blocklist[add]; }
function checkBlocklist(address add) public view returns(bool) { return _blocklist[add]; }
42,831
5
// Treasury events
event TreasuryChange(address treasury); event FeeChange(uint256 depositFee, uint256 withdrawFee, uint256 nftFee);
event TreasuryChange(address treasury); event FeeChange(uint256 depositFee, uint256 withdrawFee, uint256 nftFee);
21,155
4
// harvest from masterChef harvest from masterChef token1 token1 deposited of LP token token2 token2 deposited LP token setId ID stores Pool ID data the metadata struct /
function harvest( address token1, address token2, uint256 setId, Metadata memory data ) external payable returns (string memory _eventName, bytes memory _eventParam)
function harvest( address token1, address token2, uint256 setId, Metadata memory data ) external payable returns (string memory _eventName, bytes memory _eventParam)
34,633
16
// implementation for a TRIBE Reserve Stabilizer/Fei Protocol
contract TribeReserveStabilizer is ITribeReserveStabilizer, ReserveStabilizer, Timed { using Decimal for Decimal.D256; /// @notice a collateralization oracle ICollateralizationOracle public override collateralizationOracle; /// @notice the TRIBE minter address ITribeMinter public immutable tribeMi...
contract TribeReserveStabilizer is ITribeReserveStabilizer, ReserveStabilizer, Timed { using Decimal for Decimal.D256; /// @notice a collateralization oracle ICollateralizationOracle public override collateralizationOracle; /// @notice the TRIBE minter address ITribeMinter public immutable tribeMi...
31,829
4
// Function to add patient addresses to patients arrayRestricted to Owner within MVF scope/
function addPatient(address patientAddress, address[] requestors, uint[2][] costpairs) public onlyOwner { require(whitelists[patientAddress].patient == address(0x0)); patients.push(patientAddress); whitelists[patientAddress] = Whitelist(patientAddress, requestors, costpairs);
function addPatient(address patientAddress, address[] requestors, uint[2][] costpairs) public onlyOwner { require(whitelists[patientAddress].patient == address(0x0)); patients.push(patientAddress); whitelists[patientAddress] = Whitelist(patientAddress, requestors, costpairs);
10,225
0
// 토큰 정보
string constant public NAME = "EtherShip"; string constant public SYMBOL = "SHIP"; MersenneTwister32 internal mersenneTwister32;
string constant public NAME = "EtherShip"; string constant public SYMBOL = "SHIP"; MersenneTwister32 internal mersenneTwister32;
11,212
18
// De-whitelist TaskSpecs (A combination of a Condition, Action(s) and a gasPriceCeil) that users can select from/If gasPriceCeil was set to NO_CEIL, Input NO_CEIL constant as GasPriceCeil/_taskSpecs Task Receipt List defined in IGelatoCore
function unprovideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;
function unprovideTaskSpecs(TaskSpec[] calldata _taskSpecs) external;
11,623
1
// require a function to be called through GSN only /
modifier trustedForwarderOnly() { require(msg.sender == address(trustedForwarder), "Function can only be called through trustedForwarder"); _; }
modifier trustedForwarderOnly() { require(msg.sender == address(trustedForwarder), "Function can only be called through trustedForwarder"); _; }
25,717
62
// make sure we capture all ETH that may or may not be sent to this contract
payable(walletaddress).transfer(address(this).balance);
payable(walletaddress).transfer(address(this).balance);
44,783
121
// now we have yUnderlying asset
uint256 yUnderlyingBalanceAfter = IERC20(yVault).balanceOf(address(this)); if (yUnderlyingBalanceAfter > yUnderlyingBalanceBefore) {
uint256 yUnderlyingBalanceAfter = IERC20(yVault).balanceOf(address(this)); if (yUnderlyingBalanceAfter > yUnderlyingBalanceBefore) {
35,255
68
// release block interval
uint256 private _releaseInterval = 585000;
uint256 private _releaseInterval = 585000;
17,031
1
// Construct defining an offer did Deed ID the offer is bound to toBePaid Nn amount to be paid back (borrowed + interest) lender Address of the lender to be the loan withdrawn from loan Consisting of another an `Asset` struct defined in the MultiToken library /
struct Offer { uint256 did; uint256 toBePaid; address lender; MultiToken.Asset loan; }
struct Offer { uint256 did; uint256 toBePaid; address lender; MultiToken.Asset loan; }
7,684
570
// Validate that the total service provider balance is between the min and max stakes _serviceProvider - address of service provider /
function validateAccountStakeBalance(address _serviceProvider) external view
function validateAccountStakeBalance(address _serviceProvider) external view
26,116
5
// stores the review submitted by an agent in the scores data structure/map scores data structure/reviewer index of the reviewer in the proposals set/reviewed index of the reviewed agent/evaluation score submitted by the reviewer
function setReview(ScoreMap storage map, uint reviewer, uint reviewed, uint evaluation) external { set(map.reviewsTo[reviewer], reviewed, evaluation); set(map.reviewsFrom[reviewed], reviewer, evaluation); }
function setReview(ScoreMap storage map, uint reviewer, uint reviewed, uint evaluation) external { set(map.reviewsTo[reviewer], reviewed, evaluation); set(map.reviewsFrom[reviewed], reviewer, evaluation); }
47,992
18
// requires to pick a winner or extends duration if not enough participants
require(TotalTickets<=minTickets,"A winner has to be picked first"); NextRaffle = NextRaffle.add((((now.sub(NextRaffle)).div(60)).add(1)).mul(60));
require(TotalTickets<=minTickets,"A winner has to be picked first"); NextRaffle = NextRaffle.add((((now.sub(NextRaffle)).div(60)).add(1)).mul(60));
40,537
36
// The contract used for airdrop campaign of ATT token /
contract Airdrop { using SafeMath for uint256; using SafeERC20 for ERC20; // The token being sold ERC20 public token; address owner = 0x0; // How many token units a buyer gets per wei. // The rate is the conversion between wei and the smallest and indivisible token unit. // S...
contract Airdrop { using SafeMath for uint256; using SafeERC20 for ERC20; // The token being sold ERC20 public token; address owner = 0x0; // How many token units a buyer gets per wei. // The rate is the conversion between wei and the smallest and indivisible token unit. // S...
8,050
4
//
library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { assert(b > 0); // Solidity automatically throws when dividing by 0 ...
library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { assert(b > 0); // Solidity automatically throws when dividing by 0 ...
29,780
93
// Calculate Dividend
calDividendPercentage = SafeMath.percent(incomingEthereum,dividendFeePercent,100,18);
calDividendPercentage = SafeMath.percent(incomingEthereum,dividendFeePercent,100,18);
29,945
20
// locked token structure /
struct lockToken { uint256 amount; uint256 validity; bool claimed; }
struct lockToken { uint256 amount; uint256 validity; bool claimed; }
48,719
92
// Events
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event GuardianTransferred(address indexed previousGuardian, address indexed newGuardian);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event GuardianTransferred(address indexed previousGuardian, address indexed newGuardian);
2,400
120
// return 120-180 randomly /
function _randtimeBetweenLotteryDraw() private view returns(uint256) { uint256 seed = _semiRandom(); return 120 + seed % 61; }
function _randtimeBetweenLotteryDraw() private view returns(uint256) { uint256 seed = _semiRandom(); return 120 + seed % 61; }
22,511
13
// Bridges ERC20 to the remote chain/Locks an ERC20 on the source chain and sends LZ message to the remote chain to mint a wrapped token
function bridge(address token, uint amountLD, address to, LzLib.CallParams calldata callParams, bytes memory adapterParams) external payable nonReentrant { require(supportedTokens[token], "OriginalTokenBridge: token is not supported"); // Supports tokens with transfer fee uint balanceBef...
function bridge(address token, uint amountLD, address to, LzLib.CallParams calldata callParams, bytes memory adapterParams) external payable nonReentrant { require(supportedTokens[token], "OriginalTokenBridge: token is not supported"); // Supports tokens with transfer fee uint balanceBef...
19,636
379
// Overwrite service index
uint256 lastIndex = validServiceTypes.length - 1; validServiceTypes[serviceIndex] = validServiceTypes[lastIndex]; validServiceTypes.length--;
uint256 lastIndex = validServiceTypes.length - 1; validServiceTypes[serviceIndex] = validServiceTypes[lastIndex]; validServiceTypes.length--;
25,994
53
// Implementation of the ERC20Decimals. Extension of {ERC20} that adds decimals storage slot./ Sets the value of the `decimals`. This value is immutable, it can only beset once during construction. /
constructor(uint8 decimals_) { _decimals = decimals_; }
constructor(uint8 decimals_) { _decimals = decimals_; }
41
25
// Modifier that allows only the owner or guardian to call a function /
modifier onlyOwnerOrGuardian() { if ((guardian == msg.sender || avatar == msg.sender || owner() == msg.sender) == false) revert NOT_GUARDIAN(msg.sender); _; }
modifier onlyOwnerOrGuardian() { if ((guardian == msg.sender || avatar == msg.sender || owner() == msg.sender) == false) revert NOT_GUARDIAN(msg.sender); _; }
38,311
13
// Token transfer function Token amount should be in 18 decimals (eg. 1991018)
function transfer(address _to, uint256 _amount ) public { require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = sub(balances[msg.sender], _amount); balances[_to] = add(balances[_to], _amount); emit Transfer(msg.sender, _to, _amo...
function transfer(address _to, uint256 _amount ) public { require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = sub(balances[msg.sender], _amount); balances[_to] = add(balances[_to], _amount); emit Transfer(msg.sender, _to, _amo...
41,381
6
// reverts or returns data stored at "ptr"
switch result
switch result
20,350
75
// Approve SarcoDao - PurchaseExecutor's total USDC tokens (Execute Purchase)
USDC_TOKEN.approve( _sarco_dao, ((_sarco_allocations_total * usdc_to_sarco_precision) / _usdc_to_sarco_rate) / sarco_to_usdc_decimal_fix );
USDC_TOKEN.approve( _sarco_dao, ((_sarco_allocations_total * usdc_to_sarco_precision) / _usdc_to_sarco_rate) / sarco_to_usdc_decimal_fix );
8,303
23
// Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called./
function allowance(address owner, address spender) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
36,598
17
// sum up original payout amount (self.balance changes during payouts)
totalPayoutAmount += pots[j + numPots * round].amount;
totalPayoutAmount += pots[j + numPots * round].amount;
11,426
5
// e como um array[], so que ha situacoes que eu quero localizar algo pelo nome, endereco ou numero que eu "defina" o que muda e a forma que identifico o id entre parenteses eu defino o tipo de dado(string) tipo de dado que quero achar dentro(ofertante) tipo de dado a ser armanezado
Ofertante[] public ofertantes; bool public encerrado;
Ofertante[] public ofertantes; bool public encerrado;
43,901
9
// This is an alternative to {approve} that can be used as a mitigation forproblems described in {IBEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. /
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; }
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; }
26,065
0
// Kongliang Zhong - <kongliang@loopring.org>/IFeeHolder - A contract holding fees.
contract IFeeHolder { event TokenWithdrawn( address owner, address token, uint value ); // A map of all fee balances mapping(address => mapping(address => uint)) public feeBalances; /// @dev Allows withdrawing the tokens to be burned by /// authorized contract...
contract IFeeHolder { event TokenWithdrawn( address owner, address token, uint value ); // A map of all fee balances mapping(address => mapping(address => uint)) public feeBalances; /// @dev Allows withdrawing the tokens to be burned by /// authorized contract...
41,889
173
// percentage of treasury to send to public goods address
uint256 public public_goods_perc;
uint256 public public_goods_perc;
12,730
30
// Update active collateral
epochStrikeData[epoch][strike].activeCollateral += requiredCollateral;
epochStrikeData[epoch][strike].activeCollateral += requiredCollateral;
22,866
98
// update fee growth global and, if necessary, protocol fees overflow is acceptable, protocol has to withdraw before it hits type(uint128).max fees
if (zeroForOne) { feeGrowthGlobal0X128 = state.feeGrowthGlobalX128; unchecked { if (state.protocolFee > 0) protocolFees.token0 += state.protocolFee; }
if (zeroForOne) { feeGrowthGlobal0X128 = state.feeGrowthGlobalX128; unchecked { if (state.protocolFee > 0) protocolFees.token0 += state.protocolFee; }
4,275
4
// structs can act like objects
struct MarketToken { uint itemId; address nftContract; uint256 tokenId; address payable seller; address payable owner; uint256 price; bool sold; uint256 power; uint lvl; uint lastClaim; }
struct MarketToken { uint itemId; address nftContract; uint256 tokenId; address payable seller; address payable owner; uint256 price; bool sold; uint256 power; uint lvl; uint lastClaim; }
53,736
8
// create mapping to access bbcount
mapping(uint => BBcount) public bbcount; mapping(uint => sendLog) public sent; mapping(uint => recdLog) public rec; uint public donorCount; uint public recptCount; uint public bbcounter; uint public scount; uint public rcount;
mapping(uint => BBcount) public bbcount; mapping(uint => sendLog) public sent; mapping(uint => recdLog) public rec; uint public donorCount; uint public recptCount; uint public bbcounter; uint public scount; uint public rcount;
41,539
166
// if we have xyz to sell, then sell some of it
uint256 _xyzBalance = xyz.balanceOf(address(this)); if (_xyzBalance > 0) {
uint256 _xyzBalance = xyz.balanceOf(address(this)); if (_xyzBalance > 0) {
59,577
45
// read-only offer. Modify an offer by directly accessing offers[id]
OfferInfo memory offer = offers[id]; delete offers[id]; require( offer.pay_gem.transfer(offer.owner, offer.pay_amt) ); LogItemUpdate(id); LogKill( bytes32(id), keccak256(offer.pay_gem, offer.buy_gem), offer.owner,
OfferInfo memory offer = offers[id]; delete offers[id]; require( offer.pay_gem.transfer(offer.owner, offer.pay_amt) ); LogItemUpdate(id); LogKill( bytes32(id), keccak256(offer.pay_gem, offer.buy_gem), offer.owner,
16,643
12
// LPChainlinkOracleV1/BoringCrypto/Oracle used for getting the price of an LP token based on an chainlink oracle with 18 decimals/Optimized version based on https:blog.alphafinance.io/fair-lp-token-pricing/
contract LPChainlinkOracleV1 is IAggregator { using BoringMath for uint256; IUniswapV2Pair public immutable pair; IAggregator public immutable tokenOracle; constructor(IUniswapV2Pair pair_, IAggregator tokenOracle_) public { pair = pair_; tokenOracle = tokenOracle_; } // credi...
contract LPChainlinkOracleV1 is IAggregator { using BoringMath for uint256; IUniswapV2Pair public immutable pair; IAggregator public immutable tokenOracle; constructor(IUniswapV2Pair pair_, IAggregator tokenOracle_) public { pair = pair_; tokenOracle = tokenOracle_; } // credi...
35,215
22
// Support interfaces for Access Control and ERC721
function supportsInterface(bytes4 interfaceId) public view override(ERC721A) returns (bool)
function supportsInterface(bytes4 interfaceId) public view override(ERC721A) returns (bool)
74,385
9
// we get msg.sender's % of pool and then use that to convert to tokens
function withdraw(uint amountShares) external { require(amountShares <= IERC20(address(this)).balanceOf(msg.sender), "no"); require(amountShares > 0, "cannot withdraw 0"); //then we pass this to the strategy contract to withdraw the correct % of LP tokens (I think??) uint beforeBal = usdc.balanceOf(add...
function withdraw(uint amountShares) external { require(amountShares <= IERC20(address(this)).balanceOf(msg.sender), "no"); require(amountShares > 0, "cannot withdraw 0"); //then we pass this to the strategy contract to withdraw the correct % of LP tokens (I think??) uint beforeBal = usdc.balanceOf(add...
38,902
148
// Internal deposit logic to be implemented by Stratgies
function _deposit(uint256 _want) internal virtual;
function _deposit(uint256 _want) internal virtual;
1,873