file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/4/0xC019C6B1B4C9b94E09B0Ab562d976aE1784a2a9E/sources/Exchanger.sol | Note: this function can intentionally be called by anyone on behalf of anyone else (the caller just pays the gas) | function settle(address from, bytes32 currencyKey)
external
returns (
uint256 reclaimed,
uint256 refunded,
uint256 numEntriesSettled
)
{
systemStatus().requireSynthActive(currencyKey);
return _internalSettle(from, currencyKey);
}
| 8,610,635 |
pragma solidity ^0.4.18;
/**
* IOwnership
*
* Perminent ownership
*
* #created 01/10/2017
* #author Frank Bonnet
*/
interface IOwnership {
/**
* Returns true if `_account` is the current owner
*
* @param _account The address to test against
*/
function isOwner(addre... | Get the allocated eth balance of `_owner` _owner The address from which the allocated eth balance will be retrieved return The allocated eth balance/ | function ethBalanceOf(address _owner) public view returns (uint) {
uint sum = 0;
for (uint i = 0; i < allocatedIndex[_owner].length; i++) {
sum += allocated[_owner][allocatedIndex[_owner][i]].eth;
}
return sum;
}
| 5,403,349 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
interface UpgradeBeaconControllerInterface {
function upgrade(address beacon, address implementation) external;
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(... | Public function for setting a new timelock interval for a given function selector. The default for this function may also be modified, but excessive values will cause the `modifyTimelockInterval` function to become unusable. functionSelector the selector of the function to set the timelock interval for. newTimelockIn... | function modifyTimelockInterval(
bytes4 functionSelector, uint256 newTimelockInterval
) public {
require(
newTimelockInterval < 365000000000000 days,
"New timelock interval is too large."
);
_enforceTimelock(
this.modifyTimelockInterval.selector, abi.encode()
);
_setTimel... | 12,797,095 |
./partial_match/8453/0x99AEC509174Cbf06F8F7E15dDEeB7bcC32363827/sources/contracts/periphery/libraries/PathHelper.sol | Skips a token + fee element from the buffer and returns the remainder path The swap path return The remaining token + fee elements in the path | function skipToken(bytes memory path) internal pure returns (bytes memory) {
return path.slice(TOKEN_AND_POOL_OFFSET, path.length - TOKEN_AND_POOL_OFFSET);
}
| 16,817,057 |
./full_match/80001/0x4041C04d8048a941b475209003C787b21dE1A6A3/sources/contracts/Main.sol | Transfer the reward from the escrow contract to the assigned user | function claimReward(uint itemId) public {
require(rewardClaimed[msg.sender][itemId], "Reward not yet claimed");
Item storage item = items[itemId];
require(msg.sender == item.assignedTo, "Only assigned user can claim reward");
uint reward = item.reward;
item.reward = 0;
... | 836,245 |
./partial_match/1/0x9A93a421b74F1c5755b83dD2C211614dC419C44b/sources/src/LBRouter.sol | Helper function to swap tokens for exact tokens pairs The array of pairs versions The list of versions (V1, V2 or V2_1) tokenPath The swap path using the binSteps following `pairBinSteps` amountsIn The list of amounts in to The address of the recipient return amountOut The amount of token sent to `to`/ | function _swapTokensForExactTokens(
address[] memory pairs,
Version[] memory versions,
IERC20[] memory tokenPath,
uint256[] memory amountsIn,
address to
) private returns (uint256 amountOut) {
IERC20 token;
address recipient;
address pair;
... | 9,304,527 |
//Address: 0xc0442ec4da528f2bab059b20aa6a898aa6c2e5f9
//Contract name: ANOToken
//Balance: 0 Ether
//Verification Date: 1/26/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract ERC20 {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
funct... | function to keep track of the total token allocation | function changeSupply(uint256 _amount) public onlyCrowdFundAddress {
totalAllocatedTokens += _amount;
}
| 5,523,604 |
./full_match/1/0x0fB6052Cc079A4EEc277f73e51E0dE3411792FF4/sources/src/v2/AeraVaultModulesFactory.sol | @inheritdoc IAeraVaultHooksFactory Effects: deploy hooks. Log hooks creation. | function deployHooks(
bytes32 salt,
address owner_,
address vault,
uint256 minDailyValue,
TargetSighashData[] memory targetSighashAllowlist
) external override onlyOwnerOrV2Factory returns (address deployed) {
deployed = address(
owner_,
... | 3,067,025 |
pragma solidity ^0.4.11;
import 'zeppelin-solidity/contracts/token/MintableToken.sol';
/**
* @title Limited purchase token contract.
* @author SOCIFI Ltd, 2017
* @dev Adds ability to limit the amount of tokens available for purchase.
*/
contract LimitedPurchaseToken is MintableToken {
// Supply of tokens a... | Unfreeze n percent of unsold tokens./ | function unfreeze(uint256 _percent) onlyOwner public {
require(totalSupply < maxSupply);
uint256 unfreezeAmount = maxSupply.sub(totalSupply).div(_percent);
availableSupply = availableSupply.add(unfreezeAmount);
TokenUnfreeze(unfreezeAmount, availableSupply);
}
| 6,474,878 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.3 <0.7.0;
import "elliptic-curve-solidity/contracts/EllipticCurve.sol";
/**
* @title BN256G1 Curve Library
* @dev Added hashToPoint function from https://github.com/ChihChengLiang/bls_solidity_python
* to https://github.com/witnet/bls-solidity
*/
library BN256... | solhint-disable-next-line no-inline-assembly (N + 1) / 4 = 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52 N = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 | function sqrt(uint256 xx) internal view returns (uint256 x, bool hasRoot) {
bool callSuccess;
assembly {
let freemem := mload(0x40)
mstore(freemem, 0x20)
mstore(add(freemem, 0x20), 0x20)
mstore(add(freemem, 0x40), 0x20)
mstore(add(freemem, ... | 14,029,792 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUtil {
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) ... | ========== VIEWS ========== / | function getRewardTokens() external view returns (address[] memory) {
uint256 numTokens = rewardTokens.length;
address[] memory tokens = new address[](numTokens);
for (uint256 i = 0; i < numTokens; i++) {
tokens[i] = rewardTokens[i];
}
return tokens;
}
| 1,374,697 |
pragma solidity 0.4.23;
/**
* @title SafeMath by OpenZepelin
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | Due to the high interest rate for the first year, compounding should be taken into account. Effective annual interest rate = (1 + (nominal rate / number of compounding periods)) ^ (number of compounding periods) - 1 1st year effective annual interest rate is 900% when we select the stakeMaxAge (30 days) as the compound... | function annualInterest() constant public returns(uint interest) {
uint _now = now;
if((_now.sub(stakeStartTime)).div(1 years) == 0) {
interest = (2573 * baseIntCalc).div(100);
interest = (97 * baseIntCalc).div(100);
}
}
| 2,114,567 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.7.1;
// A contract who's whole purpose is to not trigger call failure reverts
contract TestVault {
address public pool;
function setPool(address _pool) external {
pool = _pool;
}
enum PoolSpecialization { GENERAL, MINIMAL_SWAP_INFO, T... | solhint-enable no-empty-blocks / This fallback allows us to make an arbitrary call with this vault as the msg.sender solhint-disable-next-line payable-fallback solhint-disable-next-line no-inline-assembly | function registerTokens(
bytes32,
address[] memory,
address[] memory
fallback() external {
assembly {
calldatacopy(0, 0, calldatasize())
let succeeded := call(
gas(),
sload(pool.slot),
callvalue(),
... | 15,816,537 |
./partial_match/1/0xf4263f7a8Bad3A8B6680128ea397a70295fb0Aa5/sources/LockToken.sol | lock nft/update balance in address | function lockNFT(
address _tokenAddress,
address _withdrawalAddress,
uint256 _amount,
uint256 _unlockTime,
uint256 _tokenId,
bool _mintNFT,
address referrer
)
external
payable
whenNotPaused
nonReentrant
returns (uint256 _id)
{
... | 16,027,534 |
pragma solidity ^0.4.23;
contract SafeMath {
function safeMul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a,... | To change the approve amount you first have to reduce the addresses&39; allowance to zero by calling &39;approve(_spender, 0)&39; if it is not already 0 to mitigate the race condition described here: https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 | function approve(address _spender, uint256 _value) public onlyPayloadSize(2) returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 2,255,501 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
contract GameLand is ERC721Holder {
address public testnft;
constructor(address _nftaddress) {
testnft = _nftaddress;
}
struct Nft {
//price represent in... | owner take collatoral when aggrement broken | function liquidation(uint256 nft_id) public {
require(borrow_or_not[nft_id], "the nft has not been borrowed");
require(msg.sender == nft_owner[nft_id], "Only owner can liquidation");
require(borrow_status[nft_id].repay_time <= block.timestamp, "Not yet");
(bool success, ) = nft_owner... | 7,212,176 |
pragma solidity ^0.4.23;
/*
* Contract that is working with ERC223 tokens
* https://github.com/ethereum/EIPs/issues/223
*/
/// @title ERC223ReceivingContract - Standard contract implementation for compatibility with ERC223 tokens.
contract ERC223ReceivingContract {
/// @dev Function that is called ... | Returns the block number the given address is locked until. _owner Address of token owner. return Returns block number the lock is released. | function blockLockOf(address _owner) external view returns (uint256) {
return blockLock[_owner];
}
| 12,921,301 |
// File: contracts/utils/StorageSlot.sol
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots w... | Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). Emits a {BeaconUpgraded} event./ | function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(
IBeacon(newBeac... | 1,545,343 |
./partial_match/1/0xe08852902868aDEE71CA490D9d93Fd55f5bEc200/sources/SteamedHams.sol | Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the revert reason or using the provided one. _Available since v4.3._/ | function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
_revert(returndata, errorMessage);
}
}
| 3,536,703 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import './interface/IT... | Deposits tokens into a pool. | function deposit(uint256 _poolId, uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[_poolId];
require(pool.allocPoints != 0, "MasterGoon Deposit: pool is disabled");
require(
catInfo[pool.catId].allocPoints != 0,
"MasterGoon Deposit: category is disabled"
);
UserI... | 5,390,131 |
./full_match/1/0xBc38243f07cac820dcE26Dd70B82D45D34C8da24/sources/contracts/pool/metadata/MetadataGenerator.sol | makes all the necessary external calls to contracts we do not control in order to show the SVG. Also returns it in a struct to avoid stack too deep/ | function _makeExternalCalls(IDittoPool pool) internal view returns (ExternalCallData memory data) {
IERC20Metadata token = IERC20Metadata(pool.token());
data = ExternalCallData({
addressAdmin: pool.owner(),
addressNft: address(pool.nft()),
decimals: uint256(token.... | 4,828,490 |
./full_match/1/0x7E2bDd0837A497513A4650Ac477aDF7475D87ecE/sources/contracts/UnimoonTreasury.sol | View function to get available USDC balance in treasury (USDC treasury contract balance + non-swapped swap fees) return available USDC balance/ | function gelAllAvailableFunds() external view returns (uint256) {
uint256 balance = IToken(UNIMOON_TOKEN).balanceOf(address(this));
if (balance == 0) return IToken(USDC).balanceOf(address(this));
address[] memory path = new address[](2);
path[0] = UNIMOON_TOKEN;
path[1] = USD... | 8,438,584 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / ... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _va... | 5,356,370 |
./full_match/1/0x1F033Cb8A2Df08a147BC512723fd0da3FEc5cCA7/sources/autopay/contracts/Autopay.sol | Allows dataFeed account to be filled with tokens _feedId unique feed identifier _queryId identifier of reported data type associated with feed _amount quantity of tokens to fund feed/ Add to array of feeds with funding | function fundFeed(
bytes32 _feedId,
bytes32 _queryId,
uint256 _amount
) public {
FeedDetails storage _feed = dataFeed[_queryId][_feedId].details;
require(_feed.reward > 0, "feed not set up");
require(_amount > 0, "must be sending an amount");
_feed.balance... | 4,950,784 |
./partial_match/3/0xd1502017ddAC247410207420f76EE3Be649165aa/sources/IBaseTokenPresale.sol | Withdraw tokens only after crowdsale ends./ | function withdrawTokens() public withdrawable {
require(!withdrawableTokens[_msgSender()]);
uint256 amount = _balances[_msgSender()];
require(
amount > 0,
"PostDeliveryCrowdsale: beneficiary is not due any tokens"
);
_deliverTokens(_msgSender(), amoun... | 5,094,716 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | Gets all the investment currencies./ | function getAllInvestmentCurrencies() external view returns(bytes4[] memory currencies) {
return allInvestmentCurrencies;
}
| 7,286,837 |
./partial_match/288/0xe97738dBd11F854E49faEbd5d346034833B4a317/sources/_eth-optimism/contracts/contracts/L2/messaging/L2StandardBridge.sol | @inheritdoc IL2ERC20Bridge/ Check the target token is compliant and verify the deposited token on L1 matches the L2 deposited token representation here When a deposit is finalized, we credit the account on L2 with the same amount of tokens. Either the L2 token which is being deposited-into disagrees about the correct a... | function finalizeDeposit(
address _l1Token,
address _l2Token,
address _from,
address _to,
uint256 _amount,
bytes calldata _data
) external virtual onlyFromCrossDomainAccount(l1TokenBridge) {
if (
ERC165Checker.supportsInterface(_l2Token, 0x1d1d... | 16,905,718 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
/// @title IExternalPositionVault interface
/... | Validates and initializes policies as necessary prior to fund activation _isMigratedFund True if the fund is migrating to this release There will be no enabledPolicies if the caller is not a valid ComptrollerProxy Policies must assert that they are congruent with migrated vault state | function activateForFund(bool _isMigratedFund) external override {
address comptrollerProxy = msg.sender;
if (_isMigratedFund) {
address[] memory enabledPolicies = getEnabledPoliciesForFund(comptrollerProxy);
for (uint256 i; i < enabledPolicies.length; i++) {
... | 181,802 |
pragma solidity ^0.4.19;
//
/* CONTRACT */
contract SafeMath {
function safeAdd(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function saf... | redeem exe at ico transfer tkns payment req to ico 1 for redeempayment and 2 for sell payment | function redeemOrSellCoinsToICO(uint enter1forRedeemOR2forSell, uint256 amountOfCoinPartsToRedeemOrSell) public returns (bool success ) {
require(crowdSaleOpen == false);
uint amount = amountOfCoinPartsToRedeemOrSell;
msgSndr[msg.sender] = amount;
bool isPreview = false;
ICO ico = ICO(... | 15,191,710 |
pragma solidity 0.5.8;
import "../roles/PauserRole.sol";
/**
* Allows transfers on a token contract to be paused by an administrator.
*/
contract Pausable is PauserRole {
event Paused();
event Unpaused();
bool private _paused;
/**
* @return true if the contract is paused, false otherwise.
... | called by the owner to unpause, returns to normal state/ | function _unpause() internal {
_paused = false;
emit Unpaused();
}
| 5,437,243 |
./full_match/3/0xBB6Cf070eF7E91B4808d26e1c8077aA4029b06F9/sources/browser/ERC20.sol | Internal function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. account The account that will receive the created tokens. amount The amount that will be created./ | function _mint(address account, uint256 amount) internal {
assert(account != address(0));
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 8,223,956 |
pragma solidity ^0.4.19;
contract SafeMath {
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a && c >= b);
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
func... | _owner The address of the account owning tokens _spender The address of the account able to transfer the tokens return Amount of remaining tokens allowed to spent by the _spender from _owner account | function allowance(address _owner, address _spender)
public
constant
returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 12,774,180 |
// RUN: --target substrate --emit cfg
// Tests control commands
contract c1 {
//BEGIN-CHECK: c1::function::test1
function test1(int a, int b) public pure returns (int) {
int x;
// CHECK: ty:int256 %1.cse_temp = ((arg #0) + (arg #1))
// CHECK: ty:int256 %x = (%1.cse_temp - int256 54)
... | CHECK: ty:int256 %1.cse_temp = ((arg 0) + (arg 1)) CHECK: ty:int256 %x = (%1.cse_temp - int256 54) CHECK: ty:int256 %d = (%x %1.cse_temp) CHECK: ty:int256 %2.cse_temp = ((arg 0) - (arg 1)) NOT-CHECK: ty:int256 %t = ((arg 0) - (arg 1)) CHECK: ty:int256 %t = %2.cse_temp NOT-CHECK: ty:int256 %e = ((arg 0) - (arg 1)) CHEC... | function test1(int a, int b) public pure returns (int) {
int x;
x = a+b-54;
int d = x*(a+b);
if (x + d > 0) {
int t = a-b;
bool e1 = t>3;
}
else {
int e = a-b;
bool e2 = e > 3;
}
return x-d + (a-b);
| 7,267,610 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
pragma experimental ABIEncoderV2;
import "./lib/Lib_RLPReader.sol";
/// @notice MIPS virtual machine interface
interface IMIPS {
/// @notice Given a MIPS state hash (includes code & registers), execute the next instruction and returns
/// the update ... | The challenger can call this function to submit the state hash for the next step in the binary search (cf. `getStepNumber`). | function proposeState(uint256 challengeId, bytes32 stateHash) external {
ChallengeData storage c = challenges[challengeId];
require(c.challenger != address(0), "invalid challenge");
require(c.challenger == msg.sender, "must be challenger");
require(isSearching(challengeId), "must be searching");
... | 12,895,547 |
./full_match/3/0x00c4aAa4bb8d6BB99975f65d3aDb1373882e68e6/sources/contracts/ERC721A.sol | See {IERC721Enumerable-tokenByIndex}. This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case./ Counter overflow is impossible as the loop breaks when uint256 i is equal to anot... | function tokenByIndex(uint256 index) public view override returns (uint256) {
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (!ownership.burned) {
if (tokenIdsId... | 8,132,665 |
./full_match/4/0x190193aE40D32C2eC3DAa5E490fEe809a8B1d14b/sources/contracts/InnCoin.sol | Inicializar Up or Down, se borran todos los estados del juego anterior y se abre el juego. | function startUpOrDown(uint _startPrice) public onlyFounder{
require(upOrDownState != State.Started || upOrDownState != State.Closed);
delete playersDown;
delete playersUp;
jackpotDown = 0;
jackpotUp = 0;
startPrice = _startPrice;
upOrDownState = State.Started... | 792,530 |
./partial_match/1/0x475D148484CD934d0c74C6d00fd6e942d9165EC5/sources/XRAID.sol | Change the minimum contract XRAID balance before `_swap` gets invoked _minTokenBalance The new minimum balance | function setMinTokenBalance(uint256 _minTokenBalance) external onlyOwner {
emit MinTokenBalanceChanged(minTokenBalance, _minTokenBalance);
minTokenBalance = _minTokenBalance;
}
| 2,592,256 |
./full_match/1/0xA905f9f0b525420d4E5214E73d70dfFe8438D8C8/sources/solidity/contracts/governance/GovernorCharlie.sol | Governance function for setting the whitelistGuardian. WhitelistGuardian can cancel proposals from whitelisted addresses _account Account to set whitelistGuardian to (0x0 to remove whitelistGuardian) | function setWhitelistGuardian(address _account) external override onlyGov {
address _oldGuardian = whitelistGuardian;
whitelistGuardian = _account;
emit WhitelistGuardianSet(_oldGuardian, whitelistGuardian);
}
| 8,423,488 |
./partial_match/1/0x8Fbc2bD0F023c282EB6913444f26Ec8EC73DE967/sources/src/erc/ERC20.sol | Sets the allowance granted to `spender` by `owner`. Emits an {Approval} event indicating the updated allowance./ | function _setAllowance(
address owner,
address spender,
uint wad
) internal virtual returns (bool) {
_allowance[owner][spender] = wad;
emit Approval(owner, spender, wad);
return true;
}
| 4,162,719 |
./full_match/1/0x5D4Aa78B08Bc7C530e21bf7447988b1Be7991322/sources/src/utils/EIP712.sol | Returns the domain separator for the current chain./ | function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
return _buildDomainSeparator();
}
}
| 8,423,964 |
./partial_match/1/0x039B5818e51dfEC86c1D56A4668787AF0Ed1c068/sources/UnisaveV2Router02.sol | fetches and sorts the reserves and fee for a pair | function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB, uint8 fee) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUnisaveV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA,... | 4,129,139 |
./partial_match/1/0xBf6E1F1Fd72080C4793e89aCB8FB61ef1A61cA67/sources/Proposal32.sol | Increase the amount of tokens that an owner has allowed to a spender. This method should be used instead of approve() to avoid the double approval vulnerability described above. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by./ | function increaseAllowance(address spender, uint256 addedValue)
external
override
returns (bool)
{
spender;
delegateAndReturn();
}
| 4,473,867 |
./full_match/42/0x917ec4e5940d43754c0c04DaE7B6c8813eD6bA22/sources/contracts/GetTotalTrust.sol | Receive the response in the form of uint256/ | function fulfillTotalTrust(bytes32 _requestId, bytes32 _totalTrust) public recordChainlinkFulfillment(_requestId)
{
totalTrust = bytes32ToString(_totalTrust);
}
| 16,269,947 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.9;
contract Pngn{
address owner;
struct Player{
address payable addr;
uint last_action_time;
uint last_action_type;
bytes32 hash;
uint num;
}
Player[8] players;
uint emptyseati = 9;
uint256 pu... | if there are 2 players in this tableif first picker and late and second revealed then delete first and pay the secondif the other way arround delete second and pay firstif they are both picked and late make player with the most recent pick action a winnerEqual lateness ?????? impossible. But make top-first a winner as ... | function cleanup_players() private {
emptyseati = 9;
uint priority_emptyseati = 9;
for(uint i=0;i<8;i=i+2){
if(players[i].addr != address(0) && players[i+1].addr != address(0)){
if(((block.timestamp - players[i].last_action_time) > 15 minutes) && players[i].last_a... | 15,397,749 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Used by the option owner to retrieve the escrowed tokens. optionId ID of the option to cancel Requirements: - {optionId} must exists - {_msgSender} must be the option owner/ Prevent re-entrancy [assume the NFT can call this method on SafeTransferFrom] Return the NFT to the option owner Return premium amount to the o... | function cancelOption(uint256 optionId) external onlyOptionOwner(optionId) {
OptionData storage opt = options[optionId];
require(opt.status < OptionStatus.exercised, "Option: option closed");
OptionStatus originalStatus = opt.status;
opt.status = OptionStatus.cancelled;
_t... | 1,221,309 |
./full_match/42161/0x2b99224DAD73d7D84b7C74E9161BbD0D01a2A15b/sources/contracts/multiinvoker/MultiInvoker.sol | Withdraws `amount` DSU from `msg.sender`s `product` collateral account, then unwraps the DSU into USDC and sends it to `receiver` receiver Address to receive the USDC product Product to withdraw funds for amount Amount of DSU to withdraw from the collateral account/ Withdraw the amount from the collateral account | function withdrawAndUnwrap(address receiver, IProduct product, UFixed18 amount) private {
collateral.withdrawFrom(msg.sender, address(this), product, amount);
_unwrap(receiver, amount);
}
| 16,305,859 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | Deploy Vault release proxy, owned by proxy admin Initialize Vault | function _newProxyVault(
address token,
address governance,
uint256 targetDecimals,
uint256 vault_release_target
) internal returns (address) {
address vault_release = vaultReleases[vault_release_target];
require(vault_release != address(0), "Registry: vault rele... | 13,413,919 |
pragma solidity ^0.6.0;
import "./ERC1155.sol";
/**
@dev Mintable form of ERC1155
Shows how easy it is to mint new items.
*/
contract ERC1155Mintable is ERC1155 {
bytes4 private constant INTERFACE_SIGNATURE_URI = 0x0e89341c;
// id => creators
mapping(uint256 => address) public creators;
// i... | Creates a new token type and assings _initialSupply to minter Transfer event with mint semantic | function create(uint256 _initialSupply, string calldata _uri)
external
returns (uint256 _id)
{
_id = ++nonce;
creators[_id] = msg.sender;
balances[_id][msg.sender] = _initialSupply;
emit TransferSingle(
msg.sender,
address(0x0),
... | 5,444,555 |
pragma solidity ^0.4.18;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
... | uint256 sellingPrice = tokenIdToPrice(_tokenId);_price = tokenIdToPrice[_tokenId]; POLY.transferFrom(msg.sender,oldOwner,sellingPrice); tokenIdToPrice[_tokenId] = nextPriceOf(_tokenId); | function purchase(uint256 _tokenId,uint256 time) public payable whenNotPaused {
address oldOwner = ownerOf(_tokenId);
address newOwner = msg.sender;
uint256 sellingPrice = priceOf(_tokenId);
require(oldOwner != address(0));
require(newOwner != address(0));
require(old... | 14,726,614 |
./full_match/1/0x9Eb96D50a6D2Af5771883547dae092996828BE73/sources/_pwnfinance/multitoken/contracts/MultiToken.sol | transferAsset wrapping function for transfer calls on various token interfaces _asset Struck defining all necessary context of a token _dest Destination address/ | function transferAsset(Asset memory _asset, address _dest) internal {
if (_asset.category == Category.ERC20) {
IERC20 token = IERC20(_asset.assetAddress);
token.transfer(_dest, _asset.amount);
IERC721 token = IERC721(_asset.assetAddress);
token.transferFrom(a... | 8,311,546 |
./full_match/1/0xFbeC16EECD4558297FB3deA9934A162Ef76b14bd/sources/src/captable/Captable.sol | Set controller over shares for an account in a class Can be done by any manager of the class account Address of the account to set controller for classId ID of the class controller Controller to set for the account in this class controllerParams Parameters to pass to the controller on initialization/ | function setController(
address account,
uint256 classId,
IAccountController controller,
bytes calldata controllerParams
) external {
Class storage class = _getClass(classId);
_ensureSenderIsManager(class, classId);
uint256 classBalance = class.token.bala... | 3,085,552 |
./full_match/5/0x1e2Fe5508AF91e901011763C0a0063c1Ff92e062/sources/contracts/Contract.sol | Map the fucntion inputs to the campaign struicture Check that the deadline is a future date | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image
) public returns(uint256 id) {
campaign.owner = _owner;
campaign.title = _title;
... | 1,923,341 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
... | if selling eth, convert to weth | function _buy(ExchangeData memory exData) internal returns (address, uint) {
address wrapper;
uint swapedTokens;
bool success;
require(exData.destAmount != 0, "Dest amount must be specified");
if (exData.srcAddr == KYBER_ETH_ADDRESS) {
exData.srcAddr ... | 7,333,969 |
./full_match/1/0xbBbfa5d0Bfd30B9ebce64b06E3E9Fc85E7f0F396/sources/contracts/AbstractDynaset.sol | ========== Public Functions ========== / Absorb any tokens that have been sent to the dynaset. If the token is not bound, it will be sent to the unbound token handler./ | function updateAfterSwap(address tokenIn, address tokenOut) public {
uint256 balanceIn = IERC20(tokenIn).balanceOf(address(this));
uint256 balanceOut = IERC20(tokenOut).balanceOf(address(this));
records[tokenIn].balance = balanceIn;
records[tokenOut].balance = balanceOut;
}
| 8,363,219 |
./full_match/1/0xcFbA1B907816828Fd547320a757149f649584baC/sources/contracts/Factory.sol | return address / | function getFee() external view returns (address, uint) {
uint _feePoleis = feePoleis;
if(_feePoleis == 0) return (address(0), 0);
return (feeRecipient, _feePoleis);
}
| 16,469,221 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
contract Families {
address public owner;
struct Family {
uint256 id;
string name;
}
Family[] public families;
mapping(string => uint256) public nameToFamily; // familyName => familyID
... | Retrieve people offset offset to return from limit maximum number to return return people note: this will not scale to production, but we're taking a shortcut for a hackathon | function getPeople(uint256 offset, uint256 limit)
public
view
returns (Person[] memory)
{
if (offset > people.length) {
limit = 0;
limit = people.length - offset;
}
Person[] memory selectPeople = new Person[](limit);
for (uint256 ... | 12,877,886 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./PerpsV2SettingsMixin.sol";
// Internal references
import "./interfaces/IPerpsV2Settings.sol";
import "./interfaces/IPerpsV2Market.sol";
// market manager is still the V1 one
import "./interfaces/IFuturesMarketManager.sol";
contract PerpsV2Setti... | ========== VIEWS ========== / | function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
bytes32[] memory existingAddresses = PerpsV2SettingsMixin.resolverAddressesRequired();
bytes32[] memory newAddresses = new bytes32[](1);
newAddresses[0] = CONTRACT_FUTURES_MARKET_MANAGER;
addresse... | 5,353,407 |
./full_match/5/0x54FFCE9bE0C17840103e5b28408932A2C6cC7ED4/sources/contracts/BytesUtilsSub.sol | Returns the ENS namehash of a DNS-encoded name. self The DNS-encoded name to hash. offset The offset at which to start hashing. return The namehash of the name./ | function namehash(bytes memory self, uint256 offset)
internal
pure
returns (bytes32)
{
(bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);
if (labelhash == bytes32(0)) {
require(offset == self.length - 1, "namehash: Junk at end of name");
... | 7,064,009 |
./full_match/62320/0xf84111D3FdF49FB13db9eABf0Bb64CD8Fc9AA748/sources/lib/mento-core-2.2.0/contracts/swap/BiPoolManager.sol | Determine if the median is valid based on the current oracle rates. exchange The PoolExchange. return HasValidMedian./ solhint-disable-next-line not-rely-on-time solhint-disable-next-line not-rely-on-time | function oracleHasValidMedian(PoolExchange memory exchange) internal view returns (bool) {
(bool isReportExpired, ) = sortedOracles.isOldestReportExpired(exchange.config.referenceRateFeedID);
bool enoughReports = (sortedOracles.numRates(exchange.config.referenceRateFeedID) >=
exchange.config.minimumRepo... | 3,225,212 |
./full_match/1/0x038698e3BAe6b3e30D6b94202299192bfE69c692/sources/browser/LoanShifterTaker_flat.sol | Internal method that preforms a sell on 0x/on-chain Usefull for other DFS contract to integrate for exchanging exData Exchange data struct return (address, uint) Address of the wrapper used and destAmount if 0x is selected try first the 0x order check if we have already swapped with 0x, or tried swapping but failed i... | function _sell(ExchangeData memory exData) internal returns (address, uint) {
address wrapper;
uint swapedTokens;
bool success;
uint tokensLeft = exData.srcAmount;
if (exData.exchangeType == ExchangeType.ZEROX) {
approve0xProxy(exData.srcAddr, exData.srcAmount);... | 3,048,021 |
./partial_match/1/0x02814c3B83C640d68832969C6E20669086ab83dC/sources/XDAPP.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("XDAPP", "XDAPP") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_unisw... | 2,826,045 |
./full_match/97/0xa625a8C5ab0aC9da27eF2f532aB24eB589439175/sources/_openzeppelin/contracts/token/ERC20/ERC20.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _bal... | 3,276,435 |
./full_match/137/0xf285d2fcC006fd23B1A001b6eA90b12f4a3EeB2a/sources/contracts/AssetManagerBase.sol | pId - the poolId shows amount of tokens under management by this AM (currently invested) | function getAUM(bytes32 pId) external view override withCorrectPool(pId) returns (uint256) {
return _getAUM();
}
| 4,790,271 |
//Address: 0x22a1ed2f03206be150ede2a7ffa909f7be033d99
//Contract name: AuthenticationManager
//Balance: 0 Ether
//Verification Date: 10/24/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMat... | Map all our our balances for issued tokens / Map between users and their approval addresses and amounts / List of all token holders / The name of the contract / The symbol for the contract / How many DPs are in use in this contract / Defines the current supply of the token in its own units / Defines the address of the ... | function XWinToken(address _icoContractAddress, address _authenticationManagerAddress) {
name = "XWin CryptoBet";
symbol = "XWIN";
decimals = 8;
icoPhaseManagement = IcoPhaseManagement(_icoContractAddress);
authenticationManager = AuthenticationManager(_authenticationManager... | 6,355,879 |
./partial_match/1/0x7B10Fd9D810aB5074332eAAa0DCabB044a9710ae/sources/Token.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender... | 4,276,098 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Gets the maker asset allowance for a Dydx bridge order. makerAddress The maker of the order. bridgeAddress The address of the Dydx bridge. dydx The Dydx contract address. return allowance The maker asset allowance. Allowance is infinite if the dydx bridge is an operator for the maker. | function getDydxMakerAllowance(address makerAddress, address bridgeAddress, address dydx)
public
view
returns (uint256 allowance)
{
return IDydx(dydx).getIsLocalOperator(makerAddress, bridgeAddress)
? uint256(-1) : 0;
}
| 6,462,102 |
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/Consideration.sol | Retrieve the order hash for a given order. order The components of the order. return orderHash The order hash./ Derive order hash by supplying order parameters along with counter. | function getOrderHash(OrderComponents calldata order)
external
view
override
returns (bytes32 orderHash)
{
orderHash = _deriveOrderHash(
OrderParameters(
order.offerer,
order.zone,
order.offer,
or... | 877,632 |
./full_match/1/0x3acAc7abCFE08Dc1c4731228a8D9f53f2CDbb5cb/sources/ERC20.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: tra... | 3,037,511 |
./full_match/137/0xfa834e54731224A57854BDDC85451ceEc0B9Be53/sources/pRIZE_Fighters_Financial_DAO_flat.sol | ============================================================================= ============================================================================= | function withdraw() public onlyOwner {
require(hs);
require(os);
}
| 3,762,328 |
/**
*Submitted for verification at Etherscan.io on 2021-04-19
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.1;
interface TransferETHInterface {
receive() external payable;
event LogTransferETH(address indexed from, address indexed to, uint256 value);
}
// File: @openzeppelin/contracts/token... | Register feebase for each type of aggregator. Fee base is shared among the same type of aggregators./ | function registerCurrentFeeBase(
int16 currentFeeBase,
uint256 currentCollateralPerToken,
uint256 nextCollateralPerToken,
address owner,
address oracleAddress,
bool isReversedOracle
) public override {
bytes32 aggregatorID = generateAggregatorID(owner, ora... | 2,185,081 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract TrainerNFT is ERC721, Ownable {
enum Stats{ Striking, Grappling, Stamina}
uint8 c... | if(lastPaidDates[trainerId] | function updateFighters(uint trainerId) public{
uint256 fighterIdLength = coachedFighters[trainerId].length;
for(uint8 i=0; i<fighterIdLength; i++){
}
}
| 12,860,287 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlyi... | Sender redeems cTokens in exchange for a specified amount of underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemAmount The amount of underlying to redeem return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function redeemUnderlying(uint redeemAmount) external override returns (uint) {
return redeemUnderlyingInternal(redeemAmount);
}
| 1,236,795 |
pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlyin... | Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function mint(uint mintAmount) external returns (uint) {
(uint err,) = mintInternal(mintAmount, false);
return err;
}
| 10,451,443 |
pragma solidity ^0.5.16;
contract SupplyChain{
//model a farmer
struct Farmer {
uint farmerID;
string farmerName;
uint farmerContact;
string farmerAddress;
address faddr;
bool isValue;
}
//model crop
struct Crop{
uint cropID;
string cropName;
... | add crop by old farmerFarmer storage _newfarmer = mfarmer[_farmerID]; | function addCrop(
uint _cropID,
string memory _cropName,
uint _quantity,
uint _cropPrice
) public {
Crop storage _newcrop = mcrop[_cropID];
_newcrop.faddr = msg.sender;
_newcrop.cropID = _cropID;
_newcrop.cropName = _cropName;
_newcrop.qu... | 5,388,818 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "../DamnValuableNFT.sol";
interface IWETH{
func... | rest of the function goes here!unwrap weth into ethcreate an array for the tokenIdstransfer tokens to buyer | function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external{
weth.withdraw(amount0);
uint256[] memory NFTs = new uint256[](6);
for (uint256 i; i < 6; ++i){
NFTs[i] = i;
}
for (uint256 i; i < 6; ++i){
dvNFT.sa... | 1,066,523 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
// File: @aragon/os/contracts/common/EtherTokenConstant.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
// aragonOS and aragon-apps rely on address(0) to denote native ETH, in
// contracts where both tokens and ETH are accept... | Creates a permission that wasn't previously set and managed. If a created permission is removed it is possible to reset it with createPermission. This is the ONLY way to create permissions and set managers to permissions that don't have a manager. In terms of the ACL being initialized, this function... | function createPermission(address _entity, address _app, bytes32 _role, address _manager)
external
auth(CREATE_PERMISSIONS_ROLE)
noPermissionManager(_app, _role)
{
_createPermission(_entity, _app, _role, _manager);
}
| 451,315 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Add the market to the markets mapping and set it as listed Admin function to set isListed and add support for the market cToken The address of the market (token) to list version The version of the market (token) return uint 0=success, otherwise a failure. (See enum Error for details)/ | function _supportMarket(CToken cToken, Version version) external returns (uint256) {
require(msg.sender == admin, "only admin may support market");
require(!isMarketListed(address(cToken)), "market already listed");
markets[address(cToken)] = Market({
isListed: true,
... | 6,224,123 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.0;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
interface IMintableERC20 {
function mint(uint256 value) external;
function mintTo(address to, uint256 value) external;
}
/**
* @title MintableERC20
* @dev Exposes the mint fu... | Function to mint tokens _to Address to mint to. _value The amount of tokens to mint./ | function mintTo(address _to, uint256 _value) public virtual override {
_mint(_to, _value);
}
| 5,426,647 |
./full_match/4/0x7C383E9578da9f6068532bd0d4a2c1De34516B96/sources/contracts/Mainnet/V1_Vanilla/TheCryptographLogicV1.sol | Transfer ownership of the token only callable by the associated GBM auction instance _newOwner The address of the account to become the new ownerResetting renatus timer | function transfer(address _newOwner) external {
require(msg.sender == myAuction, "The auction is the only way to set a new owner");
emit Transferred(owner, _newOwner);
owner = _newOwner;
hasCurrentOwnerMarked = false;
lastOwnerInteraction = block.timestamp;
renatusTi... | 13,351,247 |
./partial_match/42/0xdF6c055ff856fd42d13DAF5bCa489E267AAB0376/sources/MasterChef.sol | Safe pickle transfer function, just in case if rounding error causes pool to not have enough dex. | function safeTokenTransfer(address _to, uint256 _amount) internal {
uint256 pickleBal = rewardToken.balanceOf(address(this));
if (_amount > pickleBal) {
rewardToken.transfer(_to, pickleBal);
rewardToken.transfer(_to, _amount);
}
}
| 8,944,238 |
./full_match/5/0x1bbbC0EFE29c4a52DF227316431038C3470FB4c0/sources/contracts/Controller.sol | Set if provider have claimable tokens _LPToken Address of the underlying protocol vault _bool True of the underlying protocol has claimable tokens | function setClaimable(address _LPToken, bool _bool) external onlyDao {
claimable[_LPToken] = _bool;
}
| 11,618,692 |
pragma solidity 0.4.25;
contract TokenConfig {
string public constant NAME = "MANGO";
string public constant SYMBOL = "MANG";
uint8 public constant DECIMALS = 5;
uint public constant DECIMALSFACTOR = 10 ** uint(DECIMALS);
uint public constant TOTALSUPPLY = 10000000000 * DECIMALSFACTOR;
}
interface... | add an address to the whitelist addr address/ | function _addAddressToWhitelist(address addr)
internal
onlyOwner
{
require(addr != address(0), "address is zero");
_whitelist[addr] = true;
emit WhitelistAdded(addr);
}
| 6,439,317 |
/*
* @source: https://github.com/sigp/solidity-security-blog
* @author: -
* @vulnerable_at_lines: 22
*/
//added pragma version
pragma solidity ^0.4.0;
contract TimeLock {
mapping(address => uint) public balances;
mapping(address => uint) public lockTime;
function deposit() public payable {
... | lockTime[msg.sender] = now + 1 weeks; now is deprecated since v0.7.0 | function deposit() public payable {
balances[msg.sender] += msg.value;
lockTime[msg.sender] = block.timestamp + 1 weeks;
}
| 12,790,622 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC20/IERC2... | release funds to token holder Requirements: - transfers funds in the original deposit currency to the NFT holder - burns the NFT on confirmation - Emits Released event/ _checkRole(FINANCE_ROLE, _msgSender()); Could indicate that the token has already been released | function release(uint256 _tokenId, uint256 _amount, bool _validate)
public
payable onlyRole(FINANCE_ROLE)
{
require(_exists(_tokenId), "CF: token invalid");
if (_validate) {
require(_amount > 0, "CF: amount invalid");
require(_amount < (investments[_tokenId].amoun... | 6,880,606 |
./full_match/1/0x216d7636b791Ed93BFD56BF696b35A14115416ab/sources/Birbtoken.sol | Withdraw original tokens, dissipate proxy tokens amount Amount of original tokens to release/ | function withdrawTokens(uint amount) public returns (bool)
{
address from = msg.sender;
require( amount > 0 );
balances[from] -= (amount * supplyFactor);
_totalSupply -= (amount * supplyFactor);
emit Transfer( from, address(0x0), amount);
... | 8,401,064 |
./full_match/1/0xD29c9a3fD94a404728F014e92649aDE61e9cE655/sources/FirnLunarDAOEscrow.sol | Firn calls this to reclaim token if there is no deal. | function earlyExit() external payable { | 17,046,040 |
./full_match/3/0x8dF0Bb5a817210C0e27f96CDFF31c6a2497565F1/sources/browser/TorroFactory.sol | Sets address of new Main DAO. torroDao_ address of new main DAO. | function setNewDao(address torroDao_) public onlyOwner {
_torroDao = torroDao_;
}
| 8,149,560 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../common/financial-product-libraries/long-short-pair-libraries/Lon... | Creates a pair of long and short tokens equal in number to tokensToCreate. Pulls the required collateral amount into this contract, defined by the collateralPerPair value. The caller must approve this contract to transfer `tokensToCreate collateralPerPair` amount of collateral. tokensToCreate number of long and shor... | function create(uint256 tokensToCreate) public preExpiration() nonReentrant() returns (uint256 collateralUsed) {
collateralUsed = FixedPoint.Unsigned(tokensToCreate).mulCeil(FixedPoint.Unsigned(collateralPerPair)).rawValue;
collateralToken.safeTransferFrom(msg.sender, address(this), collateralUsed)... | 148,153 |
./full_match/1149/0xbaDAe50638507462896fEa9820845a1B70C08792/sources/Projects/Exchange/PlexRouter/contracts/PlexswapLibrary.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) internal pure returns (uint256 amountIn) {
require(amountOut > 0, "PlexswapLibrary: INSUFFICIENT_OUTPUT_AMOUNT");
require(reserveIn > 0 && reserveOut > 0, "PlexswapLibrary: INSUFFICIENT_LIQUI... | 4,664,801 |
pragma solidity ^0.4.17;
import "./token/ILivepeerToken.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/token/TokenVesting.sol";
import "zeppelin-solidity/contracts/token/TokenTimelock.sol";
contract Genesi... | GenesisManager constructor _token Address of the Livepeer token contract _tokenDistribution Address of the token distribution contract _bankMultisig Address of the company bank multisig _minter Address of the protocol Minter/ | function GenesisManager(
address _token,
address _tokenDistribution,
address _bankMultisig,
address _minter,
uint256 _grantsStartTimestamp
)
public
{
token = ILivepeerToken(_token);
tokenDistribution = _tokenDistribution;
bankMultisig =... | 6,451,113 |
pragma solidity 0.4.24;
import "./Escrow.sol";
/**
* @title PullPayment (based on openzeppelin version with one function to withdraw funds to the wallet)
* @dev Base contract supporting async send for pull payments. Inherit from this
* contract and use asyncTransfer instead of send or transfer.
*/
contract Pu... | Withdraw accumulated balance, called by payee. _payee The address whose funds will be withdrawn and transferred to. return Amount withdrawn/ | function _withdrawPayments(address _payee) internal returns(uint256) {
uint256 payment = escrow.withdraw(_payee);
return payment;
}
| 6,466,630 |
./partial_match/4/0xd2C1ee4B6Adc20CAFbC99930078E94cB57868ac4/sources/FarmProRata.sol | Owner is supposed to be a Governance Contract | function disburseRewardTokens() public onlyOwner {
require(now.sub(lastBurnOrTokenDistributeTime) > burnOrDisburseTokensPeriod, "Recently executed, Please wait!");
distributeDivs(tokensToBeDisbursedOrBurnt);
tokensToBeDisbursedOrBurnt = 0;
lastBurnOrTokenDistributeTime = now;
}
... | 8,643,069 |
/**
*Submitted for verification at Etherscan.io on 2021-09-15
*/
// SPDX-License-Identifier: none
pragma solidity ^0.8.4;
contract Owned {
/// Modifier for owner only function call
modifier onlyOwner() {
require(msg.sender == owner, "Only owner");
_;
}
address public owner;
... | TransferFrom function with time lock | function transferFrom(address from, address to, uint amount) public returns (bool) {
if(unlocked[from].excluded == true){
_transferFrom(from, to, amount);
return true;
}
else{
if(locked == true){
uint _releaseTime = time[from].transferTime ... | 15,280,298 |
pragma solidity ^0.5.0;
/**
* @title Payable
* @dev Stores a an address representing a "payor" i.e. an account payments will be made from.
* Contract allows the payor to transfer that obligation to another address pending an approval
* function call from that address.
* Payor mutability is implemented using a ... | Accepts the responsibility of being the new paying address. Can only be called by the current pendingPayor, which must have been set in a prior call to transferPayor./ | function approveTransferPayor() public onlyPendingPayor {
_setPayor(_pendingPayor);
delete _pendingPayor;
}
| 12,837,339 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/@synthetixio/core-modules/contracts/modules/FeatureFlagModule.sol | @inheritdoc IFeatureFlagModule/ | function addToFeatureFlagAllowlist(bytes32 feature, address account) external override {
OwnableStorage.onlyOwner();
SetUtil.AddressSet storage permissionedAddresses = FeatureFlag
.load(feature)
.permissionedAddresses;
if (!permissionedAddresses.contains(account)) {... | 16,517,665 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd.... | Finalize a succcesful crowdsale. The owner can triggre a call the contract that provides post-crowdsale actions, like releasing the tokens./ Already finalized Finalizing is optional. We only call it if we are given a finalizing agent. | function finalize() public inState(State.Success) onlyOwner stopInEmergency {
if(finalized) {
throw;
}
if(address(finalizeAgent) != 0) {
finalizeAgent.finalizeCrowdsale();
}
finalized = true;
}
| 4,812,999 |
/**
*Submitted for verification at Etherscan.io on 2021-03-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-02-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-07-14
*/
/**
*Submitted for verification at Etherscan.io on 2020-05-27
*/
// File: zos-lib/contracts/Initializable.sol
pragma... | Notifies Test contract about a new rebase cycle. supplyDelta The number of new fragment tokens to add into circulation via expansion. return The total number of fragments after the supply adjustment./ | function rebase(uint256 epoch, int256 supplyDelta)
external
onlyTestPolicy
whenRebaseNotPaused
returns (uint256)
{
if (supplyDelta == 0) {
emit LogRebase(epoch, _totalSupply);
return _totalSupply;
}
if (supplyDelta < 0) {
... | 10,916,912 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this func... | withdraws crvToken from convex, withdraws from lending pool, then deposits asset into treasury token address amount uint minAmount uint tokenIndexInPool int128 pid uint curveToken address/ account for withdrawaluint value = treasury.valueOf( token, balance );IERC20( token ).approve( address( treasury ), bal... | function withdraw(
address token,
uint256 amount,
uint256 minAmount,
int128 tokenIndexInPool,
uint256 pid,
address curveToken
) public onlyPolicy {
require(curve3Pool != ICurve3Pool(0), "Invalid curv3pool address");
(address _lptoken, , , address _... | 1,275,278 |
//Address: 0xc99f359f73626e475ee86caab459a4b34ae93fea
//Contract name: DungeonTokenAuction
//Balance: 0 Ether
//Verification Date: 3/10/2018
//Transacion Count: 9
// CODE STARTS HERE
pragma solidity ^0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization co... | The external function to add another dungeon floor by its ID, only contract owners can alter dungeon state./ | function addDungeonNewFloor(uint _id, uint _newRewards, uint _newFloorGenes) eitherOwner tokenExists(_id) external {
Dungeon storage dungeon = dungeons[_id];
dungeon.floorNumber++;
dungeon.floorCreationTime = uint32(now);
dungeon.rewards = uint128(_newRewards);
dungeon.floor... | 1,793,796 |
./full_match/11155111/0x5e7B837ACA749bf2A06947E4a411701EC0d00196/sources/src/Vault.sol | @inheritdoc IVault Explicitly overridden here to keep this function exposed via "IVault" interface. | function paused()
public
view
override(IVault, PausableUpgradeable)
returns (bool)
{
return super.paused();
}
| 3,791,757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.