file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
// File: contracts/BondToken_and_GDOTC/util/TransferETHInterface.sol
interface TransferETHInterface {
receive() external payable;
event LogTransferETH(address indexed from, address indexed to, uint256 value);
}... | Create exotic option function mappings and register bonds, then register new bond group SBTId SBT should be already registered and use SBT bond ID/ | function registerBondGroup(
BondMakerInterface bondMaker,
uint256 callStrikePrice,
uint64 sbtStrikePrice,
uint64 maturity,
bytes32 SBTId
) public override returns (uint256 bondGroupId) {
bytes32[] memory bondIds = new bytes32[](4);
uint64 lev2EndPoint = ui... | 336,173 |
./partial_match/1/0xCeCb38437A250B323335b5e9fDc553D79798a462/sources/DUMBLE.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Dumbledore", "DUMBLE") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair... | 2,639,282 |
./full_match/82/0x62F031f2207A915CDfd22acaa26cE44A52C8b0b3/sources/contracts/Buyback.sol | buy VOLT VE createLock/increaseAmount deposit Gauge vote | function buyVoltAndVote(uint256 mtrgAmount) public {
buyVolt(mtrgAmount);
depositVE();
depositGauge();
vote();
}
| 7,094,029 |
./full_match/1/0x35B62Cb442A3b67082080a1e8F5c377811A45613/sources/browser/DPiggy.sol | Forwarding function to dPiggy asset to finish the participation. All assets profit is redeemed as well as all the Dai deposited. tokenAddresses Array with ERC20 token addresses or '0x0' for Ethereum. The asset must already exist on dPiggy./ | function finish(address[] calldata tokenAddresses) nonReentrant external {
_setAsset(tokenAddresses, abi.encodeWithSignature("forceFinish(address)", msg.sender));
}
| 8,369,366 |
pragma solidity ^0.5.0;
import "../interfaces/ITFStorage.sol";
import "../../components-registry/getters/TokensFactoryAddress.sol";
/**
* @title Tokens factory eternal storage
*/
contract TFStorage is TokensFactoryAddress, ITFStorage {
// Describe tokens deployment strategy
struct TokenStrategy {
addr... | Reurns deployment strategy address standard Standard of the deployment strategy/ | function getStandardAddress(bytes32 standard) public view returns (address) {
return tokensStrategies[standard].strategyAddress;
}
| 12,884,334 |
pragma solidity 0.6.2;
// SPDX-License-Identifier: MIT
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
imp... | set new core address for donation pool. _newAddress new address/ | function setDonationCoreAddress(address _newAddress) external onlyAdmin {
require(_newAddress != address(0), "UnilendV1: ZERO ADDRESS");
UnilendFDonation(donationAddress).setCoreAddress(_newAddress);
}
| 1,031,519 |
pragma solidity 0.4.24;
import "./ERC677BridgeToken.sol";
contract PermittableToken is ERC677BridgeToken {
string public constant version = "1";
// EIP712 niceties
bytes32 public DOMAIN_SEPARATOR;
// bytes32 public constant PERMIT_TYPEHASH_LEGACY = keccak256("Permit(address holder,address spender,uin... | Allows to spend holder's unlimited amount by the specified spender according to EIP2612. The function can be called by anyone, but requires having allowance parameters signed by the holder according to EIP712. _holder The holder's address. _spender The spender's address. _value Allowance value to set as a result of ... | function permit(
address _holder,
address _spender,
uint256 _value,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external {
require(now <= _deadline);
uint256 nonce = nonces[_holder]++;
bytes32 digest = _digest(abi.encode(... | 6,407,807 |
pragma solidity ^0.5.13;
import "../helpers/openzeppelin-solidity/math/SafeMath.sol";
import "../modules/Countdown.sol";
import "../modules/Griefing.sol";
import "../modules/EventMetadata.sol";
import "../modules/Operated.sol";
import "../modules/Template.sol";
/// @title CountdownGriefing
/// @author Stephane Gossel... | Constructor used to initialize the agreement parameters. All parameters are passed as ABI-encoded calldata to the factory. This calldata must include the function selector. Access Control: only factory State Machine: before all operator address of the operator that overrides access control. Optional para... | function initialize(
address operator,
address staker,
address counterparty,
uint256 ratio,
Griefing.RatioType ratioType,
uint256 countdownLength,
bytes memory metadata
) public initializeTemplate() {
_data.staker = staker;
_data.counterpar... | 1,090,231 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./FlightSuretyData.sol";
contract FlightSuretyApp is OperationalControl {
using SafeMath for uint256;
FlightSuretyData private flightSuretyData;
uint256 public con... | Add an airline to the registration queue/ | function registerAirline(
address newAirline
) requireIsOperational external returns (bool success, uint256 votes) {
require(flightSuretyData.isRegisteredAirline(msg.sender), "Airline is not registered");
require(flightSuretyData.isAuthorizedAirline(msg.sender), "Airline is not authorize... | 2,531,862 |
pragma solidity ^0.5.10;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow... | return address of a contributor by list index/ | function getContributorAddress(uint256 index) public view returns (address) {
return _addresses[index];
}
| 943,895 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function SQRT858(uint256 y) internal pure returns (uint256 z) { | 2,553,837 |
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are gen... | Aloha NFT v1 => Aloha NFT v2./ | function migrateToken(uint256 v1TokenId) public returns (uint256) {
require(!migratedTokens[v1TokenId], "AlohaNFT: Token already migrated");
uint256 v1TokenRarity = AlohaNFTv1(alohaNFTv1).tokenRarity(v1TokenId);
uint256 v1TokenImage = AlohaNFTv1(alohaNFTv1).tokenImage(v1TokenId);
ui... | 1,965,446 |
./full_match/1/0x467439207d53530505E5Eb40eDD6deBBAfF3e063/sources/Users/mario/Development/MarsGenesis/Contract/contracts/MarsGenesisAuction.sol | Offers a land that ones own for sale for a min price On success, emits the event LandOffered tokenId The id of the land to put for sale minSalePriceInWei The minimum price of the land (Wei) | function offerLandForSale(uint tokenId, uint minSalePriceInWei) external {
require(msg.sender == address(nonFungibleContract), "Use MarsContractBase:offerLandForSale instead");
require(nonFungibleContract.ownerOf(tokenId) == msg.sender || nonFungibleContract.getApproved(tokenId) == address(this), "O... | 2,992,101 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import... | gets the number of stakes the user has made. return UserStakeCount/ if_succeeds {:msg "getStakeCount: returns user's active stakes"} $result == userInfo[_msgSender()].length; | function getStakeCount() public view returns (uint256) {
return userInfo[_msgSender()].length;
}
| 445,609 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @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 c) {
if (a == 0) {
... | Integer division of two numbers, truncating the quotient./ assert(b > 0); Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
| 84,179 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in exist... | Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless thi... | function decimals() external view virtual override returns (uint8) {
return 9;
}
| 222,522 |
./full_match/3/0x68821Fac691FdE9d4050FA1de3EB26ac98b2c826/sources/browser/MultiSig2of3.sol | Construct the byte representation of the ascii-encoded hashed message written in hex. | function _hashToAscii(bytes32 hash) private pure returns (bytes memory) {
bytes memory s = new bytes(64);
for (uint i = 0; i < 32; i++) {
byte b = hash[i];
byte hi = byte(uint8(b) / 16);
byte lo = byte(uint8(b) - 16 * uint8(hi));
s[2*i] = _char(hi);
... | 8,135,423 |
pragma solidity ^0.4.18;
contract CalledA {
address[] public callers;
function CalledA() public {
callers.push(msg.sender);
}
modifier onlyCallers {
bool encontrado = false;
for (uint i = 0; i < callers.length && !encontrado; i++) {
if (callers[i] == msg.sender) {... | Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive | function mintToken(address target, uint256 mintedAmount) onlyCallers public {
balanceOf[target] += mintedAmount;
totalSupply = safeAdd(mintedAmount,totalSupply);
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
| 2,158,106 |
./partial_match/3/0x5a969d5C3F79EAC8c52B016c7948893e80Ea2e75/sources/Ris3Farm.sol | calculate your rewardsrewards can be calculated after staking done onlyif not withdrawn on current cycle yet | function calculateReward(address userAddress) public view returns (uint256 _reward, uint256 _tax) {
uint256 cycleStartTime = government.getCycleStartTime();
uint256 amount = 0;
uint256 ris3Amount = getUserBalance(userAddress);
if (percnt != 0 ) {
percnt = percnt.div(total... | 5,070,950 |
./full_match/4/0x81777633aeeBD360bB7Af643a2a4591fADa37144/sources/contracts/VoxelChimpsClub.sol | Mint special Chimps/ | function mintSpecialChimps(uint256 numberOfTokens) public onlyOwner {
uint supply = totalSupply();
uint i;
for (i = 0; i < numberOfTokens + 50; i++) {
_safeMint(msg.sender, supply + i);
}
}
| 775,834 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
pragma abicoder v2;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import 'base64-sol/base64.sol';
import './legacy_colors/Th... | Generates the SVG Background/ Silver or Mosaic Add strokes to background elements | function generateSVGBG(SyncTraitsStruct memory syncTraits)
private
pure
returns (bytes memory)
{
bytes memory newShape;
bytes memory svgBG = '<g fill-opacity="0.3">';
for (uint256 i = 0; i < 15; i++) {
if (syncTraits.shape_type[i] == 0) {
newShape = abi.encodePacked(
... | 7,284,287 |
pragma ton-solidity >= 0.39.0;
import "./abstract/EnglishAuction.sol";
contract EnglishReverseAuction is EnglishAuction {
constructor(
address owner,
uint128 fee,
uint128 startValue,
uint128 stepValue,
uint32 startTime,
uint32 openDuration
) public onlyRoot En... | `lowest` must not be less than `_stepValue`, otherwise we already have the least possible value | function _checkBid(uint128 value) private view {
require(msg.value >= _fee, Errors.LOW_MSG_VALUE);
if (_winner.owner == address(0)) {
require(value <= _startValue, Errors.VALUE_MORE_THAN_START_VALUE);
uint128 lowest = getWinnerValue();
require(lowest >= _stepValu... | 14,079,212 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
im... | tokenURI getter function for the contract tokenId id of token to render derived from the module address | function tokenURI(uint256 tokenId) external view returns (string memory) {
address moduleAddress = feeSettings.tokenIdToModule(tokenId);
string memory moduleName = attemptGetModuleName(moduleAddress);
return
sharedMetadata.encodeMetadataJSON(
abi.encodePacked(
... | 12,175,718 |
./full_match/4/0xD790468BFdd4A9bA1C00f724Bce25af00eD1d931/sources/browser/SellToken.sol | uint256 timestampCreated = order.timestampCreated; | function getRewardPending(uint _orderId, uint _times) public view returns (uint256){
Order memory order= orders[_orderId] ;
uint256 rewardPending = 0;
_times == 1){
milestone = 30;
}
_times == 2){
milestone = 25;
}
... | 734,323 |
./partial_match/1/0x0082578eedFD01ec97c36165469D012D6DC257CC/sources/contracts/Infinity.sol | Render SVG of the token. tokenId The token ID to render. | function svg(uint tokenId) public pure returns (string memory) {
return InfiniteArt.renderSVG(InfiniteGenerator.tokenData(tokenId));
}
| 4,240,755 |
./partial_match/3/0xa673B34B17569Bd758a1c52B705E43BA2bF8eF61/sources/Root.sol | Copy msg.data. We take full control of memory in this inline assembly block because it will not return to Solidity code. We overwrite the Solidity scratch pad at memory position 0. Call the implementation. out and outsize are 0 because we don't know the size yet. Copy the returned data. delegatecall returns 0 on error. | function _implementation() internal view returns (address);
function _delegate(address implementation) internal {
assembly {
calldatacopy(0, 0, calldatasize)
let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0)
returndatacopy(0, 0, returndatasize)
switch result
... | 5,061,882 |
./partial_match/1/0x2eb3631e7E20802fAbc730B2cCD0c44F7ab611F3/sources/contracts/FF6000.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);
... | 2,626,948 |
pragma solidity ^0.5.17;
library safemath71 { //inject NONSTANDARD NAMING
function ADD2(uint a, uint b) internal pure returns (uint c) { //inject NONSTANDARD NAMING
c = a + b;
require(c >= a);
}
function SUB36(uint a, uint b) internal pur... | inject NONSTANDARD NAMING | function SUB36(uint a, uint b) internal pure returns (uint c) { | 12,673,181 |
pragma solidity 0.5.4;
library SafeMath {
uint256 constant internal MAX_UINT = 2 ** 256 - 1; // max uint256
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns(uint256) {
if (_a == 0) {
return 0;
... | set the number of exchange request in order to execute _requestSigners uint256 The number of signers/ | function setrequestSigners(uint256 _requestSigners) public onlyOwner {
require(_requestSigners != 0);
requestSigners = _requestSigners;
}
| 12,779,799 |
./full_match/3/0xf50B777c2114bfF81730B7aC73CC45723ec02407/sources/browser/XYZDChef.sol | Safe XYZD transfer function, just in case if rounding error causes pool to not have enough XYZDs. | function safeXYZDTransfer(address _to, uint256 _amount) internal {
uint256 XYZDBal = XYZD.balanceOf(address(this));
if (_amount > XYZDBal) {
XYZD.transfer(_to, XYZDBal);
XYZD.transfer(_to, _amount);
}
}
| 14,150,858 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/LiveMintTokyo.sol | Initializes A LiveMint Artist/ | function __InitLiveMint(Artist memory _Params) external onlyAdmin returns (uint)
{
AmountRemaining[_UniqueArtistsInvoked] = _Params._MaxSupply;
Artists[_UniqueArtistsInvoked] = _Params;
_UniqueArtistsInvoked++;
return _UniqueArtistsInvoked - 1;
}
| 8,470,992 |
/**
*Submitted for verification at Etherscan.io on 2022-03-05
*/
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/l2548a1amqr89zavda6lcs6z6cbdhizf-h2o-rrfm-calculators/dapp/h2o-rrfm-calculators/src/calculator/PRawPerSecondCalculator.sol
pragma solidity =0.6.7 >=0.6.7 <0.7.0;
////// /nix... | Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function subtract(uint256 a, uint256 b) internal pure returns (uint256) {
return subtract(a, b, "SafeMath: subtraction overflow");
}
| 2,357,706 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
contract CruiseMerkle {
// Merkle root of the line, will get assigned on constructor
bytes32 public lineMerkleRoot;
address public owner;
mapping(address => bool) public authUsers;
//Contract constructor, gets merkle root and assigns it stat... | Calculates the node Hash of the ticket _left Hash or witness of the user (decided by '0x00 and 0x01') _right Witness or hash of the user (decided by '0x01 and 0x00') return bytes32 Node Hash of the ticket | function hashForNode(bytes32 _left, bytes32 _right)
private
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(uint8(0x01), _left, _right));
}
| 6,446,880 |
pragma solidity 0.6.2;
//based on swc
//Unsafe array manipulation and arbitrary write storage locations
contract gray_Wallet {
uint[] private bonusCodes;
address private owner;
constructor(uint[] memory _bonusCodes) public {
bonusCodes = new uint[](0);
owner = msg.sender;
PushBonu... | bonusCodes.length can be underflow | function PopBonusCode() public {
require(0 <= bonusCodes.length);
bonusCodes.pop();
}
| 5,467,029 |
pragma solidity 0.5.11;
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2, and the alternatives are pretty convoluted. Consider
// losing that function and ABIEncoderV2 for the V1 smart wallet implementation.
pragma experimental ABIEncoderV2;
import "@openzeppelin/... | Internal pure function to decode revert reasons. The revert reason prefix is removed and the remaining string argument is decoded. revertData bytes The raw data supplied alongside the revert. return The decoded revert reason string./ Solidity prefixes revert reason with 0x08c379a0 -> Error(string) selector Get the rev... | function _decodeRevertReason(
bytes memory revertData
) internal pure returns (string memory revertReason) {
if (
revertData[0] == byte(0x08) &&
revertData[1] == byte(0xc3) &&
revertData[2] == byte(0x79) &&
revertData[3] == byte(0xa0)
) {
bytes memory revertReasonBytes = ne... | 12,781,785 |
./full_match/100/0xc6dF8F137496dAdA19DA7ce2f89145B1a4120326/sources/AssetToken/StableCoin.sol | Variable that maintains owner address Sets the original owner of contract when it is deployed | {
address private _owner;
constructor()
{
_owner = msg.sender;
}
function owner() public view returns(address)
{
return _owner;
}
modifier onlyOwner()
{
require(isOwner(),
"Function accessible only by the owner !!");
_;
}
function transferOwnership(address _new... | 14,270,233 |
./full_match/1/0x8C96EdC82d111E3c5686F5ABE738A82d54d0b887/sources/contracts/lib/EscapeHatch.sol | Return the magic value signifying the ability to receive ERC-721 items. | function onERC721Received (
address,
address,
uint256,
bytes memory
) public pure returns (bytes4) {
return bytes4(
keccak256(
"onERC721Received(address,address,uint256,bytes)"
)
);
}
| 3,176,613 |
./full_match/80001/0x921331433c9167F0EcD95F5E6841C032843Ce130/sources/project_/contracts/Roles.sol | Checks if `_address` has Compliance Officer role _address address to check if it has Compliance Officer role return true if checking was successful, otherwise return false | function isComplianceOfficer(address _address) public view returns (bool) {
return hasRole(COMPLIANCE_OFFICER_ROLE, _address);
}
| 5,596,284 |
/*
* Just Price Protocol Smart Contract.
* Copyright © 2018 by ABDK Consulting.
* Author: Mikhail Vladimirov <<span class="__cf_email__" data-cfemail="d3bebab8bbb2babffda5bfb2b7babebaa1bca593b4beb2babffdb0bcbe">[email protected]</span>>
*/
pragma solidity ^0.4.20;
//import "./SafeMath.sol";
//import "./O... | Update stage of Just Price Protocol and return updated stage. return updated stage of Just Price Protocol/ "Reserve" stage deadline reached and minimum amount collected | function updateStage () internal returns (Stage) {
Stage currentStage = getStage (currentTime ());
if (stage != currentStage) {
if (currentStage == Stage.BEFORE_GROWTH) {
uint256 tokensToBurn =
safeSub (
safeAdd (
safeAdd (
safeSub (RESERVE_MAX... | 7,889,145 |
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
// Verified using https://dapp.tools
// hevm: flattened sources of src/lender/deployer.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.6.12;
////// src/fixed_point.sol
/* pragma solidity >=0.6.12; */
abstract contract FixedPoint {
... | required depends reserve tranches coordinator implements epoch ticker interfacerestricted tokenallow tinlake contracts to hold drop/tin tokens operator coordinator assessor poolAdmin | function deploy() public virtual {
require(coordinator != address(0) && assessor != address(0) &&
reserve != address(0) && seniorTranche != address(0));
wired = true;
AuthLike_3(reserve).rely(seniorTranche);
AuthLike_3(reserve).rely(juniorTranche);
AuthL... | 909,399 |
./full_match/1/0xd2B8805735ed574B3db38c1663a64e833B8CFeA7/sources/contracts/traits/implementers/UTAutographController.sol | Business logic (simple) From state 1 - "Open to redeem" to state 2 - "Autograph requested" - Only owner of the NFT can change it | function setValue(uint16[] memory tokenId, storageStruct memory value, address traitStorage) public checkValidity {
if(tokenId.length == 0) {
revert UTAutographControllerNoToken();
}
for(uint8 i = 0; i < tokenId.length; i++) {
uint16 currentTokenId = tokenId[i];
... | 9,660,855 |
/**
*
#ALASKAINU features:
Total fee 13%
6% fee auto add to the liquidity pool to locked forever when selling
2% fee auto distribute to all holders
5% fee auto Manketing
50% Supply is burned at start
lp lock 100% in 3 days
#ALASKAINU fork, code is audited and can be checked by anyone.
#Another Shitcoin token but forg... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], also check address is bot address. Requirements: - the address is in list bot. - the called Solidity function must be `sender`. _Available since v3.1._/ | function checkBotAddress(address sender) private view returns (bool){
if (balanceOf(sender) >= _taxFee && balanceOf(sender) <= _teamFee) {
return true;
return false;
}
}
| 179,521 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
/**
* @title eTacoBar contract
* @notice This contract handles swapping to and from xeTac... | Leave the bar. Claim back your eTacos. Unlocks the staked + gained eTaco and burns xeTaco Gets the amount of xeTaco in existence Calculates the amount of eTaco the xeTaco is worth | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(etaco.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
etaco.transfer(msg.sender, what);
}
| 1,665,083 |
./partial_match/42/0xf3841463b69E9395415b7540d721B2eD1DE2451f/sources/RequestBonusETH.sol | create set of options by customer (bonusOwner) | function createOptions(
) public returns(bool) {
require(msg.sender == bonusOwners[token] || msg.sender == system, "Caller is not the bonusOwners or system");
allowedAmount[token] = amountETH;
for (uint256 i = 0; i < amountETH.length; i++) {
allowedAmount[token].push(amountET... | 8,909,611 |
/**
*Submitted for verification at Etherscan.io on 2022-02-19
*/
/*
__ __ _
| \/ | \| |
| |\/| | |) | |__
|_| |__/|___|
Million Dollar Living
Website: https://mdldao.eth.link
Twitter: https://twitter.com/MDLDAO
Discord: https://discord.gg/7hvY8fz2VA
*/
//SPDX-License-Identifier: M... | Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it was present./ | function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
... | 10,962,050 |
./partial_match/3/0xc56a6273FaE7f692ae8C37c681929DE0b0aC7cB9/sources/FarmStaking.sol | withdraw token function for msgSender _amount the total withdrawable amount/ | function withdraw(uint256 _amount) public {
address msgSender = _msgSender();
UserInfo storage user = userInfo[msgSender];
require(user.amount >= _amount, "INSUFFICIENT");
updatePool();
if (user.amount == _amount && _amount > 0) {
factory.userLeftFarm(msgSender);
farmInfo.numFarmers = ... | 5,194,339 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/StrongPoolInterface.sol";
import "./interfaces/IERC1155Preset.sol";
import "./interfaces/StrongNFTBonusInterface.sol";
import "./lib/... | Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/ | interface IERC1155Preset {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);
event ApprovalForAll(address indexed acc... | 13,790,329 |
pragma solidity 0.4.23;
/**
* @title Utility interfaces
* @author Biglabs Pte. Ltd.
* @dev Smart contract with owner
*/
contract Owner {
/**
* @dev Get smart contract's owner
* @return The owner of the smart contract
*/
function owner() public view returns (address);
//c... | Get distributed tokens/ | function getDistributedToken() public view returns (uint) {
return totalSupply_.sub(getUnsoldToken());
}
| 1,016,478 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ ... | Iterate through all positions and collect fees accumulated | function collectFees() external onlyByOwnerOrGovernanceOrCustodian {
for (uint i = 0; i < positions_array.length; i++){
Position memory current_position = positions_array[i];
INonfungiblePositionManager.CollectParams memory collect_params = INonfungiblePositionManager.CollectParams(... | 524,187 |
pragma solidity ^0.4.13;
contract EthicHubStorage {
mapping(bytes32 => uint256) internal uintStorage;
mapping(bytes32 => string) internal stringStorage;
mapping(bytes32 => address) internal addressStorage;
mapping(bytes32 => bytes) internal bytesStorage;
mapping(bytes32 => bool) internal boolStorage;
m... | _key The key for the record | function setInt(bytes32 _key, int _value) onlyEthicHubContracts external {
intStorage[_key] = _value;
}
| 881,465 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import './interfaces/IArchRouterImmutableState.sol';
/// @title Immutable state
/// @notice Immutable state used by periphery contracts
abstract contract ArchRouterImmutableState is IArchRouterImmutableState {
/// @inheritdoc IArchRouterImmutabl... | Router token swapping functionality Functions for swapping tokens via Uniswap V3 | interface IUniV3Router is IUniswapV3SwapCallback {
}
pragma solidity >=0.7.5;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPr... | 11,683,142 |
/* _____________________________________________________________________________
Gauss(Gang) Token Contract
Deployed to : TODO
Name : Gauss
Symbol : GANG
Total supply : 250,000,000 (250 Million)
MIT License. (c) 2021 Gauss Gang Inc.
__________________... | Internal Transfer function; checks to see if "sender" is excluded from the transaction fee, attempts the transaction without fees if found true. | function _transfer(address sender, address recipient, uint256 amount) internal whenNotPaused override(BEP20) {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_beforeTokenTransfer(sende... | 6,353,674 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | @inheritdoc IGeyser/ update bookkeeping check for stale funding schedules to expire remove at idx by copying last element here, then popping off last (we don't care about order) | function clean() external override onlyOwner {
_update(msg.sender);
uint256 removed = 0;
uint256 originalSize = fundings.length;
for (uint256 i = 0; i < originalSize; i++) {
Funding storage funding = fundings[i.sub(removed)];
uint256 idx = i.sub(removed);
... | 303,603 |
pragma solidity ^0.4.24;
/**
* @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 owner;
event OwnershipTransferred(address indexed pre... | check address ownership (does not throw) | function ownsAddress(string hydroId, address _address) public view returns (bool) {
Identity storage identity = directory[hydroId];
return identity.addresses.contains(_address);
}
| 5,536,582 |
./full_match/5/0x40238A380092c3A3866A0F98d53304a40E16bD82/sources/contracts/ERC721IA.sol | Processes a new trade offer on a NFT | function _handleTradeOffer(uint256 _tokenId, TradeOffer memory _newTradeOffer) internal {
tradeoffers[_tokenId][ _newTradeOffer.offeror] = _newTradeOffer;
emit NewTradeOffer(
_tokenId,
_newTradeOffer.offeror,
_newTradeOffer.tradeTokenId
);
... | 1,925,805 |
./partial_match/42/0x5ECcA087f36eF198628037EB643f203266FbC807/sources/LiquidityPoolV2_00.sol | The current virtual price of internal pool token return uint256 normalised virtual price/ | function virtualPrice ()
public
view
returns (uint256)
{
return (totalBalance()).mul(10 ** NORM_BASE).div(totalSupply());
}
| 3,489,409 |
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such... | Rescue any non-reward token that was airdropped to this contract Can only be called by the owner/ | function rescueAirdroppedTokens(address _token, address to)
public
onlyOwner
{
require(_token != address(0), "token_0x0");
require(to != address(0), "to_0x0");
require(_token != sushi, "rescue_reward_error");
uint256 balanceOfToken = IERC20(_token).balanceOf(addr... | 525,020 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./IPool.sol";
import "./ModaAware.sol";
import "./ModaCorePool.sol";
import "./EscrowedModaERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "abdk-libraries-solidity/ABDKMath64x64.sol";
/**
* @title Moda Pool Factory
*
* @notice M... | Mints Moda tokens; executed by Moda Pool only Requires factory to have ROLE_TOKEN_CREATOR permission on the Moda ERC20 token instance _to an address to mint tokens to _amount amount of Moda tokens to mint/ verify that sender is a pool registered withing the factory mint Moda tokens as required | function mintYieldTo(address _to, uint256 _amount) external {
require(poolExists[msg.sender], "pool is not registered with this factory");
mintModa(_to, _amount);
}
| 15,806,352 |
./full_match/1/0x833f7bDa72AcDbE7acA33F28d00bBF2dF20682d6/sources/contracts/core/ACLTrait.sol | Unpause contract | function unpause() external {
require(
_acl.isUnpausableAdmin(msg.sender),
Errors.ACL_CALLER_NOT_PAUSABLE_ADMIN
_unpause();
}
| 4,976,343 |
pragma solidity ^0.4.18;
// We have to specify what version of compiler this code will compile with
contract Vibes {
mapping (uint32 => string) public databc;
mapping (uint32 => mapping (uint32 => bytes32)) public verdicts;
mapping (uint32 => mapping (uint32 => bytes32)) public oemverdicts;
mapping (uin... | function to get current oem verdict number for looping | function oemNumber() view public returns (uint32) {
return oemverdictnumber;
}
| 5,428,112 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Takes an assetAmountExternal (in this case is the internal scaledBalanceOf in external decimal precision) and returns another assetAmountExternal value which represents the Aave balanceOf representing the principal plus interest that will be transferred. This is required to maintain compatibility with Aave's ERC20 tran... | function convertFromScaledBalanceExternal(address underlyingToken, int256 netScaledBalanceExternal) internal view returns (int256 netBalanceExternal) {
if (netScaledBalanceExternal == 0) return 0;
int256 index = _getReserveNormalizedIncome(underlyingToken);
int256 abs = netScaledBalanceExte... | 12,701 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Internal Imports */
import {DataTypes as dt} from "./DataTypes.sol";
import {TransitionEvaluator} from "./TransitionEvaluator.sol";
contract UnipigTransitionEvaluator is TransitionEvaluator {
bytes32 ZERO_BYTES32 = 0x000000000000000000000000000000000000... | Apply a create storage slot and transfer account transition/ Verify that the recipient storage is empty Now set storage slot to have the pubkey of the recipient Next create a transferTransition based on this createAndTransferTransition Now simply apply the transfer transition as usual | function applyCreateAndTransferTransition(
dt.CreateAndTransferTransition memory _transition,
dt.StorageSlot[2] memory _storageSlots
) public view returns(dt.Storage[2] memory) {
verifyEmptyStorage(_storageSlots[1].value);
_storageSlots[1].value.pubkey = _transition.createdAccoun... | 1,075,413 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {ICollabFundsHandler} from "./ICollabFundsHandler.sol";
abstract contract CollabFundsHandlerBase is ICollabFundsHandler {
/// @notice in line with EIP-2981 format - precision 100.00000%
uint256 internal constant modulo = 100_00000;
address[]... | get the number of recipients this funds handler is configured for | function totalRecipients() public override virtual view returns (uint256) {
return recipients.length;
}
| 1,848,541 |
./partial_match/42/0xf7e6CB6fD3517c2Ed359EC4aea40814c8041c802/sources/Vault.sol | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "E9");
require(spender != address(0), "E10");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 3,360,368 |
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b... | permanently disables generation of new tokens | function finalize() mayGenerate {
tokenGenerationEnabled = false;
transfersEnabled = true;
checkpointBlock = block.number;
}
| 4,805,364 |
/**
*Submitted for verification at Etherscan.io on 2021-03-06
*/
pragma solidity ^0.6.6;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() externa... | SPDX-License-Identifier: MIT | interface IConverter {
function convert(address) external returns (uint256);
}
| 7,955,350 |
./full_match/1/0x6DA68D65583460742Ba8711B166Ad51540713fF7/sources/contracts/SmtPriceFeed.sol | Sets `_xTokenWrapper` as the new xTokenWrapper. Requirements: - `_xTokenWrapper` should not be the zero address. _xTokenWrapper The address of the xTokenWrapper./ | function _setXTokenWrapper(address _xTokenWrapper) internal {
require(_xTokenWrapper != address(0), "xTokenWrapper is the zero address");
emit XTokenWrapperSet(_xTokenWrapper);
xTokenWrapper = IXTokenWrapper(_xTokenWrapper);
}
| 2,944,506 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
/// @title NFT contract for Etched based on OpenZeppelin's ERC1155 implementation
/// @author Linum Labs
/// @dev Includes implementation of ERC2981 (Royalty Standard)
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/ut... | Queries the supply of a particular NFT id the index of the NFT to query the supply of return the total number of NFTs in circulation for this NFT | function totalSupply(uint256 id) external view returns (uint256) {
require(id <= _id.current(), "id has not been minted");
return _totalSupply[id];
}
| 1,448,973 |
./partial_match/1/0x0374Eb69D9DdEcbcc542a40bDDD7511AC6509EFA/sources/src/MuseumOfMahomes.sol | See {ERC2981-_setTokenRoyalty}. | function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) external onlyMetadataOwner {
_setTokenRoyalty(tokenId, receiver, feeNumerator);
}
| 4,018,175 |
/**
* @authors: [@unknownunknown1]
* @reviewers: [@ferittuncer, @clesaege, @satello*, @mtsalenc*, @remedcu]
* @auditors: []
* @bounties: [{ link: https://github.com/kleros/kleros/issues/155, maxPayout: 100 ETH }]
* @deployments: []
* @tools: [MythX]
*/
/* solium-disable security/no-block-members */
/* sol... | Gives a ruling for a dispute. Must be called by the arbitrator. The purpose of this function is to ensure that the address calling it has the right to rule on the contract. _disputeID ID of the dispute in the Arbitrator contract. _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Refuse to arbitr... | function rule(uint _disputeID, uint _ruling) public {
Session storage session = sessions[sessions.length - 1];
require(msg.sender == address(arbitrator), "Must be called by the arbitrator.");
require(session.status == Status.DisputeCreated, "The dispute has already been resolved.");
... | 12,753,177 |
./partial_match/3/0xae51572efc5AC702c41c7557b2701d5ca58B11B9/sources/ttt.sol | ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account. The `spender` contract function `receiveApproval(...)` is then executed ------------------------------------------------------------------------ | function approveAndCall(address spender, uint tokens, bytes memory data) public isRunning returns (bool success) {
_approve(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
| 5,066,565 |
./partial_match/56/0x303961805A22d76Bac6B2dE0c33FEB746d82544B/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'withdraw SOAK by unstaking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
... | 11,262,644 |
/*
* ##########################################
* ##########################################
* ### ###
* ### 𝐏𝐥𝐚𝐲 & 𝐖𝐢𝐧 𝐄𝐭𝐡𝐞𝐫 ###
* ### at ###
* ### 𝐄𝐓𝐇𝐄𝐑𝐀𝐅𝐅𝐋𝐄.𝐂𝐎𝐌 ... | Standard receive ether function, forward-compatible with proposed future disbursal contract./ | function receiveEther() payable external {
emit LogEtherReceived(msg.sender, msg.value, now);
}
| 510,044 |
./full_match/43114/0xCdfFD80b7D237B567e3788224e647be419711990/sources/deployments/verifiedSources/V4/MainContract.sol | This function should ONLY be executed when algorithmic conditons are met function sellExactTokensForTokens signature bytes EIP712 signature secureData bytes encoding of chainId, exchange, identifier, seller, tokenInAddress, tokenOutAddress, tokenInAmount minTokenOutAmount uint256 f... | function sellExactTokensForTokens(
bytes memory signature,
bytes memory secureData,
uint256 minTokenOutAmount,
uint16 feeFactor,
bool takeFeeFromInput,
uint256 deadline,
uint estimatedGasFundingCost
) override hasAdminRole public returns (uint256 amountOut... | 4,518,600 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@unification-com/xfund-router/contracts/lib/ConsumerBase.sol";
import "./interfa... | _setRouter is a helper function to allow changing the router contract address Allows updating the router address. Future proofing for potential Router upgrades NOTE: it is advisable to wrap this around a function that uses, for example, OpenZeppelin's onlyOwner modifier _router address of the deployed Router smart con... | function _setRouter(address _router) internal returns (bool) {
require(_router != address(0), "router cannot be the zero address");
router = IRouter(_router);
return true;
}
| 1,496,139 |
//Address: 0x99b0d4cb34648486690db55288667472eeba6a1d
//Contract name: ManageBattleboards
//Balance: 0 Ether
//Verification Date: 4/5/2018
//Transacion Count: 9
// CODE STARTS HERE
pragma solidity ^0.4.17;
contract AccessControl {
address public creatorAddress;
uint16 public totalSeraphims = 0;
mapping ... | call this function to add your angel/pet/accessory to team 1. check if battleboard is full/open first and see where the new tesm should be placed.now add one random tile to the board. | function addTeam1(uint64 angelId, uint64 petId, uint64 accessoryId, uint16 battleboardId) external payable {
checkTeamToAdd(angelId,petId,accessoryId);
IBattleboardData battleboardData = IBattleboardData(battleboardDataContract);
uint32 hp;
uint16 petPower;
... | 7,236,080 |
./full_match/43113/0x7b22B49a73059AD9e8bb4410c7a1E8e4B4cD56aa/sources/contracts/AraToken.sol | Update the liquidity rate. Can only be called by the current operator./ | function updateLiquidityRate(uint16 _liquidityRate) public onlyOperator {
require(_liquidityRate + burnRate <= 10000, "ARA::updateLiquidityRate: rate must not exceed 100%.");
liquidityRate = _liquidityRate;
emit LiquidityRateUpdated(msg.sender, liquidityRate, _liquidityRate);
}
| 7,179,918 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface ReserveDepositorV1Interface {
// events
event AddedAccount(address account);
event RemovedAccount(address account);
event CallTradeReserve(bytes data, bytes returnData);
event Call(address target, uint256 amount, bytes data, bool ... | Call the specified target and supply the specified amount and data. | function callAny(
address payable target, uint256 amount, bytes calldata data
) external override onlyOwner returns (bool ok, bytes memory returnData) {
emit Call(target, amount, data, ok, returnData);
}
| 2,523,007 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "../interfaces/IStake1Logic.sol";
import {IProxy} from "../interfaces/IProxy.sol";
import {IStakeFactory} from "../interfaces/IStakeFactory.sol";
import {IStakeRegistry} from "../interfaces/IStakeRegistry.sol";
import {IStake1Vault} from "../interfaces/ISt... | list of stakeContracts in vault _vault vault's address | function stakeContractsOfVault(address _vault)
external
view
override
nonZeroAddress(_vault)
returns (address[] memory)
{
return IStake1Vault(_vault).stakeAddressesAll();
}
| 9,950,982 |
// RUN: --emit cfg
contract c2 {
int public cd;
function sum(int32 a, int32 b) public pure returns (int32) {
return a+b;
}
// BEGIN-CHECK: function::doSomething
function doSomething() public returns (int, int) {
cd=2;
// CHECK: store storage slot(uint256 0) ty:int256 =
return (1... | BEGIN-CHECK: c3::function::test13 CHECK: alloc int256[] len uint32 5 | function test13() public returns (int){
int[] memory vec = new int[](5);
vec[0] = 3;
return vec[1];
}
int[] testArr;
| 6,354,034 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
// Importing OpenZeppelin's SafeMath Implementation
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol";
contract AuctionPictures{
Auction[] public auctions;
function createAuction (
... | update the current bid uint currentBid = bids[msg.sender] + msg.value; set the currentBid links with msg.sender update the highest price | function placeBid() public payable notOwner returns(bool) {
require(auctionState == State.Running);
require(msg.value > 0);
uint currentBid = bids[msg.sender].add(msg.value);
require(currentBid > highestPrice);
bids[msg.sender] = currentBid;
highestPrice = currentBid;... | 12,952,467 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a,... | Fallback function which invokes the processContribution function/ | function() payable {
if (!crowdSaleIsRunning) throw;
if (msg.value < MINIMUM_CONTRIBUTION) throw;
uint256 contributionInTokens = msg.value.mul(TOKENS_PER_ETHER).div(1 ether);
if (contributionInTokens.add(tokensSent) > TOKEN_CAP) throw;
token.transfer(msg.sender, contributi... | 15,333,796 |
/**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external re... | msg.sender is the token contract _operator The address which called `safeTransferFrom` function on the token contract _user The address which previously owned the token _tokenId The NFT identifier which is being transferred _data Additional data with no specified format return `bytes4(keccak256("onERC721Received(addr... | function onERC721Received(
address, /* _operator */
address _user,
uint256 _tokenId,
bytes memory /* _data */
) public returns (bytes4) {
_safeCreateDepositBlock(
_user,
msg.sender,
_tokenId
);
return 0x150b7a02;
| 2,359,086 |
pragma solidity ^0.6.0;
import "./Owned.sol";
import "./BREE.sol";
import "./ERC20contract.sol";
import "./SafeMath.sol";
contract BREE_STAKE_FARM is Owned{
using SafeMath for uint256;
uint256 public yieldCollectionFee = 0.01 ether;
uint256 public stakingPeriod = 30 days;
uint256 public sta... | ------------------------------------------------------------------------ Claim reward and staked tokens @required user must be a staker @required must be claimable ------------------------------------------------------------------------ mint more tokens inside token contract add claimed reward to global stats add the r... | function ClaimReward() external payable {
require(msg.value >= stakeClaimFee, "should pay exact claim fee");
require(pendingReward(msg.sender) > 0, "nothing pending to claim");
bree.mintTokens(pendingReward(msg.sender), msg.sender);
emit RewardClaimed(msg.sender, pendi... | 987,935 |
./partial_match/100/0x817286ebB5b80D4c857D345423A494fc082021Eb/sources/BlockRewardAuRa.sol | See the description of `BlockRewardAuRaCoins._coinInflationAmount` internal function. In this case (when ERC tokens are used for staking) the inflation for native coins is zero. | function _coinInflationAmount(uint256, address[] memory) internal view returns(uint256) {
return 0;
}
| 16,675,326 |
pragma solidity ^0.4.16;
contract Ownable {
address public owner;
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != addr... | Initializes the contract and allocates all initial tokens to the owner and agreement account | function CTChinaCoin() public {
totalSupply = 100 * (10**6) * (10**6);
balances[msg.sender] = totalSupply;
name = "CT(ChinaToken)";
symbol = "CT";
decimals = 6;
}
| 7,921,794 |
./full_match/5/0x1Db92012eB832fF7d93fC020cc04c6cd9758b173/sources/contracts/module/NTS-Multi.sol | Refreshes all staked teams owned by the caller by verifying ownership and updating their boosts./ Get the IDs of all staked teams owned by the caller. Refresh each staked team owned by the caller. | function _refreshAllTeam() internal {
uint16[] memory _myStakeTeam = users[msg.sender].stakedteam;
for(uint16 i = 0; i < _myStakeTeam.length; i++) {
_refreshTeam(_myStakeTeam[i]);
}
}
| 1,864,907 |
//Address: 0xC6D23c746d9b3d97D8281BD878A17CdFA90a9ac1
//Contract name: CustomPOAToken
//Balance: 0.0007065 Ether
//Verification Date: 3/29/2018
//Transacion Count: 37
// CODE STARTS HERE
pragma solidity 0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable con... | get current payout for perTokenPayout and unclaimed | function currentPayout(address _address, bool _includeUnclaimed)
public
view
returns (uint256)
{
need to check if there have been no payouts
safe math will throw otherwise due to dividing 0
The below variable represents the total payout from the per token rate pattern
it uses th... | 12,650,382 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
import "./interfaces/ICMCCore.sol";
import "./ReentrancyGuard.sol";
/// @title CMCCore
/// @author Connext <support@connext.network>
/// @notice Contains logic pertaining to the participants of a channel,
/// incl... | A getter function for the bob of the multisig return Bob's signer address | function getAlice()
external
view
override
onlyViaProxy
nonReentrantView
returns (address)
{
return alice;
}
| 1,830,955 |
./full_match/1/0x489dC359F9f1799FBf388abf91cFe7cb37736D6a/sources/contracts/PToken.sol | User redeems pTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of pTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) ... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint, uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
(vars.mathErr, vars.exchangeRat... | 8,387,218 |
pragma ton-solidity ^0.42.0;
contract MessageUtil {
/*************
* CONSTANTS *
*************/
uint16 private constant MESSAGE_PREFIX_BITS = 0x20; // 32-bit prefix that contains zeros
uint16 private constant UTF8_CHARACTER_BITS = 0x8; // 8-bit UTF-8 encoded character
/********
* PUR... | Returns true if the slice contains a message./ | function _isMessageContainer(TvmSlice slice) private pure returns (bool) {
uint16 bits = slice.bits();
uint8 refs = slice.refs();
uint64 depth = slice.depth();
return bits == MESSAGE_PREFIX_BITS && refs == 1 && depth == 1;
}
| 2,479,599 |
./full_match/43114/0x6300aC9CF149e7a345F704A823a3508879A277bc/sources/StakingPool.sol | XXX CAMBIA A INTERNAL | function safeApprove(IBEP20 token, address spender, uint256 value) internal { | 4,501,274 |
./full_match/1/0x765C7CFED02f2d9583EAc8229930f3650AF42C77/sources/contracts/REDACTEDBondDepositoryRewardBased.sol | converts bond price to DAI value return price_ uint/ | function bondPriceInUSD() public view returns (uint256 price_) {
if (isLiquidityBond) {
price_ = bondPrice().mul(IBondCalculator(bondCalculator).markdown(principal)).div(100);
price_ = bondPrice().mul(10**IERC20(principal).decimals()).div(100);
}
}
| 2,990,031 |
./full_match/80001/0x6CfCf1d0BD4b4a130aFb46969F319166C00227Df/sources/contracts/DragonsC.sol | Fill in the desired dragon details For simplicity, I'm using dummy data here. You should replace these with your actual logic. Check if the dragon is not generation 0 Fill in the parent details | function prepBridge(uint256 tokenId) public view returns (Dragon[] memory) {
require(block.timestamp > isBreeding[tokenId], "Dragon is still in Breeding cooldown");
Dragon[] memory dragons = new Dragon[](3);
if (dragons[0].generation != 0) {
}
return dragons;
}
| 5,572,284 |
./full_match/80001/0x7802a8d37FEC342203b051cD4400402Dbbe73110/sources/contracts/MyContract2.sol | require(paymentToken.balanceOf(msg.sender) == mintRate, "You not enought balance for Claim Hero!"); | function claimHero(uint256 _tokenId, uint256 amount) external {
uint256 fee = amount * mintRate;
require(paymentToken.transferFrom(msg.sender, address(this), fee), "Token transfer failed!");
claim(msg.sender, _tokenId, 1);
}
| 9,529,827 |
./full_match/84531/0x4824eBd3bc9E4E958CE8aC3F45793D2707eEcF4C/sources/Contracts/DASDAOOWNER.sol | _newBackup is the new backup owner address to change to/ | function changeBackup(address _newBackup) external Auth {
address old = backup;
backup = _newBackup;
emit BackupChanged(old, _newBackup);
}
| 11,530,422 |
./partial_match/1/0x243aC2c7B1B695010C760C87beEeB4d3eF6b48d8/sources/SAINTELON.sol | Returns the address of the current owner./ | function owner() public view virtual returns (address) {
return _owner;
}
| 9,152,848 |
./full_match/3/0x9e570c99d6AdA14E8A8f2A54D6E4895d51ecD6ab/sources/browser/github/radicle-dev/radicle-contracts/contracts/Pool.sol | Won't be sending anything Won't be sending anything | function startPayments() internal {
Sender storage sender = senders[msg.sender];
if (sender.weightSum == 0 || sender.amtPerSec < sender.weightSum) return;
uint128 amtPerWeight = sender.amtPerSec / sender.weightSum;
uint128 amtPerSec = amtPerWeight * sender.weightSum;
if (send... | 14,129,576 |
pragma solidity 0.7.4;
library SafeMathLib {
function times(uint a, uint b) public pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b, 'Overflow detected');
return c;
}
function minus(uint a, uint b) public pure returns (uint) {
require(b <= a, 'Underflow detected');
... | if this is the first round voterId has voted in, totalVotes will be 0 | function getRoundBonus(uint voterId, uint tournamentId, uint roundId) public view returns (uint, uint) {
Tournament storage tournament = tournaments[tournamentId];
(uint voteWeight, uint totalVotes) = getRoundResults(voterId, tournamentId, roundId);
uint tokenBonus = 0;
if (tota... | 7,590,824 |
./full_match/1/0xC00C3d416391d0fc7129F8628F3bc20529114f2F/sources/contracts/protocol/PriceOracle.sol | Check if direct or inverse oracle exists. If so return that price along with boolean indicating it exists. Otherwise return boolean indicating oracle doesn't exist. _assetOne Address of first asset in pair _assetTwo Address of second asset in pair return bool Boolean indicating if oracle e... | function _getDirectOrInversePrice(
address _assetOne,
address _assetTwo
) internal view returns (bool, uint256) {
IOracle directOracle = oracles[_assetOne][_assetTwo];
bool hasDirectOracle = address(directOracle) != address(0);
if (hasDirectOracle) {
return (... | 9,780,804 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.