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 |
|---|---|---|---|---|
13 | // 每个用户状态状态 | mapping (address => mapping (uint64 => ServiceStat)) public serviceStatMap;
| mapping (address => mapping (uint64 => ServiceStat)) public serviceStatMap;
| 23,601 |
106 | // The public identifier for the right to sweep tokens. | bytes32 public constant SWEEP = keccak256("SWEEP");
| bytes32 public constant SWEEP = keccak256("SWEEP");
| 45,182 |
2 | // lib/dss-exec-lib/src/DssExecLib.sol DssExecLib.sol -- MakerDAO Executive Spellcrafting Library Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU Affero General Public License for more details. You should have received a | /* import { CollateralOpts } from "./CollateralOpts.sol"; */
interface Initializable {
function init(bytes32) external;
}
| /* import { CollateralOpts } from "./CollateralOpts.sol"; */
interface Initializable {
function init(bytes32) external;
}
| 16,162 |
16 | // We distribute the rewards first, so that the withdrawing staker receives all of their allocated rewards, before setting an `endTime`. | distributeRewards(staker, blockTimestamp);
staker.endTime = blockTimestamp;
| distributeRewards(staker, blockTimestamp);
staker.endTime = blockTimestamp;
| 38,384 |
12 | // Save allele on current index | aux = geneticSequence[i];
| aux = geneticSequence[i];
| 1,276 |
4 | // Transfer and lock to multiple accounts with a single transaction. Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License) / | function multiTransferAndLock(
address[] calldata to,
uint256[] calldata value,
uint32 lockTime,
uint32 periodLength,
uint16 periods
| function multiTransferAndLock(
address[] calldata to,
uint256[] calldata value,
uint32 lockTime,
uint32 periodLength,
uint16 periods
| 18,383 |
103 | // Here the owner can reclaim the tokens from a participant if/the token is not released yet. Refund will be handled offband./fromWhom address of the participant whose tokens we want to claim | function transferToOwner(address fromWhom) public onlyOwner {
if (released) revert();
uint amount = balanceOf(fromWhom);
balances[fromWhom] = balances[fromWhom].sub(amount);
balances[owner] = balances[owner].add(amount);
Transfer(fromWhom, owner, amount);
OwnerReclaim(fromWhom, amount);
}
| function transferToOwner(address fromWhom) public onlyOwner {
if (released) revert();
uint amount = balanceOf(fromWhom);
balances[fromWhom] = balances[fromWhom].sub(amount);
balances[owner] = balances[owner].add(amount);
Transfer(fromWhom, owner, amount);
OwnerReclaim(fromWhom, amount);
}
| 48,809 |
24 | // This function should be called only by account with BURN_TOKENS permissions_tokenAddress address of token_who address whose tokens will be burned_amount amount of tokens which will be burnedthis function burn tokens for address _who/ | function burnTokens(address _tokenAddress, address _who, uint _amount) public isCanDo(BURN_TOKENS) {
emit DaoBaseBurnTokens(_tokenAddress, _who, _amount);
DaoBaseLib.burnTokens(
daoStorage,
_tokenAddress,
_who,
_amount
);
}
| function burnTokens(address _tokenAddress, address _who, uint _amount) public isCanDo(BURN_TOKENS) {
emit DaoBaseBurnTokens(_tokenAddress, _who, _amount);
DaoBaseLib.burnTokens(
daoStorage,
_tokenAddress,
_who,
_amount
);
}
| 10,299 |
142 | // Create pending burn if sender is opted-in and the permaboost is active | IOptIn.OptInStatus memory optInStatus = getOptInStatus(msg.sender);
if (optInStatus.isOptedIn && optInStatus.permaBoostActive) {
_createPendingTransfer({
opType: OP_TYPE_BURN,
spender: msg.sender,
from: msg.sender,
to: address(0),
amount: amount,
data: data,
optInStatus: optInStatus
| IOptIn.OptInStatus memory optInStatus = getOptInStatus(msg.sender);
if (optInStatus.isOptedIn && optInStatus.permaBoostActive) {
_createPendingTransfer({
opType: OP_TYPE_BURN,
spender: msg.sender,
from: msg.sender,
to: address(0),
amount: amount,
data: data,
optInStatus: optInStatus
| 5,195 |
23 | // Reverts if the contract is not in an initializing state. See {onlyInitializing}. / | function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
| function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
| 28,331 |
50 | // See {IERC721-approve}. | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all");
_approve(to, tokenId);
}
| function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all");
_approve(to, tokenId);
}
| 32,120 |
62 | // End token timestamp, used only from UI | uint256 public endT;
| uint256 public endT;
| 19,155 |
435 | // round 22 | ark(i, q, 15262034989144652068456967541137853724140836132717012646544737680069032573006);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 15262034989144652068456967541137853724140836132717012646544737680069032573006);
sbox_partial(i, q);
mix(i, q);
| 49,296 |
2 | // add a trusted currencyContract _newContractAddress The address of the currencyContract / | function adminAddTrustedCurrencyContract(address _newContractAddress)
external
onlyOwner
| function adminAddTrustedCurrencyContract(address _newContractAddress)
external
onlyOwner
| 42,380 |
27 | // mint tenderTokens | require(tenderToken.mint(_for, amountOut), "TENDER_MINT_FAILED");
| require(tenderToken.mint(_for, amountOut), "TENDER_MINT_FAILED");
| 20,715 |
257 | // Get a user's asset balance | function balanceOf(
Store.State storage state,
Types.BalancePath memory balancePath,
address asset
)
internal
view
returns (uint256)
| function balanceOf(
Store.State storage state,
Types.BalancePath memory balancePath,
address asset
)
internal
view
returns (uint256)
| 12,629 |
175 | // LendingPoolAddressesProvider contractIs the main registry of the protocol. All the different components of the protocol are accessible through the addresses provider.Aave/ | contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider, AddressStorage {
//events
event LendingPoolUpdated(address indexed newAddress);
event LendingPoolCoreUpdated(address indexed newAddress);
event LendingPoolParametersProviderUpdated(address indexed newAddress);
event LendingPoolManagerUpdated(address indexed newAddress);
event LendingPoolConfiguratorUpdated(address indexed newAddress);
event LendingPoolLiquidationManagerUpdated(address indexed newAddress);
event LendingPoolDataProviderUpdated(address indexed newAddress);
event EthereumAddressUpdated(address indexed newAddress);
event PriceOracleUpdated(address indexed newAddress);
event LendingRateOracleUpdated(address indexed newAddress);
event FeeProviderUpdated(address indexed newAddress);
event TokenDistributorUpdated(address indexed newAddress);
event ProxyCreated(bytes32 id, address indexed newAddress);
bytes32 private constant LENDING_POOL = "LENDING_POOL";
bytes32 private constant LENDING_POOL_CORE = "LENDING_POOL_CORE";
bytes32 private constant LENDING_POOL_CONFIGURATOR = "LENDING_POOL_CONFIGURATOR";
bytes32 private constant LENDING_POOL_PARAMETERS_PROVIDER = "PARAMETERS_PROVIDER";
bytes32 private constant LENDING_POOL_MANAGER = "LENDING_POOL_MANAGER";
bytes32 private constant LENDING_POOL_LIQUIDATION_MANAGER = "LIQUIDATION_MANAGER";
bytes32 private constant LENDING_POOL_FLASHLOAN_PROVIDER = "FLASHLOAN_PROVIDER";
bytes32 private constant DATA_PROVIDER = "DATA_PROVIDER";
bytes32 private constant ETHEREUM_ADDRESS = "ETHEREUM_ADDRESS";
bytes32 private constant PRICE_ORACLE = "PRICE_ORACLE";
bytes32 private constant LENDING_RATE_ORACLE = "LENDING_RATE_ORACLE";
bytes32 private constant FEE_PROVIDER = "FEE_PROVIDER";
bytes32 private constant WALLET_BALANCE_PROVIDER = "WALLET_BALANCE_PROVIDER";
bytes32 private constant TOKEN_DISTRIBUTOR = "TOKEN_DISTRIBUTOR";
/**
* @dev returns the address of the LendingPool proxy
* @return the lending pool proxy address
**/
function getLendingPool() public view returns (address) {
return getAddress(LENDING_POOL);
}
/**
* @dev updates the implementation of the lending pool
* @param _pool the new lending pool implementation
**/
function setLendingPoolImpl(address _pool) public onlyOwner {
updateImplInternal(LENDING_POOL, _pool);
emit LendingPoolUpdated(_pool);
}
/**
* @dev returns the address of the LendingPoolCore proxy
* @return the lending pool core proxy address
*/
function getLendingPoolCore() public view returns (address payable) {
address payable core = address(uint160(getAddress(LENDING_POOL_CORE)));
return core;
}
/**
* @dev updates the implementation of the lending pool core
* @param _lendingPoolCore the new lending pool core implementation
**/
function setLendingPoolCoreImpl(address _lendingPoolCore) public onlyOwner {
updateImplInternal(LENDING_POOL_CORE, _lendingPoolCore);
emit LendingPoolCoreUpdated(_lendingPoolCore);
}
/**
* @dev returns the address of the LendingPoolConfigurator proxy
* @return the lending pool configurator proxy address
**/
function getLendingPoolConfigurator() public view returns (address) {
return getAddress(LENDING_POOL_CONFIGURATOR);
}
/**
* @dev updates the implementation of the lending pool configurator
* @param _configurator the new lending pool configurator implementation
**/
function setLendingPoolConfiguratorImpl(address _configurator) public onlyOwner {
updateImplInternal(LENDING_POOL_CONFIGURATOR, _configurator);
emit LendingPoolConfiguratorUpdated(_configurator);
}
/**
* @dev returns the address of the LendingPoolDataProvider proxy
* @return the lending pool data provider proxy address
*/
function getLendingPoolDataProvider() public view returns (address) {
return getAddress(DATA_PROVIDER);
}
/**
* @dev updates the implementation of the lending pool data provider
* @param _provider the new lending pool data provider implementation
**/
function setLendingPoolDataProviderImpl(address _provider) public onlyOwner {
updateImplInternal(DATA_PROVIDER, _provider);
emit LendingPoolDataProviderUpdated(_provider);
}
/**
* @dev returns the address of the LendingPoolParametersProvider proxy
* @return the address of the Lending pool parameters provider proxy
**/
function getLendingPoolParametersProvider() public view returns (address) {
return getAddress(LENDING_POOL_PARAMETERS_PROVIDER);
}
/**
* @dev updates the implementation of the lending pool parameters provider
* @param _parametersProvider the new lending pool parameters provider implementation
**/
function setLendingPoolParametersProviderImpl(address _parametersProvider) public onlyOwner {
updateImplInternal(LENDING_POOL_PARAMETERS_PROVIDER, _parametersProvider);
emit LendingPoolParametersProviderUpdated(_parametersProvider);
}
/**
* @dev returns the address of the FeeProvider proxy
* @return the address of the Fee provider proxy
**/
function getFeeProvider() public view returns (address) {
return getAddress(FEE_PROVIDER);
}
/**
* @dev updates the implementation of the FeeProvider proxy
* @param _feeProvider the new lending pool fee provider implementation
**/
function setFeeProviderImpl(address _feeProvider) public onlyOwner {
updateImplInternal(FEE_PROVIDER, _feeProvider);
emit FeeProviderUpdated(_feeProvider);
}
/**
* @dev returns the address of the LendingPoolLiquidationManager. Since the manager is used
* through delegateCall within the LendingPool contract, the proxy contract pattern does not work properly hence
* the addresses are changed directly.
* @return the address of the Lending pool liquidation manager
**/
function getLendingPoolLiquidationManager() public view returns (address) {
return getAddress(LENDING_POOL_LIQUIDATION_MANAGER);
}
/**
* @dev updates the address of the Lending pool liquidation manager
* @param _manager the new lending pool liquidation manager address
**/
function setLendingPoolLiquidationManager(address _manager) public onlyOwner {
_setAddress(LENDING_POOL_LIQUIDATION_MANAGER, _manager);
emit LendingPoolLiquidationManagerUpdated(_manager);
}
/**
* @dev the functions below are storing specific addresses that are outside the context of the protocol
* hence the upgradable proxy pattern is not used
**/
function getLendingPoolManager() public view returns (address) {
return getAddress(LENDING_POOL_MANAGER);
}
function setLendingPoolManager(address _lendingPoolManager) public onlyOwner {
_setAddress(LENDING_POOL_MANAGER, _lendingPoolManager);
emit LendingPoolManagerUpdated(_lendingPoolManager);
}
function getPriceOracle() public view returns (address) {
return getAddress(PRICE_ORACLE);
}
function setPriceOracle(address _priceOracle) public onlyOwner {
_setAddress(PRICE_ORACLE, _priceOracle);
emit PriceOracleUpdated(_priceOracle);
}
function getLendingRateOracle() public view returns (address) {
return getAddress(LENDING_RATE_ORACLE);
}
function setLendingRateOracle(address _lendingRateOracle) public onlyOwner {
_setAddress(LENDING_RATE_ORACLE, _lendingRateOracle);
emit LendingRateOracleUpdated(_lendingRateOracle);
}
function getTokenDistributor() public view returns (address) {
return getAddress(TOKEN_DISTRIBUTOR);
}
function setTokenDistributor(address _tokenDistributor) public onlyOwner {
_setAddress(TOKEN_DISTRIBUTOR, _tokenDistributor);
emit TokenDistributorUpdated(_tokenDistributor);
}
/**
* @dev internal function to update the implementation of a specific component of the protocol
* @param _id the id of the contract to be updated
* @param _newAddress the address of the new implementation
**/
function updateImplInternal(bytes32 _id, address _newAddress) internal {
address payable proxyAddress = address(uint160(getAddress(_id)));
InitializableAdminUpgradeabilityProxy proxy = InitializableAdminUpgradeabilityProxy(proxyAddress);
bytes memory params = abi.encodeWithSignature("initialize(address)", address(this));
if (proxyAddress == address(0)) {
proxy = new InitializableAdminUpgradeabilityProxy();
proxy.initialize(_newAddress, address(this), params);
_setAddress(_id, address(proxy));
emit ProxyCreated(_id, address(proxy));
} else {
proxy.upgradeToAndCall(_newAddress, params);
}
}
}
| contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider, AddressStorage {
//events
event LendingPoolUpdated(address indexed newAddress);
event LendingPoolCoreUpdated(address indexed newAddress);
event LendingPoolParametersProviderUpdated(address indexed newAddress);
event LendingPoolManagerUpdated(address indexed newAddress);
event LendingPoolConfiguratorUpdated(address indexed newAddress);
event LendingPoolLiquidationManagerUpdated(address indexed newAddress);
event LendingPoolDataProviderUpdated(address indexed newAddress);
event EthereumAddressUpdated(address indexed newAddress);
event PriceOracleUpdated(address indexed newAddress);
event LendingRateOracleUpdated(address indexed newAddress);
event FeeProviderUpdated(address indexed newAddress);
event TokenDistributorUpdated(address indexed newAddress);
event ProxyCreated(bytes32 id, address indexed newAddress);
bytes32 private constant LENDING_POOL = "LENDING_POOL";
bytes32 private constant LENDING_POOL_CORE = "LENDING_POOL_CORE";
bytes32 private constant LENDING_POOL_CONFIGURATOR = "LENDING_POOL_CONFIGURATOR";
bytes32 private constant LENDING_POOL_PARAMETERS_PROVIDER = "PARAMETERS_PROVIDER";
bytes32 private constant LENDING_POOL_MANAGER = "LENDING_POOL_MANAGER";
bytes32 private constant LENDING_POOL_LIQUIDATION_MANAGER = "LIQUIDATION_MANAGER";
bytes32 private constant LENDING_POOL_FLASHLOAN_PROVIDER = "FLASHLOAN_PROVIDER";
bytes32 private constant DATA_PROVIDER = "DATA_PROVIDER";
bytes32 private constant ETHEREUM_ADDRESS = "ETHEREUM_ADDRESS";
bytes32 private constant PRICE_ORACLE = "PRICE_ORACLE";
bytes32 private constant LENDING_RATE_ORACLE = "LENDING_RATE_ORACLE";
bytes32 private constant FEE_PROVIDER = "FEE_PROVIDER";
bytes32 private constant WALLET_BALANCE_PROVIDER = "WALLET_BALANCE_PROVIDER";
bytes32 private constant TOKEN_DISTRIBUTOR = "TOKEN_DISTRIBUTOR";
/**
* @dev returns the address of the LendingPool proxy
* @return the lending pool proxy address
**/
function getLendingPool() public view returns (address) {
return getAddress(LENDING_POOL);
}
/**
* @dev updates the implementation of the lending pool
* @param _pool the new lending pool implementation
**/
function setLendingPoolImpl(address _pool) public onlyOwner {
updateImplInternal(LENDING_POOL, _pool);
emit LendingPoolUpdated(_pool);
}
/**
* @dev returns the address of the LendingPoolCore proxy
* @return the lending pool core proxy address
*/
function getLendingPoolCore() public view returns (address payable) {
address payable core = address(uint160(getAddress(LENDING_POOL_CORE)));
return core;
}
/**
* @dev updates the implementation of the lending pool core
* @param _lendingPoolCore the new lending pool core implementation
**/
function setLendingPoolCoreImpl(address _lendingPoolCore) public onlyOwner {
updateImplInternal(LENDING_POOL_CORE, _lendingPoolCore);
emit LendingPoolCoreUpdated(_lendingPoolCore);
}
/**
* @dev returns the address of the LendingPoolConfigurator proxy
* @return the lending pool configurator proxy address
**/
function getLendingPoolConfigurator() public view returns (address) {
return getAddress(LENDING_POOL_CONFIGURATOR);
}
/**
* @dev updates the implementation of the lending pool configurator
* @param _configurator the new lending pool configurator implementation
**/
function setLendingPoolConfiguratorImpl(address _configurator) public onlyOwner {
updateImplInternal(LENDING_POOL_CONFIGURATOR, _configurator);
emit LendingPoolConfiguratorUpdated(_configurator);
}
/**
* @dev returns the address of the LendingPoolDataProvider proxy
* @return the lending pool data provider proxy address
*/
function getLendingPoolDataProvider() public view returns (address) {
return getAddress(DATA_PROVIDER);
}
/**
* @dev updates the implementation of the lending pool data provider
* @param _provider the new lending pool data provider implementation
**/
function setLendingPoolDataProviderImpl(address _provider) public onlyOwner {
updateImplInternal(DATA_PROVIDER, _provider);
emit LendingPoolDataProviderUpdated(_provider);
}
/**
* @dev returns the address of the LendingPoolParametersProvider proxy
* @return the address of the Lending pool parameters provider proxy
**/
function getLendingPoolParametersProvider() public view returns (address) {
return getAddress(LENDING_POOL_PARAMETERS_PROVIDER);
}
/**
* @dev updates the implementation of the lending pool parameters provider
* @param _parametersProvider the new lending pool parameters provider implementation
**/
function setLendingPoolParametersProviderImpl(address _parametersProvider) public onlyOwner {
updateImplInternal(LENDING_POOL_PARAMETERS_PROVIDER, _parametersProvider);
emit LendingPoolParametersProviderUpdated(_parametersProvider);
}
/**
* @dev returns the address of the FeeProvider proxy
* @return the address of the Fee provider proxy
**/
function getFeeProvider() public view returns (address) {
return getAddress(FEE_PROVIDER);
}
/**
* @dev updates the implementation of the FeeProvider proxy
* @param _feeProvider the new lending pool fee provider implementation
**/
function setFeeProviderImpl(address _feeProvider) public onlyOwner {
updateImplInternal(FEE_PROVIDER, _feeProvider);
emit FeeProviderUpdated(_feeProvider);
}
/**
* @dev returns the address of the LendingPoolLiquidationManager. Since the manager is used
* through delegateCall within the LendingPool contract, the proxy contract pattern does not work properly hence
* the addresses are changed directly.
* @return the address of the Lending pool liquidation manager
**/
function getLendingPoolLiquidationManager() public view returns (address) {
return getAddress(LENDING_POOL_LIQUIDATION_MANAGER);
}
/**
* @dev updates the address of the Lending pool liquidation manager
* @param _manager the new lending pool liquidation manager address
**/
function setLendingPoolLiquidationManager(address _manager) public onlyOwner {
_setAddress(LENDING_POOL_LIQUIDATION_MANAGER, _manager);
emit LendingPoolLiquidationManagerUpdated(_manager);
}
/**
* @dev the functions below are storing specific addresses that are outside the context of the protocol
* hence the upgradable proxy pattern is not used
**/
function getLendingPoolManager() public view returns (address) {
return getAddress(LENDING_POOL_MANAGER);
}
function setLendingPoolManager(address _lendingPoolManager) public onlyOwner {
_setAddress(LENDING_POOL_MANAGER, _lendingPoolManager);
emit LendingPoolManagerUpdated(_lendingPoolManager);
}
function getPriceOracle() public view returns (address) {
return getAddress(PRICE_ORACLE);
}
function setPriceOracle(address _priceOracle) public onlyOwner {
_setAddress(PRICE_ORACLE, _priceOracle);
emit PriceOracleUpdated(_priceOracle);
}
function getLendingRateOracle() public view returns (address) {
return getAddress(LENDING_RATE_ORACLE);
}
function setLendingRateOracle(address _lendingRateOracle) public onlyOwner {
_setAddress(LENDING_RATE_ORACLE, _lendingRateOracle);
emit LendingRateOracleUpdated(_lendingRateOracle);
}
function getTokenDistributor() public view returns (address) {
return getAddress(TOKEN_DISTRIBUTOR);
}
function setTokenDistributor(address _tokenDistributor) public onlyOwner {
_setAddress(TOKEN_DISTRIBUTOR, _tokenDistributor);
emit TokenDistributorUpdated(_tokenDistributor);
}
/**
* @dev internal function to update the implementation of a specific component of the protocol
* @param _id the id of the contract to be updated
* @param _newAddress the address of the new implementation
**/
function updateImplInternal(bytes32 _id, address _newAddress) internal {
address payable proxyAddress = address(uint160(getAddress(_id)));
InitializableAdminUpgradeabilityProxy proxy = InitializableAdminUpgradeabilityProxy(proxyAddress);
bytes memory params = abi.encodeWithSignature("initialize(address)", address(this));
if (proxyAddress == address(0)) {
proxy = new InitializableAdminUpgradeabilityProxy();
proxy.initialize(_newAddress, address(this), params);
_setAddress(_id, address(proxy));
emit ProxyCreated(_id, address(proxy));
} else {
proxy.upgradeToAndCall(_newAddress, params);
}
}
}
| 80,945 |
10 | // New request | uint256 requestId = requests.length++;
RequestMetadata storage requestMetadata = requests[requestId];
requestMetadata.applicationId = applicationId;
requestMetadata.riskId = riskId;
emit LogRequestFlightStatistics(requestId, _carrierFlightNumber, _departureTime, _arrivalTime);
| uint256 requestId = requests.length++;
RequestMetadata storage requestMetadata = requests[requestId];
requestMetadata.applicationId = applicationId;
requestMetadata.riskId = riskId;
emit LogRequestFlightStatistics(requestId, _carrierFlightNumber, _departureTime, _arrivalTime);
| 40,702 |
121 | // top up claim cycle | topUpClaimCycleAfterTransfer(recipient, amount);
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
| topUpClaimCycleAfterTransfer(recipient, amount);
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
| 29,523 |
71 | // Comptroller needs prices in the format: ${raw price}1e36 / baseUnitThe baseUnit of an asset is the amount of the smallest denomination of that asset per whole.For example, the baseUnit of ETH is 1e18.Since the prices in this view have 6 decimals, we must scale them by 1e(36 - 6)/baseUnit | return mul(1e30, priceInternal(config)) / config.baseUnit;
| return mul(1e30, priceInternal(config)) / config.baseUnit;
| 52,951 |
70 | // mint pool liquidity tokens | _mint(msg.sender, mintedAmount);
return mintedAmount;
| _mint(msg.sender, mintedAmount);
return mintedAmount;
| 22,640 |
43 | // Set Fee for Sells | if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
| if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
| 2,625 |
88 | // Returns the blocknumber of the last transaction.return Blocknumber for the last transaction. / | function getLastBlockNumber() external view returns (uint40);
| function getLastBlockNumber() external view returns (uint40);
| 13,882 |
197 | // Get cash balance of this gToken in the underlying assetreturn The quantity of underlying asset owned by this contract / | function getCash() external view returns (uint) {
return getCashPrior();
}
| function getCash() external view returns (uint) {
return getCashPrior();
}
| 577 |
17 | // Worker had already voted for a match result | error AlreadyVoted();
| error AlreadyVoted();
| 30,873 |
132 | // if (block.number > userStake[msg.sender].lastBlockChecked) { uint256 rewardBlocks = block.number.sub(userStake[msg.sender].lastBlockChecked); uint256 stakedAmount = userStake[msg.sender].stakedNyanV2LP; if (userStake[msg.sender].stakedDNyanV2LP > 0) { stakedAmount = stakedAmount.add(userStake[msg.sender].stakedDNyanV2LP); } if (userStake[msg.sender].stakedNyanV2LP > 0) { uint256 reward = stakedAmount.mul(rewardBlocks) / miningDifficulty; userStake[msg.sender].nyanV2Rewards = userStake[msg.sender].nyanV2Rewards.add(reward); userStake[msg.sender].lastBlockChecked = block.number; } rReset[msg.sender].isRewardsReset = true; } |
_;
|
_;
| 16,077 |
1 | // Modify this section | string public name = "Bounce Token";
string public symbol = "BOT";
uint8 public decimals = 18;
uint256 public totalSupply = 100000 * (uint256(10) ** decimals);
event Transfer(address indexed from, address indexed to, uint256 value);
| string public name = "Bounce Token";
string public symbol = "BOT";
uint8 public decimals = 18;
uint256 public totalSupply = 100000 * (uint256(10) ** decimals);
event Transfer(address indexed from, address indexed to, uint256 value);
| 18,473 |
46 | // Anti-bot and anti-whale mappings and variables | mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
bool public transferDelayEnabled = true;
bool public limitsInEffect = true;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
| mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
bool public transferDelayEnabled = true;
bool public limitsInEffect = true;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
| 11,539 |
19 | // Moves `amount` tokens from `sender` to `recipient` using theallowance mechanism. `amount` is then deducted from the caller'sallowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. / | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| 216 |
19 | // For 2 <= degree <= 27add 1% from the first k-1 nodesadd tier% from the last node | if(degree >= 2 && degree <= 27) {
for (uint i = 0; i < (degree - 1); i++) {
shares = node.invitees[node.inviteeIndex[i]];
reward = reward.add(shares.mul(1).div(100));
}
| if(degree >= 2 && degree <= 27) {
for (uint i = 0; i < (degree - 1); i++) {
shares = node.invitees[node.inviteeIndex[i]];
reward = reward.add(shares.mul(1).div(100));
}
| 33,140 |
2 | // Decreases the allowance granted to spender by the caller. spender The address to reduce the allowance from. subtractedValue The amount allowance to subtract.return Returns true if allowance has decreased, otherwise false. / | {
_approve(
msg.sender,
spender,
allowance[msg.sender][spender].sub(subtractedValue, "NEGATIVE_ALLOWANCE")
);
return true;
}
| {
_approve(
msg.sender,
spender,
allowance[msg.sender][spender].sub(subtractedValue, "NEGATIVE_ALLOWANCE")
);
return true;
}
| 54,167 |
219 | // initialization cannot be called for a second time | if (hasParameters())
throw;
cliffPeriod = pCliffPeriod;
vestingPeriod = pVestingPeriod;
maxFadeoutPromille = FP_SCALE - pResidualAmountPromille;
bonusOptionsPromille = pBonusOptionsPromille;
newEmployeePoolPromille = pNewEmployeePoolPromille;
optionsPerShare = pOptionsPerShare;
| if (hasParameters())
throw;
cliffPeriod = pCliffPeriod;
vestingPeriod = pVestingPeriod;
maxFadeoutPromille = FP_SCALE - pResidualAmountPromille;
bonusOptionsPromille = pBonusOptionsPromille;
newEmployeePoolPromille = pNewEmployeePoolPromille;
optionsPerShare = pOptionsPerShare;
| 30,392 |
97 | // executes all virtual orders until blockTimestamp is reached (AS A VIEW) | function executeVirtualOrdersUntilTimestampView(LongTermOrders storage longTermOrders, uint256 blockTimestamp, ExecuteVirtualOrdersResult memory reserveResult) internal view {
uint256 nextExpiryBlockTimestamp = longTermOrders.lastVirtualOrderTimestamp - (longTermOrders.lastVirtualOrderTimestamp % longTermOrders.orderTimeInterval) + longTermOrders.orderTimeInterval;
//iterate through time intervals eligible for order expiries, moving state forward
OrderPool storage orderPool0 = longTermOrders.OrderPool0;
OrderPool storage orderPool1 = longTermOrders.OrderPool1;
// currentSales for each pool is mutated in the non-view (mutate locally)
uint256 currentSalesRate0 = orderPool0.currentSalesRate;
uint256 currentSalesRate1 = orderPool1.currentSalesRate;
while (nextExpiryBlockTimestamp < blockTimestamp) {
// Optimization for skipping blocks with no expiry
if (orderPool0.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp] > 0
|| orderPool1.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp] > 0) {
//amount sold from virtual trades
uint256 blockTimestampElapsed = nextExpiryBlockTimestamp - longTermOrders.lastVirtualOrderTimestamp;
uint256 token0SellAmount = currentSalesRate0 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
uint256 token1SellAmount = currentSalesRate1 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
(uint256 token0Out, uint256 token1Out) = executeVirtualTradesAndOrderExpiries(reserveResult, token0SellAmount, token1SellAmount);
currentSalesRate0 -= orderPool0.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp];
currentSalesRate1 -= orderPool1.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp];
}
nextExpiryBlockTimestamp += longTermOrders.orderTimeInterval;
}
//finally, move state to current blockTimestamp if necessary
if (longTermOrders.lastVirtualOrderTimestamp != blockTimestamp) {
//amount sold from virtual trades
uint256 blockTimestampElapsed = blockTimestamp - longTermOrders.lastVirtualOrderTimestamp;
uint256 token0SellAmount = currentSalesRate0 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
uint256 token1SellAmount = currentSalesRate1 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
(uint256 token0Out, uint256 token1Out) = executeVirtualTradesAndOrderExpiries(reserveResult, token0SellAmount, token1SellAmount);
}
}
| function executeVirtualOrdersUntilTimestampView(LongTermOrders storage longTermOrders, uint256 blockTimestamp, ExecuteVirtualOrdersResult memory reserveResult) internal view {
uint256 nextExpiryBlockTimestamp = longTermOrders.lastVirtualOrderTimestamp - (longTermOrders.lastVirtualOrderTimestamp % longTermOrders.orderTimeInterval) + longTermOrders.orderTimeInterval;
//iterate through time intervals eligible for order expiries, moving state forward
OrderPool storage orderPool0 = longTermOrders.OrderPool0;
OrderPool storage orderPool1 = longTermOrders.OrderPool1;
// currentSales for each pool is mutated in the non-view (mutate locally)
uint256 currentSalesRate0 = orderPool0.currentSalesRate;
uint256 currentSalesRate1 = orderPool1.currentSalesRate;
while (nextExpiryBlockTimestamp < blockTimestamp) {
// Optimization for skipping blocks with no expiry
if (orderPool0.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp] > 0
|| orderPool1.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp] > 0) {
//amount sold from virtual trades
uint256 blockTimestampElapsed = nextExpiryBlockTimestamp - longTermOrders.lastVirtualOrderTimestamp;
uint256 token0SellAmount = currentSalesRate0 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
uint256 token1SellAmount = currentSalesRate1 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
(uint256 token0Out, uint256 token1Out) = executeVirtualTradesAndOrderExpiries(reserveResult, token0SellAmount, token1SellAmount);
currentSalesRate0 -= orderPool0.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp];
currentSalesRate1 -= orderPool1.salesRateEndingPerTimeInterval[nextExpiryBlockTimestamp];
}
nextExpiryBlockTimestamp += longTermOrders.orderTimeInterval;
}
//finally, move state to current blockTimestamp if necessary
if (longTermOrders.lastVirtualOrderTimestamp != blockTimestamp) {
//amount sold from virtual trades
uint256 blockTimestampElapsed = blockTimestamp - longTermOrders.lastVirtualOrderTimestamp;
uint256 token0SellAmount = currentSalesRate0 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
uint256 token1SellAmount = currentSalesRate1 * blockTimestampElapsed / SELL_RATE_ADDITIONAL_PRECISION;
(uint256 token0Out, uint256 token1Out) = executeVirtualTradesAndOrderExpiries(reserveResult, token0SellAmount, token1SellAmount);
}
}
| 60,381 |
4 | // Approve the Pool contract allowance to pull the owed amount |
emit log(address(this), address(this).balance);
uint256 amountOwed = amount + premium;
IERC20(asset).approve(address(POOL), amountOwed);
return true;
|
emit log(address(this), address(this).balance);
uint256 amountOwed = amount + premium;
IERC20(asset).approve(address(POOL), amountOwed);
return true;
| 26,666 |
90 | // Move the cash from the sender to the contract address. This must happen before the insert trade call below. | Escrow().depositIntoMarket(account, CASH_GROUP, cash, fee);
Common.Asset memory asset = Common.Asset(
CASH_GROUP,
0,
maturity,
Common.getCashReceiver(),
0,
fCashAmount
);
| Escrow().depositIntoMarket(account, CASH_GROUP, cash, fee);
Common.Asset memory asset = Common.Asset(
CASH_GROUP,
0,
maturity,
Common.getCashReceiver(),
0,
fCashAmount
);
| 4,230 |
90 | // transfer the amount from the distribution to the user | emit DistributionPaid(user, assetId, d.period, amount, balanceIndex, distributionIndex);
add(self, assetId, user, amount, 0);
| emit DistributionPaid(user, assetId, d.period, amount, balanceIndex, distributionIndex);
add(self, assetId, user, amount, 0);
| 21,884 |
18 | // Updates the logic contract for the SuperTokenFactory/This function updates the logic contract for the SuperTokenFactory/newAddress the new address of the SuperTokenFactory logic contract | function updateCode(address newAddress) external override {
if (msg.sender != address(_host)) {
revert SUPER_TOKEN_FACTORY_ONLY_HOST();
}
_updateCodeAddress(newAddress);
// Upgrade the Flow NFT logic contracts on the canonical proxies
// We only do this if the new logic contracts passed in updating the SuperTokenFactory
// are different from the current logic contracts
if (
address(CONSTANT_OUTFLOW_NFT_LOGIC) !=
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_OUTFLOW_NFT()))
.getCodeAddress() ||
address(CONSTANT_INFLOW_NFT_LOGIC) !=
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_INFLOW_NFT()))
.getCodeAddress()
) {
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_OUTFLOW_NFT()))
.updateCode(address(CONSTANT_OUTFLOW_NFT_LOGIC));
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_INFLOW_NFT()))
.updateCode(address(CONSTANT_INFLOW_NFT_LOGIC));
}
}
| function updateCode(address newAddress) external override {
if (msg.sender != address(_host)) {
revert SUPER_TOKEN_FACTORY_ONLY_HOST();
}
_updateCodeAddress(newAddress);
// Upgrade the Flow NFT logic contracts on the canonical proxies
// We only do this if the new logic contracts passed in updating the SuperTokenFactory
// are different from the current logic contracts
if (
address(CONSTANT_OUTFLOW_NFT_LOGIC) !=
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_OUTFLOW_NFT()))
.getCodeAddress() ||
address(CONSTANT_INFLOW_NFT_LOGIC) !=
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_INFLOW_NFT()))
.getCodeAddress()
) {
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_OUTFLOW_NFT()))
.updateCode(address(CONSTANT_OUTFLOW_NFT_LOGIC));
UUPSProxiable(address(_SUPER_TOKEN_LOGIC.CONSTANT_INFLOW_NFT()))
.updateCode(address(CONSTANT_INFLOW_NFT_LOGIC));
}
}
| 18,919 |
245 | // Get id | uint256 innerSalt;
(id, innerSalt) = _buildSettleId(_requestData, _loanData);
require(requests[id].borrower == address(0), "Request already exist");
| uint256 innerSalt;
(id, innerSalt) = _buildSettleId(_requestData, _loanData);
require(requests[id].borrower == address(0), "Request already exist");
| 16,231 |
12 | // A modifier that defines a protected reinitializer function that can be invoked at most once, and only if thecontract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can beused to initialize parent contracts. `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the originalinitialization step. This is essential to configure modules that are added through upgrades and that requireinitialization. Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist ina contract, executing them in the right order is up to the developer or operator. / | modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
| modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
| 13,226 |
35 | // Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see{TransparentUpgradeableProxy}./ Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encodedfunction call, and allows initializating the storage of the proxy like a Solidity constructor. / | constructor(address _logic, bytes memory _data) payable {
assert(
_IMPLEMENTATION_SLOT ==
bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
);
_setImplementation(_logic);
if (_data.length > 0) {
| constructor(address _logic, bytes memory _data) payable {
assert(
_IMPLEMENTATION_SLOT ==
bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
);
_setImplementation(_logic);
if (_data.length > 0) {
| 25,676 |
79 | // low level token purchase function / | function buyTokens() public payable whenNotPaused {
// Do not allow if gasprice is bigger than the maximum
// This is for fair-chance for all contributors, so no one can
// set a too-high transaction price and be able to buy earlier
require(tx.gasprice <= maxTxGas);
// valid purchase identifies which stage the contract is at (PreState/Token Sale)
// making sure were inside the contribution period and the user
// is sending enough Wei for the stage's rules
require(validPurchase());
address sender = msg.sender;
uint256 weiAmountSent = msg.value;
// calculate token amount to be created
uint256 rate = getRate(weiAmountSent);
uint256 newTokens = weiAmountSent.mul(rate);
// look if we have not yet reached the cap
uint256 totalTokensSold = tokensSold.add(newTokens);
if (isCrowdSaleRunning()) {
require(totalTokensSold <= GMR_TOKEN_SALE_CAP);
} else if (isPreSaleRunning()) {
require(totalTokensSold <= PRE_SALE_GMR_TOKEN_CAP);
}
// update supporter state
Supporter storage sup = supportersMap[sender];
uint256 totalWei = sup.weiSpent.add(weiAmountSent);
sup.weiSpent = totalWei;
// update contract state
weiRaised = weiRaised.add(weiAmountSent);
tokensSold = totalTokensSold;
// mint the coins
token.mint(sender, newTokens);
TokenPurchase(sender, weiAmountSent, newTokens);
// forward the funds to the wallet
fundWallet.transfer(msg.value);
}
| function buyTokens() public payable whenNotPaused {
// Do not allow if gasprice is bigger than the maximum
// This is for fair-chance for all contributors, so no one can
// set a too-high transaction price and be able to buy earlier
require(tx.gasprice <= maxTxGas);
// valid purchase identifies which stage the contract is at (PreState/Token Sale)
// making sure were inside the contribution period and the user
// is sending enough Wei for the stage's rules
require(validPurchase());
address sender = msg.sender;
uint256 weiAmountSent = msg.value;
// calculate token amount to be created
uint256 rate = getRate(weiAmountSent);
uint256 newTokens = weiAmountSent.mul(rate);
// look if we have not yet reached the cap
uint256 totalTokensSold = tokensSold.add(newTokens);
if (isCrowdSaleRunning()) {
require(totalTokensSold <= GMR_TOKEN_SALE_CAP);
} else if (isPreSaleRunning()) {
require(totalTokensSold <= PRE_SALE_GMR_TOKEN_CAP);
}
// update supporter state
Supporter storage sup = supportersMap[sender];
uint256 totalWei = sup.weiSpent.add(weiAmountSent);
sup.weiSpent = totalWei;
// update contract state
weiRaised = weiRaised.add(weiAmountSent);
tokensSold = totalTokensSold;
// mint the coins
token.mint(sender, newTokens);
TokenPurchase(sender, weiAmountSent, newTokens);
// forward the funds to the wallet
fundWallet.transfer(msg.value);
}
| 25,877 |
10 | // Set new zone (if allowed; enterZone may throw) | furballs[tokenIds[i]].zone = uint32(engine.enterZone(tokenIds[i], zone, tokenIds));
| furballs[tokenIds[i]].zone = uint32(engine.enterZone(tokenIds[i], zone, tokenIds));
| 33,926 |
32 | // Make sure member never voted on this poll | require(
hasVotedPoll[msg.sender][_pollID] == false,
"Member already voted on this poll");
| require(
hasVotedPoll[msg.sender][_pollID] == false,
"Member already voted on this poll");
| 17,222 |
28 | // admin/ | function changeAdmin(
address _newAdmin
)
public
| function changeAdmin(
address _newAdmin
)
public
| 36,805 |
80 | // Function to return the specific sales details for a given address/minter address for minter to return mint information for | function mintedPerAddress(
address minter
) external view returns (AddressMintDetails memory);
| function mintedPerAddress(
address minter
) external view returns (AddressMintDetails memory);
| 13,589 |
34 | // Borrow requests for less than this USD amount will not be approved. | uint public minBorrowAmountUsd;
| uint public minBorrowAmountUsd;
| 25,739 |
214 | // add from now if key is expired | _keys[_tokenId].expirationTimestamp = block.timestamp + _deltaT;
| _keys[_tokenId].expirationTimestamp = block.timestamp + _deltaT;
| 26,897 |
12 | // Value of total amount requested by borrowers in market (in Wei) | uint totalRequested;
| uint totalRequested;
| 18,353 |
9 | // Pool maximum size | uint256 public maxSize;
| uint256 public maxSize;
| 20,242 |
16 | // liquidityPool / 20 | mstore(add(order, 128), mload(add(data, 100)))
| mstore(add(order, 128), mload(add(data, 100)))
| 40,800 |
591 | // Send LUSD to user and decrease LUSD in Pool | function _sendLUSDToDepositor(address _depositor, uint LUSDWithdrawal) internal {
if (LUSDWithdrawal == 0) {return;}
lusdToken.returnFromPool(address(this), _depositor, LUSDWithdrawal);
_decreaseLUSD(LUSDWithdrawal);
}
| function _sendLUSDToDepositor(address _depositor, uint LUSDWithdrawal) internal {
if (LUSDWithdrawal == 0) {return;}
lusdToken.returnFromPool(address(this), _depositor, LUSDWithdrawal);
_decreaseLUSD(LUSDWithdrawal);
}
| 10,562 |
97 | // Executes plugins in the order provided. Calls itself's _pay function if the payment plugin contract itself is part of plugins. | function _execute(
address[] calldata path,
uint[] calldata amounts,
address[] calldata addresses,
address[] calldata plugins,
string[] calldata data
| function _execute(
address[] calldata path,
uint[] calldata amounts,
address[] calldata addresses,
address[] calldata plugins,
string[] calldata data
| 11,709 |
46 | // add function | ds.selectorToFacetAndPosition[selector].functionSelectorPosition = selectorPosition;
ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(selector);
ds.selectorToFacetAndPosition[selector].facetAddress = _facetAddress;
selectorPosition++;
| ds.selectorToFacetAndPosition[selector].functionSelectorPosition = selectorPosition;
ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(selector);
ds.selectorToFacetAndPosition[selector].facetAddress = _facetAddress;
selectorPosition++;
| 50,198 |
13 | // Update OpenSea contract level metadata. | function setContractCID(bytes memory contractCID_) external {
require(
hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
"GitNFT: must have admin role to change contract CID"
);
contractCID = contractCID_;
}
| function setContractCID(bytes memory contractCID_) external {
require(
hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
"GitNFT: must have admin role to change contract CID"
);
contractCID = contractCID_;
}
| 8,309 |
82 | // Store relevant auction data in memory for the life of this function. | address winner = auctions[auctionId].bidder;
uint256 amount = auctions[auctionId].amount;
address creator = auctions[auctionId].creator;
return AuctionResult(auctionId, winner, amount, creator);
| address winner = auctions[auctionId].bidder;
uint256 amount = auctions[auctionId].amount;
address creator = auctions[auctionId].creator;
return AuctionResult(auctionId, winner, amount, creator);
| 30,976 |
289 | // Validation | uint256 startPos;
bytes32 tokenIdHash;
mapping(uint256 => uint256) serialToTokenId;
mapping(uint256 => uint256) tokenIdToSerial;
mapping(uint256 => uint256) cardTraits;
bytes32 public fullTokenIDHash;
| uint256 startPos;
bytes32 tokenIdHash;
mapping(uint256 => uint256) serialToTokenId;
mapping(uint256 => uint256) tokenIdToSerial;
mapping(uint256 => uint256) cardTraits;
bytes32 public fullTokenIDHash;
| 59,332 |
2 | // burn option token from an address. Can only be called by corresponding margin engine _from account to burn from _tokenIdtokenId to burn _amount amount to burn/ | function burn(address _from, uint256 _tokenId, uint256 _amount) external;
| function burn(address _from, uint256 _tokenId, uint256 _amount) external;
| 25,726 |
337 | // Set up names for bunnies.Only the main admins can set it. / | function setBunnyName(uint8 _bunnyId, string calldata _bunnyName)
external
onlyOwner
| function setBunnyName(uint8 _bunnyId, string calldata _bunnyName)
external
onlyOwner
| 23,854 |
21 | // Update zug modifier | Orc memory orc = orcs[id];
uint16 zugModifier_ = _tier(orc.helm) + _tier(orc.mainhand) + _tier(orc.offhand);
orcs[id].zugModifier = zugModifier_;
activities[id].timestamp = uint88(block.timestamp + cooldown);
| Orc memory orc = orcs[id];
uint16 zugModifier_ = _tier(orc.helm) + _tier(orc.mainhand) + _tier(orc.offhand);
orcs[id].zugModifier = zugModifier_;
activities[id].timestamp = uint88(block.timestamp + cooldown);
| 32,245 |
2 | // function createPerson(string memory name) external returns (bool);function setPersonName(string memory name) external returns (bool); | function addMessageId(address person, uint256 messageId)
external
returns (bool);
| function addMessageId(address person, uint256 messageId)
external
returns (bool);
| 26,026 |
122 | // Manager roles |
bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
|
bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
| 11,626 |
181 | // Rebalance stable token total supply by depositary balance. Mint stable token if depositary balance greater token total supply and burn otherwise. / | function rebalance() external whenNotPaused {
uint256 currentDepositaryBalance = this.balance();
uint256 stableTokenTotalSupply = stableToken.totalSupply();
if (stableTokenTotalSupply > currentDepositaryBalance) {
uint256 burningBalance = stableToken.balanceOf(address(this));
if (burningBalance > 0) {
stableToken.burn(address(this), burningBalance.min(stableTokenTotalSupply.sub(currentDepositaryBalance)));
emit Rebalance();
}
} else if (stableTokenTotalSupply < currentDepositaryBalance) {
stableToken.mint(treasury, currentDepositaryBalance.sub(stableTokenTotalSupply));
emit Rebalance();
}
}
| function rebalance() external whenNotPaused {
uint256 currentDepositaryBalance = this.balance();
uint256 stableTokenTotalSupply = stableToken.totalSupply();
if (stableTokenTotalSupply > currentDepositaryBalance) {
uint256 burningBalance = stableToken.balanceOf(address(this));
if (burningBalance > 0) {
stableToken.burn(address(this), burningBalance.min(stableTokenTotalSupply.sub(currentDepositaryBalance)));
emit Rebalance();
}
} else if (stableTokenTotalSupply < currentDepositaryBalance) {
stableToken.mint(treasury, currentDepositaryBalance.sub(stableTokenTotalSupply));
emit Rebalance();
}
}
| 42,614 |
318 | // Mint their new synths | sUSDSynth.issue(account, sUSDAmount);
| sUSDSynth.issue(account, sUSDAmount);
| 13,352 |
29 | // ==================UTILITY======================================/get user record for a token | function getUserRecord(address tokenAddr, address user) external view returns (
uint256 stakedAmt,
uint256 stakedAt,
uint256 unstakedAmt,
uint256 unstakedAt,
uint256 rewardAmt
| function getUserRecord(address tokenAddr, address user) external view returns (
uint256 stakedAmt,
uint256 stakedAt,
uint256 unstakedAmt,
uint256 unstakedAt,
uint256 rewardAmt
| 11,473 |
18 | // Returns whether the implementing contract is currently paused or not return Whether the paused state is active / | function isPaused() constant returns (bool);
| function isPaused() constant returns (bool);
| 33,106 |
48 | // The uniswap v2 router and pair address | IUniswapV2Router private _uniswapV2Router;
address private uniswapV2Pair;
address private router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
;
| IUniswapV2Router private _uniswapV2Router;
address private uniswapV2Pair;
address private router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
;
| 21,399 |
0 | // Interface for the yEarn yVault | yVaultInterface public vault;
| yVaultInterface public vault;
| 38,557 |
0 | // ============ State Variables ============ / CToken Full Unit | uint256 public immutable cTokenFullUnit;
| uint256 public immutable cTokenFullUnit;
| 58,751 |
17 | // If we have insufficient values, reject the proof unless the stack has been fully exhausted | require(
context.afterMachine.dataStack.hash() == Value.newEmptyTuple().hash(),
STACK_MISSING
);
| require(
context.afterMachine.dataStack.hash() == Value.newEmptyTuple().hash(),
STACK_MISSING
);
| 14,326 |
80 | // / | interface IVestedLPMining {
/**
* @notice Initializes the storage of the contract
* @dev "constructor" to be called on a new proxy deployment
* @dev Sets the contract `owner` account to the deploying account
*/
function initialize(
IERC20 _cvp,
address _reservoir,
uint256 _cvpPerBlock,
uint256 _startBlock,
uint256 _cvpVestingPeriodInBlocks
) external;
function poolLength() external view returns (uint256);
/// @notice Add a new pool (only the owner may call)
function add(
uint256 _allocPoint,
IERC20 _lpToken,
uint8 _poolType,
bool _votesEnabled,
uint256 _lpBoostRate,
uint256 _cvpBoostRate,
uint256 _lpBoostMinRatio,
uint256 _lpBoostMaxRatio
) external;
/// @notice Update parameters of the given pool (only the owner may call)
function set(
uint256 _pid,
uint256 _allocPoint,
uint8 _poolType,
bool _votesEnabled,
uint256 _lpBoostRate,
uint256 _cvpBoostRate,
uint256 _lpBoostMinRatio,
uint256 _lpBoostMaxRatio
) external;
/// @notice Set the migrator contract (only the owner may call)
function setMigrator(ILpTokenMigrator _migrator) external;
/// @notice Set CVP reward per block (only the owner may call)
/// @dev Consider updating pool before calling this function
function setCvpPerBlock(uint256 _cvpPerBlock) external;
/// @notice Set CVP vesting period in blocks (only the owner may call)
function setCvpVestingPeriodInBlocks(uint256 _cvpVestingPeriodInBlocks) external;
function setCvpPoolByMetaPool(address _metaPool, address _cvpPool) external;
/// @notice Return the amount of pending CVPs entitled to the given user of the pool
function pendingCvp(uint256 _pid, address _user) external view returns (uint256);
/// @notice Return the amount of CVP tokens which may be vested to a user of a pool in the current block
function vestableCvp(uint256 _pid, address user) external view returns (uint256);
/// @notice Return `true` if the LP Token is added to created pools
function isLpTokenAdded(IERC20 _lpToken) external view returns (bool);
/// @notice Update reward computation params for all pools
/// @dev Be careful of gas spending
function massUpdatePools() external;
/// @notice Update CVP tokens allocation for the given pool
function updatePool(uint256 _pid) external;
/// @notice Deposit the given amount of LP tokens to the given pool
function deposit(
uint256 _pid,
uint256 _amount,
uint256 _boostAmount
) external;
/// @notice Withdraw the given amount of LP tokens from the given pool
function withdraw(
uint256 _pid,
uint256 _amount,
uint256 _boostAmount
) external;
/// @notice Withdraw LP tokens without caring about pending CVP tokens. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) external;
/// @notice Write votes of the given user at the current block
function checkpointVotes(address _user) external;
/// @notice Get CVP amount and the share of CVPs in LP pools for the given account and the checkpoint
function getCheckpoint(address account, uint32 checkpointId)
external
view
returns (
uint32 fromBlock,
uint96 cvpAmount,
uint96 pooledCvpShare
);
event AddLpToken(address indexed lpToken, uint256 indexed pid, uint256 allocPoint);
event SetLpToken(address indexed lpToken, uint256 indexed pid, uint256 allocPoint);
event SetMigrator(address indexed migrator);
event SetCvpPerBlock(uint256 cvpPerBlock);
event SetCvpVestingPeriodInBlocks(uint256 cvpVestingPeriodInBlocks);
event SetCvpPoolByMetaPool(address indexed metaPool, address indexed cvpPool);
event MigrateLpToken(address indexed oldLpToken, address indexed newLpToken, uint256 indexed pid);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, uint256 boostAmount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, uint256 boostAmount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount, uint256 boostAmount);
event CheckpointTotalLpVotes(uint256 lpVotes);
event CheckpointUserLpVotes(address indexed user, uint256 indexed pid, uint256 lpVotes);
event CheckpointUserVotes(address indexed user, uint256 pendedVotes, uint256 lpVotesShare);
}
| interface IVestedLPMining {
/**
* @notice Initializes the storage of the contract
* @dev "constructor" to be called on a new proxy deployment
* @dev Sets the contract `owner` account to the deploying account
*/
function initialize(
IERC20 _cvp,
address _reservoir,
uint256 _cvpPerBlock,
uint256 _startBlock,
uint256 _cvpVestingPeriodInBlocks
) external;
function poolLength() external view returns (uint256);
/// @notice Add a new pool (only the owner may call)
function add(
uint256 _allocPoint,
IERC20 _lpToken,
uint8 _poolType,
bool _votesEnabled,
uint256 _lpBoostRate,
uint256 _cvpBoostRate,
uint256 _lpBoostMinRatio,
uint256 _lpBoostMaxRatio
) external;
/// @notice Update parameters of the given pool (only the owner may call)
function set(
uint256 _pid,
uint256 _allocPoint,
uint8 _poolType,
bool _votesEnabled,
uint256 _lpBoostRate,
uint256 _cvpBoostRate,
uint256 _lpBoostMinRatio,
uint256 _lpBoostMaxRatio
) external;
/// @notice Set the migrator contract (only the owner may call)
function setMigrator(ILpTokenMigrator _migrator) external;
/// @notice Set CVP reward per block (only the owner may call)
/// @dev Consider updating pool before calling this function
function setCvpPerBlock(uint256 _cvpPerBlock) external;
/// @notice Set CVP vesting period in blocks (only the owner may call)
function setCvpVestingPeriodInBlocks(uint256 _cvpVestingPeriodInBlocks) external;
function setCvpPoolByMetaPool(address _metaPool, address _cvpPool) external;
/// @notice Return the amount of pending CVPs entitled to the given user of the pool
function pendingCvp(uint256 _pid, address _user) external view returns (uint256);
/// @notice Return the amount of CVP tokens which may be vested to a user of a pool in the current block
function vestableCvp(uint256 _pid, address user) external view returns (uint256);
/// @notice Return `true` if the LP Token is added to created pools
function isLpTokenAdded(IERC20 _lpToken) external view returns (bool);
/// @notice Update reward computation params for all pools
/// @dev Be careful of gas spending
function massUpdatePools() external;
/// @notice Update CVP tokens allocation for the given pool
function updatePool(uint256 _pid) external;
/// @notice Deposit the given amount of LP tokens to the given pool
function deposit(
uint256 _pid,
uint256 _amount,
uint256 _boostAmount
) external;
/// @notice Withdraw the given amount of LP tokens from the given pool
function withdraw(
uint256 _pid,
uint256 _amount,
uint256 _boostAmount
) external;
/// @notice Withdraw LP tokens without caring about pending CVP tokens. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) external;
/// @notice Write votes of the given user at the current block
function checkpointVotes(address _user) external;
/// @notice Get CVP amount and the share of CVPs in LP pools for the given account and the checkpoint
function getCheckpoint(address account, uint32 checkpointId)
external
view
returns (
uint32 fromBlock,
uint96 cvpAmount,
uint96 pooledCvpShare
);
event AddLpToken(address indexed lpToken, uint256 indexed pid, uint256 allocPoint);
event SetLpToken(address indexed lpToken, uint256 indexed pid, uint256 allocPoint);
event SetMigrator(address indexed migrator);
event SetCvpPerBlock(uint256 cvpPerBlock);
event SetCvpVestingPeriodInBlocks(uint256 cvpVestingPeriodInBlocks);
event SetCvpPoolByMetaPool(address indexed metaPool, address indexed cvpPool);
event MigrateLpToken(address indexed oldLpToken, address indexed newLpToken, uint256 indexed pid);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, uint256 boostAmount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, uint256 boostAmount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount, uint256 boostAmount);
event CheckpointTotalLpVotes(uint256 lpVotes);
event CheckpointUserLpVotes(address indexed user, uint256 indexed pid, uint256 lpVotes);
event CheckpointUserVotes(address indexed user, uint256 pendedVotes, uint256 lpVotesShare);
}
| 31,999 |
13 | // - allows Owner to add a new revenue stream to the Spigot - revenueContract cannot be address(this) - callable by `owner` revenueContract - smart contract to claim tokens from setting - Spigot settings for smart contract / | function addSpigot(address revenueContract, Setting memory setting) external returns (bool) {
return state.addSpigot(revenueContract, setting);
}
| function addSpigot(address revenueContract, Setting memory setting) external returns (bool) {
return state.addSpigot(revenueContract, setting);
}
| 29,585 |
292 | // Trade the heldToken for the owedToken | uint256 receivedOwedToken = ExchangeWrapper(transaction.exchangeWrapper).exchange(
msg.sender,
state.TOKEN_PROXY,
transaction.owedToken,
transaction.heldToken,
buybackCostInHeldToken,
orderData
);
require(
| uint256 receivedOwedToken = ExchangeWrapper(transaction.exchangeWrapper).exchange(
msg.sender,
state.TOKEN_PROXY,
transaction.owedToken,
transaction.heldToken,
buybackCostInHeldToken,
orderData
);
require(
| 35,185 |
20 | // documentHasAchievedMajority: per hash, whether that hash has ever achieved majoritythe note for upgradeHasAchievedMajority above applies here as well | mapping(bytes32 => bool) public documentHasAchievedMajority;
| mapping(bytes32 => bool) public documentHasAchievedMajority;
| 3,158 |
239 | // Get a portion of the eventual unlent balance | redeemedTokens = redeemedTokens.add(_amount.mul(balanceUnderlying).div(afiSupply));
| redeemedTokens = redeemedTokens.add(_amount.mul(balanceUnderlying).div(afiSupply));
| 10,476 |
190 | // Handle back interest: calculates interest owned since the loan endtime passed but the loan remained open | uint256 backInterestTime;
uint256 backInterestOwed;
if (block.timestamp > loanLocal.endTimestamp) {
backInterestTime = block.timestamp
.sub(loanLocal.endTimestamp);
backInterestOwed = backInterestTime
.mul(loanInterestLocal.owedPerDay);
backInterestOwed = backInterestOwed
.div(24 hours);
}
| uint256 backInterestTime;
uint256 backInterestOwed;
if (block.timestamp > loanLocal.endTimestamp) {
backInterestTime = block.timestamp
.sub(loanLocal.endTimestamp);
backInterestOwed = backInterestTime
.mul(loanInterestLocal.owedPerDay);
backInterestOwed = backInterestOwed
.div(24 hours);
}
| 12,391 |
255 | // Redeem a specified quantity of the sender's shares for a proportionate slice of/ the fund's assets, optionally specifying additional assets and assets to skip./_sharesQuantity The quantity of shares to redeem/_additionalAssets Additional (non-tracked) assets to claim/_assetsToSkip Tracked assets to forfeit/ return payoutAssets_ The assets paid out to the redeemer/ return payoutAmounts_ The amount of each asset paid out to the redeemer/Any claim to passed _assetsToSkip will be forfeited entirely. This should generally/ only be exercised if a bad asset is causing redemption to fail. | function redeemSharesDetailed(
uint256 _sharesQuantity,
address[] calldata _additionalAssets,
address[] calldata _assetsToSkip
| function redeemSharesDetailed(
uint256 _sharesQuantity,
address[] calldata _additionalAssets,
address[] calldata _assetsToSkip
| 16,942 |
728 | // if boost is not enabled, set max ratio to max uint | uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1);
require(checkParams(manager.ilks(_cdpId), _minRatio, localMaxRatio), "Must be correct params");
SubPosition storage subInfo = subscribersPos[_cdpId];
CdpHolder memory subscription = CdpHolder({
minRatio: _minRatio,
maxRatio: localMaxRatio,
optimalRatioBoost: _optimalBoost,
optimalRatioRepay: _optimalRepay,
| uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1);
require(checkParams(manager.ilks(_cdpId), _minRatio, localMaxRatio), "Must be correct params");
SubPosition storage subInfo = subscribersPos[_cdpId];
CdpHolder memory subscription = CdpHolder({
minRatio: _minRatio,
maxRatio: localMaxRatio,
optimalRatioBoost: _optimalBoost,
optimalRatioRepay: _optimalRepay,
| 57,909 |
41 | // Internally calculates a swap between two tokens.The caller is expected to transfer the actual amounts (dx and dy)using the token contracts.self Swap struct to read from tokenIndexFrom the token to sell tokenIndexTo the token to buy dy the number of tokens to buy. If the token charges a fee on transfers,use the amount that gets transferred after the fee.return dx the number of tokens the user have to deposit in the token's precision. ex WBTC -> 8return dxFee the associated fee in multiplied precision (Constants.POOL_PRECISION_DECIMALS) / | function _calculateSwapInv(
Swap storage self,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dy,
uint256[] memory balances
| function _calculateSwapInv(
Swap storage self,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dy,
uint256[] memory balances
| 21,003 |
0 | // |
IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11);
VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code")))));
address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67;
uint256 private constant INT256_MIN_ABS =
57896044618658097711785492504343953926634992332820282019728792003956564819968;
uint256 private constant UINT256_MAX =
115792089237316195423570985008687907853269984665640564039457584007913129639935;
/*//////////////////////////////////////////////////////////////////////////
|
IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11);
VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code")))));
address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67;
uint256 private constant INT256_MIN_ABS =
57896044618658097711785492504343953926634992332820282019728792003956564819968;
uint256 private constant UINT256_MAX =
115792089237316195423570985008687907853269984665640564039457584007913129639935;
/*//////////////////////////////////////////////////////////////////////////
| 21,579 |
26 | // Calculate natural exponent of x.Revert on overflow.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function exp (int128 x) internal pure returns (int128) {
unchecked {
require (x < 0x400000000000000000); // Overflow
if (x < -0x400000000000000000) return 0; // Underflow
return exp_2 (
int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));
}
}
| function exp (int128 x) internal pure returns (int128) {
unchecked {
require (x < 0x400000000000000000); // Overflow
if (x < -0x400000000000000000) return 0; // Underflow
return exp_2 (
int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));
}
}
| 12,155 |
20 | // Will revert if lot is not in biddable state | _isLotInBiddableState(_lotID);
| _isLotInBiddableState(_lotID);
| 41,307 |
27 | // Replaces the attribute which is attached to an NFT with another attribute of the same type. | * @dev Works like {dettach} and {attach} in the same function.
*/
function replaceAttr(uint _attrId, uint _tokenId) external payable {
address owner = ownerOfAttr(_attrId);
require(owner == ownerOf(_tokenId));
_isApprovedOrAttrOwner(owner, msg.sender, _attrId);
_isApprovedOrOwner(owner, msg.sender, _tokenId);
TraitType attrType = attrs[_attrId].trait_type;
// before replace attr
require(uint(attrType) > 0);
uint attachedAttr = _attrsOf[_tokenId][uint(attrType)];
// dettach
delete _attachedTo[attachedAttr];
_attrOwners[attachedAttr] = owner;
// attach
delete _attrOwners[_attrId];
delete _attrTokenApprovals[_attrId];
_attrsOf[_tokenId][uint(attrType)] = _attrId;
_attachedTo[_attrId] = _tokenId;
}
| * @dev Works like {dettach} and {attach} in the same function.
*/
function replaceAttr(uint _attrId, uint _tokenId) external payable {
address owner = ownerOfAttr(_attrId);
require(owner == ownerOf(_tokenId));
_isApprovedOrAttrOwner(owner, msg.sender, _attrId);
_isApprovedOrOwner(owner, msg.sender, _tokenId);
TraitType attrType = attrs[_attrId].trait_type;
// before replace attr
require(uint(attrType) > 0);
uint attachedAttr = _attrsOf[_tokenId][uint(attrType)];
// dettach
delete _attachedTo[attachedAttr];
_attrOwners[attachedAttr] = owner;
// attach
delete _attrOwners[_attrId];
delete _attrTokenApprovals[_attrId];
_attrsOf[_tokenId][uint(attrType)] = _attrId;
_attachedTo[_attrId] = _tokenId;
}
| 42,628 |
5 | // price | uint256 public darkPriceOne;
uint256 public darkPriceCeiling;
uint256 public seigniorageSaved;
uint256 public darkSupplyTarget;
uint256 public maxSupplyExpansionPercent;
uint256 public bondDepletionFloorPercent;
uint256 public seigniorageExpansionFloorPercent;
| uint256 public darkPriceOne;
uint256 public darkPriceCeiling;
uint256 public seigniorageSaved;
uint256 public darkSupplyTarget;
uint256 public maxSupplyExpansionPercent;
uint256 public bondDepletionFloorPercent;
uint256 public seigniorageExpansionFloorPercent;
| 4,857 |
26 | // Unsubscribe an existing strategy/_subId Subscription id | function unsubscribe(uint _subId) public {
Strategy memory s = strategies[_subId];
require(s.user != address(0), "Strategy does not exist");
require(msg.sender == s.proxy, "Proxy not strategy owner");
strategies[_subId].active = false;
logger.Log(address(this), msg.sender, "Unsubscribe", abi.encode(_subId));
}
| function unsubscribe(uint _subId) public {
Strategy memory s = strategies[_subId];
require(s.user != address(0), "Strategy does not exist");
require(msg.sender == s.proxy, "Proxy not strategy owner");
strategies[_subId].active = false;
logger.Log(address(this), msg.sender, "Unsubscribe", abi.encode(_subId));
}
| 80,815 |
24 | // 终结申请,判断是否通过,通过转载给卖家 | function finality(uint256 i) public {
Resquest storage res = requestsMapping[i];
// 1、只有众筹的人才有资格结束这个申请
assert(msg.sender == manager);
// 2、票数要大于一半
assert(res.votesNum * 2 > voters.length);
// 3、转账的金额必须小于于合约余额
assert(res.costMoney <= address(this).balance);
// 4、执行转账
payable(res.seller).transfer(res.costMoney);
// 5、修改状态为完结
res.status = RequestStatus.wnachen;
}
| function finality(uint256 i) public {
Resquest storage res = requestsMapping[i];
// 1、只有众筹的人才有资格结束这个申请
assert(msg.sender == manager);
// 2、票数要大于一半
assert(res.votesNum * 2 > voters.length);
// 3、转账的金额必须小于于合约余额
assert(res.costMoney <= address(this).balance);
// 4、执行转账
payable(res.seller).transfer(res.costMoney);
// 5、修改状态为完结
res.status = RequestStatus.wnachen;
}
| 21,338 |
26 | // ints | uint256 private _totalSupply;
uint256 private _unitsPerToken;
uint256 private _initialPoolToken;
uint256 private _poolBalance;
uint256 private _poolFactor;
uint256 private _period;
uint256 private _timelockkeeping;
uint256 private _timelockstopinflations;
| uint256 private _totalSupply;
uint256 private _unitsPerToken;
uint256 private _initialPoolToken;
uint256 private _poolBalance;
uint256 private _poolFactor;
uint256 private _period;
uint256 private _timelockkeeping;
uint256 private _timelockstopinflations;
| 31,424 |
40 | // to position this {TimelockController} as the owner of a smart contract, with/ Emitted when a call is scheduled as part of operation `id`. / | event CallScheduled(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data, bytes32 predecessor, uint256 delay);
| event CallScheduled(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data, bytes32 predecessor, uint256 delay);
| 23,498 |
2 | // number of tokens that can be claimed for free - 20% of MAX_TOKENS | uint256 public PAID_TOKENS;
| uint256 public PAID_TOKENS;
| 71,385 |
50 | // Safety mechanism to pause most Vault operations in the event of an emergency - typically detection of anerror in some part of the system. The Vault can only be paused during an initial time period, after which pausing is forever disabled. While the contract is paused, the following features are disabled:- depositing and transferring internal balance- transferring external balance (using the Vault's allowance)- swaps- joining Pools- Asset Manager interactions Internal Balance can still be withdrawn, and Pools exited. / | function setPaused(bool paused) external;
| function setPaused(bool paused) external;
| 22,001 |
131 | // Returns all the relevant information about a specific player./_id The ID of the player of interest. | function getPlayer(uint256 _id)
external
view
returns (
uint256 typeId,
uint256 attack,
uint256 defense,
uint256 stamina,
uint256 xp,
uint256 isKeeper,
| function getPlayer(uint256 _id)
external
view
returns (
uint256 typeId,
uint256 attack,
uint256 defense,
uint256 stamina,
uint256 xp,
uint256 isKeeper,
| 15,426 |
46 | // migration function | function TGPTMigration(address[] memory _address, uint256[] memory _amount) external onlyOwner {
for(uint i=0; i< _amount.length; i++){
address adr = _address[i];
uint amnt = _amount[i];
super._transfer(owner(), adr, amnt);
}
// events from ERC20
}
| function TGPTMigration(address[] memory _address, uint256[] memory _amount) external onlyOwner {
for(uint i=0; i< _amount.length; i++){
address adr = _address[i];
uint amnt = _amount[i];
super._transfer(owner(), adr, amnt);
}
// events from ERC20
}
| 12,777 |
15 | // Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders | function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
require(tokenAddress != address(stakingToken), "Cannot withdraw the staking token");
IERC20(tokenAddress).safeTransfer(owner(), tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
}
| function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
require(tokenAddress != address(stakingToken), "Cannot withdraw the staking token");
IERC20(tokenAddress).safeTransfer(owner(), tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
}
| 3,015 |
38 | // leave off amount0 and amount1 due to stack limit | (uint256 token_id, uint128 liquidity, , ) = univ3_positions.mint(mint_params);
| (uint256 token_id, uint128 liquidity, , ) = univ3_positions.mint(mint_params);
| 3,953 |
198 | // Transfer set and all its assets / | function _transferEnvelope(address _to,uint256 _assetId)
internal
| function _transferEnvelope(address _to,uint256 _assetId)
internal
| 50,883 |
73 | // R1 | require(msg.sender == creator);
_;
| require(msg.sender == creator);
_;
| 50,080 |
10 | // Calculate quantity of optionTokens needed to burn. An ether put option with strike price $300 has a "base" value of 300, and a "quote" value of 1. To calculate how many options are needed to be burned, we need to cancel out the "quote" units. The input strike quantity can be multiplied by the strike ratio to cancel out "quote" units. 1 ether (quote units)300 (base units) / 1 (quote units) = 300 inputOptions | uint256 inputOptions = inputStrikes.mul(optionToken.getBaseValue()).div(
optionToken.getQuoteValue()
);
| uint256 inputOptions = inputStrikes.mul(optionToken.getBaseValue()).div(
optionToken.getQuoteValue()
);
| 39,588 |
22 | // liquidates trove, must be called from that trove/this function does not provide an opportunity for a reentrancy attack even though it would make the arbitrage/fail because of the lowering of the stablecoin balance/must be called by the valid trove | function liquidate() public override {
ITrove trove = ITrove(msg.sender);
IERC20 collateralToken = IERC20(trove.token());
address collateralTokenAddress = address(collateralToken);
ITroveFactory factory_cached = factory;
require(
factory_cached.containsTrove(address(collateralToken), msg.sender),
"StabilityPool:liquidate: must be called from a valid trove"
);
uint256 troveDebt = trove.debt();
uint256 totalStableCoin = totalDeposit; // cached to save an SLOAD
uint256 troveCollateral = trove.collateral();
collateralToken.safeTransferFrom(address(trove), address(this), troveCollateral);
(uint256 collateralGainPerUnitStaked, uint256 stableCoinLossPerUnitStaked) = _computeRewardsPerUnitStaked(
collateralTokenAddress,
troveCollateral,
troveDebt,
totalStableCoin
);
_updateRewardSumAndProduct(collateralTokenAddress, collateralGainPerUnitStaked, stableCoinLossPerUnitStaked);
_triggerBONQdistribution();
stableCoin.burn(troveDebt);
uint256 newTotalDeposit = totalStableCoin - troveDebt;
totalDeposit = newTotalDeposit;
emit TotalDepositUpdated(newTotalDeposit);
factory_cached.emitLiquidationEvent(address(collateralToken), msg.sender, address(this), troveCollateral);
}
| function liquidate() public override {
ITrove trove = ITrove(msg.sender);
IERC20 collateralToken = IERC20(trove.token());
address collateralTokenAddress = address(collateralToken);
ITroveFactory factory_cached = factory;
require(
factory_cached.containsTrove(address(collateralToken), msg.sender),
"StabilityPool:liquidate: must be called from a valid trove"
);
uint256 troveDebt = trove.debt();
uint256 totalStableCoin = totalDeposit; // cached to save an SLOAD
uint256 troveCollateral = trove.collateral();
collateralToken.safeTransferFrom(address(trove), address(this), troveCollateral);
(uint256 collateralGainPerUnitStaked, uint256 stableCoinLossPerUnitStaked) = _computeRewardsPerUnitStaked(
collateralTokenAddress,
troveCollateral,
troveDebt,
totalStableCoin
);
_updateRewardSumAndProduct(collateralTokenAddress, collateralGainPerUnitStaked, stableCoinLossPerUnitStaked);
_triggerBONQdistribution();
stableCoin.burn(troveDebt);
uint256 newTotalDeposit = totalStableCoin - troveDebt;
totalDeposit = newTotalDeposit;
emit TotalDepositUpdated(newTotalDeposit);
factory_cached.emitLiquidationEvent(address(collateralToken), msg.sender, address(this), troveCollateral);
}
| 28,782 |
96 | // Get time lock array lengthaccount The address want to know the time lock length. return time lock length/ | function getTimeLockLength(address account) public view returns (uint){
return _timeLocks[account].length;
}
| function getTimeLockLength(address account) public view returns (uint){
return _timeLocks[account].length;
}
| 32,348 |
6 | // Contract constructor_asset ERC20 token_name Token name_symbol Token symbol / | constructor(
| constructor(
| 521 |
28 | // add token to new owner | require(idToOwner[_tokenId] == address(0));
idToOwner[_tokenId] = _to;
ownerToTokenCount[_to] = ownerToTokenCount[_to].add(1);
emit Transfer(_from, _to, _tokenId);
| require(idToOwner[_tokenId] == address(0));
idToOwner[_tokenId] = _to;
ownerToTokenCount[_to] = ownerToTokenCount[_to].add(1);
emit Transfer(_from, _to, _tokenId);
| 5,336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.