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
23
// execute event NewProduct
emit NewProduct(newID, name, price, quantity, owner); return newID;
emit NewProduct(newID, name, price, quantity, owner); return newID;
38,944
39
// function _safeTransferFrom( IERC20 token, address sender, address recipient, uint amount
// ) private { // bool sent = token.transferFrom(sender, recipient, amount); // require(sent, "Token transfer failed"); // }
// ) private { // bool sent = token.transferFrom(sender, recipient, amount); // require(sent, "Token transfer failed"); // }
1,656
77
// Returns ceil(a / b)./
function ceil(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; if(a % b == 0) { return c; } else { return c + 1; } }
function ceil(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; if(a % b == 0) { return c; } else { return c + 1; } }
4,856
22
// 600 million total supply divided into90 million to privatesale address120 million to presale address180 million to crowdsale address90 million to eco supply address120 million to team supply address
totalSupply_ = 600000000 * 10**uint(decimals); privatesaleSupply = 90000000 * 10**uint(decimals); presaleSupply = 120000000 * 10**uint(decimals); crowdsaleSupply = 180000000 * 10**uint(decimals); ecoSupply = 90000000 * 10**uint(decimals); teamSupply = 120000000 * 10**uint(decimals); firstVestAmount = tea...
totalSupply_ = 600000000 * 10**uint(decimals); privatesaleSupply = 90000000 * 10**uint(decimals); presaleSupply = 120000000 * 10**uint(decimals); crowdsaleSupply = 180000000 * 10**uint(decimals); ecoSupply = 90000000 * 10**uint(decimals); teamSupply = 120000000 * 10**uint(decimals); firstVestAmount = tea...
31,190
4
// The ONI TOKEN!
OniToken public oni;
OniToken public oni;
7,905
10
// Token - is a smart contract interface for managing common functionality of a token./
contract TokenInterface { // total amount of tokens uint256 totalSupply; /** * * balanceOf() - constant function check concrete tokens balance * * @param owner - account owner * * @return the value of balance */ funct...
contract TokenInterface { // total amount of tokens uint256 totalSupply; /** * * balanceOf() - constant function check concrete tokens balance * * @param owner - account owner * * @return the value of balance */ funct...
29,944
25
// Performs a Solidity function call using a low level `call`. Aplain`call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expected...
function functionCall(address target, bytes memory data) internal returns (bytes memory)
function functionCall(address target, bytes memory data) internal returns (bytes memory)
48,591
41
// The "key" below is the Ethereum Address in string format that is in the "listOfSellers" double-linked list.
uint keyCount = 0; string memory key = EMPTY_STRING; while (true) { key = listOfSellers[key][NEXT]; if (keyCount == _index) { break; }
uint keyCount = 0; string memory key = EMPTY_STRING; while (true) { key = listOfSellers[key][NEXT]; if (keyCount == _index) { break; }
46,596
49
// calculates the delta between supply and redeem for tokens and burn or mint them
adjustTokenBalance(epochID, supplyInToken, redeemInToken);
adjustTokenBalance(epochID, supplyInToken, redeemInToken);
31,495
4
// Validate strike digits
uint8 digits = _getDigits(strike); require(digits > 3, "Strike digits < 3");
uint8 digits = _getDigits(strike); require(digits > 3, "Strike digits < 3");
42,875
112
// require(amount > 0, 'VirtualDepositRewardPool : Cannot withdraw 0');
emit Withdrawn(_account, amount);
emit Withdrawn(_account, amount);
63,605
153
// Creates `amount` new tokens for `to`.
* See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); ...
* See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); ...
7,483
0
// Sign extend a shorter signed value to the full int32/number signed number to be extended/wordSize number of bits of the signed number, ie, 8 for int8
function int32SignExtension(int32 number, uint32 wordSize) public pure returns(int32)
function int32SignExtension(int32 number, uint32 wordSize) public pure returns(int32)
25,910
5
// Function for start initial farming round (only for `DEFAULT_ADMIN_ROLE`)/
function startFarming() external AccessControlUpgradeable.onlyRole(DEFAULT_ADMIN_ROLE) { FarmingUpgradeable._startFarming(); }
function startFarming() external AccessControlUpgradeable.onlyRole(DEFAULT_ADMIN_ROLE) { FarmingUpgradeable._startFarming(); }
21,796
23
// RightsDigitalAssetObject/ERC721 based token.
contract RightsDigitalAssetObject is IRightsDigitalAssetObject, RDDNControl, ERC721Full { using SafeMath for uint256; string internal constant name_ = "RithtsDigitalAssets"; string internal constant symbol_ = "RDA"; /*** DATA TYPES ***/ struct DigitalAssetObject { uint256 specId; // asset...
contract RightsDigitalAssetObject is IRightsDigitalAssetObject, RDDNControl, ERC721Full { using SafeMath for uint256; string internal constant name_ = "RithtsDigitalAssets"; string internal constant symbol_ = "RDA"; /*** DATA TYPES ***/ struct DigitalAssetObject { uint256 specId; // asset...
49,462
5
// validate only guardian can set
require( msg.sender == guardian, "PriceOracleDispatcher: only guardian may set the address" ); adapterMockAddress = addressAdapter;
require( msg.sender == guardian, "PriceOracleDispatcher: only guardian may set the address" ); adapterMockAddress = addressAdapter;
39,613
71
// Extension of {ERC20} that adds a set of accounts with the {MinterRole},/ See {ERC20-_mint}. Requirements: - the caller must have the {MinterRole}. /
function mint(address account, uint256 amount) public onlyMinter returns (bool) { _mint(account, amount); return true; }
function mint(address account, uint256 amount) public onlyMinter returns (bool) { _mint(account, amount); return true; }
10,241
5
// utility functions for uint256 operations /
library UintUtils { error UintUtils__InsufficientHexLength(); bytes16 private constant HEX_SYMBOLS = '0123456789abcdef'; function add(uint256 a, int256 b) internal pure returns (uint256) { return b < 0 ? sub(a, -b) : a + uint256(b); } function sub(uint256 a, int256 b) internal pure return...
library UintUtils { error UintUtils__InsufficientHexLength(); bytes16 private constant HEX_SYMBOLS = '0123456789abcdef'; function add(uint256 a, int256 b) internal pure returns (uint256) { return b < 0 ? sub(a, -b) : a + uint256(b); } function sub(uint256 a, int256 b) internal pure return...
31,110
8
// Stores the amount that the admin has mintedThis variable is private because it is not neeeded to be reteived outside of this contract
uint16 private adminMintCount;
uint16 private adminMintCount;
37,702
20
// Adminable dYdXEIP-1967 Proxy Admin contract. /
contract Adminable { /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier to c...
contract Adminable { /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier to c...
55,614
0
// / Highly opinionated token implementation
interface IERC20 { event Approval(address indexed src, address indexed dst, uint256 amt); event Transfer(address indexed src, address indexed dst, uint256 amt); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view ...
interface IERC20 { event Approval(address indexed src, address indexed dst, uint256 amt); event Transfer(address indexed src, address indexed dst, uint256 amt); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view ...
15,696
88
// Initializes the contract by setting a `name` and a `symbol` to the token collection./
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
58,341
0
// ============ Libraries ============
using TypedMemView for bytes; using TypedMemView for bytes29; using BridgeMessage for bytes29;
using TypedMemView for bytes; using TypedMemView for bytes29; using BridgeMessage for bytes29;
13,995
35
// NOTE: argument order matters, avoid stack too deep
emit SubmitProposal(applicant, sharesRequested, lootRequested, tributeOffered, tributeToken, paymentRequested, paymentToken, details, flags, data, proposalCount, msg.sender, memberAddressByDelegateKey[msg.sender]); proposalCount += 1;
emit SubmitProposal(applicant, sharesRequested, lootRequested, tributeOffered, tributeToken, paymentRequested, paymentToken, details, flags, data, proposalCount, msg.sender, memberAddressByDelegateKey[msg.sender]); proposalCount += 1;
57,852
776
// Withdraw `amountInShares` shares from vault
uint256 sharePrice = vault.getPricePerFullShare(); uint256 amountInShares = amountInUnderlying.decdiv(sharePrice); if (amountInShares > 0) { stakingPool.withdraw(amountInShares); vault.withdraw(amountInShares); }
uint256 sharePrice = vault.getPricePerFullShare(); uint256 amountInShares = amountInUnderlying.decdiv(sharePrice); if (amountInShares > 0) { stakingPool.withdraw(amountInShares); vault.withdraw(amountInShares); }
13,475
133
// = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
keccak256(bytes(name)), keccak256(bytes(version)), chainId, address(this) ) );
keccak256(bytes(name)), keccak256(bytes(version)), chainId, address(this) ) );
71,630
74
// Check whether a valid quantity of listed tokens is being bought.
require( _listing.quantity > 0 && _quantityToBuy > 0 && _quantityToBuy <= _listing.quantity, "Marketplace: buying invalid amount of tokens." );
require( _listing.quantity > 0 && _quantityToBuy > 0 && _quantityToBuy <= _listing.quantity, "Marketplace: buying invalid amount of tokens." );
3,396
65
// SGR sell Wallets Trading Limiter. /
contract SGRSellWalletsTradingLimiter is SGRWalletsTradingLimiter { string public constant VERSION = "2.0.0"; /** * @dev Create the contract. * @param _contractAddressLocator The contract address locator. */ constructor(IContractAddressLocator _contractAddressLocator) SGRWalletsTradingLimite...
contract SGRSellWalletsTradingLimiter is SGRWalletsTradingLimiter { string public constant VERSION = "2.0.0"; /** * @dev Create the contract. * @param _contractAddressLocator The contract address locator. */ constructor(IContractAddressLocator _contractAddressLocator) SGRWalletsTradingLimite...
10,399
14
// BlockHash only works for the most 256 recent blocks.
uint256 _block_shift = uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp))); _block_shift = 1 + (_block_shift % 255);
uint256 _block_shift = uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp))); _block_shift = 1 + (_block_shift % 255);
6,896
851
// set the FeePool contract as it is the only authority to be able to callappendVestingEntry with the onlyFeePool modifer /
function setFeePool(IFeePool _feePool) external onlyOwner { feePool = _feePool; emit FeePoolUpdated(address(_feePool)); }
function setFeePool(IFeePool _feePool) external onlyOwner { feePool = _feePool; emit FeePoolUpdated(address(_feePool)); }
34,395
19
// function to submit the CID of the manuscript uploaded on IPFS paramater is the unique CID generated when a document is uploaded on IPFS
function submitManuscript( uint256 _cid, string memory _title, string memory _area, string memory _publisher, string memory _journal
function submitManuscript( uint256 _cid, string memory _title, string memory _area, string memory _publisher, string memory _journal
6,742
2
// Vote to remove a keyholder and strip their voting/attesting power. The associated hash in `attestations` will be of the address of the keyholder they are voting to remove.
VOTE_TO_REMOVE_KEYHOLDER,
VOTE_TO_REMOVE_KEYHOLDER,
28,848
36
// Update payout
if (config.payoutAddress != address(0)) { _updatePayoutAddress(config.payoutAddress); }
if (config.payoutAddress != address(0)) { _updatePayoutAddress(config.payoutAddress); }
30,981
481
// Internal function calculating the market index with the shortest maturity that was at least minAmountToMaturity seconds still return uint256 result, the minimum market index the strategy should be entering positions intoreturn uint256 maturity, the minimum market index's maturity the strategy should be entering posi...
function _getMinimumMarketIndex() internal view returns(uint256, uint256) { MarketParameters[] memory _activeMarkets = nProxy.getActiveMarkets(currencyID); for(uint256 i = 0; i<_activeMarkets.length; i++) { if (_activeMarkets[i].maturity - block.timestamp >= minTimeToMaturity) { ...
function _getMinimumMarketIndex() internal view returns(uint256, uint256) { MarketParameters[] memory _activeMarkets = nProxy.getActiveMarkets(currencyID); for(uint256 i = 0; i<_activeMarkets.length; i++) { if (_activeMarkets[i].maturity - block.timestamp >= minTimeToMaturity) { ...
2,387
245
// Deposit all want in sushi chef
ISushiChef(chef).deposit(pid, _want);
ISushiChef(chef).deposit(pid, _want);
83,215
103
// Pool state that never changes/These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables { /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contra...
interface IUniswapV3PoolImmutables { /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contra...
21,594
27
// 锁仓截止日期2
uint256 public stepTwoLockEndTime;
uint256 public stepTwoLockEndTime;
34,555
14
// Returns the creation code that will result in a contract being deployed with `constructorArgs`. /
function _getCreationCodeWithArgs(bytes memory constructorArgs) private view returns (bytes memory code)
function _getCreationCodeWithArgs(bytes memory constructorArgs) private view returns (bytes memory code)
27,296
1
// Provides a safe ERC20.symbol version which returns '???' as fallback string./token The address of the ERC-20 token contract./ return (string) Token symbol.
function safeSymbol(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_SYMBOL)); return success ? returnDataToString(data) : "???"; }
function safeSymbol(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_SYMBOL)); return success ? returnDataToString(data) : "???"; }
38,318
10
// for switching off auction creations, bids and withdrawals
bool public isPaused;
bool public isPaused;
27,953
695
// Calculate rebalance amount for provide liquidity/wadMiltonErc20BalanceAfterDeposit Milton erc20 balance in wad, Notice: this is balance after provide liquidity operation!/vaultBalance Vault balance in wad, Stanley's accrued balance.
function _calculateRebalanceAmountAfterProvideLiquidity( uint256 wadMiltonErc20BalanceAfterDeposit, uint256 vaultBalance
function _calculateRebalanceAmountAfterProvideLiquidity( uint256 wadMiltonErc20BalanceAfterDeposit, uint256 vaultBalance
31,474
2
// require it has enough tokens
require(token.balanceOf(address(this))>=tokenAmount); token.transfer(msg.sender, tokenAmount);
require(token.balanceOf(address(this))>=tokenAmount); token.transfer(msg.sender, tokenAmount);
6,321
14
// Structs/
struct TokenInfo { uint pos; // 0 mens unregistered; if > 0, pos + 1 is the // token's position in `addresses`. string symbol; // Symbol of the token }
struct TokenInfo { uint pos; // 0 mens unregistered; if > 0, pos + 1 is the // token's position in `addresses`. string symbol; // Symbol of the token }
30,750
56
// Freeze the account _accounts Given accounts executed by CRM /
function freeze(address[] _accounts) public onlyOwnerOrManager { require(phase_i != PHASE_NOT_STARTED && phase_i != PHASE_FINISHED, "Bad phase"); uint i; for (i = 0; i < _accounts.length; i++) { require(_accounts[i] != address(0), "Zero address"); require(_accounts[i]...
function freeze(address[] _accounts) public onlyOwnerOrManager { require(phase_i != PHASE_NOT_STARTED && phase_i != PHASE_FINISHED, "Bad phase"); uint i; for (i = 0; i < _accounts.length; i++) { require(_accounts[i] != address(0), "Zero address"); require(_accounts[i]...
41,616
249
// Gets the DMM token contract address for the provided DMM token ID. For example, `1` returns the mToken contract address for that token ID. /
function getDmmTokenAddressByDmmTokenId(uint dmmTokenId) external view returns (address);
function getDmmTokenAddressByDmmTokenId(uint dmmTokenId) external view returns (address);
2,495
67
// Buys single token to an address specified. Accepts ETH as payment and mints a token_to address to mint token to /
function buySingleTo(address _to) public payable { // verify the inputs and transaction value require(_to != address(0), "recipient not set"); require(msg.value >= itemPrice, "not enough funds"); // verify mint limit if(mintLimit != 0) { require(mints[msg.sender] + 1 <= mintLimit, "mint lim...
function buySingleTo(address _to) public payable { // verify the inputs and transaction value require(_to != address(0), "recipient not set"); require(msg.value >= itemPrice, "not enough funds"); // verify mint limit if(mintLimit != 0) { require(mints[msg.sender] + 1 <= mintLimit, "mint lim...
1,722
202
// An index of contracts that are allowed to mint new tokens. /
mapping(address => bool) public minters;
mapping(address => bool) public minters;
71,581
171
// List of tokens that cluster holds, called underlyings./Order of addresses is important, as it corresponds with the order in underlyingsShares.
address[] public underlyings;
address[] public underlyings;
42,495
29
// or 0-9
(_temp[i] > 0x2f && _temp[i] < 0x3a), "string contains invalid characters" );
(_temp[i] > 0x2f && _temp[i] < 0x3a), "string contains invalid characters" );
28,591
133
// Sets liquidationIncentiveAdmin function to set liquidationIncentivenewLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/
function _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK); } // Check de-scaled min <= newLiquid...
function _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK); } // Check de-scaled min <= newLiquid...
27,557
9
// total number of tokens in existence/
function totalSupply() public view returns (uint256) { return totalSupply_; }
function totalSupply() public view returns (uint256) { return totalSupply_; }
2,881
9
// ChainlinkScheduler Giancarlo Sanchez Orchestrator for yield distribution and prize pool. /
contract ChainlinkScheduler is ChainlinkClient { bytes32 public currentRequestId; uint256 public timer = 0; uint256 public cycles = 0; address public yieldContractAddress; address public poolContractAddress; uint256 public currentCycle; ChainlinkConfiguration private configuration = new C...
contract ChainlinkScheduler is ChainlinkClient { bytes32 public currentRequestId; uint256 public timer = 0; uint256 public cycles = 0; address public yieldContractAddress; address public poolContractAddress; uint256 public currentCycle; ChainlinkConfiguration private configuration = new C...
37,849
5
// ----------MODIFIERS--------------------
modifier byPlayer(){ require(msg.sender != notary); _; }
modifier byPlayer(){ require(msg.sender != notary); _; }
33,794
28
// Update the price for rerolling radbro art. /
function setRadrollPrice(uint128 _radrollPrice) external onlyOwner { radrollPrice = _radrollPrice; }
function setRadrollPrice(uint128 _radrollPrice) external onlyOwner { radrollPrice = _radrollPrice; }
38,813
7
// Add ETH reward to the staking pool/ntoken The address of NToken
function addETHReward(address ntoken) external payable;
function addETHReward(address ntoken) external payable;
17,388
27
// Event: 移転承認
event ApproveTransfer( uint256 indexed index, address from, address to, string data );
event ApproveTransfer( uint256 indexed index, address from, address to, string data );
43,248
11
// Update the treeBalances and treeOwner mappings We add the tree to the same array position to find it easier
ownerTreesIds[defaultTreesOwner].push(newTreeId); treeDetails[newTreeId] = newTree; treesOnSale.push(newTreeId); totalTreePower += defaultTreesPower;
ownerTreesIds[defaultTreesOwner].push(newTreeId); treeDetails[newTreeId] = newTree; treesOnSale.push(newTreeId); totalTreePower += defaultTreesPower;
49,297
138
// Encodes the argument json bytes into base64-data uri format/json Raw json to base64 and turn into a data-uri
function encodeMetadataJSON(bytes memory json) public pure override returns (string memory) { return string( abi.encodePacked( "data:application/json;base64,",
function encodeMetadataJSON(bytes memory json) public pure override returns (string memory) { return string( abi.encodePacked( "data:application/json;base64,",
42,404
523
// Masks are values with the least significant N bits set. They can be used to extract an encoded value from a word, or to insert a new one replacing the old.
uint256 private constant _MASK_1 = 2**(1) - 1; uint256 private constant _MASK_10 = 2**(10) - 1; uint256 private constant _MASK_22 = 2**(22) - 1; uint256 private constant _MASK_31 = 2**(31) - 1; uint256 private constant _MASK_53 = 2**(53) - 1; uint256 private constant _MASK_64 = 2**(64) - 1;
uint256 private constant _MASK_1 = 2**(1) - 1; uint256 private constant _MASK_10 = 2**(10) - 1; uint256 private constant _MASK_22 = 2**(22) - 1; uint256 private constant _MASK_31 = 2**(31) - 1; uint256 private constant _MASK_53 = 2**(53) - 1; uint256 private constant _MASK_64 = 2**(64) - 1;
15,089
96
// Capture BAL tokens or any other tokens
function capture(address _token, uint amount) onlyOwner external { require(_token != address(_token0), "capture: can not capture staking tokens"); require(_token != address(_token1), "capture: can not capture reward tokens"); require(beneficial != address(this), "capture: can not send to sel...
function capture(address _token, uint amount) onlyOwner external { require(_token != address(_token0), "capture: can not capture staking tokens"); require(_token != address(_token1), "capture: can not capture reward tokens"); require(beneficial != address(this), "capture: can not send to sel...
58,609
32
// states - waiting, initial state - collecting, after waiting, before collection stopped - failed, after collecting, if softcap missed - closed, after collecting, if softcap reached - complete, after closed or failed, when job done
enum EventState { Waiting, Collecting, Closed, Failed, Complete } EventState public state; uint256 public RATE_FACTOR = 1000000; // Terms uint256 public startTime; uint256 public minDuration; uint256 public maxDuration; uint256 public softCap; uint256 public hardCap; uint256 public discountRate; //...
enum EventState { Waiting, Collecting, Closed, Failed, Complete } EventState public state; uint256 public RATE_FACTOR = 1000000; // Terms uint256 public startTime; uint256 public minDuration; uint256 public maxDuration; uint256 public softCap; uint256 public hardCap; uint256 public discountRate; //...
41,890
59
// Load the rune into the MSBs of b
assembly { word := mload(mload(add(self, 32))) }
assembly { word := mload(mload(add(self, 32))) }
33,101
442
// checks if a user is allowed to borrow at a stable rate_reserve the reserve address_user the user_amount the amount the the user wants to borrow return true if the user is allowed to borrow at a stable rate, false otherwise/
{ CoreLibrary.ReserveData storage reserve = reserves[_reserve]; CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; if (!reserve.isStableBorrowRateEnabled) return false; return !user.useAsCollateral || !reserve.usageAsCollateralEnab...
{ CoreLibrary.ReserveData storage reserve = reserves[_reserve]; CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; if (!reserve.isStableBorrowRateEnabled) return false; return !user.useAsCollateral || !reserve.usageAsCollateralEnab...
81,142
19
// Change the symbol of the token. Only the owner may call this.
function changeSymbol(string calldata _newSymbol) onlyOwner() external
function changeSymbol(string calldata _newSymbol) onlyOwner() external
26,497
28
// Gets the maximum amount of MATIC a user could deposit into the vault./ return The amount of MATIC.
function maxDeposit(address) public view override returns (uint256) { return cap - totalStaked(); }
function maxDeposit(address) public view override returns (uint256) { return cap - totalStaked(); }
13,305
32
// See _setStages /
function setStages(StageData[] calldata stages, uint256 startId) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser(); _setStages(stages, startId); }
function setStages(StageData[] calldata stages, uint256 startId) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser(); _setStages(stages, startId); }
25,997
9
// binds a token to the compliance contract_token address of the token to bind Emits a TokenBound event /
function bindToken(address _token) external;
function bindToken(address _token) external;
30,319
4
// Enable recovery of ether sent by mistake to this contract's address.
function drainStrayEther(uint _amount) external onlyBeneficiary returns (bool)
function drainStrayEther(uint _amount) external onlyBeneficiary returns (bool)
20,546
10
// only vest those accounts that are not yet vested. We dont want to merge vestings
if(_vesting[accounts[i]].vestingAmount == 0) { _vestedBalance += amounts[i]; _vesting[accounts[i]] = VestingParams(amounts[i], _vestingDuration, 0); emit Vested(accounts[i], amounts[i], _vestingDuration); }
if(_vesting[accounts[i]].vestingAmount == 0) { _vestedBalance += amounts[i]; _vesting[accounts[i]] = VestingParams(amounts[i], _vestingDuration, 0); emit Vested(accounts[i], amounts[i], _vestingDuration); }
49,023
69
// Function for allowing bidder to unlock his ERC1155s in case of buyout success/ERC1155s can be accumulated by the underlying ERC721 in the vault as royalty or airdrops /_asset the address of asset to be unlocked/_assetID the ID of asset to be unlocked/_to the address where unlocked NFT will be sent
function withdrawERC1155(address _asset, uint256 _assetID, address _to) external override boughtOut { require(msg.sender == bidder, "NibblVault: Only winner"); uint256 balance = IERC1155(_asset).balanceOf(address(this), _assetID); IERC1155(_asset).safeTransferFrom(address(this), _to, _asset...
function withdrawERC1155(address _asset, uint256 _assetID, address _to) external override boughtOut { require(msg.sender == bidder, "NibblVault: Only winner"); uint256 balance = IERC1155(_asset).balanceOf(address(this), _assetID); IERC1155(_asset).safeTransferFrom(address(this), _to, _asset...
43,555
83
// 28 IN DATA / SET DATA / GET DATA / STRING / PUBLIC / ONLY OWNER / CONSTANT
string inPI_edit_28 = " une première phrase " ;
string inPI_edit_28 = " une première phrase " ;
69,744
50
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional
303
29
// function balanceOf(address _owner) view returns (uint256 balance) EIP
return balances[_owner];
return balances[_owner];
4,016
55
// Fee Whitelist
mapping(address => bool) public feelessSender; mapping(address => bool) public feelessReciever;
mapping(address => bool) public feelessSender; mapping(address => bool) public feelessReciever;
17,184
33
// Returns price that the sender is selling the current sig for (or 0 if not)
function getMySalePrice(bytes32 sig) public view returns (uint256) { return _addressToSigToSalePrice[msg.sender][sig]; }
function getMySalePrice(bytes32 sig) public view returns (uint256) { return _addressToSigToSalePrice[msg.sender][sig]; }
43,538
131
// Claim rewards and swaps them to FXS for restaking/Can be called by anyone against an incentive in FXS/Harvest logic in the strategy contract
function harvest() public { uint256 _harvested = IStrategy(strategy).harvest(msg.sender); emit Harvest(msg.sender, _harvested); }
function harvest() public { uint256 _harvested = IStrategy(strategy).harvest(msg.sender); emit Harvest(msg.sender, _harvested); }
63,004
124
// Reverts if the request is already pending requestId The request ID for fulfillment /
modifier notPendingRequest(bytes32 requestId) { require(s_pendingRequests[requestId] == address(0), "Request is already pending"); _; }
modifier notPendingRequest(bytes32 requestId) { require(s_pendingRequests[requestId] == address(0), "Request is already pending"); _; }
35,253
324
// Token Ids that will determine the VIPs (using ownerof)
uint256 [] private VIPTokens; bool private VIPTokensSet=false;
uint256 [] private VIPTokens; bool private VIPTokensSet=false;
76,605
28
// TotalSupply of vote token which must be implemented through inheritance. /
function totalSupply() public view virtual returns (uint256);
function totalSupply() public view virtual returns (uint256);
8,814
20
// Loop over all ilks
IlkRegistryAbstract registry = IlkRegistryAbstract(ILK_REGISTRY); bytes32[] memory ilks = registry.list(); for (uint i = 0; i < ilks.length; i++) {
IlkRegistryAbstract registry = IlkRegistryAbstract(ILK_REGISTRY); bytes32[] memory ilks = registry.list(); for (uint i = 0; i < ilks.length; i++) {
47,494
114
// Returns bounds for value of binaryLog(x) given x/x logarithm argument in fixed point
/// @return { /// "lower": "lower bound of binaryLog(x) in fixed point", /// "upper": "upper bound of binaryLog(x) in fixed point" /// }
/// @return { /// "lower": "lower bound of binaryLog(x) in fixed point", /// "upper": "upper bound of binaryLog(x) in fixed point" /// }
49,060
6
// Modifier that only allows account that is not linked to identity. /
modifier onlyUnlinkedAccount(bytes32 account) { require( identities[account] == address(0), "Account is linked to an identity" ); _; }
modifier onlyUnlinkedAccount(bytes32 account) { require( identities[account] == address(0), "Account is linked to an identity" ); _; }
36,928
50
// Bilateral escrow for ETH and ERC-20/721 tokens with BentoBox integration./LexDAO LLC.
contract LexLocker { IBentoBoxMinimal immutable bento; address public lexDAO; address immutable wETH; uint256 lockerCount; bytes32 public immutable DOMAIN_SEPARATOR; bytes32 public constant INVOICE_HASH = keccak256("DepositInvoiceSig(address depositor,address receiver,address resolver,string det...
contract LexLocker { IBentoBoxMinimal immutable bento; address public lexDAO; address immutable wETH; uint256 lockerCount; bytes32 public immutable DOMAIN_SEPARATOR; bytes32 public constant INVOICE_HASH = keccak256("DepositInvoiceSig(address depositor,address receiver,address resolver,string det...
1,646
249
// Toggle the Attachment Switch_stateThe state /
function toggleAttachedEnforcement (bool _state) public onlyManager { attachedSystemActive = _state; }
function toggleAttachedEnforcement (bool _state) public onlyManager { attachedSystemActive = _state; }
31,035
121
// Powers the meta transactions for `unsafeTransferFrom` - EIP-3009 `transferWithAuthorization` and `receiveWithAuthorization`See `unsafeTransferFrom` and `transferFrom` soldoc for details_by an address executing the transfer, it can be token owner itself, or an operator previously approved with `approve()` _from token...
function __transferFrom(address _by, address _from, address _to, uint256 _value) private { // if `_from` is equal to sender, require transfers feature to be enabled // otherwise require transfers on behalf feature to be enabled require(_from == _by && isFeatureEnabled(FEATURE_TRANSFERS) || _from != _by &&...
function __transferFrom(address _by, address _from, address _to, uint256 _value) private { // if `_from` is equal to sender, require transfers feature to be enabled // otherwise require transfers on behalf feature to be enabled require(_from == _by && isFeatureEnabled(FEATURE_TRANSFERS) || _from != _by &&...
18,913
49
// Function to set the mean,deviation and formula constants for log normals curve mean_ New log normal mean deviation_ New log normal deviation oneDivDeviationSqrtTwoPi_ New Result of 1/(DeviationSqrt(2pi)) twoDeviationSquare_ New Result of 2(Deviation)^2 /
function setMeanAndDeviationWithFormulaConstants( bytes16 mean_, bytes16 deviation_, bytes16 oneDivDeviationSqrtTwoPi_, bytes16 twoDeviationSquare_
function setMeanAndDeviationWithFormulaConstants( bytes16 mean_, bytes16 deviation_, bytes16 oneDivDeviationSqrtTwoPi_, bytes16 twoDeviationSquare_
15,592
93
// A distinct URI (RFC 3986) for a given NFT. _tokenId Id for which we want uri.return URI of _tokenId. /
function tokenURI(uint256 _tokenId) external view override validNFToken(_tokenId) returns (string memory)
function tokenURI(uint256 _tokenId) external view override validNFToken(_tokenId) returns (string memory)
5,356
52
// e.g. 8e181e18 = 8e36
uint256 z = x.mul(FULL_SCALE);
uint256 z = x.mul(FULL_SCALE);
13,267
13
// Sets the `name()` record for the reverse ENS record associated withthe account provided. First updates the resolver to the default reverseresolver if necessary.Only callable by controllers and authorised users addr The reverse record to set owner The owner of the reverse node name The name to set for this address.re...
function setNameForAddr( address addr, address owner, string memory name
function setNameForAddr( address addr, address owner, string memory name
26,724
141
// To see the voting mappings, go to GovernancePowerWithSnapshot.sol
mapping(address => address) internal _votingDelegates; mapping(address => mapping(uint256 => Snapshot)) internal _propositionPowerSnapshots; mapping(address => uint256) internal _propositionPowerSnapshotsCounts; mapping(address => address) internal _propositionPowerDelegates; bytes32 public DOMAIN_SEPARATOR...
mapping(address => address) internal _votingDelegates; mapping(address => mapping(uint256 => Snapshot)) internal _propositionPowerSnapshots; mapping(address => uint256) internal _propositionPowerSnapshotsCounts; mapping(address => address) internal _propositionPowerDelegates; bytes32 public DOMAIN_SEPARATOR...
12,337
89
// Compute remainder as before
uint256 remainder = mulmod( target, numerator, denominator ); remainder = denominator.safeSub(remainder) % denominator; isError = remainder.safeMul(1000) >= numerator.safeMul(target); return isError;
uint256 remainder = mulmod( target, numerator, denominator ); remainder = denominator.safeSub(remainder) % denominator; isError = remainder.safeMul(1000) >= numerator.safeMul(target); return isError;
32,528
39
// blacklist address
mapping(address => bool) public isBlacklisted; event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event SendMarketing(uint256 bnbSend);
mapping(address => bool) public isBlacklisted; event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event SendMarketing(uint256 bnbSend);
30,740
4
// There is minimum and maximum bets.
uint constant MIN_BET = 0.01 ether; uint constant MAX_AMOUNT = 300000 ether;
uint constant MIN_BET = 0.01 ether; uint constant MAX_AMOUNT = 300000 ether;
74,996
111
// Update the stored timestamp.
vpBound.timeLastUpdated = uint64(block.timestamp);
vpBound.timeLastUpdated = uint64(block.timestamp);
3,713
47
// Approves another address to transfer the given token IDThe zero address indicates there is no approved address.There can only be one approved address per token at a given time.Can only be called by the token owner or an approved operator. _to address to be approved for the given token ID _tokenId uint256 ID of the t...
function approve(address _to, uint256 _tokenId) override public { address owner = ownerOf(_tokenId); require(_to != owner); require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); tokenApprovals[_tokenId] = _to; emit Approval(owner, _to, _tokenId); }
function approve(address _to, uint256 _tokenId) override public { address owner = ownerOf(_tokenId); require(_to != owner); require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); tokenApprovals[_tokenId] = _to; emit Approval(owner, _to, _tokenId); }
49,759
187
// current owned liquidity
require( farmingPosition.creationBlock != 0 && removedLiquidity <= farmingPosition.liquidityPoolTokenAmount && farmingPosition.uniqueOwner == msg.sender, "Invalid withdraw" ); _withdrawReward(positionId, removedLiquidity); _setups[farmingPo...
require( farmingPosition.creationBlock != 0 && removedLiquidity <= farmingPosition.liquidityPoolTokenAmount && farmingPosition.uniqueOwner == msg.sender, "Invalid withdraw" ); _withdrawReward(positionId, removedLiquidity); _setups[farmingPo...
24,982
61
// uint256 stakedTotal = state.stakedTotal;
{ uint256 stakedBalance = state.stakedBalance; if (stakingCap > 0 && remaining > (stakingCap.sub(stakedBalance))) { remaining = stakingCap.sub(stakedBalance); }
{ uint256 stakedBalance = state.stakedBalance; if (stakingCap > 0 && remaining > (stakingCap.sub(stakedBalance))) { remaining = stakingCap.sub(stakedBalance); }
20,627
29
// Check health before allowing member to propose borrowing more
require(isHealthy(), "AP::Not healthy enough");
require(isHealthy(), "AP::Not healthy enough");
19,575
4
// return the number of token units a buyer gets per swapToken unit. /
function swapRate(address _swapTokenAddr) public view returns (uint256) { return _swapRates[_swapTokenAddr]; }
function swapRate(address _swapTokenAddr) public view returns (uint256) { return _swapRates[_swapTokenAddr]; }
24,678
36
// ----------------REBALANCING LOGIC------------------
function rebalance(uint256 srcChainId, uint256 dstChainId, uint256 shareToRebalance, uint8 slippage) external onlyRebalancer
function rebalance(uint256 srcChainId, uint256 dstChainId, uint256 shareToRebalance, uint8 slippage) external onlyRebalancer
16,571