Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
2
// ========== ADD ========== // adds a new Note for a user, stores the front end & DAO rewards, and mints & stakes payout & rewards _userthe user that owns the Note _payoutthe amount of CADT due to the user _expirythe timestamp when the Note is redeemable _marketIDthe ID of the market deposited intoreturn index_the ind...
function addNote( address _user, uint256 _payout, uint48 _expiry, uint48 _marketID, address _referral
function addNote( address _user, uint256 _payout, uint48 _expiry, uint48 _marketID, address _referral
7,281
7
// Reference implementation of the Ownership, where it contains a single owner and a single beneficiary, and allow transfer of ownership /
contract Ownership is Ownable { /** * @dev the beneficiaryAccount where the DeadManSwitch's contract will send when the contract expires. */ address private _beneficiary; event BeneficiaryTransferred( address indexed previousBeneficiary, address indexed newBeneficiary ); ...
contract Ownership is Ownable { /** * @dev the beneficiaryAccount where the DeadManSwitch's contract will send when the contract expires. */ address private _beneficiary; event BeneficiaryTransferred( address indexed previousBeneficiary, address indexed newBeneficiary ); ...
32,613
9
// Change cost of License newLicenseCost New price for license /
{ licenseCost = newLicenseCost; return licenseCost; }
{ licenseCost = newLicenseCost; return licenseCost; }
66
8
// The Ownable constructor sets the original `owner` of the contract to the sender account. /
function Ownable() public { owner = msg.sender; }
function Ownable() public { owner = msg.sender; }
3,741
20
// Trade ERC20 to ETH
function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external returns (uint256 eth_bought); function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address recipient) external returns (uint256 eth_bought); function tokenToEthSwapOutput(uint256 eth...
function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external returns (uint256 eth_bought); function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address recipient) external returns (uint256 eth_bought); function tokenToEthSwapOutput(uint256 eth...
14,532
42
// Changes the required number of blocks for victory. This may ONLY be called by the "admin" role /
function setRequiredBlocksElapsedForVictory(uint256 _requiredBlocksElapsedForVictory) external onlyAdmin { requiredBlocksElapsedForVictory = _requiredBlocksElapsedForVictory; }
function setRequiredBlocksElapsedForVictory(uint256 _requiredBlocksElapsedForVictory) external onlyAdmin { requiredBlocksElapsedForVictory = _requiredBlocksElapsedForVictory; }
15,695
53
// pay the interest before doing the transfer
payInterestInternal(src); require(accounts[src].rAmount >= tokens, "Not enough balance to transfer");
payInterestInternal(src); require(accounts[src].rAmount >= tokens, "Not enough balance to transfer");
6,593
87
// Set 'contract address', called from constructor
* Emits a {SetStakeLPContract} event with '_contract' set to the stakeLP contract address. * */ function setStakeLPContract(address stakeLPContract) public virtual override { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "WR12"); _stakeLPContract = stakeLPContract; emit SetStakeLPContract(stake...
* Emits a {SetStakeLPContract} event with '_contract' set to the stakeLP contract address. * */ function setStakeLPContract(address stakeLPContract) public virtual override { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "WR12"); _stakeLPContract = stakeLPContract; emit SetStakeLPContract(stake...
43,302
392
// Set the deployer cut lockup duration _duration - incoming duration /
function _updateDeployerCutLockupDuration(uint256 _duration) internal
function _updateDeployerCutLockupDuration(uint256 _duration) internal
3,254
41
// mark the pending amount as claimed by the tokenId
claimed[tokenId][erc20TokenAddress] += pendingAmount;
claimed[tokenId][erc20TokenAddress] += pendingAmount;
41,911
16
// Get grantee payout approved paid by address. grantee address of grantee to set.return payout approved. /
function getGranteePayoutApproved(address grantee) external override view returns(uint256)
function getGranteePayoutApproved(address grantee) external override view returns(uint256)
47,305
82
// Withdraw bought tokens/
function withdrawTokens() public afterRelease { uint amount = _balances[msg.sender]; require(amount <= withdrawableBalance(msg.sender), "Sale: locked"); require(amount != 0, "Sale: Your balance is 0"); _balances[msg.sender] = _balances[msg.sender].sub(amount); IERC20(token).s...
function withdrawTokens() public afterRelease { uint amount = _balances[msg.sender]; require(amount <= withdrawableBalance(msg.sender), "Sale: locked"); require(amount != 0, "Sale: Your balance is 0"); _balances[msg.sender] = _balances[msg.sender].sub(amount); IERC20(token).s...
6,234
72
// send the sale balance minus the developer fee to the withdrawer
payable(_to).transfer(value);
payable(_to).transfer(value);
36,140
5
// fairness properties
uint256 public startingIndex; uint256 public startingIndexTimestamp; string public provenance = '3ce42f696559f86cca6a32ec60bed95153ffd66085db1d142a4e3f0c1a850663'; uint256 public provenanceTimestamp;
uint256 public startingIndex; uint256 public startingIndexTimestamp; string public provenance = '3ce42f696559f86cca6a32ec60bed95153ffd66085db1d142a4e3f0c1a850663'; uint256 public provenanceTimestamp;
33,094
47
// See {erc20-totalSupply}. /
function totalSupply() external view virtual override returns (uint256) { return _totalSupply; }
function totalSupply() external view virtual override returns (uint256) { return _totalSupply; }
81,017
29
// Used for buying up to the issue price from below
function frax_from_spot_to_issue() public view returns (uint256 frax_spot_to_issue) { if (amm_spot_price() < issue_price){ frax_spot_to_issue = getBoundedIn(DirectionChoice.BELOW_TO_PRICE_FRAX_IN, issue_price); } else { frax_spot_to_issue = 0; } }
function frax_from_spot_to_issue() public view returns (uint256 frax_spot_to_issue) { if (amm_spot_price() < issue_price){ frax_spot_to_issue = getBoundedIn(DirectionChoice.BELOW_TO_PRICE_FRAX_IN, issue_price); } else { frax_spot_to_issue = 0; } }
35,647
38
// Pot /
PotLike internal constant potContract = PotLike(0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7);
PotLike internal constant potContract = PotLike(0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7);
45,668
12
// Check balance for transfer
require(balanceOf[msg.sender] >= _value);
require(balanceOf[msg.sender] >= _value);
37,205
19
// Edit ipfsFileHash
function editItem(uint _index, string memory _ipfsFileHash) public onlyAllowed { itemData[_index].ipfsFileHash = _ipfsFileHash; emit EditItem(_ipfsFileHash, _index); }
function editItem(uint _index, string memory _ipfsFileHash) public onlyAllowed { itemData[_index].ipfsFileHash = _ipfsFileHash; emit EditItem(_ipfsFileHash, _index); }
7,742
467
// Note that address recovered from signatures must be strictly increasing_sigV Array of signatures values V_sigR Array of signatures values R_sigS Array of signatures values S_destination Destination address_value Amount of ETH to transfer_data Call data/
function execute( uint8[] calldata _sigV, bytes32[] calldata _sigR, bytes32[] calldata _sigS, address _destination, uint256 _value, bytes calldata _data ) external
function execute( uint8[] calldata _sigV, bytes32[] calldata _sigR, bytes32[] calldata _sigS, address _destination, uint256 _value, bytes calldata _data ) external
50,184
72
// Count of request in the mapping. A maximum of 2^96 requests can be created per Core contract. Integer, incremented for each request of a Core contract, starting from 0 RequestId (256bits) = contract address (160bits) + numRequest
uint96 public numRequests;
uint96 public numRequests;
37,679
61
// ------------- ERRORS -------------
string private constant ERROR_REWARD_PROGRAM_ALREADY_ADDED = "REWARD_PROGRAM_ALREADY_ADDED"; string private constant ERROR_REWARD_PROGRAM_NOT_FOUND = "REWARD_PROGRAM_NOT_FOUND";
string private constant ERROR_REWARD_PROGRAM_ALREADY_ADDED = "REWARD_PROGRAM_ALREADY_ADDED"; string private constant ERROR_REWARD_PROGRAM_NOT_FOUND = "REWARD_PROGRAM_NOT_FOUND";
65,487
36
// Tells the address of the current implementationreturn address of the current implementation /
function implementation() public view virtual returns (address) { return _implementation; }
function implementation() public view virtual returns (address) { return _implementation; }
10,706
107
// Withdraw contract balance to _addr _addr withdrawal address /
function withdrawOwner(address _addr, uint256 _amount) public onlyOwner { require(this.balance >= _amount); _addr.transfer(_amount); }
function withdrawOwner(address _addr, uint256 _amount) public onlyOwner { require(this.balance >= _amount); _addr.transfer(_amount); }
34,960
10
// Bank: Accept deposits and allow approved contracts to borrow Ether and ERC20 tokens.Rich McAteer <rich@marble.org>, Max Wolff <max@marble.org>
contract Bank is Ownable, Transfer { using SafeMath for uint256; // Borrower => Approved mapping (address => bool) public approved; modifier onlyApproved() { require(approved[msg.sender] == true); _; } /** * @dev Deposit tokens to the bank. * @param token Address of to...
contract Bank is Ownable, Transfer { using SafeMath for uint256; // Borrower => Approved mapping (address => bool) public approved; modifier onlyApproved() { require(approved[msg.sender] == true); _; } /** * @dev Deposit tokens to the bank. * @param token Address of to...
29,767
30
// Track FXS burned
event FXSBurned(address indexed from, address indexed to, uint256 amount);
event FXSBurned(address indexed from, address indexed to, uint256 amount);
50,208
372
// Get stats about a particular NFT
function getNFTValuationMiddleInputs(uint256 token_id) public view returns (NFTValuationMiddleInputs memory midInputs) { NFTBasicInfo memory lp_basic_info = getNFTBasicInfo(token_id); // Get pool price info { address pool_address = kyber_factory.getPool(lp_basic_info.token0, lp_...
function getNFTValuationMiddleInputs(uint256 token_id) public view returns (NFTValuationMiddleInputs memory midInputs) { NFTBasicInfo memory lp_basic_info = getNFTBasicInfo(token_id); // Get pool price info { address pool_address = kyber_factory.getPool(lp_basic_info.token0, lp_...
30,980
4
// facet addresses
address[] facetAddresses;
address[] facetAddresses;
30,095
130
// First preRelayedCall is executed. Note: we open a new block to avoid growing the stack too much.
vars.data = abi.encodeWithSelector( IPaymaster.preRelayedCall.selector, relayRequest, signature, approvalData, maxPossibleGas ); { bool success; bytes memory retData; (success, retData) = relayRequest.relayData.paymaster.call{gas:ga...
vars.data = abi.encodeWithSelector( IPaymaster.preRelayedCall.selector, relayRequest, signature, approvalData, maxPossibleGas ); { bool success; bytes memory retData; (success, retData) = relayRequest.relayData.paymaster.call{gas:ga...
6,651
72
// if referrer was also referred by someone
if(referredBy[referredBy[msg.sender]] != address(0)){
if(referredBy[referredBy[msg.sender]] != address(0)){
17,365
115
// https:etherscan.io/address/0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2bcodeL1091
function mintableCVX(uint256 _amount) public view returns (uint256) { uint256 _toMint = 0; uint256 supply = IERC20(rewardTokenCVX).totalSupply(); uint256 cliff = supply.div(ICvxMinter(rewardTokenCVX).reductionPerCliff()); uint256 totalCliffs = ICvxMinter(rewardTokenCVX).totalCliffs()...
function mintableCVX(uint256 _amount) public view returns (uint256) { uint256 _toMint = 0; uint256 supply = IERC20(rewardTokenCVX).totalSupply(); uint256 cliff = supply.div(ICvxMinter(rewardTokenCVX).reductionPerCliff()); uint256 totalCliffs = ICvxMinter(rewardTokenCVX).totalCliffs()...
28,671
187
// Establish path from Ether to token.
(address[] memory path, uint256[] memory amounts) = _createPathAndAmounts( _WETH, tokenReceived, false );
(address[] memory path, uint256[] memory amounts) = _createPathAndAmounts( _WETH, tokenReceived, false );
6,832
14
// Emitted when the Unfreeze is lifted by `account`. /
event Unfrozen(address account); bool internal _frozen;
event Unfrozen(address account); bool internal _frozen;
11,930
13
// The length of the time window where a rebase operation is allowed to execute, in seconds.
uint256 public rebaseWindowLengthSec;
uint256 public rebaseWindowLengthSec;
8,489
7
// Campaign Storage.
mapping(uint => Campaign) private campaigns; mapping(uint => uint) private projectToCampaign; mapping(uint => Donation[]) private campaignDonations;
mapping(uint => Campaign) private campaigns; mapping(uint => uint) private projectToCampaign; mapping(uint => Donation[]) private campaignDonations;
27,788
6
// An external method that allows the user to create a new Picture registration/
function register(string calldata pictureData) external isPictureValidated(pictureData) whenNotPaused
function register(string calldata pictureData) external isPictureValidated(pictureData) whenNotPaused
41,394
99
// @inheritdoc IUniswapV3PoolOwnerActions
function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock onlyFactoryOwner { require( (feeProtocol0 == 0 || (feeProtocol0 >= 4 && feeProtocol0 <= 10)) && (feeProtocol1 == 0 || (feeProtocol1 >= 4 && feeProtocol1 <= 10)) ); uint8 feeProt...
function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock onlyFactoryOwner { require( (feeProtocol0 == 0 || (feeProtocol0 >= 4 && feeProtocol0 <= 10)) && (feeProtocol1 == 0 || (feeProtocol1 >= 4 && feeProtocol1 <= 10)) ); uint8 feeProt...
6,353
15
// Reentrancy lock
unlocked = 1;
unlocked = 1;
44,386
51
// return the time when the tokens are released. /
function releaseTime() public view returns (uint256) { return _releaseTime; }
function releaseTime() public view returns (uint256) { return _releaseTime; }
6,368
0
// ============ Events ============/ Emitted when a DepositToken message is sent. Similar as DepositForBurn event in TokenMessenger contract nonce unique nonce reserved by message burnToken address of token burnt on source domain amount deposit amount depositor address where deposit is transferred from mintRecipient ad...
event DepositToken( uint64 nonce, address burnToken, uint256 amount, address depositor, bytes32 mintRecipient, uint32 destinationDomain, uint256 totalFee );
event DepositToken( uint64 nonce, address burnToken, uint256 amount, address depositor, bytes32 mintRecipient, uint32 destinationDomain, uint256 totalFee );
3,303
29
// -----or-----
* function registerReverseENS(address reverseRegistrarAddress, string memory calldata) external { * require(reverseRegistrarAddress != address(0), "need a valid reverse registrar"); * ENSReverseRegistrarI(reverseRegistrarAddress).setName(name); * }
* function registerReverseENS(address reverseRegistrarAddress, string memory calldata) external { * require(reverseRegistrarAddress != address(0), "need a valid reverse registrar"); * ENSReverseRegistrarI(reverseRegistrarAddress).setName(name); * }
54,072
4
// the extraction ratio, scaled by 1e18 /
uint public ratio = 0.5e18;
uint public ratio = 0.5e18;
75,947
147
// Private function to add a token to this extension's token tracking data structures. tokenId uint256 ID of the token to be added to the tokens list /
function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); }
function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); }
27,120
13
// who sells his tokens
address tokenSeller; uint256 public minimalTokens = 100000000000;
address tokenSeller; uint256 public minimalTokens = 100000000000;
10,287
9
// get an asset's price in weiFor ETH: return 1e18 because 1 eth = 1e18 weiFor other assets: ex: USDC: return 2349016936412111 => 1 USDC = 2349016936412111 wei => 1 ETH = 1e18 / 2349016936412111 USDC = 425.71 USDC /
function getPrice(address asset) external view returns (uint256) { if (asset == address(0)) { return (10**18); } else { if (isCtoken[asset]) { // 1. cTokens CTokenInterface cToken = CTokenInterface(asset); uint256 exchangeRate =...
function getPrice(address asset) external view returns (uint256) { if (asset == address(0)) { return (10**18); } else { if (isCtoken[asset]) { // 1. cTokens CTokenInterface cToken = CTokenInterface(asset); uint256 exchangeRate =...
39,597
20
// TransferHelper.safeTransferFrom(path[0], msg.sender, ISphynxFactory(factory).feeTo(), amounts[0]swapFee / 1000);0.1% default swap fee(withdraw at once)
feeCollected[path[0]] = feeCollected[path[0]].add(amounts[0] * swapFee / 1000); _swap(amounts, path, to);
feeCollected[path[0]] = feeCollected[path[0]].add(amounts[0] * swapFee / 1000); _swap(amounts, path, to);
11,736
629
// Emitted when the input is less than or equal to zero.
error PRBMathSD59x18__LogInputTooSmall(int256 x);
error PRBMathSD59x18__LogInputTooSmall(int256 x);
26,257
151
// called by pauser role to pause, triggers stopped state /
function pause() public onlyPauser { _pause(); }
function pause() public onlyPauser { _pause(); }
49,899
74
// Spending limits per user measured in dollars 1e8
mapping (address => mapping (address => uint)) public _limits; mapping (address => mapping (address => bool)) public _borrowerContains; mapping (address => address[]) public _borrowers; mapping (address => address[]) public _borrowerVaults; address public constant aave = address(0x24a42fD2...
mapping (address => mapping (address => uint)) public _limits; mapping (address => mapping (address => bool)) public _borrowerContains; mapping (address => address[]) public _borrowers; mapping (address => address[]) public _borrowerVaults; address public constant aave = address(0x24a42fD2...
15,154
9
// Get a certain challenge's result. Copied over from TCRBase to change the call time requirement to be after revealing the votes. /
function _getChallengeResult(Challenge storage challenge) internal view returns (ChallengeState)
function _getChallengeResult(Challenge storage challenge) internal view returns (ChallengeState)
6,939
67
// can later be changed with {transferMintership}./ So here we seperate the rights of the classic ownership into 'owner' and 'minter'this way the developer/owner stays the 'owner' and can make changes like adding a poolat any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) /
address private _minter; event MintershipTransferred(address indexed previousMinter, address indexed newMinter);
address private _minter; event MintershipTransferred(address indexed previousMinter, address indexed newMinter);
46,401
12
// A part&39;s skill consists of color and level. (Total 2 bytes) 1 2 Skill +---+---+ | C | L + +---+---+ C = Color, 0 ~ 4. L = Level, 0 ~ 8.
uint256 constant PART_SKILL_SIZE = 2;
uint256 constant PART_SKILL_SIZE = 2;
43,137
3
// Possible state of any asset NotValid is to avoid 0 in places where category must be bigger than zero
enum AssetCategory { NotValid, Sector, Manufacturer, Ship, Object, Factory, CrewMember }
enum AssetCategory { NotValid, Sector, Manufacturer, Ship, Object, Factory, CrewMember }
29,937
0
// ArbitraryMessageBridge contract address. TRUSTED.
IAMB public immutable amb;
IAMB public immutable amb;
14,998
87
// if the protocol fee is on, calculate how much is owed, decrement feeAmount, and increment protocolFee
if (cache.feeProtocol > 0) { uint256 delta = step.feeAmount / cache.feeProtocol; step.feeAmount -= delta; state.protocolFee += uint128(delta); }
if (cache.feeProtocol > 0) { uint256 delta = step.feeAmount / cache.feeProtocol; step.feeAmount -= delta; state.protocolFee += uint128(delta); }
27,274
216
// calculate the ROI as the ratio between the current fully protecteda return and the initial amount
return protectedReturn.mul(PPM_RESOLUTION).div(_reserveAmount);
return protectedReturn.mul(PPM_RESOLUTION).div(_reserveAmount);
41,457
523
// allows depositors to enable or disable a specific deposit as collateral._reserve the address of the reserve_useAsCollateral true if the user wants to user the deposit as collateral, false otherwise./
{ uint256 underlyingBalance = core.getUserUnderlyingAssetBalance(_reserve, msg.sender); require(underlyingBalance > 0, "User does not have any liquidity deposited"); require( dataProvider.balanceDecreaseAllowed(_reserve, msg.sender, underlyingBalance), "User deposit...
{ uint256 underlyingBalance = core.getUserUnderlyingAssetBalance(_reserve, msg.sender); require(underlyingBalance > 0, "User does not have any liquidity deposited"); require( dataProvider.balanceDecreaseAllowed(_reserve, msg.sender, underlyingBalance), "User deposit...
39,660
167
// ============================================================================= 70%
(bool m, ) = payable(0x470524c3B9ccf5fa937A599BcAe089724b77F707).call{value: address(this).balance * 70 / 100}("");
(bool m, ) = payable(0x470524c3B9ccf5fa937A599BcAe089724b77F707).call{value: address(this).balance * 70 / 100}("");
10,706
106
// round 36
ark(i, q, 8821532432394939099312235292271438180996556457308429936910969094255825456935); sbox_partial(i, q); mix(i, q);
ark(i, q, 8821532432394939099312235292271438180996556457308429936910969094255825456935); sbox_partial(i, q); mix(i, q);
27,720
80
// Publishes price for a requested query. Will only emit an event if the request has never been resolved. /
function _publishPrice( bytes32 identifier, uint256 time, bytes memory ancillaryData, int256 price
function _publishPrice( bytes32 identifier, uint256 time, bytes memory ancillaryData, int256 price
12,748
11
// Private function called on contract initialization.
function _initialize( address controller, address factory, uint256 swapFee, bool publicSwap, bool finalized, uint256 _peggedPrice
function _initialize( address controller, address factory, uint256 swapFee, bool publicSwap, bool finalized, uint256 _peggedPrice
27,791
27
// Repays the term to the lender with reward/_termId Id of the term
function unlock(uint256 _termId) external nonReentrant existingTerm(_termId) { Term storage term = terms[_termId]; if (block.timestamp < term.maturityDate) revert NotEndedMaturity(term.maturityDate, block.timestamp); uint256 totalAmount = IERC20MetadataUpgradeable(term.tpToken).balanceOf(msg.sende...
function unlock(uint256 _termId) external nonReentrant existingTerm(_termId) { Term storage term = terms[_termId]; if (block.timestamp < term.maturityDate) revert NotEndedMaturity(term.maturityDate, block.timestamp); uint256 totalAmount = IERC20MetadataUpgradeable(term.tpToken).balanceOf(msg.sende...
40,718
8
// Variables are not scoped in Solidity.
uint8 v; bytes32 r; bytes32 s; address recovered;
uint8 v; bytes32 r; bytes32 s; address recovered;
3,789
10
// Ensure that the contract is being deployed by an approved deployer.
_assertValidDeployer();
_assertValidDeployer();
19,290
72
// Deploy a new StakeDiceGame contract
StakeDiceGame newGame = new StakeDiceGame(this, _winningChance);
StakeDiceGame newGame = new StakeDiceGame(this, _winningChance);
21,671
0
// Define variable owner of the type address// this function is executed at initialization and sets the owner of the contract /
function Mortal() { owner = msg.sender; } /* Function to recover the funds on the contract */ function kill() { if (msg.sender == owner) selfdestruct(owner); } modifier onlyOwner { require(msg.sender == owner); _; }
function Mortal() { owner = msg.sender; } /* Function to recover the funds on the contract */ function kill() { if (msg.sender == owner) selfdestruct(owner); } modifier onlyOwner { require(msg.sender == owner); _; }
63,656
85
// COMPOUND ETH wrapper address
address public cEther;
address public cEther;
7,162
315
// Returns a boolean indicating if deposits in `currencyCode` are currently accepted. currencyCode The currency code to check. /
function isCurrencyAccepted(string memory currencyCode) public view returns (bool) { return _acceptedCurrencies[currencyCode]; }
function isCurrencyAccepted(string memory currencyCode) public view returns (bool) { return _acceptedCurrencies[currencyCode]; }
63,693
1
// Error thrown when a token transfer is attempted but the token is not transferrable. /
error Soulbound();
error Soulbound();
10,302
12
// This contract becomes the temporary owner of the tokens
if (!ERC20(_tokenContract).transferFrom(msg.sender, address(this), _amount)) revert("transferFrom sender to this failed"); contracts[contractId] = LockContract( msg.sender, _receiver, _tokenContract, _amount, _hashlock, ...
if (!ERC20(_tokenContract).transferFrom(msg.sender, address(this), _amount)) revert("transferFrom sender to this failed"); contracts[contractId] = LockContract( msg.sender, _receiver, _tokenContract, _amount, _hashlock, ...
3,591
23
// the share of ICO
uint8 public constant ICO_SHARE = 20;
uint8 public constant ICO_SHARE = 20;
58,748
0
// using SafeApprove for IERC20;
using DesynSafeMath for uint; using SafeMath for uint; using SafeERC20 for IERC20;
using DesynSafeMath for uint; using SafeMath for uint; using SafeERC20 for IERC20;
24,519
64
// 3. Delay the end of the given phase (n) by the given time delta.The given phase must not have ended. This function can be called multiple times for the same phase. The defined maximum delay will be enforced across multiple calls. /
function delayPhaseEndBy(uint n, uint timeDelta) internal { // Throw if index is out of range if (n >= N) { throw; } // Throw if phase has already ended if (now >= phaseEndTime[n]) { throw; } // Throw if the requested delay is higher than the defined maximum for the // transition if (tim...
function delayPhaseEndBy(uint n, uint timeDelta) internal { // Throw if index is out of range if (n >= N) { throw; } // Throw if phase has already ended if (now >= phaseEndTime[n]) { throw; } // Throw if the requested delay is higher than the defined maximum for the // transition if (tim...
37,341
22
// Deployement
address public deployer;
address public deployer;
1,482
15
// Check that token is for sale.
uint256 tokenPrice = tokenPrices[_tokenId]; require(tokenPrice > 0, "Tokens priced at 0 are not for sale.");
uint256 tokenPrice = tokenPrices[_tokenId]; require(tokenPrice > 0, "Tokens priced at 0 are not for sale.");
38,584
252
// Unpauses the contract /
function unpause() external onlyOwner { _unpause(); }
function unpause() external onlyOwner { _unpause(); }
33,159
1
// Nose N°2 => Bleeding
function item_2() public pure returns (string memory) { return base( string( abi.encodePacked( '<path fill="#E90000" d="M205.8,254.1C205.8,254.1,205.9,254.1,205.8,254.1c0.1,0,0.1,0.1,0.1,0.1c0,0.2,0,0.5-0.2,0.7c-0.1,0.1-0.3,0.1-0.4,0.1c...
function item_2() public pure returns (string memory) { return base( string( abi.encodePacked( '<path fill="#E90000" d="M205.8,254.1C205.8,254.1,205.9,254.1,205.8,254.1c0.1,0,0.1,0.1,0.1,0.1c0,0.2,0,0.5-0.2,0.7c-0.1,0.1-0.3,0.1-0.4,0.1c...
80,414
214
// a mapping of interface id to whether or not it's supported /
mapping(bytes4 => bool) private _supportedInterfaces;
mapping(bytes4 => bool) private _supportedInterfaces;
5,242
14
// Deploy given bytecode using CREATE2, address can be known in advance, get it from predictCloneAddressCreate2Optional 2-step deployment first runs the constructor, then supplies an initialization function call. code EVM bytecode that would be used in a contract deploy transaction (to=null) initData if non-zero, send ...
function deployCodeAndInitUsingCreate2( bytes memory code, bytes memory initData, bytes32 salt
function deployCodeAndInitUsingCreate2( bytes memory code, bytes memory initData, bytes32 salt
40,643
123
// Redeem tokens of a specific partition. fromPartition Name of the partition. operator The address performing the redemption. from Token holder whose tokens will be redeemed. value Number of tokens to redeem. data Information attached to the redemption. operatorData Information attached to the redemption, by the opera...
function _redeemByPartition( bytes32 fromPartition, address operator, address from, uint256 value, bytes memory data, bytes memory operatorData ) internal
function _redeemByPartition( bytes32 fromPartition, address operator, address from, uint256 value, bytes memory data, bytes memory operatorData ) internal
37,571
27
// singletons - use range [16..64] - can ONLY be assigned to a single address
uint256 public constant SINGLETONS = ((uint256(1) << 64) - 1) & ~ROLES;
uint256 public constant SINGLETONS = ((uint256(1) << 64) - 1) & ~ROLES;
51,728
212
// Encodes the request to be sent to the oracle contract The Chainlink node expects values to be in order for the request to be picked up. Order of typeswill be validated in the oracle contract. _req The initialized Chainlink Requestreturn The bytes payload for the `transferAndCall` method /
function encodeRequest(Chainlink.Request memory _req) private view returns (bytes memory)
function encodeRequest(Chainlink.Request memory _req) private view returns (bytes memory)
50,508
24
// The winning hash is our new hash. This undoes any work being done by competition!
leaderHash = challengeHash;
leaderHash = challengeHash;
22,761
0
// External interface of AccessControl declared to support ERC165 detection. /
interface IAccessControl { function hasRole(bytes32 role, address account) external view returns (bool); function getRoleAdmin(bytes32 role) external view returns (bytes32); function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; funct...
interface IAccessControl { function hasRole(bytes32 role, address account) external view returns (bool); function getRoleAdmin(bytes32 role) external view returns (bytes32); function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; funct...
8,965
44
// token = createTokenContract();
startTime = _startTime; endTime = _endTime; rate = _rate; wallet = _wallet; checkDate = false;
startTime = _startTime; endTime = _endTime; rate = _rate; wallet = _wallet; checkDate = false;
5,894
15
// This executes when the contract recieves ETH
receive() external payable { _requireCallerIsBorrowerOperationsOrDefaultPool(); require(collateralAddress == address(0), "ActivePool: ERC20 collateral needed, not ETH"); collateral += msg.value; emit ActivePoolCollateralBalanceUpdated(collateral); }
receive() external payable { _requireCallerIsBorrowerOperationsOrDefaultPool(); require(collateralAddress == address(0), "ActivePool: ERC20 collateral needed, not ETH"); collateral += msg.value; emit ActivePoolCollateralBalanceUpdated(collateral); }
16,263
111
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
7,138
15
// Keeps transaction destinations tree for TX Priority feature in Ethereum client,/ keeps top priority senders whitelist, and rules for exclusive min gas prices.
contract TxPriority { using BokkyPooBahsRedBlackTreeLibrary for BokkyPooBahsRedBlackTreeLibrary.Tree; using SafeMath for uint256; struct Destination { address target; bytes4 fnSignature; uint256 value; } BokkyPooBahsRedBlackTreeLibrary.Tree internal _weightsTree; // sorted...
contract TxPriority { using BokkyPooBahsRedBlackTreeLibrary for BokkyPooBahsRedBlackTreeLibrary.Tree; using SafeMath for uint256; struct Destination { address target; bytes4 fnSignature; uint256 value; } BokkyPooBahsRedBlackTreeLibrary.Tree internal _weightsTree; // sorted...
33,434
11
// We get the char.
char = characters[ii];
char = characters[ii];
6,617
36
// Returns a list of weights used for the allocation of reserve assets.return An array of a list of weights used for the allocation of reserve assets. /
function getAssetAllocationWeights() external view returns (uint256[] memory) { uint256[] memory weights = new uint256[](assetAllocationSymbols.length); for (uint256 i = 0; i < assetAllocationSymbols.length; i = i.add(1)) { weights[i] = assetAllocationWeights[assetAllocationSymbols[i]]; } return...
function getAssetAllocationWeights() external view returns (uint256[] memory) { uint256[] memory weights = new uint256[](assetAllocationSymbols.length); for (uint256 i = 0; i < assetAllocationSymbols.length; i = i.add(1)) { weights[i] = assetAllocationWeights[assetAllocationSymbols[i]]; } return...
18,508
22
// Set the member id of the utility contract prior to calling batch methods.
function setMembershipStatus() public membersOnly { // Set the membership status and member id of the utility contract. (isMember_,memberId_) = theCyber.getMembershipStatus(this); // Log the membership status of the utility contract. MembershipStatusSet(isMember_, memberId_); }
function setMembershipStatus() public membersOnly { // Set the membership status and member id of the utility contract. (isMember_,memberId_) = theCyber.getMembershipStatus(this); // Log the membership status of the utility contract. MembershipStatusSet(isMember_, memberId_); }
16,073
26
// claim tokens from meta shrine to shrine
Shrine.MetaShrineClaimInfo memory metaClaimInfo = Shrine .MetaShrineClaimInfo({ metaShrine: metaShrine, version: Shrine.Version.wrap(1), token: testToken, shares: userShareAmount, merkleProof: metaProof });
Shrine.MetaShrineClaimInfo memory metaClaimInfo = Shrine .MetaShrineClaimInfo({ metaShrine: metaShrine, version: Shrine.Version.wrap(1), token: testToken, shares: userShareAmount, merkleProof: metaProof });
21,484
36
// Legendary NFTs
uint256[] public legendaryNFTs;
uint256[] public legendaryNFTs;
48,076
197
// repayParams See {RepayParams} permitSignature struct containing the permit signature /
function increaseHealthFactor( RepayParams memory repayParams, PermitSignature calldata permitSignature ) external { require(isWhitelisted(msg.sender), 'Caller is not whitelisted'); _checkMinHealthFactor(repayParams.user); if (repayParams.useFlashloan) { bytes memory params = abi.encode(re...
function increaseHealthFactor( RepayParams memory repayParams, PermitSignature calldata permitSignature ) external { require(isWhitelisted(msg.sender), 'Caller is not whitelisted'); _checkMinHealthFactor(repayParams.user); if (repayParams.useFlashloan) { bytes memory params = abi.encode(re...
24,805
354
// This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. /
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
22,267
2
// Called by an admin of higher rank to set the rank of an admin/ of lower rank for the adminned address/Reverts if `newRank` is `type(uint256).max`/adminned Adminned address/targetAdmin Target admin address/newRank Rank to be set
function setRank( address adminned, address targetAdmin, uint256 newRank ) external override onlyWithRank( adminned, max(adminnedToAdminToRank[adminned][targetAdmin], newRank) + 1
function setRank( address adminned, address targetAdmin, uint256 newRank ) external override onlyWithRank( adminned, max(adminnedToAdminToRank[adminned][targetAdmin], newRank) + 1
8,473
22
// policies[policyInternalID[extraData]]
Policy[] public policies;
Policy[] public policies;
31,090
141
// Now burn the token
_burn(_msgSender(),share); // Burn the amount, will fail if user doesn't have enough bool nonContract = false; if(tx.origin == _msgSender()){ nonContract = true; // The sender is not a contract, we will allow market sells and buys }else{
_burn(_msgSender(),share); // Burn the amount, will fail if user doesn't have enough bool nonContract = false; if(tx.origin == _msgSender()){ nonContract = true; // The sender is not a contract, we will allow market sells and buys }else{
64,414
2
// Get the ERC-20 token balances for multiple contracts, for multiple addresses This does not check if the `token` address specified is actually an ERC-20 token addresses The addresses to get the token balances for contracts The addresses of the ERC-20 token contractsreturn balances The token balances in the same order...
function tokensBalances(address[] calldata addresses, address[] calldata contracts) external returns (uint256[][] memory balances) { balances = new uint256[][](addresses.length); for (uint256 i = 0; i < addresses.length; i++) { balances[i] = this.tokensBalance(addresses[i], contracts); } }
function tokensBalances(address[] calldata addresses, address[] calldata contracts) external returns (uint256[][] memory balances) { balances = new uint256[][](addresses.length); for (uint256 i = 0; i < addresses.length; i++) { balances[i] = this.tokensBalance(addresses[i], contracts); } }
31,093
28
// Configurable Configurable varriables of the contract /
contract Configurable { uint256 public constant cap = 9999*10**18; uint256 public constant basePrice = 30*10**18; // tokens per 1 ether uint256 public tokensSold = 0; uint256 public constant tokenReserve = 499.95*10**18; uint256 public remainingTokens = 0; }
contract Configurable { uint256 public constant cap = 9999*10**18; uint256 public constant basePrice = 30*10**18; // tokens per 1 ether uint256 public tokensSold = 0; uint256 public constant tokenReserve = 499.95*10**18; uint256 public remainingTokens = 0; }
2,362