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 |
|---|---|---|---|---|
32 | // Set new pause status. newIsPaused The pause status: 0 - not paused, 1 - paused. / | function setIsPaused(bool newIsPaused) external onlyOwner {
isPaused = newIsPaused;
}
| function setIsPaused(bool newIsPaused) external onlyOwner {
isPaused = newIsPaused;
}
| 43,494 |
348 | // Loads values from a "DailyDataStore" object into a "DailyDataCache" object. dayStore "DailyDataStore" object to be loaded. day "DailyDataCache" object to be populated with storage data. / | function _dailyDataLoad(
DailyDataStore storage dayStore,
DailyDataCache memory day
)
internal
view
| function _dailyDataLoad(
DailyDataStore storage dayStore,
DailyDataCache memory day
)
internal
view
| 31,342 |
127 | // Send the FL funds received to DSProxy/_proxy DSProxy address/_reserve Token address/_amount Amount of tokens | function sendLoanToProxy(address payable _proxy, address _reserve, uint _amount) internal {
if (_reserve != ETH_ADDRESS) {
ERC20(_reserve).safeTransfer(_proxy, _amount);
}
_proxy.transfer(address(this).balance);
}
| function sendLoanToProxy(address payable _proxy, address _reserve, uint _amount) internal {
if (_reserve != ETH_ADDRESS) {
ERC20(_reserve).safeTransfer(_proxy, _amount);
}
_proxy.transfer(address(this).balance);
}
| 44,226 |
39 | // Return OracleHub Module address from the Nexusreturn Address of the OracleHub Module contract / | function _oracleHub() internal view returns (address) {
return nexus.getModule(KEY_ORACLE_HUB);
}
| function _oracleHub() internal view returns (address) {
return nexus.getModule(KEY_ORACLE_HUB);
}
| 21,968 |
24 | // checks teachers' address | mapping(address => teach) public checkTeacher;
| mapping(address => teach) public checkTeacher;
| 24,569 |
11 | // Returns the number of tokens left to distribute. / | function remainingRewards() external view override returns (uint256) {
return rewardToken.balanceOf(address(this));
}
| function remainingRewards() external view override returns (uint256) {
return rewardToken.balanceOf(address(this));
}
| 21,335 |
68 | // ่ฎพ็ฝฎไผฐ่ฎก็ๆฏไธชๅ้ด้๏ผ่ฟ้ๆฃๆฅๅฟ
้กปๅฐไบ 1 ๅ้ไบ/ ๅฟ
้กป็ฎก็ๅฑ่ฐ็จ ๅค้จๅฝๆฐ | function setSecondsPerBlock(uint256 secs) external onlyCLevel {
require(secs < cooldowns[0]);
secondsPerBlock = secs;
}
| function setSecondsPerBlock(uint256 secs) external onlyCLevel {
require(secs < cooldowns[0]);
secondsPerBlock = secs;
}
| 44,008 |
50 | // Returns the number of NFTs in `owner`'s account. / | function balanceOf(address owner) public view returns (uint256 balance);
| function balanceOf(address owner) public view returns (uint256 balance);
| 20,132 |
223 | // If this is an ETH bid, ensure they sent enough and convert it to WETH under the hood | if(currency == address(0)) {
require(msg.value == amount, "Sent ETH Value does not match specified bid amount");
IWETH(wethAddress).deposit{value: amount}();
} else {
// We must check the balance that was actually transferred to the auction,
// as some tokens impose a transfer fee and would not actually transfer the
// full amount to the market, resulting in potentally locked funds
IERC20 token = IERC20(currency);
uint256 beforeBalance = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender, address(this), amount);
uint256 afterBalance = token.balanceOf(address(this));
require(beforeBalance.add(amount) == afterBalance, "Token transfer call did not transfer expected amount");
}
| if(currency == address(0)) {
require(msg.value == amount, "Sent ETH Value does not match specified bid amount");
IWETH(wethAddress).deposit{value: amount}();
} else {
// We must check the balance that was actually transferred to the auction,
// as some tokens impose a transfer fee and would not actually transfer the
// full amount to the market, resulting in potentally locked funds
IERC20 token = IERC20(currency);
uint256 beforeBalance = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender, address(this), amount);
uint256 afterBalance = token.balanceOf(address(this));
require(beforeBalance.add(amount) == afterBalance, "Token transfer call did not transfer expected amount");
}
| 17,058 |
17 | // Emits a {Transfer} event. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. / | function transfer(address to, uint256 amount) external returns (bool) {
_transfer(msg.sender, to, amount);
return true;
}
| function transfer(address to, uint256 amount) external returns (bool) {
_transfer(msg.sender, to, amount);
return true;
}
| 18,670 |
129 | // Flag marking whether the proposal has been canceled | bool canceled;
| bool canceled;
| 20,847 |
36 | // data contract | address public dataContract;
address public battleContract;
address public tradeContract;
| address public dataContract;
address public battleContract;
address public tradeContract;
| 53,408 |
16 | // packed contains: 1. Timestamps for start and end of ballot (UTC) 2. bits used to decide which options are enabled or disabled for submission of ballots | uint256 packed;
| uint256 packed;
| 18,344 |
183 | // Safe EdFi transfer function, just in case if rounding error causes pool to not have enough EDFis. | function safeEdFiTransfer(address _to, uint256 _amount)
external
whenNotPaused
onlyAdminOrMinter
| function safeEdFiTransfer(address _to, uint256 _amount)
external
whenNotPaused
onlyAdminOrMinter
| 29,516 |
9 | // timestamp to keep track of if presale started | uint256 public timeToStartPresale = 1647500400;
| uint256 public timeToStartPresale = 1647500400;
| 66,558 |
391 | // Withdraw a bid when the auction is not finalized | function withdraw(uint256 tokenId) public nonReentrant {
require(canWithdraw(tokenId), "Conditions to withdraw are not met");
// transfer funds to highest bidder always
if (auctions[tokenId].highestBid > 0) {
require(payment_token.transfer(auctions[tokenId].highestBidder, auctions[tokenId].highestBid), "Transfer failed.");
}
// finalize the auction
delete auctions[tokenId];
}
| function withdraw(uint256 tokenId) public nonReentrant {
require(canWithdraw(tokenId), "Conditions to withdraw are not met");
// transfer funds to highest bidder always
if (auctions[tokenId].highestBid > 0) {
require(payment_token.transfer(auctions[tokenId].highestBidder, auctions[tokenId].highestBid), "Transfer failed.");
}
// finalize the auction
delete auctions[tokenId];
}
| 8,678 |
5 | // payment currency | _path[_path.length - 1],
_to,
amountToPay,
_paymentReference,
amountToPayInFees,
_feeAddress
)
);
require(status, "transferFromWithReferenceAndFee failed");
| _path[_path.length - 1],
_to,
amountToPay,
_paymentReference,
amountToPayInFees,
_feeAddress
)
);
require(status, "transferFromWithReferenceAndFee failed");
| 31,729 |
48 | // Calculate necessary sweepable token amount for pool to contain full token supply | uint256 amountIn = IERC20(msg.sender).totalSupply() - _reserveSweeper;
uint256 numerator = amountIn.mul(_reserveSwept);
uint256 denominator = _reserveSweeper.mul(1000).add(amountIn);
uint256 amountOut = numerator / denominator;
uint256 maxSweepable = _reserveSwept - amountOut;
uint256 _sweptAmount = sweptAmount.add(amount);
require(_sweptAmount <= maxSweepable, "Empire: INCORRECT_SWEEP_AMOUNT");
| uint256 amountIn = IERC20(msg.sender).totalSupply() - _reserveSweeper;
uint256 numerator = amountIn.mul(_reserveSwept);
uint256 denominator = _reserveSweeper.mul(1000).add(amountIn);
uint256 amountOut = numerator / denominator;
uint256 maxSweepable = _reserveSwept - amountOut;
uint256 _sweptAmount = sweptAmount.add(amount);
require(_sweptAmount <= maxSweepable, "Empire: INCORRECT_SWEEP_AMOUNT");
| 70,654 |
38 | // ========== Custodian ========== / | function withdrawRewards() public onlyCustodian {
COMP.transfer(custodian_address, COMP.balanceOf(address(this)));
stkAAVE.transfer(custodian_address, stkAAVE.balanceOf(address(this)));
AAVE.transfer(custodian_address, AAVE.balanceOf(address(this)));
}
| function withdrawRewards() public onlyCustodian {
COMP.transfer(custodian_address, COMP.balanceOf(address(this)));
stkAAVE.transfer(custodian_address, stkAAVE.balanceOf(address(this)));
AAVE.transfer(custodian_address, AAVE.balanceOf(address(this)));
}
| 12,176 |
13 | // Royalty percentage | uint256 public royaltyPercentage;
| uint256 public royaltyPercentage;
| 39,046 |
208 | // Balancer Labs Manage Configurable Rights for the smart pool canPauseSwapping - can setPublicSwap back to false after turning it onby default, it is off on initialization and can only be turned on canChangeSwapFee - can setSwapFee after initialization (by default, it is fixed at create time) canChangeWeights - can bind new token weights (allowed by default in base pool) canAddRemoveTokens - can bind/unbind tokens (allowed by default in base pool) canWhitelistLPs - can limit liquidity providers to a given set of addresses canChangeCap - can change the BSP cap (maxof pool tokens) / | library RightsManager {
// Type declarations
enum Permissions {
PAUSE_SWAPPING,
CHANGE_SWAP_FEE,
CHANGE_WEIGHTS,
ADD_REMOVE_TOKENS,
WHITELIST_LPS,
CHANGE_CAP
}
struct Rights {
bool canPauseSwapping;
bool canChangeSwapFee;
bool canChangeWeights;
bool canAddRemoveTokens;
bool canWhitelistLPs;
bool canChangeCap;
}
// State variables (can only be constants in a library)
bool public constant DEFAULT_CAN_PAUSE_SWAPPING = false;
bool public constant DEFAULT_CAN_CHANGE_SWAP_FEE = true;
bool public constant DEFAULT_CAN_CHANGE_WEIGHTS = true;
bool public constant DEFAULT_CAN_ADD_REMOVE_TOKENS = false;
bool public constant DEFAULT_CAN_WHITELIST_LPS = false;
bool public constant DEFAULT_CAN_CHANGE_CAP = false;
// Functions
/**
* @notice create a struct from an array (or return defaults)
* @dev If you pass an empty array, it will construct it using the defaults
* @param a - array input
* @return Rights struct
*/
function constructRights(bool[] calldata a)
external
pure
returns (Rights memory)
{
if (a.length == 0) {
return
Rights(
DEFAULT_CAN_PAUSE_SWAPPING,
DEFAULT_CAN_CHANGE_SWAP_FEE,
DEFAULT_CAN_CHANGE_WEIGHTS,
DEFAULT_CAN_ADD_REMOVE_TOKENS,
DEFAULT_CAN_WHITELIST_LPS,
DEFAULT_CAN_CHANGE_CAP
);
} else {
return Rights(a[0], a[1], a[2], a[3], a[4], a[5]);
}
}
/**
* @notice Convert rights struct to an array (e.g., for events, GUI)
* @dev avoids multiple calls to hasPermission
* @param rights - the rights struct to convert
* @return boolean array containing the rights settings
*/
function convertRights(Rights calldata rights)
external
pure
returns (bool[] memory)
{
bool[] memory result = new bool[](6);
result[0] = rights.canPauseSwapping;
result[1] = rights.canChangeSwapFee;
result[2] = rights.canChangeWeights;
result[3] = rights.canAddRemoveTokens;
result[4] = rights.canWhitelistLPs;
result[5] = rights.canChangeCap;
return result;
}
// Though it is actually simple, the number of branches triggers code-complexity
/* solhint-disable code-complexity */
/**
* @notice Externally check permissions using the Enum
* @param self - Rights struct containing the permissions
* @param permission - The permission to check
* @return Boolean true if it has the permission
*/
function hasPermission(Rights calldata self, Permissions permission)
external
pure
returns (bool)
{
if (Permissions.PAUSE_SWAPPING == permission) {
return self.canPauseSwapping;
} else if (Permissions.CHANGE_SWAP_FEE == permission) {
return self.canChangeSwapFee;
} else if (Permissions.CHANGE_WEIGHTS == permission) {
return self.canChangeWeights;
} else if (Permissions.ADD_REMOVE_TOKENS == permission) {
return self.canAddRemoveTokens;
} else if (Permissions.WHITELIST_LPS == permission) {
return self.canWhitelistLPs;
} else if (Permissions.CHANGE_CAP == permission) {
return self.canChangeCap;
}
}
/* solhint-enable code-complexity */
}
| library RightsManager {
// Type declarations
enum Permissions {
PAUSE_SWAPPING,
CHANGE_SWAP_FEE,
CHANGE_WEIGHTS,
ADD_REMOVE_TOKENS,
WHITELIST_LPS,
CHANGE_CAP
}
struct Rights {
bool canPauseSwapping;
bool canChangeSwapFee;
bool canChangeWeights;
bool canAddRemoveTokens;
bool canWhitelistLPs;
bool canChangeCap;
}
// State variables (can only be constants in a library)
bool public constant DEFAULT_CAN_PAUSE_SWAPPING = false;
bool public constant DEFAULT_CAN_CHANGE_SWAP_FEE = true;
bool public constant DEFAULT_CAN_CHANGE_WEIGHTS = true;
bool public constant DEFAULT_CAN_ADD_REMOVE_TOKENS = false;
bool public constant DEFAULT_CAN_WHITELIST_LPS = false;
bool public constant DEFAULT_CAN_CHANGE_CAP = false;
// Functions
/**
* @notice create a struct from an array (or return defaults)
* @dev If you pass an empty array, it will construct it using the defaults
* @param a - array input
* @return Rights struct
*/
function constructRights(bool[] calldata a)
external
pure
returns (Rights memory)
{
if (a.length == 0) {
return
Rights(
DEFAULT_CAN_PAUSE_SWAPPING,
DEFAULT_CAN_CHANGE_SWAP_FEE,
DEFAULT_CAN_CHANGE_WEIGHTS,
DEFAULT_CAN_ADD_REMOVE_TOKENS,
DEFAULT_CAN_WHITELIST_LPS,
DEFAULT_CAN_CHANGE_CAP
);
} else {
return Rights(a[0], a[1], a[2], a[3], a[4], a[5]);
}
}
/**
* @notice Convert rights struct to an array (e.g., for events, GUI)
* @dev avoids multiple calls to hasPermission
* @param rights - the rights struct to convert
* @return boolean array containing the rights settings
*/
function convertRights(Rights calldata rights)
external
pure
returns (bool[] memory)
{
bool[] memory result = new bool[](6);
result[0] = rights.canPauseSwapping;
result[1] = rights.canChangeSwapFee;
result[2] = rights.canChangeWeights;
result[3] = rights.canAddRemoveTokens;
result[4] = rights.canWhitelistLPs;
result[5] = rights.canChangeCap;
return result;
}
// Though it is actually simple, the number of branches triggers code-complexity
/* solhint-disable code-complexity */
/**
* @notice Externally check permissions using the Enum
* @param self - Rights struct containing the permissions
* @param permission - The permission to check
* @return Boolean true if it has the permission
*/
function hasPermission(Rights calldata self, Permissions permission)
external
pure
returns (bool)
{
if (Permissions.PAUSE_SWAPPING == permission) {
return self.canPauseSwapping;
} else if (Permissions.CHANGE_SWAP_FEE == permission) {
return self.canChangeSwapFee;
} else if (Permissions.CHANGE_WEIGHTS == permission) {
return self.canChangeWeights;
} else if (Permissions.ADD_REMOVE_TOKENS == permission) {
return self.canAddRemoveTokens;
} else if (Permissions.WHITELIST_LPS == permission) {
return self.canWhitelistLPs;
} else if (Permissions.CHANGE_CAP == permission) {
return self.canChangeCap;
}
}
/* solhint-enable code-complexity */
}
| 6,355 |
5 | // Returns the current round. / | function currentRound() external view virtual returns (uint16) {
return _currentRound;
}
| function currentRound() external view virtual returns (uint16) {
return _currentRound;
}
| 7,665 |
146 | // note: already checked msg.sender has admin with `only_admin` modifier | require(msg.sender != owner, "owner cannot upgrade self");
_setAdmin(msg.sender, false);
_setAdmin(newAdmin, true);
| require(msg.sender != owner, "owner cannot upgrade self");
_setAdmin(msg.sender, false);
_setAdmin(newAdmin, true);
| 22,382 |
7 | // IERC1363Spender Interface Interface for any contract that wants to support approveAndCall from ERC1363 token contracts as defined in / | interface IERC1363Spender {
/*
* Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
* 0x7b04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))
*/
/**
* @notice Handle the approval of ERC1363 tokens
* @dev Any ERC1363 smart contract calls this function on the recipient
* after an `approve`. This function MAY throw to revert and reject the
* approval. Return of other than the magic value MUST result in the
* transaction being reverted.
* Note: the token contract address is always the message sender.
* @param sender address The address which called `approveAndCall` function
* @param amount uint256 The amount of tokens to be spent
* @param data bytes Additional data with no specified format
* @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` unless throwing
*/
function onApprovalReceived(address sender, uint256 amount, bytes calldata data) external returns (bytes4);
}
| interface IERC1363Spender {
/*
* Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
* 0x7b04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))
*/
/**
* @notice Handle the approval of ERC1363 tokens
* @dev Any ERC1363 smart contract calls this function on the recipient
* after an `approve`. This function MAY throw to revert and reject the
* approval. Return of other than the magic value MUST result in the
* transaction being reverted.
* Note: the token contract address is always the message sender.
* @param sender address The address which called `approveAndCall` function
* @param amount uint256 The amount of tokens to be spent
* @param data bytes Additional data with no specified format
* @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` unless throwing
*/
function onApprovalReceived(address sender, uint256 amount, bytes calldata data) external returns (bytes4);
}
| 32,860 |
1 | // โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ/@inheritdoc IGovernanceLockedRevenueDistributionToken / | function delegate(address delegatee_) external virtual override {
| function delegate(address delegatee_) external virtual override {
| 10,826 |
7 | // Emits an {Approval} event. Requirements: - `owner` cannot be the zero address.- `spender` cannot be the zero address. / | function _approve(address owner, address spender, uint256 amount)
internal
override(ERC20, LinkToken)
virtual
{
LinkToken._approve(owner, spender, amount);
}
| function _approve(address owner, address spender, uint256 amount)
internal
override(ERC20, LinkToken)
virtual
{
LinkToken._approve(owner, spender, amount);
}
| 12,670 |
12 | // returns the LP store / | function store() external view override returns (ILiquidityProtectionStore) {
return _store;
}
| function store() external view override returns (ILiquidityProtectionStore) {
return _store;
}
| 2,189 |
28 | // (5) ่ฃ้ฃพๅจ modifier / ่ฃ้ฃพๅจ(5-1)๏ผๅชๆๆฟๅฎขๅฏไปฅ่ชฟ็จ | modifier onlyTenant() {
// ้ๅถ๏ผๆฌๆฌกๅ็ด็็งๅฎขๅทฒ็ถๅๅงๅ
require(
addressToTenant[msg.sender].initialized == true,
"Only a tenant can invoke this functionality"
);
_;
}
| modifier onlyTenant() {
// ้ๅถ๏ผๆฌๆฌกๅ็ด็็งๅฎขๅทฒ็ถๅๅงๅ
require(
addressToTenant[msg.sender].initialized == true,
"Only a tenant can invoke this functionality"
);
_;
}
| 6,566 |
179 | // return token value in the vault in BNB | function getTokenValues(address tokenaddress) external view returns (uint256){
return _getTokenValues(tokenaddress);
}
| function getTokenValues(address tokenaddress) external view returns (uint256){
return _getTokenValues(tokenaddress);
}
| 16,753 |
82 | // Calculate tokens added (or lost) | amountAdded = int256(amount) - int256(balance);
| amountAdded = int256(amount) - int256(balance);
| 80,816 |
10 | // Loop through the array and check each element |
for (uint256 i = 0; i < _levelDepositers.length; i++) {
if (_levelDepositers[i] == _depositer) {
return true;
}
|
for (uint256 i = 0; i < _levelDepositers.length; i++) {
if (_levelDepositers[i] == _depositer) {
return true;
}
| 24,620 |
18 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 1,994 |
9 | // Handle if ether is sent to this address | receive() external payable {
// In-case: None Exchangeable
// If ether is sent to this address, send it back.
//revert();
// In-case: Exchangeable
// Send 1 Eth to get 100 ExchangeableToken
uint256 _amountEth = msg.value;
require(_amountEth >= 1, "1 ETH to get 1000000 Token");
uint256 _tokens = (_amountEth * 1000000 * 10 ** uint256(decimals())) / 1 ether;
_mint(_msgSender(), _tokens);
// Transfer ether to Owner
address payable payableOwner = payable(owner());
(bool success,) = payableOwner.call{value : _amountEth}("");
require(success, "Transfer failed.");
}
| receive() external payable {
// In-case: None Exchangeable
// If ether is sent to this address, send it back.
//revert();
// In-case: Exchangeable
// Send 1 Eth to get 100 ExchangeableToken
uint256 _amountEth = msg.value;
require(_amountEth >= 1, "1 ETH to get 1000000 Token");
uint256 _tokens = (_amountEth * 1000000 * 10 ** uint256(decimals())) / 1 ether;
_mint(_msgSender(), _tokens);
// Transfer ether to Owner
address payable payableOwner = payable(owner());
(bool success,) = payableOwner.call{value : _amountEth}("");
require(success, "Transfer failed.");
}
| 17,568 |
69 | // sets the wallets for the thunder tokens only callable by owner _newWallets updated wallets / | function setThunderWallets(Wallets memory _newWallets) public onlyOwner {
emit ThunderWalletsUpdated();
thunderWallets = _newWallets;
}
| function setThunderWallets(Wallets memory _newWallets) public onlyOwner {
emit ThunderWalletsUpdated();
thunderWallets = _newWallets;
}
| 51,112 |
135 | // attributes and Component Ids (i.e. PowerStones) CryptoBeastie_tokenId uint256 for the given token_attributes Cryptobeasties attributes_componentIds Array of Cryptobeasties componentIds (i.e. PowerStones)/ | function updateAttributes(uint256 _tokenId, uint256 _attributes, uint256[] _componentIds) external {
require(ownerOf(_tokenId) == msg.sender || owner == msg.sender || isController(msg.sender)); //, "token owner"
cbStorage.updateAttributes(_tokenId, _attributes, _componentIds);
}
| function updateAttributes(uint256 _tokenId, uint256 _attributes, uint256[] _componentIds) external {
require(ownerOf(_tokenId) == msg.sender || owner == msg.sender || isController(msg.sender)); //, "token owner"
cbStorage.updateAttributes(_tokenId, _attributes, _componentIds);
}
| 49,347 |
183 | // nft item Id | uint8 mrId;
| uint8 mrId;
| 14,072 |
94 | // GOVERNANCE FUNCTION: Add new asset pair oracle._assetOne Address of first asset in pair _assetTwo Address of second asset in pair _oracle Address of asset pair's oracle / | function addPair(address _assetOne, address _assetTwo, IOracle _oracle) external onlyOwner {
require(
address(oracles[_assetOne][_assetTwo]) == address(0),
"PriceOracle.addPair: Pair already exists."
);
oracles[_assetOne][_assetTwo] = _oracle;
emit PairAdded(_assetOne, _assetTwo, address(_oracle));
}
| function addPair(address _assetOne, address _assetTwo, IOracle _oracle) external onlyOwner {
require(
address(oracles[_assetOne][_assetTwo]) == address(0),
"PriceOracle.addPair: Pair already exists."
);
oracles[_assetOne][_assetTwo] = _oracle;
emit PairAdded(_assetOne, _assetTwo, address(_oracle));
}
| 7,439 |
271 | // Calculates the amount of reserve in exchange for DVD after applying bonding curve tax./tokenAmount Token value in wei to use in the conversion./ return Reserve amount in wei after the 10% tax has been applied. | function dvdToReserveTaxed(uint256 tokenAmount) external view returns (uint256) {
if (tokenAmount == 0) {
return 0;
}
uint256 reserveAmount = dvdToReserve(tokenAmount);
uint256 tax = reserveAmount.div(CURVE_TAX_DENOMINATOR);
return reserveAmount.sub(tax);
}
| function dvdToReserveTaxed(uint256 tokenAmount) external view returns (uint256) {
if (tokenAmount == 0) {
return 0;
}
uint256 reserveAmount = dvdToReserve(tokenAmount);
uint256 tax = reserveAmount.div(CURVE_TAX_DENOMINATOR);
return reserveAmount.sub(tax);
}
| 19,229 |
20 | // Returns cost of certain protection amount amount to be protected period duration of quoted protectionreturn cost of protection / | function wrapCost(uint amount, uint period) view external returns (uint cost){
uint strike = _currentPrice();
return whiteOptionsPricer.getOptionPrice(period, amount, strike);
}
| function wrapCost(uint amount, uint period) view external returns (uint cost){
uint strike = _currentPrice();
return whiteOptionsPricer.getOptionPrice(period, amount, strike);
}
| 75,736 |
33 | // Interest index of the market | Interest.Index index;
| Interest.Index index;
| 14,912 |
135 | // Implements https:en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle. Code taken from CryptoPhunksV2 | function getAvailableTokenAtIndex(uint256 indexToUse, uint updatedNumAvailableTokens)
internal
returns (uint256)
| function getAvailableTokenAtIndex(uint256 indexToUse, uint updatedNumAvailableTokens)
internal
returns (uint256)
| 35,947 |
123 | // Return amount of tokens (in EXTwei) which can be purchased at the moment for given amount of ether (in wei). | function toEXTwei(uint256 _value) public view returns (uint256) {
return _value.mul(dec).div(currentPrice);
}
| function toEXTwei(uint256 _value) public view returns (uint256) {
return _value.mul(dec).div(currentPrice);
}
| 14,117 |
17 | // This function charge interest on a interestBearingAmountinterestBearingAmount is the interest bearing amountratePerSecond Interest rate accumulation per second in RAD(10ห27)lastUpdated last time the interest has been charged return interestBearingAmount + interest | function chargeInterest(uint interestBearingAmount, uint ratePerSecond, uint lastUpdated) public view returns (uint) {
if (block.timestamp >= lastUpdated) {
interestBearingAmount = _chargeInterest(interestBearingAmount, ratePerSecond, lastUpdated, block.timestamp);
}
return interestBearingAmount;
}
| function chargeInterest(uint interestBearingAmount, uint ratePerSecond, uint lastUpdated) public view returns (uint) {
if (block.timestamp >= lastUpdated) {
interestBearingAmount = _chargeInterest(interestBearingAmount, ratePerSecond, lastUpdated, block.timestamp);
}
return interestBearingAmount;
}
| 37,888 |
1 | // IVault private immutable iVault; | address public constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;
address public constant USDC = 0x78dEca24CBa286C0f8d56370f5406B48cFCE2f86;
address public constant TRANCHE = 0x80272c960b862B4d6542CDB7338Ad1f727E0D18d;
ITranche public iTranche;
constructor(
| address public constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;
address public constant USDC = 0x78dEca24CBa286C0f8d56370f5406B48cFCE2f86;
address public constant TRANCHE = 0x80272c960b862B4d6542CDB7338Ad1f727E0D18d;
ITranche public iTranche;
constructor(
| 54,162 |
61 | // How many token units a buyer gets per wei | uint256 public rate;
uint256 public minimumInvest; // in wei
uint256 public softCap; // in wei
uint256 public hardCap; // in wei
| uint256 public rate;
uint256 public minimumInvest; // in wei
uint256 public softCap; // in wei
uint256 public hardCap; // in wei
| 17,605 |
1 | // Indicates whether the contract implements the interface 'interfaceHash' for the address 'addr' or not./interfaceHash keccak256 hash of the name of the interface/addr Address for which the contract will implement the interface/ return ERC1820_ACCEPT_MAGIC only if the contract implements 'interfaceHash' for the address 'addr'. | function canImplementInterfaceForAddress(
bytes32 interfaceHash,
address addr
) external view returns (bytes32);
| function canImplementInterfaceForAddress(
bytes32 interfaceHash,
address addr
) external view returns (bytes32);
| 15,467 |
235 | // Function to automatically swap tokens for ERC20 and get feesRequirements:Only the contract owner can call this functionThe contract balance must be greater than or equal to the swap threshold limitEffects:Swaps the total fees available of tokens for ERC20 and gets feesDeducts the previous total fees available from the new total fees available / | function autoERC20Swap() external onlyOwner {
uint256 balance = balanceOf(address(this));
require(
balance >= swapThresholdLimit,
"ACG: Contract balance is less than swap threshold limit"
);
balance = swapThresholdLimit;
_swapAndGetFees(balance);
emit AutoErc20Swap(balance);
}
| function autoERC20Swap() external onlyOwner {
uint256 balance = balanceOf(address(this));
require(
balance >= swapThresholdLimit,
"ACG: Contract balance is less than swap threshold limit"
);
balance = swapThresholdLimit;
_swapAndGetFees(balance);
emit AutoErc20Swap(balance);
}
| 5,345 |
20 | // time to recover the signature | address signer = ecrecover(_h, _v, _r, _s);
| address signer = ecrecover(_h, _v, _r, _s);
| 45,063 |
108 | // Only associatedContract can do it account The address of holder amount The number of token be burned / |
function burn(address account, uint256 amount)
external
notPaused
onlyAssociatedContract
|
function burn(address account, uint256 amount)
external
notPaused
onlyAssociatedContract
| 5,212 |
47 | // Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense/ | if (startingIndexBlock == 0 && (totalSupply() == MAX_NFT_SUPPLY || block.timestamp >= REVEAL_TIMESTAMP)) {
| if (startingIndexBlock == 0 && (totalSupply() == MAX_NFT_SUPPLY || block.timestamp >= REVEAL_TIMESTAMP)) {
| 8,144 |
167 | // Mints desired amount of tokens for the recepient/_amount Amount (in wei - smallest decimals) | function mint(uint256 _amount) external hardcapped(_amount) onlyRole(DEFAULT_ADMIN_ROLE) {
require(_amount > 0, "Incorrect amount");
_mint(_msgSender(), _amount);
}
| function mint(uint256 _amount) external hardcapped(_amount) onlyRole(DEFAULT_ADMIN_ROLE) {
require(_amount > 0, "Incorrect amount");
_mint(_msgSender(), _amount);
}
| 43,148 |
18 | // Seconds added per LT = SAT - ((Current no. of LT + 1) / SDIVIDER)^6 | function getAddedTime(uint256 _rTicketSum, uint256 _tAmount)
public
pure
returns (uint256)
| function getAddedTime(uint256 _rTicketSum, uint256 _tAmount)
public
pure
returns (uint256)
| 18,969 |
13 | // deduct from sender balance | balances[from] = saldo - amount;
| balances[from] = saldo - amount;
| 19,150 |
39 | // Calculates the debt accrued by a Credit Account/creditAccount Address of the Credit Account/ return borrowedAmount The debt principal/ return borrowedAmountWithInterest The debt principal + accrued interest/ return borrowedAmountWithInterestAndFees The debt principal + accrued interest and protocol fees | function calcCreditAccountAccruedInterest(address creditAccount)
external
view
returns (
uint256 borrowedAmount,
uint256 borrowedAmountWithInterest,
uint256 borrowedAmountWithInterestAndFees
);
| function calcCreditAccountAccruedInterest(address creditAccount)
external
view
returns (
uint256 borrowedAmount,
uint256 borrowedAmountWithInterest,
uint256 borrowedAmountWithInterestAndFees
);
| 31,699 |
20 | // Public function for setting a new timelock interval for a given function selector. The default for this function may also be modified, butexcessive values will cause the `modifyTimelockInterval` function to becomeunusable. functionSelector the selector of the function to set the timelockinterval for. newTimelockInterval the new minimum timelock interval to set for thegiven function. / | function modifyTimelockInterval(
bytes4 functionSelector,
uint256 newTimelockInterval
| function modifyTimelockInterval(
bytes4 functionSelector,
uint256 newTimelockInterval
| 1,534 |
14 | // Fallback function that delegates the execution to the proxy implementation contract. / | fallback() external payable {
address addr = implementation();
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), addr, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
| fallback() external payable {
address addr = implementation();
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), addr, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
| 47,163 |
422 | // retrieve the size of the code at address `addr` | size := extcodesize(addr)
| size := extcodesize(addr)
| 49,983 |
80 | // Validate that address and bytes array lengths match. Validate address array is not emptyand contains no duplicate elements.A Array of addresses B Array of bytes / | function validatePairsWithArray(address[] memory A, bytes[] memory B) internal pure {
require(A.length == B.length, "Array length mismatch");
_validateLengthAndUniqueness(A);
}
| function validatePairsWithArray(address[] memory A, bytes[] memory B) internal pure {
require(A.length == B.length, "Array length mismatch");
_validateLengthAndUniqueness(A);
}
| 54,297 |
195 | // WL mint of 1, 2, or 3 addresses whitelisted | require(supply + _mintAmount <= 4436, "Total whitelist supply exceeded!");
require(addressWLMintsAvailable[msg.sender] >= _mintAmount , "Max NFTs exceeded");
addressWLMintsAvailable[msg.sender] -= _mintAmount;
| require(supply + _mintAmount <= 4436, "Total whitelist supply exceeded!");
require(addressWLMintsAvailable[msg.sender] >= _mintAmount , "Max NFTs exceeded");
addressWLMintsAvailable[msg.sender] -= _mintAmount;
| 17,627 |
92 | // Iterate over coin symbols to find winner - tie could be possible? | for(uint256 i = 0; i < arrayLength; i++)
{
if(race.winner_horse(all_horses[i])) {
horse = all_horses[i];
found = true;
break;
}
| for(uint256 i = 0; i < arrayLength; i++)
{
if(race.winner_horse(all_horses[i])) {
horse = all_horses[i];
found = true;
break;
}
| 30,576 |
183 | // DEN FUNCTIONS/ | function setMultiSig(address _denMultiSig) public onlyDenMultiSig {
denMultiSig = _denMultiSig;
}
| function setMultiSig(address _denMultiSig) public onlyDenMultiSig {
denMultiSig = _denMultiSig;
}
| 8,311 |
109 | // Initialize the new money market name_ ERC-20 name of this token symbol_ ERC-20 symbol of this token decimals_ ERC-20 decimal precision of this token / | function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
address initial_owner,
uint256 initSupply_
)
public
| function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
address initial_owner,
uint256 initSupply_
)
public
| 12,619 |
171 | // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . | if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
| if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
| 32,867 |
35 | // Get total staked amount / | function getTotalStakedAmount() external view returns (uint256) {
return _totalStakedAmount;
}
| function getTotalStakedAmount() external view returns (uint256) {
return _totalStakedAmount;
}
| 29,253 |
21 | // if it's an entity token sale | if (t == MODT_ENTITY_SALE) {
| if (t == MODT_ENTITY_SALE) {
| 20,835 |
5 | // Add protocol fee to pool | creationFeePool += creationFee;
| creationFeePool += creationFee;
| 13,440 |
0 | // Target address for payments | address public payoutAddress = 0x1544D2de126e3A4b194Cfad2a5C6966b3460ebE3; // Default: metawin.eth
| address public payoutAddress = 0x1544D2de126e3A4b194Cfad2a5C6966b3460ebE3; // Default: metawin.eth
| 1,539 |
123 | // Set piERC20 ETH fee for deposit and withdrawal functions. _ethFee Fee amount in ETH. / | function setPiTokenEthFee(uint256 _ethFee) external onlyOwner {
require(_ethFee <= 0.1 ether, "ETH_FEE_OVER_THE_LIMIT");
piToken.setEthFee(_ethFee);
}
| function setPiTokenEthFee(uint256 _ethFee) external onlyOwner {
require(_ethFee <= 0.1 ether, "ETH_FEE_OVER_THE_LIMIT");
piToken.setEthFee(_ethFee);
}
| 44,004 |
31 | // Current game maximum id | uint public maxgame = 0;
uint public expireTimeLimit = 30 minutes;
| uint public maxgame = 0;
uint public expireTimeLimit = 30 minutes;
| 21,099 |
3 | // Whether cre8ing is currently allowed./If false then cre8ing is blocked, but uncre8ing is always allowed. | mapping(address => bool) public cre8ingOpen;
| mapping(address => bool) public cre8ingOpen;
| 1,023 |
46 | // --- Logs --- | event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
| event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
| 34,533 |
138 | // prevents collision of identical structures. Formed in the initialization of the contract solhint-disable-next-line var-name-mixedcase | bytes32 public override DOMAIN_SEPARATOR;
| bytes32 public override DOMAIN_SEPARATOR;
| 10,790 |
47 | // if holders has more than 0 token | if ( balanceOf(to) + amount > _minTortuga - 1 && index[to] == 0 ) {
index[to] = holders.length + 1;
holders.push(to);
}
| if ( balanceOf(to) + amount > _minTortuga - 1 && index[to] == 0 ) {
index[to] = holders.length + 1;
holders.push(to);
}
| 29,752 |
81 | // If additional reward to existing period, calc sum | else {
uint256 remaining = periodFinish - currentTime;
uint256 leftoverReward = remaining * rewardRate;
rewardRate = (_reward + leftoverReward) / DURATION;
uint256 leftoverPlatformReward = remaining * platformRewardRate;
platformRewardRate = (newPlatformRewards + leftoverPlatformReward) / DURATION;
}
| else {
uint256 remaining = periodFinish - currentTime;
uint256 leftoverReward = remaining * rewardRate;
rewardRate = (_reward + leftoverReward) / DURATION;
uint256 leftoverPlatformReward = remaining * platformRewardRate;
platformRewardRate = (newPlatformRewards + leftoverPlatformReward) / DURATION;
}
| 28,548 |
124 | // Format the signature to the default format | require(
uint256(s) <=
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
"ERC20: invalid signature 's' value"
);
| require(
uint256(s) <=
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
"ERC20: invalid signature 's' value"
);
| 24,329 |
55 | // Redeem tokens. These tokens are withdrawn from the owner address if the balance must be enough to cover the redeem or the call will fail._amount Number of tokens to be issued | function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
| function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
| 14,108 |
22 | // Calculate the current price for buy in amount./ | function calculatePrice(uint value, uint weiRaised, uint tokensSold, address msgSender, uint decimals) public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.times(multiplier) / oneTokenInWei;
}
| function calculatePrice(uint value, uint weiRaised, uint tokensSold, address msgSender, uint decimals) public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.times(multiplier) / oneTokenInWei;
}
| 1,982 |
79 | // Emit when an user claims their fees | event Claimed(address indexed user, uint256 amountOut);
| event Claimed(address indexed user, uint256 amountOut);
| 22,390 |
86 | // once we have tokens we can enable the withdrawal setting this _useAsDefault to true will set this incoming address to the defaultToken. | function enableTokenWithdrawals (address _tokenAddr, bool _useAsDefault) public onlyAdmin noReentrancy {
require (contractStage == CONTRACT_SUBMIT_FUNDS, "wrong contract stage");
if (_useAsDefault) {
defaultToken = _tokenAddr;
} else {
require (defaultToken != 0x00, "defaultToken must be set");
}
TokenAllocation storage ta = tokenAllocationMap[_tokenAddr];
if (ta.pct.length==0){
ta.token = ERC20(_tokenAddr);
}
uint256 amount = ta.token.balanceOf(this).sub(ta.balanceRemaining);
require (amount > 0);
if (feePct > 0) {
uint256 feePctFromBips = _toPct(feePct, 10000);
uint256 feeAmount = _applyPct(amount, feePctFromBips);
require (ta.token.transfer(owner, feeAmount));
emit TokenWithdrawal(owner, _tokenAddr, feeAmount);
}
amount = ta.token.balanceOf(this).sub(ta.balanceRemaining);
ta.balanceRemaining = ta.token.balanceOf(this);
ta.pct.push(_toPct(amount,finalBalance));
}
| function enableTokenWithdrawals (address _tokenAddr, bool _useAsDefault) public onlyAdmin noReentrancy {
require (contractStage == CONTRACT_SUBMIT_FUNDS, "wrong contract stage");
if (_useAsDefault) {
defaultToken = _tokenAddr;
} else {
require (defaultToken != 0x00, "defaultToken must be set");
}
TokenAllocation storage ta = tokenAllocationMap[_tokenAddr];
if (ta.pct.length==0){
ta.token = ERC20(_tokenAddr);
}
uint256 amount = ta.token.balanceOf(this).sub(ta.balanceRemaining);
require (amount > 0);
if (feePct > 0) {
uint256 feePctFromBips = _toPct(feePct, 10000);
uint256 feeAmount = _applyPct(amount, feePctFromBips);
require (ta.token.transfer(owner, feeAmount));
emit TokenWithdrawal(owner, _tokenAddr, feeAmount);
}
amount = ta.token.balanceOf(this).sub(ta.balanceRemaining);
ta.balanceRemaining = ta.token.balanceOf(this);
ta.pct.push(_toPct(amount,finalBalance));
}
| 42,149 |
170 | // N>B. Do not re-order these fields! They must appear in the same order as they appear in the proof data | struct Proof {
G1Point W1;
G1Point W2;
G1Point W3;
G1Point W4;
G1Point Z;
G1Point T1;
G1Point T2;
G1Point T3;
G1Point T4;
uint256 w1;
uint256 w2;
uint256 w3;
uint256 w4;
uint256 sigma1;
uint256 sigma2;
uint256 sigma3;
uint256 q_arith;
uint256 q_ecc;
uint256 q_c;
uint256 linearization_polynomial;
uint256 grand_product_at_z_omega;
uint256 w1_omega;
uint256 w2_omega;
uint256 w3_omega;
uint256 w4_omega;
G1Point PI_Z;
G1Point PI_Z_OMEGA;
G1Point recursive_P1;
G1Point recursive_P2;
uint256 quotient_polynomial_eval;
}
| struct Proof {
G1Point W1;
G1Point W2;
G1Point W3;
G1Point W4;
G1Point Z;
G1Point T1;
G1Point T2;
G1Point T3;
G1Point T4;
uint256 w1;
uint256 w2;
uint256 w3;
uint256 w4;
uint256 sigma1;
uint256 sigma2;
uint256 sigma3;
uint256 q_arith;
uint256 q_ecc;
uint256 q_c;
uint256 linearization_polynomial;
uint256 grand_product_at_z_omega;
uint256 w1_omega;
uint256 w2_omega;
uint256 w3_omega;
uint256 w4_omega;
G1Point PI_Z;
G1Point PI_Z_OMEGA;
G1Point recursive_P1;
G1Point recursive_P2;
uint256 quotient_polynomial_eval;
}
| 18,255 |
83 | // withdrawLink allows the owner to withdraw any extra LINK on the contract | function withdrawLink() public onlyAdmin
| function withdrawLink() public onlyAdmin
| 9,210 |
13 | // transferFrom allows a sender to spend meloncoin on the from address's behalfpending approval _from : The account from which to withdraw tokens _to : The address of the recipient _tokens : Number of tokens to transfer in musk / | function transferFrom(address _from, address _to, uint _tokens) public
whenNotPaused
validDestination(_to)
| function transferFrom(address _from, address _to, uint _tokens) public
whenNotPaused
validDestination(_to)
| 39,762 |
593 | // Returns the scaled total supply of the token ID. Represents sum(token ID Principal /index) _assetID: ERC1155 ID of the asset which state will be updated. / | function scaledTotalSupply(uint256 _assetID) public view virtual returns (uint256) {
return super.totalSupply(_assetID);
}
| function scaledTotalSupply(uint256 _assetID) public view virtual returns (uint256) {
return super.totalSupply(_assetID);
}
| 38,950 |
7 | // Stake is initialized, the operator is still active so we need to check if it's not undelegating. | require(!isUndelegating(operatorParams), "Stake undelegated");
| require(!isUndelegating(operatorParams), "Stake undelegated");
| 41,252 |
480 | // silence warning about unused variable without the addition of bytecode. | token;
amount;
return 0;
| token;
amount;
return 0;
| 6,154 |
47 | // The protocol's fee | function protocolFee() external view returns (uint192 _protocolFee);
| function protocolFee() external view returns (uint192 _protocolFee);
| 27,998 |
167 | // Maximum fee (20%) | uint256 public constant maxFee = 2000;
| uint256 public constant maxFee = 2000;
| 28,985 |
88 | // Use leftover Crypto for buyback of token to burn | if(address(this).balance > 0){
swapETHForTokens(address(this).balance);
}
| if(address(this).balance > 0){
swapETHForTokens(address(this).balance);
}
| 23,442 |
8 | // is the participant an executer / | function isExecuter(address _address) public view returns (bool) {
return participantRBACs[_address].executer;
}
| function isExecuter(address _address) public view returns (bool) {
return participantRBACs[_address].executer;
}
| 33,312 |
13 | // the callback function is called by Oraclize when the result is ready the oraclize_randomDS_proofVerify modifier prevents an invalid proof to execute this function code: the proof validity is fully verified on-chain | function __callback(bytes32 _queryId, string _result, bytes _proof) public
| function __callback(bytes32 _queryId, string _result, bytes _proof) public
| 27,345 |
174 | // adjustments[3]/mload(0x58a0), Constraint expression for cpu/update_registers/update_pc/pc_cond_positive: (column19_row11 - cpu__decode__opcode_rc__bit_9)(column17_row16 - npc_reg_0). | let val := mulmod(
addmod(
| let val := mulmod(
addmod(
| 14,720 |
72 | // Private function to add a asset to this extension's asset tracking data structures. / | function _addAssetToAllAssetsEnumeration(uint256 assetId) private {
_allAssetsIndex[assetId] = _allAssets.length;
_allAssets.push(assetId);
}
| function _addAssetToAllAssetsEnumeration(uint256 assetId) private {
_allAssetsIndex[assetId] = _allAssets.length;
_allAssets.push(assetId);
}
| 33,240 |
216 | // Decimal math library | library DecMath {
using SafeMath for uint256;
uint256 internal constant PRECISION = 10**18;
function decmul(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(b).div(PRECISION);
}
function decdiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISION).div(b);
}
}
| library DecMath {
using SafeMath for uint256;
uint256 internal constant PRECISION = 10**18;
function decmul(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(b).div(PRECISION);
}
function decdiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a.mul(PRECISION).div(b);
}
}
| 59,544 |
150 | // Approve token transfer to cover all possible scenarios. / | _approve(address(this), address(pancakeswapV2Router), tokenAmount);
| _approve(address(this), address(pancakeswapV2Router), tokenAmount);
| 46,283 |
3 | // subtraction overflow is desired | uint32 timeElapsed = blockTimestamp - blockTimestampLast;
| uint32 timeElapsed = blockTimestamp - blockTimestampLast;
| 8,951 |
42 | // Update the signature threshold to set hot wallet address._newThreshold, the new threshold | function updateSetHotWalletSignatureThreshold(
uint _newThreshold
)
public
isUnbankOwner(msg.sender)
requireSetParams(_newThreshold)
returns (bool response)
| function updateSetHotWalletSignatureThreshold(
uint _newThreshold
)
public
isUnbankOwner(msg.sender)
requireSetParams(_newThreshold)
returns (bool response)
| 2,472 |
185 | // see {_setRoyalties} / | function setRevenueShare(address[2] memory newAddresses, uint256[2] memory newBPS) external onlyOwner {
_setRevenueShare(newAddresses, newBPS);
emit RevenueShareUpdated(newAddresses[0], newAddresses[1], newBPS[0], newBPS[1]);
}
| function setRevenueShare(address[2] memory newAddresses, uint256[2] memory newBPS) external onlyOwner {
_setRevenueShare(newAddresses, newBPS);
emit RevenueShareUpdated(newAddresses[0], newAddresses[1], newBPS[0], newBPS[1]);
}
| 8,565 |
56 | // Swap Collateral for underlying to repay Flashloan | uint256 remaining =
_swap(vAssets.borrowAsset, _amount.add(_flashloanFee), userCollateralInPlay);
| uint256 remaining =
_swap(vAssets.borrowAsset, _amount.add(_flashloanFee), userCollateralInPlay);
| 19,544 |
414 | // update the Renderer to a new contract / | function updateRenderer(address _renderer) external {
onlyRole(ADMIN_ROLE);
renderer = Renderer(_renderer);
}
| function updateRenderer(address _renderer) external {
onlyRole(ADMIN_ROLE);
renderer = Renderer(_renderer);
}
| 41,905 |
3 | // Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. _tokenAmount Number of tokens to be emitted / | function _deliverTokens(uint256 _tokenAmount) internal {
token.transfer(payable(msg.sender), _tokenAmount);
}
| function _deliverTokens(uint256 _tokenAmount) internal {
token.transfer(payable(msg.sender), _tokenAmount);
}
| 14,380 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.