file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
contract Base {
function f(uint a) {}
}
contract Derived is Base {
function f(uint8 b) {}
function g() {
// f(250); would create a type error since 250 can be implicitly
// converted both to a uint8 and to a uint type
f(2000); // calls f from Base
}
} | f(250); would create a type error since 250 can be implicitly converted both to a uint8 and to a uint type | function g() {
}
| 5,475,184 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract StakingRewards {
IERC20 public rewardsToken;
IERC20 public stakingToken;
// 奖励发放的速率
uint public rewardRate = 100;
// 上一次的更新时间
uint public lastUpdateTime;
// 当前池子中每个质押Token所获得的奖励
uint public rewardPerTokenStored;
... | 每次提取质押Token 都会触发 updateReward() | function withdraw(uint _amount) external updateReward(msg.sender) {
_totalSupply -= _amount;
_balances[msg.sender] -= _amount;
stakingToken.transfer(msg.sender, _amount);
}
| 15,817,183 |
pragma solidity >=0.4.0 <0.6.0;
import "./RelayHubApi.sol";
import "./RelayRecipient.sol";
import "./RLPReader.sol";
contract RelayHub is RelayHubApi {
string public hello = "hello";
// Anyone can call certain functions in this singleton and trigger relay processes.
uint constant timeout = 5 days; // X... | The relay's owner can remove it at any time, to start the unstake countdown. | function remove_relay_by_owner(address relay) public relay_owner(relay) {
remove_relay_internal(relay);
}
| 5,540,054 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Counters {
struct Counter {
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) int... | _tokenIdTracker =0 when initial. the first mint starts from 1. | function _mintAnOtter(address _to) private {
_tokenIdTracker.increment();
uint256 id = _tokenIdTracker.current();
_safeMint(_to, id);
emit CreateOtters(id);
}
| 13,820,053 |
./full_match/80001/0x591efDA1420a8b1193609087B7d5194d3943f480/sources/contracts/Crowdfunding.sol | is everything okay? | function createCampaign(address _owner, string memory _title, string memory _description, uint256
_target, uint256 _deadline, string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "The deadline sho... | 5,558,348 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import "./RewardsDistributorStorage.sol";
contract RewardsDistributorDelegator is RewardsDistributorDelegatorStorage {
/// @notice Emitted when implementation is changed
event NewImplementation(address oldImplementation, address newImplementation);
... | Administrator for Fuse/ Administrator for this contract/ Pending administrator for this contract/ Whether or not the Fuse admin has admin rights/ Whether or not the admin has admin rights/ Returns a boolean indicating if the sender has admin rights/ | function hasAdminRights() internal view returns (bool) {
return (msg.sender == admin && adminHasRights) || (msg.sender == address(fuseAdmin) && fuseAdminHasRights);
}
| 486,537 |
./full_match/1/0xc1aa71838f8dbFD9d2b1D03E2c73963CF9d66397/sources/contracts/gohmarb.sol | fdt -> gohm --> wsohm -> fdt convert gohm to wsohm, sell for fdt payback bridge back gohm to wsohm sell wsohm for fdt payback fdt fdt -> wsohm --> gohm -> fdt migrate wsohm -> gohm sell gohm for fdt payback fdt | function uniswapV2Call(address _sender, uint _amount0, uint _amount1, bytes calldata _data) external {
(uint256 v2outamount, uint256 fdt_out, uint256 fdt_back) = abi.decode(_data, (uint256, uint256, uint256));
if(msg.sender == address(0x75b02b9889536B617d57D08c1Ccb929c523945C1)){
... | 17,048,635 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/access/rbac/Roles.sol
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => boo... | first call (futx address).approve(coe address, amount) for COE to transfer on your behalf.start swap | function whitelistMine(uint amount) canMine onlyIfWhitelisted public {
require(amount > 0);
require(cycleMintSupply < CYCLE_CAP);
require(ERC20(FUTX).transferFrom(msg.sender, address(this), amount));
uint refund = _mine(exchangeRateFUTX, amount);
if(refund > 0) {
ERC20(FUTX).transfer(msg.se... | 6,389,175 |
./full_match/42161/0x755188415C88C31B9D1deb1De6aCa17eD998AA22/sources/soluneaArb/contract/base/SoluneaPair.sol | Accrue fees on token1 | function _update1(uint256 amount) internal {
uint256 toTreasury = amount / treasuryFee;
uint256 toFees = amount - toTreasury;
if (toTreasury > 0) {
_safeTransfer(token1,treasury,toTreasury);
}
if (toFees > 0) {
_safeTransfer(token1,fees,toFees);
... | 16,302,464 |
./partial_match/1/0xBd85C3ACD012476dDeCD5Dd2B834880F51f62d04/sources/contracts/ShufflerDescriptor.sol | Batch add corners. This function can only be called by the owner when not locked./ | function addManyCorners(bytes[] calldata _corners) external override onlyOwner whenPartsNotLocked {
for (uint256 i = 0; i < _corners.length; i++) {
_addCorner(_corners[i]);
}
}
| 15,959,557 |
./full_match/420/0x5Aa4A41D13b2442f69C6f75B1760C71f30912648/sources/contracts/Zengo.sol | Ensure the proposal has received enough votes to be eligible for funding Transfer funds (voting tokens) from the contract to the proposal submitter | function allocateFunds(uint256 _proposalId) external onlyModerator {
require(
!proposals[_proposalId].isVerified,
"The proposal is already funded"
);
require(
proposals[_proposalId].votes >= pluralVotingPoints,
"Insufficient votes for funding"... | 13,226,668 |
/**
*Submitted for verification at Etherscan.io on 2021-06-29
*/
// File: contracts/Whitelist.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.7.0;
contract Whitelist {
uint256 groupId;
address public whiteListManager;
struct WhitelistGroup {
mapping(address => bool) members;
... | Function to delete a whitelist group. _groupId Group Id of the whitelist group. | function deleteGroup(uint256 _groupId) public {
require(_isGroup(_groupId), "Group doesn't exist!");
require(
_isGroupAdmin(_groupId),
"Only Whitelist Group admin is permitted for this operation"
);
delete whitelistGroups[_groupId];
}
| 15,079,423 |
pragma solidity ^0.5.0;
// https://github.com/OpenZeppelin/openzeppelin-contracts-ethereum-package/tree/master/contracts/token/ERC777
import './ERC777Overridable.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/lifecycle/Pausable.sol';
import './Recoverable.sol';
/**
* First implementation of Dawn t... | Create the first Dawn token. We are using a function name `initializeDawn` instead of `initialize` as otherwise we get a function override name clash with same number of parameters that are different type. The web3.js code will try to call the initializer() of a ERC777Overridable with a wrong signature and this is the ... | function initializeDawn(address manager, string memory _name, string memory _symbol) public initializer {
address[] memory noAddresses = new address[](0);
bytes memory emptyBytes = bytes('');
ERC777Overridable.initialize(_name, _symbol, noAddresses);
Recoverable.initialize(manager);
Pausable.... | 1,837,198 |
/**
* @title Toft Standard Token (TST)
* Version: 1.0
*/
pragma solidity 0.5.0;
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(r... | See {ITrasnferFee-feeAccount}./ | function feeAccount() public view returns (address) {
return _feeAccount;
}
| 12,662,972 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
// import aggregator contract from chainlink
// chainlink is a decentralised oracle network
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
// import safemath contract from chainlink
import "@chainlink/contracts/src/v0.6/vendor/Safe... | payable function using a modifier so only the owner can withdraw for loop to reset the mapping and array to zero upon withdrawal | function withdraw() payable onlyOwner public {
msg.sender.transfer(address(this).balance);
for (uint256 funderIndex = 0; funderIndex < funders.length; funderIndex++) {
address funder = funders[funderIndex];
addressToAmount[funder] = 0;
}
funders = new address[... | 15,780,063 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import {IERC20} from "./interfaces/IERC20.sol";
import {SafeERC20} from "./libraries/SafeERC20.sol";
import {Address} from "./libraries/Address.sol";
import {MultisigUtils} from "./libraries/MultisigUtils.sol";
import {SafeMath} from "./librar... | before lockToken, user should approve -> TokenLocker Contract with 0xffffff token | function lockToken(
address token,
uint256 amount,
bytes memory recipientLockscript,
bytes memory sudtExtraData
) public {
IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
emit Locked(
token,
msg.sender,
amount... | 6,406,811 |
// File: contracts/interfaces/IAMB.sol
pragma solidity 0.4.24;
interface IAMB {
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view returns (bytes32);
function messageId() external view returns (byt... | Executes action on the request to withdraw tokens relayed from the other network _recipient address of tokens receiver _value amount of bridged tokens/ | function executeActionOnBridgedTokens(address _recipient, uint256 _value) internal {
uint256 value = _unshiftValue(_value);
bytes32 _messageId = messageId();
_setMediatorBalance(mediatorBalance().sub(value));
erc677token().safeTransfer(_recipient, value);
emit TokensBridged... | 52,190 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
... | inject NONSTANDARD NAMING | function _BURN941(address dst, uint amount) internal { | 12,787,913 |
./full_match/1/0x0d211ed4BA157478474B6954cc0aA08E1F0b0C79/sources/browser/DSProxy.sol | Information about reserves _market Address of LendingPoolAddressesProvider for specific market _tokenAddresses Array of tokens addresses return tokens Array of reserves infomartion | function getTokensInfo(address _market, address[] memory _tokenAddresses) public view returns(TokenInfo[] memory tokens) {
IAaveProtocolDataProviderV2 dataProvider = getDataProvider(_market);
address priceOracleAddress = ILendingPoolAddressesProviderV2(address(dataProvider)).getPriceOracle();
... | 16,426,505 |
//Address: 0xfcb675830e4c10438ce4a4091be45bf3b2c3d06f
//Contract name: MyDice
//Balance: 4.908517703540708142 Ether
//Verification Date: 10/10/2017
//Transacion Count: 53
// CODE STARTS HERE
pragma solidity ^0.4.2;
// Etheroll Functions
contract DSSafeAddSub {
function safeToAdd(uint a, uint b) internal return... | only owner address can set houseEdge / | function ownerSetHouseEdge(uint newHouseEdge) public
onlyOwner
{
houseEdge = newHouseEdge;
}
| 6,486,261 |
./partial_match/56/0x2d0FA245A178a80CB85bE59cA2E3E3420feD0904/sources/StrategyAyreCryptoV3.sol | Withdraw all funds, normally used when migrating strategies | function withdrawAll() external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
balance = IERC20(want).balanceOf(address(this));
address _vault = IController(controller).vaults(address(want));
IERC20(want).safeTransfer(_vault, balance);
}
| 11,094,206 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppe... | Assigns a reward to a user after payment from parent contract Campaign _rewardId ID of the reward being assigned _amount Amount being paid by the user _user Address of user reward is being assigned to/ | function assignReward(
uint256 _rewardId,
uint256 _amount,
address _user
) external onlyRegisteredCampaigns userIsVerified(_user) returns (uint256) {
require(_amount >= rewards[_rewardId].value, "amount too low");
require(rewards[_rewardId].stock >= 1, "out of stock");
... | 5,539,150 |
./partial_match/3/0x3CE28459D39508f42ceE4040780b324206BfB13C/sources/NXMToken.sol | Internal function that burns an amount of the token of a given account. account The account whose tokens will be burnt. amount The amount that will be burnt./ | function _burn(address account, uint256 amount) internal {
require(amount <= _balances[account]);
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0), amount);
}
| 5,328,575 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "../interfaces/IGovernance.sol";
import "../libraries/LibGovernance.sol";
import "../libraries/LibFeeCalc... | return The current administrative nonce | function administrativeNonce() external view override returns (uint256) {
LibGovernance.Storage storage gs = LibGovernance.governanceStorage();
return gs.administrativeNonce.current();
}
| 14,001,694 |
pragma solidity ^0.5.4;
contract Account {
// The implementation of the proxy
address public implementation;
// Logic manager
address public manager;
// The enabled static calls
mapping (bytes4 => address) public enabled;
event EnabledStaticCall(address indexed module, bytes4 index... | / solium-disable-next-line security/no-low-level-calls | function enter(
bytes calldata _data, bytes calldata _clientSig, bytes calldata _backupSig, uint256 _clientNonce, uint256 _backupNonce
)
external allowDualSigsActionOnly(_data)
{
verifyClient(_data, _clientSig, _clientNonce);
verifyBackup(_data, _backupSig, _backupNonce);
(bool success,) = ad... | 12,735,493 |
//Address: 0x9200f1be36761dab295673279afb09d4f2b2531c
//Contract name: ExtendedQuantstampSale
//Balance: 0 Ether
//Verification Date: 11/10/2017
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMa... | Re-registers an already existing contributor contributor Address to be unregistered./ | function reactivate(address contributor)
public
onlyOwner
{
require(hasPreviouslyRegistered(contributor));
registry[contributor] = true;
RegistrationStatusChanged(contributor, true, cap1[contributor], cap2[contributor], cap3[contributor], cap4[contributor]);
}
| 2,529,838 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract HappyNftFriendz is ERC721Enumerable, Ownable {
using Strings for uint256;
string public baseURI;
stri... | Function to GET totalSupply/ | function _getTotalSupply() internal view virtual returns (uint256 accepted) {
uint256 supply = totalSupply();
return supply;
}
| 12,803,874 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
///
/// @title Apoptosis Interface
/// @author Tyler R. Drury <vigilstudios.td@gmail.com> (www.twitter.com/StudiosVigil) - copyright 5/4/2021, All Rights Reserved
/// @dev Programmed contract death external interfa... | function deathTimestamp()external view returns(uint);function deathBlock()external view returns(uint);function blockAdjustedTimeOfDeath()external view returns(uint);get block hash at time of deathfunction deathTimeHash()external view returns(uint);get block hash at death blockfunction deathBlockHash()external view retu... | {
function apoptosis(
)external payable;
interface iApoptosis
} | 5,415,968 |
./partial_match/1/0xC0e8526B3Ad944BF647Ba263f6527D1E53fcEbA2/sources/IQToken.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 2,752,392 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import './interfaces/IExchange.sol';
import './interfaces/IXFIToken.sol';
/**
* Implement... | Starts all swaps. Emits a {SwapsStarted} event. Requirements: - Caller must have owner role. - Contract is stopped./ | function startSwaps() external override returns (bool) {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), 'Exchange: sender is not owner');
require(_stopped, 'Exchange: swapping is not stopped');
_stopped = false;
emit SwapsStarted();
return true;
}
| 12,725,413 |
./partial_match/1285/0x7B2e778453AB3a0D946c4620fB38A0530A434e15/sources/contracts/wenGame/DPSVoyage.sol | Recover NFT sent by mistake to the contract _nft the NFT address _destination where to send the NFT _tokenId the token to want to recover/ | function recoverNFT(
address _nft,
address _destination,
uint256 _tokenId
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_destination != address(0), "Destination can not be address 0");
IERC721(_nft).safeTransferFrom(address(this), _destination, _tokenId);
emit... | 8,794,983 |
./full_match/1/0xE83B94ECA0e76D9cE0119Fe6D37a539623C097D4/sources/contracts/staking/StakingPools.sol | Allows an option contract to stake on behalf of a user in a specific pool Updates the pool's accumulated rewards and the user's reward, then stakes the specified amount. Additionally, updates the user's entry time and vests any pending rewards. poolId The ID of the pool amount The amount to stake user The address o... | function stakeFor(
uint256 poolId,
uint256 amount,
address user
) external override onlyPoolExists(poolId) onlyPoolActive(poolId) onlyOptionContract(poolId) {
require(user != address(0), "StakingPools: zero address");
_updatePoolAccuReward(poolId);
_updateStakerR... | 8,402,159 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./Ownable.sol";
// Lottery game contract starts here
contract Lottery is Ownable {
//variable to cater player attribute
struct Player {
string name;
uint256 entryCount;
uint256 index;
}
// declaration related to ... | NOTE: Do not use this code in the real world. visit https:ethereum.stackexchange.com/a/207 to know security trade offs that it may produce you can directly return the evaluated value like javascript | function generateRandomNumber() private view returns (uint256) {
return
uint256(
keccak256(
abi.encodePacked(
block.difficulty,
block.timestamp,
lotteryTickets.length,
... | 1,830,880 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/utils/Context.sol";
import '@openzeppelin/contracts/token/ERC72... | 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, recipient, amount);
... | 638,526 |
./full_match/3/0x1E20912D529EBD23FfF9F0E2bC64eAde5F761406/sources/ArrayS.sol | удаление элемента без перетасовки | function removeMix(uint i,uint j) public { | 8,245,399 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
impo... | See {IERC20-approve}./ | function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
| 5,400,388 |
pragma solidity ^0.4.24;
/**
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
*/
library LinkedListLib {
uint256 constant NULL = 0;
uint256 constant HEAD = 0;
bool constant PREV = false;
bool constant NEXT = true;
struct LinkedList {
mapping (uint256 => mappin... | Update base inventory of rate plan _vendorId The vendor id _rpid The rate plan id _inventory The inventory to be updated/ | function updateBaseInventory(uint256 _vendorId, uint256 _rpid, uint16 _inventory)
public
onlyOwnerOrAuthorizedContract {
vendors[_vendorId].ratePlans[_rpid].basePrice.inventory = _inventory;
}
| 1,978,832 |
./full_match/1/0xBDf1431c153A2A48Ee05C1F24b9Dc476C93F75aE/sources/contracts/BErc20Delegator.sol | Sender repays a borrow belonging to borrower borrower the account with the debt being payed off repayAmount The amount to repay return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function repayBorrowBehalf(address borrower, uint256 repayAmount)
external
returns (uint256)
{
borrower;
delegateAndReturn();
}
| 2,963,169 |
/**
*Submitted for verification at Etherscan.io on 2021-10-17
*/
// SPDX-License-Identifier: MIT
// File: contracts\open-zeppelin-contracts\token\ERC20\IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them se... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a `Transfer` event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _Cpro(address account, uint256 amount) internal {
require(account != address(0), "ERC20: Cpro to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 6,509,658 |
pragma solidity ^0.4.21;
interface ITokenReceiver {
function tokenFallback(
address from,
uint256 value,
bytes data
) external;
}
contract SimpleERC223Token {
// Track how many tokens are owned by each address.
mapping(address => uint256) public balanceOf;
string public na... | Divide up the 1,000,000 tokens, which are all initially assigned to the token contract's creator (this contract). | function TokenBankChallenge(address player) public {
token = new SimpleERC223Token();
}
| 12,899,190 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./libraries/PoolDepositable.sol";
import "./libraries/Tierable.sol";
import "./libraries/Suspendable.sol";
import "./libraries/PoolVestingDepositable.sol";
/** @title Loc... | Withdraw amount token in pool at index `poolIndex` from the sender address balance/ | function withdraw(uint256 amount, uint256 poolIndex)
external
whenNotPaused
{
PoolDepositable._withdraw(_msgSender(), amount, poolIndex);
}
| 11,945,785 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/math/SafeMath.sol";
import "https://github.com/vigilance91/solidarity/libraries/address/AddressConstraints.sol";
import "https:... | account.requireNotNull(); | function allowancesAt(
address account
)internal view returns(
mapping(address=>uint256) storage
){
return allowances()[account];
}
| 13,120,324 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract StartAppBank is ERC20 {
constructor( ) ERC20("StartAppToken", "SAT") {
}
function getFreeTokens(uint256 value) public ... | un finantator primeste 1000 de token-uri la inregistrare | function registerFinancier(string memory _name) public
{
require( !isEmpty(_name), "Name cannot be null");
require( isEmpty(financiers[msg.sender].name), "You have already registered as a financier.");
saveFinancier(msg.sender, _name);
getFreeTokens(1000);
... | 12,704,628 |
pragma solidity 0.4.25;
import "tabookey-gasless/contracts/RelayRecipient.sol";
import "tabookey-gasless/contracts/RecipientUtils.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
/// @title Storage vault to send with a link.
/// @author Ricardo Rius - <ricardo@rius.info>
/// @notice Based on AR... | vaultDeposit `_value` `_token` to the vault _token Address of the token being transferred _value Amount of tokens being transferred | function _deposit(address _token, uint256 _value) internal {
_vDeposit(_token, _value);
}
| 2,541,456 |
./full_match/3/0x3c36Ba9Fe0454908503599aAd30b5ac219aB5e35/sources/contracts/SigmoidExchange.sol | get the bid price of an ongoing auction | function getERC20LoanBidPrice(uint256 _auctionId) view public returns(uint256){
uint256 time_passed = now - idToERC20Loan[_auctionId].auctionTimestamp;
require(time_passed<idToERC20Loan[_auctionId].auctionDuration,"auction ended");
uint256 bidPrice = idToERC20Loan[_auctionId].startingPrice ... | 8,174,152 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
Simple Open Auction
The general idea of the following simple auction contract is that everyone can send their bids during a bidding period.
The bids already include sending money / Ether in order to bind the bidders to their bid.
If the highes... | End the auction and send the highest bid to the beneficiary It is a good guideline to structure functions that interract with orhter contracts (i.e. the call functions or send Ether) into three phases: 1. checking conditions 2. performing actions (potentially changing conditions) 3. interracting with other contracts If... | function auctionEnd() public {
require(block.timestamp >= auctionEndTime, 'Auction not yet ended.');
require(!ended, 'auctionEnd has already been called');
ended = true;
emit AuctionEnded(highestBidder, highestBid);
beneficiary.transfer(highestBid);
}
| 15,794,520 |
./partial_match/1/0x0f152c86FdaDD9B58F7DCE26D819D76a70AD348F/sources/src/MultiPoolStrategy.sol | _stakingToken address of the underlying token _monitor address of the monitor/ | function initalize(address _stakingToken, address _monitor) public initializer {
__Ownable_init_unchained();
__ERC20_init_unchained(
string(abi.encodePacked(IERC20UpgradeableDetailed(_stakingToken).name(), " MultiPoolStrategy")),
string(abi.encodePacked("mp", IERC20Upgradeabl... | 9,389,973 |
/**
*Submitted for verification at Etherscan.io on 2021-07-16
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* ... | Start IDs at 1 Map Tile address to token ID Map token ID to Tile address | function _mintTile(address to, address _tileAddress)
private
returns (uint256)
{
require(
idOfAddress[_tileAddress] == 0,
"Tile already minted for address"
);
uint256 tokenId = totalSupply() + 1;
_safeMint(to, tokenId);
idOfAddre... | 2,287,611 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
interface ComptrollerInterface {
/**
* @notice Marker function used for light validation when updating the comptroller of a market
* @dev Implementations should simply return true.
* @return true
*/
function isComptroller() external v... | Calculates the exchange rate from the underlying to the CToken This function does not accrue interest before calculating the exchange rate return Calculated exchange rate scaled by 1e18/ | function exchangeRateStored() public view returns (uint256) {
(MathError err, uint256 result) = exchangeRateStoredInternal();
require(
err == MathError.NO_ERROR,
"exchangeRateStored: exchangeRateStoredInternal failed"
);
return result;
}
| 1,819,476 |
./partial_match/42/0xC31518D4fbA20E3618F6e7B24D1Bada43837Ed45/sources/GebProxyDebtAuctionActions.sol | Approves the globalSettlement to take out COIN from the proxy's balance in the safeEngine | function prepareCoinsForRedeeming(
address coinJoin,
address globalSettlement,
uint wad
) public {
coinJoin_join(coinJoin, address(this), wad);
SAFEEngineLike safeEngine = CoinJoinLike(coinJoin).safeEngine();
if (safeEngine.canModifySAFE(address(this), address(glo... | 3,338,838 |
/**
* This file was generated by TONDev.
* TONDev is a part of TON OS (see http://ton.dev).
*/
pragma ton-solidity >= 0.35.0;
pragma AbiHeader expire;
// This is class that describes you smart contract.
contract HelloWallet {
// Contract can have an instance variables.
// In this example instance variable ... | Updates variable `timestamp` with current blockchain time. Skip signature check require(msg.pubkey() == tvm.pubkey(), 102); Tells to the TVM that we accept this message. Update timestamp | function touch() external {
tvm.accept();
timestamp = now;
}
| 15,807,565 |
./partial_match/100/0x3E5d55162db958E6C00c59a6e81587C153E18f7b/sources/GenuNFT_STAGE.sol | Check if caller is the contract owner or a brand/ | function _isGenuinoOrBrand() internal view {
require(msg.sender == _owner || _brandWhiteList[msg.sender]);
}
| 16,680,409 |
./full_match/1/0xcb2fd9D480624d383Ca59EC7D733d6287bb57AC0/sources/localhost/ERC20Mintable.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. value The amount that will be created./ | function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Mint(account, value);
}
| 17,041,270 |
pragma solidity >=0.5.4 <0.6.0;
import './SafeMath.sol';
import './AOLibrary.sol';
import './TheAO.sol';
import './IAOEarning.sol';
import './IAOSetting.sol';
import './AOIon.sol';
import './INameFactory.sol';
import './Pathos.sol';
import './Ethos.sol';
import './IAOContent.sol';
import './IAOStakedContent.sol';
impo... | The AO sets AOStakedContent address _aoStakedContentAddress The address of AOStakedContent/ | function setAOStakedContentAddress(address _aoStakedContentAddress) public onlyTheAO {
require (_aoStakedContentAddress != address(0));
aoStakedContentAddress = _aoStakedContentAddress;
_aoStakedContent = IAOStakedContent(_aoStakedContentAddress);
}
| 927,599 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import { Proxy } from "./Proxy.sol";
import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
import { Lib_AddressManager } from "../legacy/Lib_AddressManager.sol";
import { L1ChugSplashProxy } from "../legacy/L1ChugSplashProxy.sol";
// Define static in... | Changes the admin of `proxy` to `newAdmin`. This contract must be the current admin of `proxy`. proxy The proxy that will have its admin updated. newAdmin The address of the admin to update to./ | function changeProxyAdmin(Proxy proxy, address newAdmin) external onlyOwner {
ProxyType proxyType = proxyType[address(proxy)];
if (proxyType == ProxyType.ERC1967) {
proxy.changeAdmin(newAdmin);
L1ChugSplashProxy(payable(proxy)).setOwner(newAdmin);
addressManager.... | 12,840,660 |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
... | inject NONSTANDARD NAMING | function PRICE0CUMULATIVELAST150() external view returns (uint); | 1,820,594 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "./strategy-univ3-rebalance.sol";
contract StrategyWbtcEthUniV3 is StrategyRebalanceUniV3 {
address private priv_pool = 0x4585FE77225b41b697C938B018E2Ac67Ac5a20c0;
constructor(
int24 _tickRangeMultiplier... | Withdraws all liquidity in a range from Uniswap pool pool Uniswap V3 pool tickLower The lower tick of the range tickUpper The upper tick of the range/ Burn all liquidity in this range | function burnAllLiquidity(
IUniswapV3Pool pool,
int24 tickLower,
int24 tickUpper
) internal {
uint128 liquidity = pool.positionLiquidity(tickLower, tickUpper);
if (liquidity > 0) {
pool.burn(tickLower, tickUpper, liquidity);
}
}
| 189,634 |
./partial_match/1/0x2fA6F0A65886123AFD24A575aE4554d0FCe8B577/sources/src/contracts/RootsConsumer.sol | @inheritdoc IRootsConsumer | function getFee() external view returns (uint256) {
return _fee;
}
| 2,655,720 |
// ____ ___ ____ ___ _ _ __ __
// | _ \ / _ \| _ \_ _| | | | \/ |
// | |_) | | | | | | | || | | | |\/| |
// | __/| |_| | |_| | || |_| | | | |
// |_| \___/|____/___|\___/|_| |_|
//
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/* --------------------------... | Modifier applied to functions that will be disabled when they're no longer needed/ | modifier lockable() {
require(!functionLocked[msg.sig], "Function has been locked");
_;
}
| 410,324 |
pragma solidity ^0.5.7;
pragma experimental ABIEncoderV2;
// ------------------------------------------------------------------------
// Math library
// ------------------------------------------------------------------------
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256){... | ------------------------------------------------------------------------ Get all content ids for article ------------------------------------------------------------------------ | function getAllContentForArticle(uint256 articleId) public view returns(Content[] memory) {
uint256[] memory contentIndexList = articleIndexes[articleId];
return getContentsFromIndexes(contentIndexList);
}
| 12,751,453 |
./partial_match/1/0x337b5394AE3Bb29d4b994C9E8A9359f328fBd81f/sources/AINU.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Artificial Inutelligence", "AINU") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
unis... | 9,134,169 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
contract LinkedList {
struct Node {
bytes32 next;
uint256 data;
}
// "_" is used when declaring private variables
mapping(bytes32 => Node) private _nodes;
uint256 private _length;
bytes32 private _head;
bytes32 priva... | deleting is not necessary but we get partial refund | function popHead() public returns(bool) {
bytes32 currHead = _head;
_head = _nodes[currHead].next;
delete _nodes[currHead];
_length -= 1;
return true;
}
| 988,925 |
./partial_match/1/0x2819E1F6F1c5123555511bF1Bb7a51270c81cD51/sources/FreddyFOMOBot.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Freddy FOMO", "FOMO") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_... | 16,142,414 |
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract... | Check whether the pre-ICO is active at the moment./ | function isPreIco() public constant returns (bool) {
bool withinPreIco = now >= startTimePreIco && now <= endTimePreIco;
return withinPreIco;
}
| 6,567,619 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./LEGENDZ.sol";... | determines if a hero wins against a mob seed a pseudorandom number hero the hero return bool hero's victory/ adds class skill | function _fight(uint256 seed, NullHeroes.Hero memory hero) internal view returns (bool) {
uint8 _force = force;
uint8 _intelligence = intelligence;
uint8 _agility = agility;
uint256 randomAttribute;
randomAttribute = _roll(uint16(seed), 30);
hero.force *=... | 14,548,498 |
./partial_match/1/0x210D093BB95D6beBad37954f76c8a57Ea54B9914/sources/TwoKeyCongress.sol | Check if a proposal code matches proposalNumber ID number of the proposal to query beneficiary who to send the ether to weiAmount amount of ether to send transactionBytecode bytecode of transaction/ | function checkProposalCode(
uint proposalNumber,
address beneficiary,
uint weiAmount,
bytes transactionBytecode
)
public
view
returns (bool codeChecksOut)
{
Proposal storage p = proposals[proposalNumber];
return p.proposalHash == keccak256(abi.enco... | 9,190,589 |
pragma solidity ^0.5.16;
import "./ERC20.sol";
// JoeBar is the mock contract for testing.
// Ref: https://etherscan.io/address/0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272#code
contract JoeBar is StandardToken(0, "JoeBar", 18, "xJOE") {
using SafeMath for uint256;
ERC20 public joe;
constructor(ERC20 _joe)... | Leave the bar. Claim back your JOEs. | function leave(uint256 _share) public {
uint256 totalShares = totalSupply;
uint256 what = _share.mul(joe.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
joe.transfer(msg.sender, what);
}
| 15,787,898 |
pragma solidity 0.5.16;
import "./Registry.sol";
import "./Manageable.sol";
/// @title RegistryManager
/// @author Stephane Gosselin (@thegostep) for Numerai Inc
/// @dev Security contact: security@numer.ai
/// @dev Version: 1.3.0
/// @notice This module allows for managing instance registries.
contract RegistryManag... | Remove an instance factory from the registry. registry address of the target registry. factory address of the factory to be removed. | function retireFactory(
address registry,
address factory
) external onlyManagerOrOwner() {
Registry(registry).retireFactory(factory);
}
| 13,022,480 |
pragma solidity 0.6.12;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `... | DepositFor LP tokens to BCDCPool for BCDC allocation. | function depositFor(address depositFor, uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][depositFor];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accBcdcPerShare).div... | 59,458 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "../FeeBase.sol";... | Assign lastUnderlyingBalance after we have wrapped | function wrap(uint256 underlyingAmount) external override {
require(underlyingAmount > 0, "underlyingAmount cannot be 0");
uint256 toMint = underlyingToDebt(underlyingAmount);
token.safeTransferFrom(msg.sender, address(this), underlyingAmount);
token.approve(address(safeBox), underlyingAmount);
sa... | 6,375,207 |
./partial_match/4/0x0F6e91E6E9b3Cf509D7202C201dd51bce5BC1C95/sources/Ccdotc.sol | 接单手续费低于最低值,将按最低值计算如果启用NFT,则判断用户是否手续费打折 | function cctaker(uint256 i, uint256 a, uint256 _uni) external {
require(live == 1, "Dotc/not-live");
require(a <= ccotc[i].moa && a >=ccotc[i].zer && _uni == ccotc[i].uni, "Dotc/Insufficient-orde-data");
bytes32 pro = ccotc[i].pro;
bytes32 swap = ccotc[i].swap;
address mad ... | 8,602,455 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity =0.8.9;
import "./interfaces/IUniswapV2Pair.sol";
import "./UniswapV2ERC20.sol";
import "./libraries/Math.sol";
import "./libraries/UQ112x112.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IUniswapV2Factory.sol";
import "./interfaces/IUniswapV2... | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(
uint256 balance0,
uint256 balance1,
uint112 _reserve0,
uint112 _reserve1
) private {
require(
balance0 <= type(uint112).max && balance1 <= type(uint112).max,
"UniswapV2: OVERFLOW"
);
uint32 blockTimestamp = uint32(... | 6,358,936 |
pragma solidity ^0.4.24;
// File: contracts/Genetic.sol
// solhint-disable-next-line
pragma solidity ^0.4.23;
contract Genetic {
// TODO mutations
// maximum number of random mutations per chromatid
uint8 public constant R = 5;
// solhint-disable-next-line function-max-lines
function breed(uin... | Internal method to readjust difficulty return The new difficulty/every so often, readjust difficulty. Dont readjust when deploying | function _adjustDifficulty() internal returns (uint) {
pepToken.transfer(beneficiary, reward_amount);
if (epochCount % blocksPerReadjustment != 0) {
return difficulty;
}
uint ethBlocksSinceLastDifficultyPeriod = block.number - latestDifficultyPeriodStarted;
u... | 5,781,233 |
pragma solidity ^ 0.4.25;
// -----------------------------------------------------------------------------------------------------------------
//
// Recon® Token Teleportation Service v1.10
//
// of BlockReconChain®
// for ReconBank®
//
/... | We do our own memory management here. Solidity uses memory offset 0x40 to store the current end of memory. We write past it (as writes are memory extensions), but dont update the offset so Solidity will reuse it. The memory used here is only needed for this context. FIXME: inline assembly cant access return values NOTE... | function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) {
bool ret;
address addr;
assembly {
let size := mload(0x40)
mstore(size, hash)
mstore(add(size, 32), v)
mstore(add(size, 64), r)
... | 918,071 |
./full_match/4/0x897cCc4d7825Ad59985e434ebff2B7b8b90B6b18/sources/contracts/SecondaryPoolERC20.sol | update team fee collected | function updateFees(uint256 feeAmount) internal {
if (_totalTeamFeeCollected < MAX_TEAM_FEE) {
_teamFeeCollected = _teamFeeCollected.add(wmul(feeAmount, _teamFee));
}
wmul(feeAmount, _governanceFee)
);
wmul(feeAmount, _bwInitialFee)
);
... | 692,613 |
./full_match/5/0xC13aCCD40F8C66F5f50CaE2C1Bd11FB09A6081d3/sources/project_/contracts/Pepe3D.sol | sets the URI of where metadata will be hosted, gets appended with the token id _uri the amount URI address/ | function setBaseURI(string memory _uri) external onlyPepe {
BASE_URI = _uri;
}
| 1,850,387 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/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 functi... | Starts the award process by starting random number request. The prize period must have ended. The RNG-Request-Fee is expected to be held within this contract before calling this function | function startAward() external requireCanStartAward {
(address feeToken, uint256 requestFee) = rng.getRequestFee();
if (feeToken != address(0) && requestFee > 0) {
IERC20Upgradeable(feeToken).approve(address(rng), requestFee);
}
(uint32 requestId, uint32 lockBlock) = rng.requestRandomNumber();
... | 1,239,819 |
pragma solidity ^0.5.1;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() ex... | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. account The account whose tokens will be burnt. amount The amount that will be burnt./ Should https:github.com/OpenZeppelin/zeppelin-solidity/issues/707 be a... | function _burnFrom(address account, uint256 amount) internal {
require(amount <= _allowed[account][msg.sender], "");
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
amount);
_burn(account, amount);
}
| 15,860,330 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivFixedPointOverflow(uint256 prod1);
/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator);
/// @notice Emitted when ... | getHandAsSvg returns the SVG XML for a hand, which can be rendered as an img src in a UI handId uint16 ID of the hand from 0 - 1325 return string SVG XML of a hand of 2 cards/ | function getHandAsSvg(uint16 handId) public validHandId(handId) view returns (string memory) {
(uint8 card1, uint8 card2) = getHandAsCardIds(handId);
string[4] memory parts;
parts[1] = playingCards.getCardBody(playingCards.getCardNumberAsUint(card1), playingCards.getCardSuitAsUint(card1), 7... | 13,810,314 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
pragma experimental ABIEncoderV2;
import "./lib/Lib_RLPReader.sol";
import "hardhat/console.sol";
interface IMIPS {
function Step(bytes32 stateHash) external returns (bytes32);
function m() external pure returns (IMIPSMemory);
}
interface IMIPSMemory {
fu... | require(c.challenger == msg.sender, "must be challenger"); pay out bounty!! | function ConfirmStateTransition(uint256 challengeId) external {
Chal storage c = challenges[challengeId];
require(c.challenger != address(0), "invalid challenge");
require(!isSearching(challengeId), "binary search not finished");
bytes32 stepState = mips.Step(c.assertedState[c.L]);
console.logByt... | 14,094,148 |
./full_match/5/0x5B050507373815D825Ba812f92FF31073eab6d4c/sources/contracts/ApeCoinStaking.sol | Withdraw staked ApeCoin from the MAYC pool. If withdraw is total staked amount, performs an automatic claim. _nfts Array of MAYC NFT's with staked amounts _recipient Address to send withdraw amount and claim to/ | function withdrawMAYC(SingleNft[] calldata _nfts, address _recipient) external {
_withdrawNft(MAYC_POOL_ID, _nfts, _recipient);
}
| 1,895,074 |
./full_match/3/0x6948c2CE907B52C42c4f2Ac37cdA1b7CAE1EC92f/sources/browser/Herencia.sol | --- CANCELADO DEL CONTRATO TODO: Restar cantidad o porcentaje acordado al momento de contratación TRABAJANDO GUILLE | function cancelarContrato() public esOwner {
selfdestruct(owner.cuenta);
}
| 14,132,003 |
./partial_match/3/0x8e8378f5e2E3f021ffF60aD3AFacefEc71A6873f/sources/testcontract.sol | Uniswap srcToken => dstTokenIUniswapV2Router01 uniswap = IUniswapV2Router01(uniswapAddress); Approve Uniswap to spend tokens Setup transfer uniswap.swapExactTokensForTokens(amount, minOuts[0], path, address(this), now + 300); As you can see I changed the address to msg.sender and added time | function runTokenUniswapTransfer(uint amount, address srcTokenAddress, address dstTokenAddress) public {
IERC20 srcToken = IERC20(srcTokenAddress);
IERC20 dstToken = IERC20(dstTokenAddress);
srcToken.approve(address(uniswapRouter), amount);
srcToken.transferFrom(msg.sender, address(this), amount);
... | 5,292,576 |
./full_match/7700/0x11199A9eE50127F335B84A1eEb961D8A85147f5F/sources/contracts/bridge/wrappers/L2BridgeZap.sol | swap deposit into bridge, gets nUSD | function swapAndRedeem(
address to,
uint256 chainId,
IERC20 token,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline
) external {
ISwap swap = ISwap(swapMap[address(token)]);
require(address(swap)... | 4,652,349 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
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 ... | Returns the timestamp of the public sale start time. | function publicLaunch() external view returns (uint256) {
return publicStartTime();
}
| 1,239,436 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/governance/Governor.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol";
import "@openzeppelin/contracts/gove... | An alternate way to cancel: anyone can cancel a proposal if the StRSR exchange rate has inflated more than 50%. startIndex The index of the `IStRSRVotes.getPastExchangeRate` that begins the span endIndex The index of the `IStRSRVotes.getPastExchangeRate` that ends the span rates are in {qStRSR/qRSR} The value at `sta... | function alternativeCancel(
uint256 proposalId,
uint256 startIndex,
uint256 endIndex
) public {
require(endIndex > startIndex, "Governor: invalid indices");
ProposalDetails storage details = _proposalDetails[proposalId];
(uint32 nextBlockNumber, ) = IStRSRVotes... | 13,033,973 |
./partial_match/1/0x9C8062Cee0650f3195106B8f1429De11005ED870/sources/contracts/SmartVault.sol | Set timestamp for debugging _timestamp Epoch time in seconds | function setNow(uint _timestamp) public onlyOwner {
timestamp = _timestamp;
}
| 4,167,707 |
./partial_match/8453/0xC0d3c0d3c0D3c0d3C0D3c0D3C0d3C0D3C0D30010/sources/contracts/universal/OptimismMintableERC20.sol | ERC165 interface check function. _interfaceId Interface ID to check. return Whether or not the interface is supported by this contract./ Interface corresponding to the legacy L2StandardERC20. Interface corresponding to the updated OptimismMintableERC20 (this contract). | function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {
bytes4 iface1 = type(IERC165).interfaceId;
bytes4 iface2 = type(ILegacyMintableERC20).interfaceId;
bytes4 iface3 = type(IOptimismMintableERC20).interfaceId;
return _interfaceId == iface1 || _interfaceId ==... | 16,751,165 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "IERC721.sol";
import "IERC721Receiver.sol";
import "IERC20.sol";
import "SafeERC20.sol";
import "SafeMath.sol";
import "Address.sol";
import "Ownable.sol";
import "ReentrancyGuard.sol";
import "Security4.sol";
import "ORentable.sol";
import "YRentable.s... | Set new governance _governance governance address./ | function setGovernance(address _governance) public virtual onlyGovernance {
pendingGovernance = _governance;
}
| 328,632 |
./partial_match/42/0xf97bFAd0059e2173AB14b419360fA11B05cB1849/sources/StoplossReserve.sol | TODO - in the future fork the cdp to make sure user cannot do operations outside this interface user had to control on the CDP | function join(uint cdp) public {
require(cdpManager.cdpCan(msg.sender,cdp, address(this)) == 1, "permission-was-not-given");
if(orders[cdp] == 0) orders[cdp] = placeStoplossOrder(cdp);
}
| 8,947,158 |
./full_match/3/0xd9B9F84417C68222aC0E184BB6A835125D619Cd0/sources/contracts/mainCaboodles.sol | WhiteList Mint On/Off switch.. | function turnOnWhiteListMint() public onlyOwner{
mode = 2;
}
| 14,148,398 |
/**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
/*
________ ________ __
\_____ \ / _____/ ____ ____ ________________ _/ |_ ___________
/ | \/ \ ____/ __ \ / \_/ __ \_ __ \__ \\ __\/ _ \_ __ \
/ | \ \_\ \ ___/|... | If there is no base URI, return the token URI. | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
JsonInfo memory jsonSlot;
jsonSlot.artData = makeArt(_ogs[tokenId], _mintingYear[tokenId]);
jsonSlot.json = string... | 10,887,669 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import '../utils/RetrieveTokensFeature.sol';
/**
* Contract that acts as a freeze (timelocked) vault to an immuntable beneficiary.
*/
contract TimelockedTokenVault is RetrieveTokensFeature {
using SafeERC20 for IERC20;
// ERC20 basic token contract b... | return the startDate of the vault/ | function startDate() public view returns (uint256) {
return _startDate;
}
| 6,474,803 |
./partial_match/4/0x62C7e68a14C3692fb26a13637d3b399A47c50107/sources/HappyTokenPool.sol | Returns 0. exchange_addrs in the given pool 1. remaining tokens 2. if expired 3. if swapped | function check_availability (bytes32 id) external view returns (address[] memory exchange_addrs, uint256 remaining,
bool started, bool expired, uint256 swapped,
uint256[] memory e... | 8,526,501 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.6;
import './NutBerryCore.sol';
/// @notice Includes Deposit & Withdraw functionality
// Audit-1: ok
contract NutBerryTokenBridge is NutBerryCore {
event Deposit(address owner, address token, uint256 value, uint256 tokenType);
event Withdraw(address owne... | Saves the token type for `token`. Intended to be used in a L2 context. | function _setTokenType (address token, uint256 tokenType) internal virtual {
uint256 key = _TOKEN_TYPE_KEY(token);
_sstore(key, tokenType);
}
| 12,868,503 |
pragma solidity ^0.4.15;
import "../RocketPoolToken.sol";
import "../base/SalesAgent.sol";
import "../base/Owned.sol";
import "../lib/SafeMath.sol";
/// @title The main Rocket Pool Token (RPL) crowdsale contract
/// @author David Rugendyke - http://www.rocketpool.net
/***********************************************... | Default payable Accepts ETH from a contributor, calls the parent token contract to mint tokens Get the token contract The target ether amount Only allow sales if set to true Do some common contribution validation, will throw if an error occurs Add to contributions, automatically checks for overflow with safeMath Fire ... | function() payable external {
RocketPoolToken rocketPoolToken = RocketPoolToken(tokenContractAddress);
uint256 targetEth = rocketPoolToken.getSaleContractTargetEtherMin(this);
assert(saleDepositsAllowed == true);
assert(rocketPoolToken.validateContribution(msg.value));
contr... | 5,518,640 |
./full_match/1/0xa3C8d390c3965D33937865973b6159D37B777C54/sources/tests/contracts/TestingPriceFeed.sol | needed just to get decimals for prices | function batchSetDecimals(address[] memory _assets, uint[] memory _decimals) public {
require(_assets.length == _decimals.length, "Array lengths unequal");
for (uint i = 0; i < _assets.length; i++) {
setDecimals(_assets[i], _decimals[i]);
}
}
| 3,057,332 |
/**
*Submitted for verification at Etherscan.io on 2022-02-28
*/
/**
*Submitted for verification at BscScan.com on 2022-02-28
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.... | Used only by admin or owner, used to withdraw locked xsVemp tokens in emergency _to address of xsVemp tokens receiver _amount amount of xsVemp and must be less than total locked amount/ | function emergencyWithdrawxsVempTokens(address _to, uint256 _amount)
public
onlyOwner
{
require(_to != address(0), "Invalid _to address");
uint256 vempBal = IERC20(xsVemp).balanceOf(address(this));
require(vempBal >= _amount, "Insufficiently amount");
IERC20(xsVem... | 10,697,207 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owne... | voting function _proposalId id of the proposal _vote NO(2) or YES(1). return bool true - the proposal has been executed false - otherwise./ | function vote(bytes32 _proposalId, uint _vote) external votable(_proposalId) returns(bool) {
return internalVote(_proposalId, msg.sender, _vote, 0);
}
| 1,299,275 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./IBancorNetwork.sol";
import "./IConversionPathFinder.sol";
import "./converter/interfaces/IConverter.sol";
import "./conv... | using a static call to get the return from older converters | ) internal view returns (uint256, uint256) {
bytes memory data = abi.encodeWithSelector(GET_RETURN_FUNC_SELECTOR, sourceToken, targetToken, sourceAmount);
(bool success, bytes memory returnData) = address(dest).staticcall(data);
function _getReturn(
IConverter dest,
IReserveToke... | 15,787,377 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.