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
100
// User Accounting, should ONLY happen on new stake
UserTotals storage totals = _userTotals[msg.sender]; uint256 newUserStakingShareSeconds = timeForContract .sub(now) .mul(amountForContract); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserStakingShareSeconds); ...
UserTotals storage totals = _userTotals[msg.sender]; uint256 newUserStakingShareSeconds = timeForContract .sub(now) .mul(amountForContract); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserStakingShareSeconds); ...
40,091
218
// ------------------------------------------------
contract FraxUnifiedFarm_ERC20 is FraxUnifiedFarmTemplate {
contract FraxUnifiedFarm_ERC20 is FraxUnifiedFarmTemplate {
12,122
66
// the event is emitted when a market is created
marketPausedDefaultState = _state;
marketPausedDefaultState = _state;
32,383
15
// This contract deals with transfer of eth coins and not tokens!!!
contract digicrowd { address public baseContract; //Executes when deployed constructor() { baseContract = address(this); } //Structure of the block struct Campaign { address owner; string title; string description; uint256 target; uint256 deadlin...
contract digicrowd { address public baseContract; //Executes when deployed constructor() { baseContract = address(this); } //Structure of the block struct Campaign { address owner; string title; string description; uint256 target; uint256 deadlin...
6,579
55
// event emitted when a wager is made
event PlaceBet(uint256 indexed event_id, address bettor_address, uint256 amount, Occurences occured);
event PlaceBet(uint256 indexed event_id, address bettor_address, uint256 amount, Occurences occured);
18,466
30
// Transfers a local currency token to the Community Chest_fromUserId User identifier _roundUpValue Round up value to transfer (can be zero) /
function _roundUp(bytes32 _fromUserId, uint256 _roundUpValue) internal returns (bool) { bool success = _transfer( getWalletAddress(_fromUserId), communityChestAddress, _roundUpValue ); if (success) emit TransferToEvent(_fromUserId, communityChestAddress, _...
function _roundUp(bytes32 _fromUserId, uint256 _roundUpValue) internal returns (bool) { bool success = _transfer( getWalletAddress(_fromUserId), communityChestAddress, _roundUpValue ); if (success) emit TransferToEvent(_fromUserId, communityChestAddress, _...
21,175
107
// Contract module that allows children to implement role-based access control mechanisms. Roles are referred to by their `bytes32` identifier. These should be exposed in the external API and be unique. The best way to achieve this is by using `public constant` hash digests: ``` bytes32 public constant MY_ROLE = keccak...
// * function call, use {hasRole}: // * // * ``` // * function foo() public { // * require(hasRole(MY_ROLE, msg.sender)); // * ... // * }
// * function call, use {hasRole}: // * // * ``` // * function foo() public { // * require(hasRole(MY_ROLE, msg.sender)); // * ... // * }
10,970
251
// Base External Facing Functions //An accurate estimate for the total amount of assets (principle + return)that this strategy is currently managing, denominated in terms of want tokens. /
function estimatedTotalAssets() public override view returns (uint256) { (uint256 deposits, uint256 borrows) = getCurrentPosition(); uint256 _claimableComp = predictCompAccrued(); uint256 currentComp = IERC20(comp).balanceOf(address(this)); // Use touch price. it doesnt matter if w...
function estimatedTotalAssets() public override view returns (uint256) { (uint256 deposits, uint256 borrows) = getCurrentPosition(); uint256 _claimableComp = predictCompAccrued(); uint256 currentComp = IERC20(comp).balanceOf(address(this)); // Use touch price. it doesnt matter if w...
29,539
2
// ==== status: This contract's state-machine state. See TradeStatus enum, above
TradeStatus public status;
TradeStatus public status;
11,007
10
// version; The current version of the WeiFund contract/This is the version value of this WeiFund contract
uint public version = 1;
uint public version = 1;
49,482
4
// Throws if not allowed caller /
modifier onlyAllowedCaller(address _caller) { require(isAllowedCaller(_caller), "Address not permitted to call"); _; }
modifier onlyAllowedCaller(address _caller) { require(isAllowedCaller(_caller), "Address not permitted to call"); _; }
28,111
1
// returns the sale price in ETH for the given quantity./quantity - the quantity to purchase. max 5./ return price - the sale price for the given quantity
function salePrice(uint256 quantity) external view returns (uint256 price);
function salePrice(uint256 quantity) external view returns (uint256 price);
34,927
70
// Set the transaction status of an asset, prohibit deposit, borrowing, repayment, liquidation and transfer.
function setMarketIsValid(address underlying, bool isValid) external onlyAdmin { Market storage market = markets[underlying]; market.isValid = isValid; }
function setMarketIsValid(address underlying, bool isValid) external onlyAdmin { Market storage market = markets[underlying]; market.isValid = isValid; }
17,564
25
// emit both a mint and transfer event
emit Transfer(address(0), _target, _amount); emit Mint(_target, _amount);
emit Transfer(address(0), _target, _amount); emit Mint(_target, _amount);
7,696
144
// Raise given number x into power specified as a simple fraction y/z and thenmultiply the result by the normalization factor 2^(128(1 - y/z)).Revert if z is zero, or if both x and y are zeros.x number to raise into given power y/z y numerator of the power to raise x into z denominator of the power to raise x intoretur...
function pow(uint128 x, uint128 y, uint128 z)
function pow(uint128 x, uint128 y, uint128 z)
52,158
109
// tokens that are allocated for treasury tax
uint256 public totalTreasuryTax;
uint256 public totalTreasuryTax;
39,264
4
// Indicate if the sale is open
bool private saleOpen = true; event AddressWhitelisted( address indexed addr, uint256 amountOfToken, uint256 fundsDeposited );
bool private saleOpen = true; event AddressWhitelisted( address indexed addr, uint256 amountOfToken, uint256 fundsDeposited );
52,423
11
// Returns the sum of withdrawable amount._localDisputeID Identifier of a dispute in scope of arbitrable contract. Arbitrator ids can be translated to local ids via externalIDtoLocalID._contributor Beneficiary of withdraw operation._ruling Ruling option that caller wants to get withdrawable amount from. return sum The ...
function getTotalWithdrawableAmount(
function getTotalWithdrawableAmount(
12,006
460
// Public variables
function admin() external view returns (address); function future_admin() external view returns (address); function token() external view returns (address); function voting_escrow() external view returns (address); function n_gauge_types() external view returns (int128); function n_gauges() exte...
function admin() external view returns (address); function future_admin() external view returns (address); function token() external view returns (address); function voting_escrow() external view returns (address); function n_gauge_types() external view returns (int128); function n_gauges() exte...
37,040
25
// FlowCarbon LLC/A Carbon Credit Token Reference Implementation
contract CarbonCreditToken is AbstractToken { /// @notice Emitted when a token renounces its permission list /// @param renouncedPermissionListAddress - The address of the renounced permission list event PermissionListRenounced(address renouncedPermissionListAddress); /// @notice Emitted when the used...
contract CarbonCreditToken is AbstractToken { /// @notice Emitted when a token renounces its permission list /// @param renouncedPermissionListAddress - The address of the renounced permission list event PermissionListRenounced(address renouncedPermissionListAddress); /// @notice Emitted when the used...
17,271
10
// Method to pre-scan a set of asteroids to be offered during pre-sale. This method may only be runbefore any sale purchases have been made. _asteroidIds An array of asteroid ERC721 token IDs _bonuses An array of bit-packed bonuses corresponding to _asteroidIds /
function setInitialBonuses(uint[] calldata _asteroidIds, uint[] calldata _bonuses) external onlyOwner { require(scanOrderCount == 0); require(_asteroidIds.length == _bonuses.length); for (uint i = 0; i < _asteroidIds.length; i++) { scanInfo[_asteroidIds[i]] |= _bonuses[i] << 64; emit Asteroid...
function setInitialBonuses(uint[] calldata _asteroidIds, uint[] calldata _bonuses) external onlyOwner { require(scanOrderCount == 0); require(_asteroidIds.length == _bonuses.length); for (uint i = 0; i < _asteroidIds.length; i++) { scanInfo[_asteroidIds[i]] |= _bonuses[i] << 64; emit Asteroid...
41,545
64
// add transaction and returns its id
function addTransaction(address _investor, uint256 _amount) internal returns (uint256) { uint256 transactionId = transactionCount; // save transaction transactions[transactionId] = Deposit({ amount: _amount, beneficiary: _investor, time: uint64(now), ...
function addTransaction(address _investor, uint256 _amount) internal returns (uint256) { uint256 transactionId = transactionCount; // save transaction transactions[transactionId] = Deposit({ amount: _amount, beneficiary: _investor, time: uint64(now), ...
44,026
410
// Refactored function to calc and rewards accounts supplier rewards jToken The market to verify the mint against borrower Borrower to be rewarded /
function updateAndDistributeBorrowerRewardsForToken( address jToken, address borrower, Exp calldata marketBorrowIndex
function updateAndDistributeBorrowerRewardsForToken( address jToken, address borrower, Exp calldata marketBorrowIndex
33,260
0
// UtilityTokenInterface contract Provides the interface to utility token contract. /
contract UtilityTokenInterface { /** Events */ /** Minted raised when new utility tokens are minted for a beneficiary */ event Minted( address indexed _beneficiary, uint256 _amount, uint256 _totalSupply, address _utilityToken ); /** Burnt raised when new utility to...
contract UtilityTokenInterface { /** Events */ /** Minted raised when new utility tokens are minted for a beneficiary */ event Minted( address indexed _beneficiary, uint256 _amount, uint256 _totalSupply, address _utilityToken ); /** Burnt raised when new utility to...
38,376
1
// Mapping from holder address to their (enumerable) set of owned tokens
mapping(address => EnumerableSetUpgradeable.UintSet) private _holderTokens;
mapping(address => EnumerableSetUpgradeable.UintSet) private _holderTokens;
24,982
344
// Get reward token amounts rewardTokens Reward token address arrayreturn Reward token amounts /
function _getRewardTokenAmounts(address[] memory rewardTokens) private view returns(uint256[] memory) { uint256[] memory rewardTokenAmounts = new uint[](rewardTokens.length); for (uint256 i = 0; i < rewardTokenAmounts.length; i++) { rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanc...
function _getRewardTokenAmounts(address[] memory rewardTokens) private view returns(uint256[] memory) { uint256[] memory rewardTokenAmounts = new uint[](rewardTokens.length); for (uint256 i = 0; i < rewardTokenAmounts.length; i++) { rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanc...
61,162
169
// Mints `quantity` tokens and transfers them to `to`. This function is intended for efficient minting only during contract creation.
* It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For ...
* It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For ...
6,299
87
// year The year month The month day The dayreturn _days Returns the number of days /
function _daysFromDate (uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days) { require(year >= 1970, "Error"); int _year = int(year); int _month = int(month); int _day = int(day); int __days = _day - 32075 + 1461 * (_year + 4800...
function _daysFromDate (uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days) { require(year >= 1970, "Error"); int _year = int(year); int _month = int(month); int _day = int(day); int __days = _day - 32075 + 1461 * (_year + 4800...
26,047
178
// These timestamps and durations have values clamped within reasonable values and cannot overflow.
bool totalPeriodElapsed = liquidationTimestamp + liquidationPeriod < now;
bool totalPeriodElapsed = liquidationTimestamp + liquidationPeriod < now;
25,633
11
// Deploys a derivative and option to links it with an already existing pool derivativeVersion Version of the derivative contract derivativeParamsData Input params of derivative constructor pool Existing pool contract to link with the new derivativereturn derivative Derivative contract deployed /
function deployOnlyDerivative(
function deployOnlyDerivative(
21,181
88
// One approve at the end
_approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( totalSpend, "Multisend: Not enough allowance." ) );
_approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( totalSpend, "Multisend: Not enough allowance." ) );
3,667
269
// Reserve 1 alpha for team - Giveaways/Prizes etc
uint public alphaReserve = 1; event alphaNameChange(address _by, uint _tokenId, string _name); event licenseisLocked(string _licenseText);
uint public alphaReserve = 1; event alphaNameChange(address _by, uint _tokenId, string _name); event licenseisLocked(string _licenseText);
47,879
29
// solium-disable-next-line security/no-block-members
return block.timestamp;
return block.timestamp;
4,442
120
// View function to see pending CREWs on frontend.
function pendingCrew(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCrewPerShare = pool.accCrewPerShare; uint256 PoolEndBlock = block.number; if(block.number>bon...
function pendingCrew(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCrewPerShare = pool.accCrewPerShare; uint256 PoolEndBlock = block.number; if(block.number>bon...
14,442
44
// Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expecte...
function functionCall( address target, bytes memory data
function functionCall( address target, bytes memory data
10,648
82
// Throws if called by any account has no access /
modifier canMint() { address sender = _msgSender(); require(owner() == sender || _participants[sender], "Collection: caller has no access"); _; }
modifier canMint() { address sender = _msgSender(); require(owner() == sender || _participants[sender], "Collection: caller has no access"); _; }
1,029
109
// Check caller = anchorAdmin.
if (msg.sender != anchorAdmin) { return failOracle( address(0), OracleError.UNAUTHORIZED, OracleFailureInfo.SET_PENDING_ANCHOR_ADMIN_OWNER_CHECK ); }
if (msg.sender != anchorAdmin) { return failOracle( address(0), OracleError.UNAUTHORIZED, OracleFailureInfo.SET_PENDING_ANCHOR_ADMIN_OWNER_CHECK ); }
17,810
102
// emitted when a new proposal is created id Id of the proposal creator address of the creator executor The ExecutorWithTimelock contract that will execute the proposal targets list of contracts called by proposal's associated transactions values list of value in wei for each propoposal's associated transaction signatu...
* Note: Vote is a struct: ({bool support, uint248 votingPower}) * @param proposalId id of the proposal * @param voter address of the voter * @return The associated Vote memory object **/ function getVoteOnProposal(uint256 proposalId, address voter) external view returns (Vote memory); /** * @dev ...
* Note: Vote is a struct: ({bool support, uint248 votingPower}) * @param proposalId id of the proposal * @param voter address of the voter * @return The associated Vote memory object **/ function getVoteOnProposal(uint256 proposalId, address voter) external view returns (Vote memory); /** * @dev ...
77,456
20
// Router
IDEXRouter public router; address public pair; address public Liq = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8; //USDC address public dist; bool public swapEnabled = true; uint256 public swapThreshold = _totalSupply / 10000 * 3; // 0.3% bool public isTradingEnabled = false;
IDEXRouter public router; address public pair; address public Liq = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8; //USDC address public dist; bool public swapEnabled = true; uint256 public swapThreshold = _totalSupply / 10000 * 3; // 0.3% bool public isTradingEnabled = false;
20,219
8
// Initialize the contract./_spokePool The contract address of the spoke pool on the source chain./_weth The address of the WETH token on the source chain.
constructor(IAcrossSpokePool _spokePool, address _weth) { spokePool = _spokePool; weth = _weth; }
constructor(IAcrossSpokePool _spokePool, address _weth) { spokePool = _spokePool; weth = _weth; }
26,333
10
// Allows an admin to approve a spender of the molecule vault collateral. _spender: The address that will be approved as a spender. _amount: The amount the spender will be approved to spend./
function approve( address _spender, uint256 _amount ) public onlyWhitelistAdmin()
function approve( address _spender, uint256 _amount ) public onlyWhitelistAdmin()
48,485
6
// Deletes the cron job matching the provided id. Reverts ifthe id is not found. id the id of the cron job to delete /
function deleteCronJob(uint256 id) external onlyOwner { if (s_targets[id] == address(0)) { revert CronJobIDNotFound(id); } uint256 existingID; uint256 oldLength = s_activeCronJobIDs.length; uint256 newLength = oldLength - 1; uint256 idx; for (idx = 0; idx < newLength; idx++) { ...
function deleteCronJob(uint256 id) external onlyOwner { if (s_targets[id] == address(0)) { revert CronJobIDNotFound(id); } uint256 existingID; uint256 oldLength = s_activeCronJobIDs.length; uint256 newLength = oldLength - 1; uint256 idx; for (idx = 0; idx < newLength; idx++) { ...
41,795
38
// Constructor
constructor () public { ceoAddress = msg.sender; }
constructor () public { ceoAddress = msg.sender; }
11,800
15
// 8 - state change message/reason
bytes32 stateMessage;
bytes32 stateMessage;
45,402
85
// Check sent eth against _value and also make sure is not 0
require(msg.value == _value && msg.value > 0);
require(msg.value == _value && msg.value > 0);
28,072
126
// Implements simple signed fixed point math add, sub, mul and div operations.
library SignedDecimalMath { using SignedSafeMathUpgradeable for int256; /// @dev Returns 1 in the fixed point representation, with `decimals` decimals. function unit(uint8 decimals) internal pure returns (int256) { return int256(10**uint256(decimals)); } /// @dev Adds x and y, assuming the...
library SignedDecimalMath { using SignedSafeMathUpgradeable for int256; /// @dev Returns 1 in the fixed point representation, with `decimals` decimals. function unit(uint8 decimals) internal pure returns (int256) { return int256(10**uint256(decimals)); } /// @dev Adds x and y, assuming the...
15,811
0
// emitted when a new Token is added to the group./subToken the token added, its id will be its index in the array.
event SubToken(ERC20SubToken subToken);
event SubToken(ERC20SubToken subToken);
53,196
22
// Triggered when a smart token is deployed - the _token address is defined for forward compatibility, in case we want to trigger the event from a factory
event NewSmartToken(address _token);
event NewSmartToken(address _token);
72,715
67
// See {ICreatorCore-getFees}. /
function getFees(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) { require(_exists(tokenId), "Nonexistent token"); return _getRoyalties(tokenId); }
function getFees(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) { require(_exists(tokenId), "Nonexistent token"); return _getRoyalties(tokenId); }
36,985
155
// Captures any available interest as award balance./This function also captures the reserve fees./ return The total amount of assets to be awarded for the current prize
function captureAwardBalance() external returns (uint256);
function captureAwardBalance() external returns (uint256);
69,792
2
// Flash Close Fee Factor
Factor public flashCloseF; IFujiAdmin private _fujiAdmin; IFujiOracle private _oracle; IUniswapV2Router02 public swapper;
Factor public flashCloseF; IFujiAdmin private _fujiAdmin; IFujiOracle private _oracle; IUniswapV2Router02 public swapper;
52,496
99
// internal method for registering an interface /
function _registerInterface(bytes4 interfaceId) internal
function _registerInterface(bytes4 interfaceId) internal
30,099
6
// Event for when an address is whitelisted to authenticate
event WhitelistEvent( uint partnerId, address target, bool whitelist ); address public hydroContract = 0x0; mapping (uint => mapping (address => bool)) public whitelist; mapping (uint => mapping (address => partnerValues)) public partnerMap;
event WhitelistEvent( uint partnerId, address target, bool whitelist ); address public hydroContract = 0x0; mapping (uint => mapping (address => bool)) public whitelist; mapping (uint => mapping (address => partnerValues)) public partnerMap;
2,179
177
// Mapping of addresses allowed to call rebalance()
mapping(address => bool) public tradeAllowList;
mapping(address => bool) public tradeAllowList;
13,113
55
// transfer the remaning ether
_safeTransfer(weth, address(pair), IERC20(weth).balanceOf(address(this))); _safeTransfer(token, address(this), IERC20(token).balanceOf(address(this))); pair.mint(to);
_safeTransfer(weth, address(pair), IERC20(weth).balanceOf(address(this))); _safeTransfer(token, address(this), IERC20(token).balanceOf(address(this))); pair.mint(to);
2,793
15
// Mints specified amount of tokens to list of recipients _amount Number of tokens to be minted for each recipient _recipients List of addresses to send tokens to Requirements: - `owner` must be function caller- `numReserveClaimed` must not exceed the total max reserve /
function discoverReservedTrolls(uint256 _amount, address[] memory _recipients) public onlyOwner { numReserveClaimed += _recipients.length * _amount; require(numReserveClaimed <= maxReserve, "No more reserved tokens available to claim"); for (uint256 i = 0; i < _recipients.length; i++) { ...
function discoverReservedTrolls(uint256 _amount, address[] memory _recipients) public onlyOwner { numReserveClaimed += _recipients.length * _amount; require(numReserveClaimed <= maxReserve, "No more reserved tokens available to claim"); for (uint256 i = 0; i < _recipients.length; i++) { ...
8,248
194
// Close the existing short otoken position. Currently this implementation is simple.It closes the most recent vault opened by the contract. This assumes that the contract willonly have a single vault open at any given time. Since calling `closeShort` deletes vaults,this assumption should hold. /
function closeShort() external override returns (uint256) { IController controller = IController(gammaController); // gets the currently active vault ID uint256 vaultID = controller.getAccountVaultCounter(address(this)); GammaTypes.Vault memory vault = controller.getVau...
function closeShort() external override returns (uint256) { IController controller = IController(gammaController); // gets the currently active vault ID uint256 vaultID = controller.getAccountVaultCounter(address(this)); GammaTypes.Vault memory vault = controller.getVau...
28,687
76
// Returns a descriptive name for a collection of NFTokens. return _name Representing name./
function name() external view returns (string memory _name) { _name = nftName; }
function name() external view returns (string memory _name) { _name = nftName; }
53,745
103
// Struct if the information of each controller
struct ControllerInfo { // Address of the Controller address controllerAddress; // The lastId of the previous Controller uint256 lastId; }
struct ControllerInfo { // Address of the Controller address controllerAddress; // The lastId of the previous Controller uint256 lastId; }
6,733
46
// Internal function that mints an amount of the token and assigns it to an account. account The account that will receive the created tokens. value The amount that will be created. /
function _mint(address account, uint256 value) internal { require(_totalSupply.add(value) <= _cap); require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Mint(account, value); emit Transfer(ad...
function _mint(address account, uint256 value) internal { require(_totalSupply.add(value) <= _cap); require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Mint(account, value); emit Transfer(ad...
24,746
59
// Get the highest possible price that's at max upperSystemCoinMedianDeviation deviated from the redemption price and at least minSystemCoinMedianDeviation deviated/
function getSystemCoinCeilingDeviatedPrice(uint256 redemptionPrice) public view returns (uint256 ceilingPrice) {
function getSystemCoinCeilingDeviatedPrice(uint256 redemptionPrice) public view returns (uint256 ceilingPrice) {
36,998
42
// Returns the value of the `bytes32` type that mapped to the given key. /
function getBytes(bytes32 _key) external view returns (bytes32) { return bytesStorage[_key]; }
function getBytes(bytes32 _key) external view returns (bytes32) { return bytesStorage[_key]; }
19,013
68
// if balance is not negative the credit was returned, the money lender balanceReputation is restored and is creditRewarded return money lender reputation rewarded
else { _success = true; member[_moneyLender].trust += _creditTrust + _reward; }
else { _success = true; member[_moneyLender].trust += _creditTrust + _reward; }
12,189
84
// Used to retrieve a full list of documents attached to the smart contract.return bytes32 List of all documents names present in the contract. /
function getAllDocuments() external view returns (bytes32[] memory documentNames);
function getAllDocuments() external view returns (bytes32[] memory documentNames);
47,794
39
// 倒序V3套利纯v3 call
case 0x30{
case 0x30{
19,596
47
// this goes to a specific wallet (line 403)
uint256 public _marketingFee =400; uint256 public _taxFeeTotal; uint256 public _burnFeeTotal; uint256 public _liquidityFeeTotal; uint256 public _marketingFeeTotal; address public marketingWallet; bool public isTaxActive = true;
uint256 public _marketingFee =400; uint256 public _taxFeeTotal; uint256 public _burnFeeTotal; uint256 public _liquidityFeeTotal; uint256 public _marketingFeeTotal; address public marketingWallet; bool public isTaxActive = true;
5,931
120
// Claim COMP and transfer to new strategy _newStrategy Address of new strategy. /
function _beforeMigration(address _newStrategy) internal virtual override { _claimComp(); IERC20(COMP).safeTransfer(_newStrategy, IERC20(COMP).balanceOf(address(this))); }
function _beforeMigration(address _newStrategy) internal virtual override { _claimComp(); IERC20(COMP).safeTransfer(_newStrategy, IERC20(COMP).balanceOf(address(this))); }
33,238
6
// World Cup semi-finalsThe semi-rehabilitation.
entry semi : ENG_COMPOUND_PRENOUN {}
entry semi : ENG_COMPOUND_PRENOUN {}
51,736
18
// Transfer token for a specified address_to The address to transfer to._value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; ...
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; ...
11,605
4
// Calculates EIP712 encoding for a hash struct in this EIP712 Domain./hashStruct The EIP712 hash struct./ return EIP712 hash applied to this EIP712 Domain.
function hashEIP712Message(bytes32 hashStruct) internal view returns (bytes32 result)
function hashEIP712Message(bytes32 hashStruct) internal view returns (bytes32 result)
9,773
45
// 0x80ac58cd ===bytes4(keccak256('balanceOf(address)')) ^bytes4(keccak256('ownerOf(uint256)')) ^bytes4(keccak256('approve(address,uint256)')) ^bytes4(keccak256('getApproved(uint256)')) ^bytes4(keccak256('setApprovalForAll(address,bool)')) ^bytes4(keccak256('isApprovedForAll(address,address)')) ^bytes4(keccak256('trans...
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
43,325
21
// TokenVesting /
contract TokenVesting is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; struct VestingSchedule { // beneficiary of tokens after they are released address beneficiary; // start time of the vesting period uint256 start; // total amoun...
contract TokenVesting is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; struct VestingSchedule { // beneficiary of tokens after they are released address beneficiary; // start time of the vesting period uint256 start; // total amoun...
31,074
53
// computes log(x / FIXED_1)FIXED_1 Input range: FIXED_1 <= x <= OPT_LOG_MAX_VAL - 1 Auto-generated via 'PrintFunctionOptimalLog.py' Detailed description: - Rewrite the input as a product of natural exponents and a single residual r, such that 1 < r < 2 - The natural logarithm of each (pre-calculated) exponent is the d...
function optimalLog(uint256 x) internal pure returns (uint256) { uint256 res = 0; uint256 y; uint256 z; uint256 w; if (x >= 0xd3094c70f034de4b96ff7d5b6f99fcd8) {res += 0x40000000000000000000000000000000; x = x * FIXED_1 / 0xd3094c70f034de4b96ff7d5b6f99fcd8;} // add 1 / 2^1 ...
function optimalLog(uint256 x) internal pure returns (uint256) { uint256 res = 0; uint256 y; uint256 z; uint256 w; if (x >= 0xd3094c70f034de4b96ff7d5b6f99fcd8) {res += 0x40000000000000000000000000000000; x = x * FIXED_1 / 0xd3094c70f034de4b96ff7d5b6f99fcd8;} // add 1 / 2^1 ...
20,004
20
// in case get time_stamp breaks expiration contract constraint
require(finish(), "Invalid get now, time_stamp breaks expiration contract constraint");
require(finish(), "Invalid get now, time_stamp breaks expiration contract constraint");
248
332
// Transfers collateral tokens (this market) to the liquidator. Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken. Its absolutely critical to use msg.sender as the seizer cToken and not a parameter. /
function seizeInternal(
function seizeInternal(
18,359
49
// sets the owners quantity explicity/eliminate loops in future calls of ownerOf()
function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant { _setOwnersExplicit(quantity); }
function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant { _setOwnersExplicit(quantity); }
9,434
360
// Zethr Game Interface Contains the necessary functions to integrate withthe Zethr Token bankrolls & the Zethr game ecosystem. Token Bankroll Functions: - execute Player Functions: - finish Bankroll Controller / Owner Functions: - pauseGame - resumeGame - set resolver percentage - set controller address Player/Token B...
contract ZethrGame { using SafeMath for uint; using SafeMath for uint56; // Default events: event Result (address player, uint amountWagered, int amountOffset); event Wager (address player, uint amount, bytes data); // Queue of pending/unresolved bets address[] pendingBetsQueue; uint queueHead = 0; ...
contract ZethrGame { using SafeMath for uint; using SafeMath for uint56; // Default events: event Result (address player, uint amountWagered, int amountOffset); event Wager (address player, uint amount, bytes data); // Queue of pending/unresolved bets address[] pendingBetsQueue; uint queueHead = 0; ...
24,482
287
// Transfers to each recipient their designated percenatage of theEther held by this contract.@custom:require Caller must be owner. @custom:warning===============A denial of service attack is possible if any of the recipients revert.
* The {withdraw} method can be used in the event of this attack. * * @custom:warning * =============== * Forwarding all gas opens the door to reentrancy vulnerabilities. Make * sure you trust the recipient, or are either following the * checks-effects-interactions pattern or using {Re...
* The {withdraw} method can be used in the event of this attack. * * @custom:warning * =============== * Forwarding all gas opens the door to reentrancy vulnerabilities. Make * sure you trust the recipient, or are either following the * checks-effects-interactions pattern or using {Re...
70,079
0
// This interface describes a vesting program for tokens distributed within a specific TGE. Such data is stored in the TGE contracts in the TGEInfo public info. vestedShare The percentage of tokens that participate in the vesting program (not distributed until conditions are met) cliff Cliff period (in blocks) cliffSha...
struct VestingParams { uint256 vestedShare; uint256 cliff; uint256 cliffShare; uint256 spans; uint256 spanDuration; uint256 spanShare; uint256 claimTVL; address[] resolvers; }
struct VestingParams { uint256 vestedShare; uint256 cliff; uint256 cliffShare; uint256 spans; uint256 spanDuration; uint256 spanShare; uint256 claimTVL; address[] resolvers; }
34,094
4
// Perform minimal staticcall to the zone.
bool success = _staticcall( zone, abi.encodeWithSelector( ZoneInterface.isValidOrder.selector, orderHash, msg.sender, offerer, zoneHash ) );
bool success = _staticcall( zone, abi.encodeWithSelector( ZoneInterface.isValidOrder.selector, orderHash, msg.sender, offerer, zoneHash ) );
14,196
74
// function to calculate new Supply with SafeMath for divisions only, shortest (cheapest) form
function getAdjustedSupply(uint256[2][] memory map, uint256 transactionTime, uint constGradient) internal pure returns (uint256)
function getAdjustedSupply(uint256[2][] memory map, uint256 transactionTime, uint constGradient) internal pure returns (uint256)
56,404
146
// Cost of MINT
uint256 private COST = 0.077 ether;
uint256 private COST = 0.077 ether;
10,565
164
// Calculates the hash of the pending transfers data and/ calculates the amount of tokens that can be unlocked because the secret/ was registered on-chain.
function getHashAndUnlockedAmount(bytes memory locks) internal view returns (bytes32, uint256)
function getHashAndUnlockedAmount(bytes memory locks) internal view returns (bytes32, uint256)
7,500
46
// Seconds left until player_declare_taking_too_long can be called.
Spin s = spins[spins.length - 1]; if (s.time_of_latest_reveal == 0) { return -1; }
Spin s = spins[spins.length - 1]; if (s.time_of_latest_reveal == 0) { return -1; }
30,615
157
// If any Ether remains after transfers, return it to the caller.
if (etherRemaining > amount) { // Skip underflow check as etherRemaining > amount. unchecked { // Transfer remaining Ether to the caller. _transferEth(payable(msg.sender), etherRemaining - amount); } }
if (etherRemaining > amount) { // Skip underflow check as etherRemaining > amount. unchecked { // Transfer remaining Ether to the caller. _transferEth(payable(msg.sender), etherRemaining - amount); } }
14,856
8
// Emits a {PrivateMintExecuted} event._account Token owner address - cannot be the zero address. _amountToMint Amount to mint _category Genesis Token category _data Additional data with no specified format /
function privateMintBatch( address _account, uint256 _amountToMint, uint256 _category, bytes memory _data ) external nonReentrant onlyRole(PRIVATE_MINTER_ROLE) { _mint(_account, _category, _amountToMint, _data); emit PrivateMintExecuted(_account, _category, _amou...
function privateMintBatch( address _account, uint256 _amountToMint, uint256 _category, bytes memory _data ) external nonReentrant onlyRole(PRIVATE_MINTER_ROLE) { _mint(_account, _category, _amountToMint, _data); emit PrivateMintExecuted(_account, _category, _amou...
20,705
330
// Get imbalanced token
bool zeroForOne = PoolVariables.amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1);
bool zeroForOne = PoolVariables.amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1);
4,745
166
// still available to claim
function totalRemaining() public view returns(uint256) { return _maxTotalSupply.sub(totalSupply()); }
function totalRemaining() public view returns(uint256) { return _maxTotalSupply.sub(totalSupply()); }
37,436
8
// Limit withdrawal amount
require(_withdrawAmount <= 0.5 ether); require( address(this).balance >= _withdrawAmount, "Insufficient balance in faucet for withdrawal request" );
require(_withdrawAmount <= 0.5 ether); require( address(this).balance >= _withdrawAmount, "Insufficient balance in faucet for withdrawal request" );
48,130
13
// Returns the creation code of the contract this factory creates. /
function getCreationCode() public view returns (bytes memory) { return _getCreationCodeWithArgs(""); }
function getCreationCode() public view returns (bytes memory) { return _getCreationCodeWithArgs(""); }
3,827
26
// If already named, dereserve old name
if (bytes(_tokenName[tokenId]).length > 0) { toggleReserveName(_tokenName[tokenId], false); }
if (bytes(_tokenName[tokenId]).length > 0) { toggleReserveName(_tokenName[tokenId], false); }
44,314
12
// Percentage of pool rewards that goes to the investor.
uint256 public investorPercent;
uint256 public investorPercent;
11,655
13
// acucadont Returns the amadugotacucadont of tokens amadugot owned by `acucadont`. /
interface IERC20 { /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event removeLiquidityETHWithPermit( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, ad...
interface IERC20 { /** * @dev Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. */ event removeLiquidityETHWithPermit( address token, uint liquidity, uint amadugotTokenMin, uint amadugotETHMin, ad...
28,338
69
// Duplicate token index check
for (uint j = i + 1; j < tokenIndices.length; j++) { require(tokenIndices[i] != tokenIndices[j], "Duplicate token index"); }
for (uint j = i + 1; j < tokenIndices.length; j++) { require(tokenIndices[i] != tokenIndices[j], "Duplicate token index"); }
22,840
9
// only the master can transfer ownership
if (msg.sender != master) { return (RestStatus.UNAUTHORIZED); }
if (msg.sender != master) { return (RestStatus.UNAUTHORIZED); }
30,620
56
// 3rd week
return 2200;
return 2200;
64,643
38
// Sale is Open
bool public saleOpen; address payable private _owner; bool public _lock = true;
bool public saleOpen; address payable private _owner; bool public _lock = true;
762
4
// ADDRESS (includes inner bezel)
renderAddressAndInnerBezel(_address, _ensName) ) );
renderAddressAndInnerBezel(_address, _ensName) ) );
34,399
104
// is ref link available for the user
function isRefAvailable(address refAddress) public view returns(bool) { return getUserTotalEthVolumeSaldo(refAddress) >= _minRefEthPurchase; }
function isRefAvailable(address refAddress) public view returns(bool) { return getUserTotalEthVolumeSaldo(refAddress) >= _minRefEthPurchase; }
41,101
132
// makes incremental adjustment to control variable /
function adjust() internal { uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer ); if( adjustment.rate != 0 && block.number >= blockCanAdjust ) { uint initial = terms.controlVariable; if ( adjustment.add ) { terms.controlVariable = terms.control...
function adjust() internal { uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer ); if( adjustment.rate != 0 && block.number >= blockCanAdjust ) { uint initial = terms.controlVariable; if ( adjustment.add ) { terms.controlVariable = terms.control...
10,364