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 | // totalPrincipalAmount = totalPrincipalAmount + actualMintAmount | productInfo.totalPrincipalAmount = add_(productInfo.totalPrincipalAmount, vars.actualMintAmount);
_createProductWith(productInfoId, vars.account, vars.actualMintAmount);
VDON(VDONAddress).mint(vars.account, mul_(productInfo.VDONExchangeRate, vars.actualMintAmount));
emit Mint(v... | productInfo.totalPrincipalAmount = add_(productInfo.totalPrincipalAmount, vars.actualMintAmount);
_createProductWith(productInfoId, vars.account, vars.actualMintAmount);
VDON(VDONAddress).mint(vars.account, mul_(productInfo.VDONExchangeRate, vars.actualMintAmount));
emit Mint(v... | 52,645 |
3 | // ==============================================================/ Withdraw NFT from the contract lien Reconstructed lien info lienId The ID for the lien being cleared / | function withdrawNft(Lien calldata lien, uint256 lienId) external;
| function withdrawNft(Lien calldata lien, uint256 lienId) external;
| 13,724 |
145 | // fallback function that allows contract to accept ETH | function () public payable {}
}
| function () public payable {}
}
| 22,207 |
46 | // treasury | bool _successTransferTreasury = platformToken.transfer(treasury, _fees - _partReward * 2);
require(_successTransferTreasury, "Treasury protocol fees transfer failure");
balance = _balance;
isWinnersSet = true;
| bool _successTransferTreasury = platformToken.transfer(treasury, _fees - _partReward * 2);
require(_successTransferTreasury, "Treasury protocol fees transfer failure");
balance = _balance;
isWinnersSet = true;
| 6,404 |
59 | // Get the value of the next burn from the bonding curve / | function getBurnValue(uint256 printNumber)
public
pure
returns (uint256 value)
| function getBurnValue(uint256 printNumber)
public
pure
returns (uint256 value)
| 20,940 |
6 | // returns (bool){ | require (keccak256(abi.encodePacked(tokens[_hashPassport].image)) == keccak256(abi.encodePacked(_image)),
"myvaxxID: The patient does not have a passport");
return true;
| require (keccak256(abi.encodePacked(tokens[_hashPassport].image)) == keccak256(abi.encodePacked(_image)),
"myvaxxID: The patient does not have a passport");
return true;
| 46,753 |
80 | // can later be changed with {transferOwnership}./ Initializes the contract setting the deployer as the initial owner. / | constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| 13,263 |
33 | // Returns the downcasted uint16 from uint256, reverting onoverflow (when the input is greater than largest uint16). Counterpart to Solidity's `uint16` operator. Requirements: - input must fit into 16 bits / | function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
| function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
| 1,342 |
91 | // ZKSeaNFT contract. Contains the nft info in layer1 and layer2 | IZKSeaNFT internal zkSeaNFT;
UniswapV2Factory internal pairmanager;
| IZKSeaNFT internal zkSeaNFT;
UniswapV2Factory internal pairmanager;
| 22,411 |
175 | // reduce | cvx = (crv * reduction) / totalCliffs;
| cvx = (crv * reduction) / totalCliffs;
| 12,930 |
181 | // The LP token used | IBEP20 public lpToken;
| IBEP20 public lpToken;
| 5,189 |
5 | // get Total Supply | function totalSupply() view public returns (uint){
return currentIndex;
}
| function totalSupply() view public returns (uint){
return currentIndex;
}
| 54,823 |
40 | // ------------------------------------------------------------------------ Constructor to allow total tokens minted (upon creation) to be set Name and Symbol can be changed via SetInfo (decided to remove from constructor) ------------------------------------------------------------------------ | constructor(uint256 _totalTokensToMint) payable public {
name = "Morality";
symbol = "MO";
totalSupply = _totalTokensToMint;
decimals = 18;
balances[msg.sender] = totalSupply;
creator = msg.sender;
emit LogFundsReceived(msg.sender, msg.value);
}
| constructor(uint256 _totalTokensToMint) payable public {
name = "Morality";
symbol = "MO";
totalSupply = _totalTokensToMint;
decimals = 18;
balances[msg.sender] = totalSupply;
creator = msg.sender;
emit LogFundsReceived(msg.sender, msg.value);
}
| 10,433 |
7 | // forward is called by the registry and forwards the call to the target gasAmount is the amount of gas to use in the call data is the 4 bytes function selector + arbitrary function datareturn success indicating whether the target call succeeded or failed / | function forward(uint256 gasAmount, bytes memory data) external returns (bool success, uint256 gasUsed) {
if (msg.sender != address(s_registry)) revert();
address target = i_target;
gasUsed = gasleft();
assembly {
let g := gas()
// Compute g -= PERFORM_GAS_CUSHION and check for underflow
... | function forward(uint256 gasAmount, bytes memory data) external returns (bool success, uint256 gasUsed) {
if (msg.sender != address(s_registry)) revert();
address target = i_target;
gasUsed = gasleft();
assembly {
let g := gas()
// Compute g -= PERFORM_GAS_CUSHION and check for underflow
... | 18,912 |
177 | // convert remainder to weth | remainder = swapTokens(position.token, WETH_ADDRESS, canReturn.sub(position.owed));
| remainder = swapTokens(position.token, WETH_ADDRESS, canReturn.sub(position.owed));
| 22,689 |
122 | // Get from the DAO settings | RocketDAOProtocolSettingsRewardsInterface daoSettingsRewards = RocketDAOProtocolSettingsRewardsInterface(getContractAddress("rocketDAOProtocolSettingsRewards"));
return daoSettingsRewards.getRewardsClaimIntervalTime();
| RocketDAOProtocolSettingsRewardsInterface daoSettingsRewards = RocketDAOProtocolSettingsRewardsInterface(getContractAddress("rocketDAOProtocolSettingsRewards"));
return daoSettingsRewards.getRewardsClaimIntervalTime();
| 62,877 |
99 | // _weiAmount Value in wei to be converted into tokensreturn Number of tokens that can be purchased with the specified _weiAmount / | function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.div(rate).mul(10 ** 9);
}
| function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.div(rate).mul(10 ** 9);
}
| 16,660 |
350 | // The loan data is stored, but not initiated yet. | Created,
| Created,
| 24,432 |
16 | // pool index => swapped amount of token0 | mapping(uint => uint) public swappedAmount0P;
| mapping(uint => uint) public swappedAmount0P;
| 24,348 |
414 | // Emitted when the pause is lifted for `name` | event Unpaused(bytes32 name);
| event Unpaused(bytes32 name);
| 44,359 |
30 | // Add oracles to whitelist.//_whitelist user list. | function addOracles(address[] _whitelist) external onlyContractOwner returns (uint) {
for (uint _idx = 0; _idx < _whitelist.length; ++_idx) {
address _oracle = _whitelist[_idx];
if (!oracles[_oracle]) {
oracles[_oracle] = true;
_emitOracleAdded(_ora... | function addOracles(address[] _whitelist) external onlyContractOwner returns (uint) {
for (uint _idx = 0; _idx < _whitelist.length; ++_idx) {
address _oracle = _whitelist[_idx];
if (!oracles[_oracle]) {
oracles[_oracle] = true;
_emitOracleAdded(_ora... | 15,622 |
8 | // IERC20/This interface composes ERC-20 token calls with common extensions. | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
... | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
... | 31,021 |
543 | // Verify that the provided Merkle tree data is valid by using the Merkle proof. | ExchangeBalances.verifyAccountBalance(
uint(S.merkleRoot),
merkleProof
);
| ExchangeBalances.verifyAccountBalance(
uint(S.merkleRoot),
merkleProof
);
| 31,689 |
4,858 | // 2430 | entry "diploidized" : ENG_ADJECTIVE
| entry "diploidized" : ENG_ADJECTIVE
| 19,042 |
2 | // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` | address internal singleton;
| address internal singleton;
| 8,522 |
63 | // spawningForIndexes: per address, per point, (index + 1) inthe spawningFor array | mapping(address => mapping(uint32 => uint256)) public spawningForIndexes;
| mapping(address => mapping(uint32 => uint256)) public spawningForIndexes;
| 36,908 |
257 | // Calculates TWAP from uniswapWhen liquidity is low, this can be manipulated by an end of block -> next block attack. We delay the activation of rebases 12 hours after liquidity incentives to reduce this attack vector. Additional there is very little supply to be able to manipulate this during that time period of high... | function getTWAP() internal returns (uint256) {
(
uint256 priceCumulative,
uint32 blockTimestamp
) = UniswapV2OracleLibrary.currentCumulativePrices(
uniswap_pair,
isToken0
);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // ... | function getTWAP() internal returns (uint256) {
(
uint256 priceCumulative,
uint32 blockTimestamp
) = UniswapV2OracleLibrary.currentCumulativePrices(
uniswap_pair,
isToken0
);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // ... | 14,341 |
161 | // Returns a token ID owned by `owner` at a given `index` of its token list. | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSuppl... | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSuppl... | 7,726 |
161 | // Gets the reward amount in saved without withdrawal and returns the sum of all values. / | uint256 value =
| uint256 value =
| 19,324 |
2 | // Thrown when the requested amount for a transfer is larger than the permissioned amount/maxAmount The maximum amount a spender can request to transfer | error InvalidAmount(uint256 maxAmount);
| error InvalidAmount(uint256 maxAmount);
| 19,777 |
91 | // Add tokens&bonus amount to counters | function addToStat(uint tokens, uint bonus) internal {
uint total = tokens + bonus;
totalSupply = totalSupply.add(total);
//tokensBought = tokensBought.add(tokens.div(multiplier));
//tokensBonus = tokensBonus.add(bonus.div(multiplier));
tokensSoldTotal = tokensSoldTotal.add(t... | function addToStat(uint tokens, uint bonus) internal {
uint total = tokens + bonus;
totalSupply = totalSupply.add(total);
//tokensBought = tokensBought.add(tokens.div(multiplier));
//tokensBonus = tokensBonus.add(bonus.div(multiplier));
tokensSoldTotal = tokensSoldTotal.add(t... | 28,397 |
11 | // Logs bets + output to web3 for precise &39;payout on win&39; field in UI | event LogBet(address sender, uint value, uint rollUnder);
| event LogBet(address sender, uint value, uint rollUnder);
| 35,387 |
4 | // MTX is invalid after this time. | uint256 expirationTimeSeconds;
| uint256 expirationTimeSeconds;
| 27,994 |
1 | // price of 1 token in GWEI | }
| }
| 32,789 |
14 | // Move the rose to the Active Pool, and mint the OSDAmount to the borrower | _activePoolAddColl(contractsCache.activePool, vars.netColl);
_withdrawOSD(contractsCache.activePool, contractsCache.osdToken, msg.sender, _OSDAmount, vars.netDebt);
| _activePoolAddColl(contractsCache.activePool, vars.netColl);
_withdrawOSD(contractsCache.activePool, contractsCache.osdToken, msg.sender, _OSDAmount, vars.netDebt);
| 31,257 |
11 | // Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero./ | event Transfer(address indexed from, address indexed to, uint256 value);
| event Transfer(address indexed from, address indexed to, uint256 value);
| 2,405 |
1,416 | // Liquidations are unique by ID per sponsor | mapping(address => LiquidationData[]) public liquidations;
| mapping(address => LiquidationData[]) public liquidations;
| 12,582 |
45 | // return true if crowdsale event has ended | function hasEnded() public constant returns (bool) {
return now > ICOEndTime;
}
| function hasEnded() public constant returns (bool) {
return now > ICOEndTime;
}
| 47,362 |
13 | // a modifier which allows only `panicOwner` to call a function. | modifier onlyPanicOwner() {
require(panicOwner == _msgSender(),
"TokenVault: caller is not the panic owner");
_;
}
| modifier onlyPanicOwner() {
require(panicOwner == _msgSender(),
"TokenVault: caller is not the panic owner");
_;
}
| 40,416 |
4 | // 32 bytes returned: check if non-zero | case 0x20 {
| case 0x20 {
| 52,117 |
23 | // Pausable Base contract which allows children to implement an emergency stop mechanism. / | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only wh... | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only wh... | 2,763 |
36 | // only owner address can set minBet / | {
minBet = newMinimumBet;
}
| {
minBet = newMinimumBet;
}
| 12,289 |
130 | // Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address.- `quantity` cannot be larger than the max batch size. | * Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), 'ERC721A: mint to the zero address');
// We know if the first token in the bat... | * Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), 'ERC721A: mint to the zero address');
// We know if the first token in the bat... | 17,233 |
115 | // The address of initializer to initialize staking address. | address private _initializer;
| address private _initializer;
| 29,550 |
14 | // administrator list (see above on what they can do)mapping(bytes32 => bool) public administrators; | mapping(address => bool) public administrators;
| mapping(address => bool) public administrators;
| 19,441 |
30 | // this function MUST be called on any balance changes, otherwise can be used to infinitely claim fees Fees are segregated from core funds, so fees can never put liquidity at risk | function _updateFor(address recipient) internal {
uint _supplied = balanceOf[recipient]; // get LP balance of `recipient`
if (_supplied > 0) {
uint _supplyIndex0 = supplyIndex0[recipient]; // get last adjusted index0 for recipient
uint _supplyIndex1 = supplyIndex1[recipient];... | function _updateFor(address recipient) internal {
uint _supplied = balanceOf[recipient]; // get LP balance of `recipient`
if (_supplied > 0) {
uint _supplyIndex0 = supplyIndex0[recipient]; // get last adjusted index0 for recipient
uint _supplyIndex1 = supplyIndex1[recipient];... | 34,190 |
3 | // contracts | IERC20 public reignToken;
ISovWrapper public wrapper;
uint128 public lastInitializedEpoch;
uint256 public epochDuration; // init from staking contract
uint256 public epochStart; // init from staking contract
mapping(uint128 => uint256) private _sizeAtEpoch;
mapping(address => uint128) priv... | IERC20 public reignToken;
ISovWrapper public wrapper;
uint128 public lastInitializedEpoch;
uint256 public epochDuration; // init from staking contract
uint256 public epochStart; // init from staking contract
mapping(uint128 => uint256) private _sizeAtEpoch;
mapping(address => uint128) priv... | 29 |
15 | // Sanity check: has that much to spend | if (routerBalance < _maxIn) revert PortalFacet__repayAavePortal_insufficientFunds();
| if (routerBalance < _maxIn) revert PortalFacet__repayAavePortal_insufficientFunds();
| 23,039 |
17 | // Check in Foundation if msg.sender is the owner of this contract.Same remark. / | function isIdentityOwner() internal view returns (bool) {
return msg.sender == identityOwner();
}
| function isIdentityOwner() internal view returns (bool) {
return msg.sender == identityOwner();
}
| 37,216 |
53 | // Unlocks the contract for owner when _lockTime is exceeds | function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
| function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
| 8,098 |
69 | // Emitted when an admin supports a market | event MarketAdded(
address iToken,
uint256 collateralFactor,
uint256 borrowFactor,
uint256 supplyCapacity,
uint256 borrowCapacity,
uint256 distributionFactor
);
function _addMarket(
| event MarketAdded(
address iToken,
uint256 collateralFactor,
uint256 borrowFactor,
uint256 supplyCapacity,
uint256 borrowCapacity,
uint256 distributionFactor
);
function _addMarket(
| 13,209 |
191 | // Check that tokenId was not transferred by `_beforeTokenTransfer` hook | require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
| require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
| 2,458 |
15 | // starting | uint256 public startTime = 0; // January 1, 1970 12:00:00
| uint256 public startTime = 0; // January 1, 1970 12:00:00
| 71,146 |
1 | // Public Functions//Relays a cross domain message to a contract.@inheritdoc iOVM_L2CrossDomainMessenger / | function relayMessage(
| function relayMessage(
| 25,126 |
63 | // We will transfer and then empty the rewards for the sender. | _rewards[msg.sender] = 0;
roomToken.transferFrom(roomTokenRewardsReservoirAddress, msg.sender, reward);
emit ClaimReward(msg.sender, reward);
| _rewards[msg.sender] = 0;
roomToken.transferFrom(roomTokenRewardsReservoirAddress, msg.sender, reward);
emit ClaimReward(msg.sender, reward);
| 73,453 |
49 | // Total number of owners | uint256 private _totalOwner;
| uint256 private _totalOwner;
| 29,463 |
17 | // WARNING: This contract assumes synth and reserve are equally valuable and share the same decimals (e.g. Dola and Dai) DO NOT USE WITH USDC OR USDT DO NOT USE WITH NON-STANDARD ERC20 TOKENS | contract Stabilizer {
using SafeMath for uint;
uint public constant MAX_FEE = 1000; // 10%
uint public constant FEE_DENOMINATOR = 10000;
uint public buyFee;
uint public sellFee;
uint public supplyCap;
uint public supply;
ERC20 public synth;
ERC20 public reserve;
address public o... | contract Stabilizer {
using SafeMath for uint;
uint public constant MAX_FEE = 1000; // 10%
uint public constant FEE_DENOMINATOR = 10000;
uint public buyFee;
uint public sellFee;
uint public supplyCap;
uint public supply;
ERC20 public synth;
ERC20 public reserve;
address public o... | 11,109 |
1 | // migration functions migrate the data from the previous contract in stages all addresses are included for transparency and easy verification however addresses with no robots (i.e. failed transaction and never bought properly) have been commented out. | // to view the full list of state assignments, go to etherscan.io/address/{address} and you can view the verified
mapping (address => uint[]) public userToRobots;
function _migrate(uint _index) external onlyOwner {
bytes4 selector = bytes4(sha3("setData()"));
address a = migrators[_index];... | // to view the full list of state assignments, go to etherscan.io/address/{address} and you can view the verified
mapping (address => uint[]) public userToRobots;
function _migrate(uint _index) external onlyOwner {
bytes4 selector = bytes4(sha3("setData()"));
address a = migrators[_index];... | 40,517 |
3 | // set nominee owner, granting permission to call acceptOwnership / | function _transferOwnership(address account) internal virtual override {
SafeOwnableStorage.layout().setNomineeOwner(account);
}
| function _transferOwnership(address account) internal virtual override {
SafeOwnableStorage.layout().setNomineeOwner(account);
}
| 20,925 |
6 | // CNSRegistryForwarder CNSRegistryForwarder simplifies operation with legacy meta-transactions.It works on top of existing SignatureController contract. / | contract CNSRegistryForwarder is BaseRoutingForwarder {
IForwarder private _target;
constructor(IForwarder target) {
_target = target;
_addRoute('transferFrom(address,address,uint256)', 'transferFromFor(address,address,uint256,bytes)');
_addRoute('safeTransferFrom(address,address,uint25... | contract CNSRegistryForwarder is BaseRoutingForwarder {
IForwarder private _target;
constructor(IForwarder target) {
_target = target;
_addRoute('transferFrom(address,address,uint256)', 'transferFromFor(address,address,uint256,bytes)');
_addRoute('safeTransferFrom(address,address,uint25... | 83,548 |
1 | // coin per token | uint256 private cpt;
uint256 private fund;
uint256 private lastBalance;
| uint256 private cpt;
uint256 private fund;
uint256 private lastBalance;
| 48,687 |
20 | // To withdraw the ether sent by marketplace | function withdraw() public {
require(msg.sender == owner, "Only the owner can withdraw");
payable(owner).transfer(address(this).balance);
}
| function withdraw() public {
require(msg.sender == owner, "Only the owner can withdraw");
payable(owner).transfer(address(this).balance);
}
| 22,955 |
155 | // If no reward is currently being distributed, the new rate is just `reward / duration` | rewardRate = reward / rewardsDuration;
| rewardRate = reward / rewardsDuration;
| 50,918 |
58 | // This is where your custom logic goesWhen this code executes, this contract will hold _amount of _tokenBorrowIt is important that, by the end of the execution of this function, this contract holds at least _amountToRepay of the _tokenPay tokenPaying back the flash-loan happens automatically for you -- DO NOT pay back... | function execute(address _tokenBorrow, uint _amount, address _tokenPay, uint _amountToRepay, bytes memory _userData) internal override {
// do whatever you want here
// we're just going to update some local variables because we're boring
// but you could do some arbitrage or liquidaztions or... | function execute(address _tokenBorrow, uint _amount, address _tokenPay, uint _amountToRepay, bytes memory _userData) internal override {
// do whatever you want here
// we're just going to update some local variables because we're boring
// but you could do some arbitrage or liquidaztions or... | 14,677 |
66 | // Private Functions//Calculates the integer ceiling of the log base 2 of an input. _in Unsigned input to calculate the log.return ceil(log_base_2(_in)) / | function _ceilLog2(uint256 _in) private pure returns (uint256) {
require(_in > 0, 'Lib_MerkleTree: Cannot compute ceil(log_2) of 0.');
if (_in == 1) {
return 0;
}
// Find the highest set bit (will be floor(log_2)).
// Borrowed with <3 from https://github.com/ethereum/solidity-examples
... | function _ceilLog2(uint256 _in) private pure returns (uint256) {
require(_in > 0, 'Lib_MerkleTree: Cannot compute ceil(log_2) of 0.');
if (_in == 1) {
return 0;
}
// Find the highest set bit (will be floor(log_2)).
// Borrowed with <3 from https://github.com/ethereum/solidity-examples
... | 13,868 |
103 | // Approves a wallet address to spend on behalf of the sender./ This function is overridden to leverage transfer state feature./ _spender The address which is approved to spend on behalf of the sender./ _value The amount of tokens approve to spend. | function approve(address _spender, uint256 _value)
public
revertIfLocked(msg.sender)
canTransfer(msg.sender)
| function approve(address _spender, uint256 _value)
public
revertIfLocked(msg.sender)
canTransfer(msg.sender)
| 49,619 |
161 | // the powers of the given validators in the same order as above | uint256[] powers;
| uint256[] powers;
| 40,392 |
2 | // balances[0x1111...] = 100; |
mapping(address => mapping(address => uint)) allowed;
|
mapping(address => mapping(address => uint)) allowed;
| 20,843 |
172 | // Sets {name} as "EURO Stable Token", {symbol} as "EURST" and {decimals} with 18. Setup roles {DEFAULT_ADMIN_ROLE}, {MINTER_ROLE}, {WIPER_ROLE} and {REGISTRY_MANAGER_ROLE}. Mints `initialSupply` tokens and assigns them to the caller. / | constructor(
uint256 _initialSupply,
IUserRegistry _userRegistry,
address _minter,
address _wiper,
address _registryManager
) public ERC20("EURO Stable Token", "EURST") {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MINTER_ROLE, _minter);
... | constructor(
uint256 _initialSupply,
IUserRegistry _userRegistry,
address _minter,
address _wiper,
address _registryManager
) public ERC20("EURO Stable Token", "EURST") {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MINTER_ROLE, _minter);
... | 49,942 |
126 | // will pause the system | function pause() public onlyPauser {
if (msg.sender == coreDev) {
shouldPauseDev = true;
} else {
shouldPauseTrustee = true;
}
if (shouldPauseDev && shouldPauseTrustee) {
systemPause = true;
// pause the system
boringDAO().p... | function pause() public onlyPauser {
if (msg.sender == coreDev) {
shouldPauseDev = true;
} else {
shouldPauseTrustee = true;
}
if (shouldPauseDev && shouldPauseTrustee) {
systemPause = true;
// pause the system
boringDAO().p... | 80,397 |
35 | // Implements IControllerGovernanceEngine |
function state()
public
constant
returns (
Gov.State s
)
|
function state()
public
constant
returns (
Gov.State s
)
| 32,417 |
26 | // Company should get paid here | remainder -= (news[_id].totalFundAmount * percentageCompany / 100) / news[_id].totalAuditors;
| remainder -= (news[_id].totalFundAmount * percentageCompany / 100) / news[_id].totalAuditors;
| 26,297 |
0 | // Finney to Wei | uint256 mintPriceInWei = uint256(edition.contractMintPriceInFinney) *
10e14;
| uint256 mintPriceInWei = uint256(edition.contractMintPriceInFinney) *
10e14;
| 7,661 |
33 | // Burns all tokens of the eligible burner / | function burnAllTokens() public isBurner(msg.sender) {
require(balances[msg.sender]>0);
uint256 value = balances[msg.sender];
totalSupply = totalSupply.sub(value);
balances[msg.sender] = 0;
emit Burn(msg.sender, value);
}
| function burnAllTokens() public isBurner(msg.sender) {
require(balances[msg.sender]>0);
uint256 value = balances[msg.sender];
totalSupply = totalSupply.sub(value);
balances[msg.sender] = 0;
emit Burn(msg.sender, value);
}
| 20,145 |
47 | // See {ERC20-totalSupply}. / | function totalSupply() external view virtual override returns (uint256) {
return _totalSupply;
}
| function totalSupply() external view virtual override returns (uint256) {
return _totalSupply;
}
| 8,361 |
113 | // ======== CONSTRUCTOR ======== / address _rewardPool, | address _curve3Pool,
address _rewardCollector,
address _ftmAddress,
uint256 _ftmAddressChangeTimelock,
uint256 _timelockInBlocks,
address _router
| address _curve3Pool,
address _rewardCollector,
address _ftmAddress,
uint256 _ftmAddressChangeTimelock,
uint256 _timelockInBlocks,
address _router
| 8,967 |
353 | // gasAccountTargetEthBalance_ The target ETH balance of the gas account | function updateGasAccountTargetEthBalance(uint256 gasAccountTargetEthBalance_)
external;
| function updateGasAccountTargetEthBalance(uint256 gasAccountTargetEthBalance_)
external;
| 63,518 |
26 | // Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow. This will "floor" the product. a a FixedPoint. b a uint256.return the product of `a` and `b`. / | function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.mul(b));
}
| function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.mul(b));
}
| 8,908 |
174 | // Revert if the creator payouts are not set. | if (creatorPayoutsLength == 0) {
revert CreatorPayoutsNotSet();
}
| if (creatorPayoutsLength == 0) {
revert CreatorPayoutsNotSet();
}
| 15,096 |
19 | // extract and store the current bitcoin address | payerRefundAddress[_requestId][j] = Bytes.extractString(_payerRefundAddress, sizeCurrentBitcoinAddress, ++cursor);
| payerRefundAddress[_requestId][j] = Bytes.extractString(_payerRefundAddress, sizeCurrentBitcoinAddress, ++cursor);
| 23,047 |
1 | // SIZE / TBDreturn TBD / | function size(
Column[] memory _column
| function size(
Column[] memory _column
| 27,025 |
4 | // 2/3 of validators must sign to interact | address[] public _validators;
| address[] public _validators;
| 31,594 |
53 | // Getter of the delay between queuing and executionreturn The delay in seconds / | function getDelay() external view override returns (uint256) {
return _delay;
}
| function getDelay() external view override returns (uint256) {
return _delay;
}
| 75,959 |
10 | // Returns the zamzam token / | function token() external view returns (IERC20Upgradeable) {
return zamzamToken;
}
| function token() external view returns (IERC20Upgradeable) {
return zamzamToken;
}
| 32,977 |
113 | // import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
function borrowBalanceCurrent(address _account) external returns (uint256);
function borrowBalanceStored(address _account) external view returns (uint256);
function balanceOfUnderlying(address _account) external returns (uint256);
|
function borrowBalanceCurrent(address _account) external returns (uint256);
function borrowBalanceStored(address _account) external view returns (uint256);
function balanceOfUnderlying(address _account) external returns (uint256);
| 15,849 |
13 | // Returns the sender whitelist set by the `setSendersWhitelist` function. | function getSendersWhitelist() external view returns(address[] memory whitelist) {
whitelist = _sendersWhitelist;
}
| function getSendersWhitelist() external view returns(address[] memory whitelist) {
whitelist = _sendersWhitelist;
}
| 33,432 |
5 | // Event raised only the first time this NFT receives a vote | event FirstVote(address indexed tokenAddress, uint256 indexed tokenId);
| event FirstVote(address indexed tokenAddress, uint256 indexed tokenId);
| 28,133 |
8 | // TODO: Source | uint256 public constant UNUSED_FUNDS_MIN_DEPOSIT_SIZE = 1;
uint256 public constant MIN_LOAN_DURATION = 30 days;
uint256 public constant MIN_LOAN_PAYMENT_INTERVAL = 2 days;
uint256 public constant MAX_LOAN_DURATION = 1825 days;
uint256 public constant MAX_LOAN_PAYMENT_INTERVAL = 180 days;
uint... | uint256 public constant UNUSED_FUNDS_MIN_DEPOSIT_SIZE = 1;
uint256 public constant MIN_LOAN_DURATION = 30 days;
uint256 public constant MIN_LOAN_PAYMENT_INTERVAL = 2 days;
uint256 public constant MAX_LOAN_DURATION = 1825 days;
uint256 public constant MAX_LOAN_PAYMENT_INTERVAL = 180 days;
uint... | 51,383 |
48 | // Allows a farmer to mark an item 'Packed'also marks farmer address and block number into itemHistory. Only a farmer can call it. _upc: uint | * Emits an {Packed} event.
*/
function packItem(uint _upc) public
processed(_upc)
verifyCaller(msg.sender)
onlyFarmer()
{
// Update the appropriate fields
items[_upc].itemState = State.Packed;
// Emit the appropriate event
emit Packed(_upc);
//itemsHistory?
itemsHistory[_... | * Emits an {Packed} event.
*/
function packItem(uint _upc) public
processed(_upc)
verifyCaller(msg.sender)
onlyFarmer()
{
// Update the appropriate fields
items[_upc].itemState = State.Packed;
// Emit the appropriate event
emit Packed(_upc);
//itemsHistory?
itemsHistory[_... | 21,569 |
21 | // ------------------------------------------------------------------------ Transfer tokens from the from account to the to accountThe calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have suf... | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(from, to, toke... | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(from, to, toke... | 3,802 |
19 | // change Muon's app id/appIdd distinguishes us from other Muon apps/appId_ Muon's app id | function setAppId(uint8 appId_) external onlyOwner {
emit SetAppId(appId, appId_);
appId = appId_;
}
| function setAppId(uint8 appId_) external onlyOwner {
emit SetAppId(appId, appId_);
appId = appId_;
}
| 46,563 |
25 | // ๋ง์ฝ ์๋์ ๋ณธ๋ถ๊ฐ ์์ ์๋ ๊ฒฝ์ฐ, ์ฒ์ ์ง๋ ๊ณณ ์ฃผ๋ณ์ ์ ๊ตฐ์ ๊ฑด๋ฌผ์ด ์กด์ฌํ๋ฉด ์๋ฉ๋๋ค. | if (ownerToHQIds[owner].length == 0) {
for (uint i = (col <= 3 ? 0 : col - 3); i <= (col >= 96 ? 99 : col + 3); i += 1) {
for (uint j = (row <= 3 ? 0 : row - 3); j <= (row >= 96 ? 99 : row + 3); j += 1) {
require(positionToBuildingId[i][j] == 0 || buildings[positionToBuildingId[i][j]].owner == owner);
... | if (ownerToHQIds[owner].length == 0) {
for (uint i = (col <= 3 ? 0 : col - 3); i <= (col >= 96 ? 99 : col + 3); i += 1) {
for (uint j = (row <= 3 ? 0 : row - 3); j <= (row >= 96 ? 99 : row + 3); j += 1) {
require(positionToBuildingId[i][j] == 0 || buildings[positionToBuildingId[i][j]].owner == owner);
... | 24,739 |
0 | // Mint 55 tokens for the team. | for( uint i = 0; i < 55; i++ ) {
_safeMint( _team[1], i );
}
| for( uint i = 0; i < 55; i++ ) {
_safeMint( _team[1], i );
}
| 4,391 |
12 | // Whether `a` is less than `b`. a a FixedPoint. b a uint256.return True if `a < b`, or False. / | function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue < fromUnscaledUint(b).rawValue;
}
| function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue < fromUnscaledUint(b).rawValue;
}
| 8,894 |
2 | // Write / | {
require(hasRole(FACTORY_ADMIN, msg.sender), "WINTokenSale: Restricted to FACTORY_ADMIN role");
require(whitelistContract.getWhitelistStatus(tx.origin), "WINTokenSale: user is not in whitelist");
require(ERC1155(winTokenContract).balanceOf(address(this), collectionId) >= _amount,"WINTokenSa... | {
require(hasRole(FACTORY_ADMIN, msg.sender), "WINTokenSale: Restricted to FACTORY_ADMIN role");
require(whitelistContract.getWhitelistStatus(tx.origin), "WINTokenSale: user is not in whitelist");
require(ERC1155(winTokenContract).balanceOf(address(this), collectionId) >= _amount,"WINTokenSa... | 23,315 |
9 | // Clones the allowlist using EIP-1167 template during new protocol registration / | function cloneAllowlist() internal returns (address allowlistAddress) {
bytes20 templateAddress = bytes20(allowlistTemplateAddress);
assembly {
let clone := mload(0x40)
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
mstore(add(clone,... | function cloneAllowlist() internal returns (address allowlistAddress) {
bytes20 templateAddress = bytes20(allowlistTemplateAddress);
assembly {
let clone := mload(0x40)
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
mstore(add(clone,... | 2,342 |
55 | // Should be emitted when the arbitration is requested. _questionID The ID of the question with the request for arbitration. _requester The address of the arbitration requester. _maxPrevious The maximum value of the current bond for the question. The arbitration request will get rejected if the current bond is greater ... | event ArbitrationRequested(bytes32 indexed _questionID, address indexed _requester, uint256 _maxPrevious);
| event ArbitrationRequested(bytes32 indexed _questionID, address indexed _requester, uint256 _maxPrevious);
| 45,516 |
30 | // event when someone bought tokens by ETH | event investmentReceived(
address sender,
uint weis,
uint total
);
uint256 public maxSupply = 298500000000000000000000000;
uint256 public allowedToBeSold = 104475000000000000000000000;
address public founder = address( 0x3abb86C7C1a533Eb0464E9BD870FD1b501C7A8A8 );
uint256 public rate = 2800;
| event investmentReceived(
address sender,
uint weis,
uint total
);
uint256 public maxSupply = 298500000000000000000000000;
uint256 public allowedToBeSold = 104475000000000000000000000;
address public founder = address( 0x3abb86C7C1a533Eb0464E9BD870FD1b501C7A8A8 );
uint256 public rate = 2800;
| 79,660 |
18 | // Total HND equivalents | rewards[2] = rewards[0] + rewards[1];
| rewards[2] = rewards[0] + rewards[1];
| 44,711 |
13 | // require(price == 0,"Price is zero!"); require(mToU == 0,"mToU is zero"); require(UToI == 0,"UToI is zero"); | finalMatic = ((price*100000000/UToI)/mToU);
emit maticevent(finalMatic);
map[symbol] = finalMatic;
return finalMatic;
| finalMatic = ((price*100000000/UToI)/mToU);
emit maticevent(finalMatic);
map[symbol] = finalMatic;
return finalMatic;
| 33,383 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.