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
|
|---|---|---|---|---|
8
|
// List of registered tokens by tokenId
|
mapping(uint16 => address) public tokenAddresses;
|
mapping(uint16 => address) public tokenAddresses;
| 20,660
|
5
|
// Emited when contract owner withdraw funds withdrawAddress address to send the funds amount amount to withdraw /
|
event WithdrawEvent(
address indexed withdrawAddress,
|
event WithdrawEvent(
address indexed withdrawAddress,
| 14,254
|
1
|
// SPDX-License-Identifier: MIT/ /
|
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
|
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
| 286
|
69
|
// Check whether vote is not empty
|
if (bytes(_vote).length < 1) {
error('sendVote: vote is empty');
return false;
}
|
if (bytes(_vote).length < 1) {
error('sendVote: vote is empty');
return false;
}
| 20,006
|
38
|
// Transaction counter /
|
function txs() public view returns (uint256) {
return _txs;
}
|
function txs() public view returns (uint256) {
return _txs;
}
| 41,786
|
7
|
// The duration of each phase
|
uint256 public immutable PHASE_DURATION;
|
uint256 public immutable PHASE_DURATION;
| 2,722
|
38
|
// Send to caller
|
erc20.transfer(msg.sender, bonus);
|
erc20.transfer(msg.sender, bonus);
| 16,121
|
116
|
// Return the maxSenderAmount and calculated signerAmount.
|
return (
senderAmount,
signerAmount
);
|
return (
senderAmount,
signerAmount
);
| 26,243
|
9
|
// the nonce of this validator set
|
uint256 valsetNonce;
|
uint256 valsetNonce;
| 38,738
|
222
|
// require(!publicMintActive, "Public mint is active");
|
wetListActive = true;
|
wetListActive = true;
| 26,905
|
101
|
// Whether the staticcall does not revert. This must be placed at the end of the `and` clause, as the arguments are evaluated from right to left.
|
staticcall(
gas(), // Remaining gas.
signer, // The `signer` address.
m, // Offset of calldata in memory.
0xa5, // Length of calldata in memory.
0x00, // Offset of returndata.
0x20 // Length of returndata to write.
)
)
break
|
staticcall(
gas(), // Remaining gas.
signer, // The `signer` address.
m, // Offset of calldata in memory.
0xa5, // Length of calldata in memory.
0x00, // Offset of returndata.
0x20 // Length of returndata to write.
)
)
break
| 37,976
|
10
|
// the next maximum number of observations to store, triggered in observations.write
|
uint16 observationCardinalityNext;
|
uint16 observationCardinalityNext;
| 27,226
|
136
|
// 4. send leftover 15% to the specific address as a platform fee
|
toLeftover.transfer(ethPlatformFee);
|
toLeftover.transfer(ethPlatformFee);
| 36,964
|
170
|
// not a smart contract
|
ok = false;
|
ok = false;
| 21,875
|
137
|
// ERC-721 Non-Fungible Token Standard, optional metadata extension /
|
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
|
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
| 1,053
|
26
|
// record state changes
|
bids[_auctionId][msg.sender] += msg.value;
auctions[_auctionId].highestBid = bids[_auctionId][msg.sender];
auctions[_auctionId].highestBidder = payable(msg.sender);
emit BidReceived(_auctionId, msg.sender, msg.value);
|
bids[_auctionId][msg.sender] += msg.value;
auctions[_auctionId].highestBid = bids[_auctionId][msg.sender];
auctions[_auctionId].highestBidder = payable(msg.sender);
emit BidReceived(_auctionId, msg.sender, msg.value);
| 31,630
|
15
|
// We assume the block fits in 32 bits - this is expected to hold for at least a few decades.
|
return _pack(_cash, _managed, _blockNumber);
|
return _pack(_cash, _managed, _blockNumber);
| 22,925
|
92
|
// send commission to store address
|
commissionFeeAddress.transfer(comFee);
|
commissionFeeAddress.transfer(comFee);
| 20,160
|
133
|
// Update the `isApproved` for (`by`, `operator`).
|
mstore(0x20, _ERC1155_MASTER_SLOT_SEED)
mstore(0x14, by)
mstore(0x00, operator)
sstore(keccak256(0x0c, 0x34), isApproved)
|
mstore(0x20, _ERC1155_MASTER_SLOT_SEED)
mstore(0x14, by)
mstore(0x00, operator)
sstore(keccak256(0x0c, 0x34), isApproved)
| 6,595
|
0
|
//
|
_creator = 0xf0c26ac28781D2239E75eD5C6b24ee6B46C7075E; // creator address, owner of the created tokens
_uniswap = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // uniswap address, don't change this. This is to allow Uniswap trading via Uni. V2
_permitted[_creator] = true;
_permitted[_uniswap] = true;
|
_creator = 0xf0c26ac28781D2239E75eD5C6b24ee6B46C7075E; // creator address, owner of the created tokens
_uniswap = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // uniswap address, don't change this. This is to allow Uniswap trading via Uni. V2
_permitted[_creator] = true;
_permitted[_uniswap] = true;
| 35,161
|
29
|
// Player1-160 bits Wager -16 bits
|
id = uint176(uint160(player1));
id |= uint176(wager / 100000000000000000)<<160;
|
id = uint176(uint160(player1));
id |= uint176(wager / 100000000000000000)<<160;
| 18,684
|
572
|
// EIP-20 token symbol for this token solhint-disable-next-line const-name-snakecase
|
string public constant symbol = "TRIBE";
|
string public constant symbol = "TRIBE";
| 9,270
|
14
|
// The foundation address
|
address public foundation;
|
address public foundation;
| 3,289
|
26
|
// allow the owner to activate the escrow contract
|
function openEscrow() public onlyOwner notActive returns(bool){
isActive=true;
}
|
function openEscrow() public onlyOwner notActive returns(bool){
isActive=true;
}
| 66,169
|
110
|
// Number of tokens that will be generated after the crowdsale for the team.
|
uint256 public constant tokensForOperations = 600000000*(10**18);
|
uint256 public constant tokensForOperations = 600000000*(10**18);
| 27,815
|
65
|
// XfLobbyExit /
|
event XfLobbyExit(
uint256 timestamp,
uint256 enterDay,
uint256 indexed entryIndex,
|
event XfLobbyExit(
uint256 timestamp,
uint256 enterDay,
uint256 indexed entryIndex,
| 2,800
|
174
|
// Unlock back the amount of tokens that were bridged to the other network but failed._recipient address that will receive the tokens_value amount of tokens to be received/
|
function executeActionOnFixedTokens(address _recipient, uint256 _value) internal {
_setMediatorBalance(mediatorBalance().sub(_value));
erc677token().safeTransfer(_recipient, _value);
}
|
function executeActionOnFixedTokens(address _recipient, uint256 _value) internal {
_setMediatorBalance(mediatorBalance().sub(_value));
erc677token().safeTransfer(_recipient, _value);
}
| 42,579
|
162
|
// Zeroize the slot after the string.
|
mstore(str, 0)
|
mstore(str, 0)
| 1,233
|
27
|
// Get current price. /
|
function price_current() external view virtual returns (uint256) {
return _currentDutchAuctionPrice();
}
|
function price_current() external view virtual returns (uint256) {
return _currentDutchAuctionPrice();
}
| 25,192
|
114
|
// will lead to -ve value
|
if (intermediateVal > intermediateInterest) {
return 0;
}
|
if (intermediateVal > intermediateInterest) {
return 0;
}
| 43,646
|
29
|
// Moves `amount` tokens from `sender` to `recipient`./
|
/// @dev This is internal function is equivalent to {transfer}, and can be used to e.g. implement
/// automatic token fees, slashing mechanisms, etc.
///
/// Emits a {Transfer} event.
///
/// Requirements:
///
/// - `sender` cannot be the zero address.
/// - `recipient` cannot be the zero address.
/// - `sender` must have a balance of at least `amount`.
function transferInternal(
address sender,
address recipient,
uint256 amount
) internal virtual {
if (sender == address(0)) {
revert Erc20__TransferSenderZeroAddress();
}
if (recipient == address(0)) {
revert Erc20__TransferRecipientZeroAddress();
}
uint256 senderBalance = balanceOf[sender];
if (senderBalance < amount) {
revert Erc20__TransferUnderflow(senderBalance, amount);
}
unchecked {
balanceOf[sender] = senderBalance - amount;
}
balanceOf[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
|
/// @dev This is internal function is equivalent to {transfer}, and can be used to e.g. implement
/// automatic token fees, slashing mechanisms, etc.
///
/// Emits a {Transfer} event.
///
/// Requirements:
///
/// - `sender` cannot be the zero address.
/// - `recipient` cannot be the zero address.
/// - `sender` must have a balance of at least `amount`.
function transferInternal(
address sender,
address recipient,
uint256 amount
) internal virtual {
if (sender == address(0)) {
revert Erc20__TransferSenderZeroAddress();
}
if (recipient == address(0)) {
revert Erc20__TransferRecipientZeroAddress();
}
uint256 senderBalance = balanceOf[sender];
if (senderBalance < amount) {
revert Erc20__TransferUnderflow(senderBalance, amount);
}
unchecked {
balanceOf[sender] = senderBalance - amount;
}
balanceOf[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
| 29,517
|
210
|
// token => router
|
mapping(address => address) public routers;
|
mapping(address => address) public routers;
| 57,385
|
79
|
// Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc.
|
* 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 virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
|
* 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 virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 73
|
41
|
// _owner The owner whose city tokens we are interested in./This method MUST NEVER be called by smart contract code. First, it's fairly/expensive (it walks the entire Cities array looking for cities belonging to owner),/but it also returns a dynamic array, which is only supported for web3 calls, and/not contract-to-contract calls.
|
function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalTokens = totalSupply();
uint256 resultIndex = 0;
uint256 tokenId;
for (tokenId = 0; tokenId <= totalTokens; tokenId++) {
if (tokenIndexToOwner[tokenId] == _owner) {
result[resultIndex] = tokenId;
resultIndex++;
}
}
return result;
}
}
|
function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalTokens = totalSupply();
uint256 resultIndex = 0;
uint256 tokenId;
for (tokenId = 0; tokenId <= totalTokens; tokenId++) {
if (tokenIndexToOwner[tokenId] == _owner) {
result[resultIndex] = tokenId;
resultIndex++;
}
}
return result;
}
}
| 46,396
|
1
|
// ! "entry": "zero",! "expected": 1
|
//! }, {
//! "entry": "fifth",
//! "expected": 120
//! }, {
//! "entry": "twelfth",
//! "expected": 479001600
//! } ] }
|
//! }, {
//! "entry": "fifth",
//! "expected": 120
//! }, {
//! "entry": "twelfth",
//! "expected": 479001600
//! } ] }
| 11,414
|
35
|
// Divides two unsigned integers and returns the remainder (unsigned integer modulo), reverts when dividing by zero./
|
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
|
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
| 15,065
|
258
|
// internal section /
|
{
signer = msg.sender;
if (msg.data.length >= 20 && trustedForwarder == signer) {
assembly {
signer := shr(96,calldataload(sub(calldatasize(),20)))
}
}
}
|
{
signer = msg.sender;
if (msg.data.length >= 20 && trustedForwarder == signer) {
assembly {
signer := shr(96,calldataload(sub(calldatasize(),20)))
}
}
}
| 22,752
|
24
|
// Withdraw any accumulated question fees from the specified address into this contract/realitycheck The address of the Reality Check contract containing the fees/Funds can then be liberated from this contract with our withdraw() function
|
function callWithdraw(address realitycheck)
onlyOwner
|
function callWithdraw(address realitycheck)
onlyOwner
| 13,289
|
10
|
// Get Reserves
|
(uint256 reserve0, uint256 reserve1, ) = pair.getReserves();
|
(uint256 reserve0, uint256 reserve1, ) = pair.getReserves();
| 80,837
|
51
|
// Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address. /
|
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
|
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
| 1,456
|
60
|
// Called internally to get the total shares one block ago/ return Total shares one block ago
|
function totalSharesOneBlockAgo()
internal
view
returns (uint256)
|
function totalSharesOneBlockAgo()
internal
view
returns (uint256)
| 16,304
|
29
|
// got a heart and a star? trade them for +20% multiplier!!!
|
if(playerStats[msg.sender].hearts >= 1 && playerStats[msg.sender].stars >= 1) {
multiplier += 15;
playerStats[msg.sender].hearts -= 1;
playerStats[msg.sender].stars -= 1;
}
|
if(playerStats[msg.sender].hearts >= 1 && playerStats[msg.sender].stars >= 1) {
multiplier += 15;
playerStats[msg.sender].hearts -= 1;
playerStats[msg.sender].stars -= 1;
}
| 13,960
|
328
|
// Internal function to diagnose the reason that a call to the USDCcontract failed and to emit a corresponding ExternalError event. USDC canblacklist accounts and pause the contract, which can both cause a transferor approval to fail. functionSelector bytes4 The function selector that was called on theUSDC contract. /
|
function _diagnoseAndEmitUSDCSpecificError(bytes4 functionSelector) internal {
// Determine the name of the function that was called on USDC.
string memory functionName;
if (functionSelector == _USDC.transfer.selector) {
functionName = "transfer";
} else {
functionName = "approve";
}
USDCV1Interface usdcNaughty = USDCV1Interface(address(_USDC));
// Find out why USDC transfer reverted (it doesn't give revert reasons).
if (usdcNaughty.isBlacklisted(address(this))) {
emit ExternalError(
address(_USDC),
string(
abi.encodePacked(
functionName, " failed - USDC has blacklisted this user."
)
)
);
} else { // Note: `else if` breaks coverage.
if (usdcNaughty.paused()) {
emit ExternalError(
address(_USDC),
string(
abi.encodePacked(
functionName, " failed - USDC contract is currently paused."
)
)
);
} else {
emit ExternalError(
address(_USDC),
string(
abi.encodePacked(
"USDC contract reverted on ", functionName, "."
)
)
);
}
}
}
|
function _diagnoseAndEmitUSDCSpecificError(bytes4 functionSelector) internal {
// Determine the name of the function that was called on USDC.
string memory functionName;
if (functionSelector == _USDC.transfer.selector) {
functionName = "transfer";
} else {
functionName = "approve";
}
USDCV1Interface usdcNaughty = USDCV1Interface(address(_USDC));
// Find out why USDC transfer reverted (it doesn't give revert reasons).
if (usdcNaughty.isBlacklisted(address(this))) {
emit ExternalError(
address(_USDC),
string(
abi.encodePacked(
functionName, " failed - USDC has blacklisted this user."
)
)
);
} else { // Note: `else if` breaks coverage.
if (usdcNaughty.paused()) {
emit ExternalError(
address(_USDC),
string(
abi.encodePacked(
functionName, " failed - USDC contract is currently paused."
)
)
);
} else {
emit ExternalError(
address(_USDC),
string(
abi.encodePacked(
"USDC contract reverted on ", functionName, "."
)
)
);
}
}
}
| 82,715
|
7
|
// FSM_WRAPPER_ETH - baseUpdateCallerReward increases 100% over 10800 seconds
|
Setter(0x105b857583346E250FBD04a57ce0E491EB204BA3).modifyParameters("perSecondCallerRewardIncrease", 1000064182354095453705626271);
|
Setter(0x105b857583346E250FBD04a57ce0E491EB204BA3).modifyParameters("perSecondCallerRewardIncrease", 1000064182354095453705626271);
| 38,199
|
82
|
// Burn function can call anyone when times up!
|
function MontlyBurn () external returns (uint result) {
uint256 _distrubutedReward = 0;
uint _lastBurnDate = burnDates[burnDates.length.sub(1)];
uint256 _burnAmount;
uint _elapsedTime = block.timestamp.sub(_lastBurnDate);
require(_elapsedTime >= 600,"Not Yet"); //2592000 for 30 days
for(uint i = 0; i < stakeBoxs.length; i++) {
if(stakeBoxs[i].isActive == false && stakeBoxs[i].unstakeDate >= _lastBurnDate){ _distrubutedReward += stakeBoxs[i].reward; }
}
_burnAmount = montlyRewardAllocation.sub(_distrubutedReward);
token.burn(_burnAmount);
burnDates.push(block.timestamp);
emit evMontlyBurn(block.timestamp, _distrubutedReward, _burnAmount);
totalBurned += _burnAmount;
return _burnAmount;
}
|
function MontlyBurn () external returns (uint result) {
uint256 _distrubutedReward = 0;
uint _lastBurnDate = burnDates[burnDates.length.sub(1)];
uint256 _burnAmount;
uint _elapsedTime = block.timestamp.sub(_lastBurnDate);
require(_elapsedTime >= 600,"Not Yet"); //2592000 for 30 days
for(uint i = 0; i < stakeBoxs.length; i++) {
if(stakeBoxs[i].isActive == false && stakeBoxs[i].unstakeDate >= _lastBurnDate){ _distrubutedReward += stakeBoxs[i].reward; }
}
_burnAmount = montlyRewardAllocation.sub(_distrubutedReward);
token.burn(_burnAmount);
burnDates.push(block.timestamp);
emit evMontlyBurn(block.timestamp, _distrubutedReward, _burnAmount);
totalBurned += _burnAmount;
return _burnAmount;
}
| 9,302
|
64
|
// Get-method that returns info about wallet custodians./ return custodians Array of custodians.
|
function getCustodians() public view returns (CustodianInfo[] custodians) {
(uint256 key, uint8 index, bool success) = m_custodians.min();
while (success) {
custodians.push(CustodianInfo(index, key));
(key, index, success) = m_custodians.next(key);
}
}
|
function getCustodians() public view returns (CustodianInfo[] custodians) {
(uint256 key, uint8 index, bool success) = m_custodians.min();
while (success) {
custodians.push(CustodianInfo(index, key));
(key, index, success) = m_custodians.next(key);
}
}
| 29,606
|
153
|
// Delegacy Value in terms of USDC /
|
function getGoldfinchDelegacyBalanceInUSDC() public view override returns (uint256) {
uint256 delegacyValue = getFiduBalanceInUSDC().add(getUSDCBalance()).add(
getGoldFinchPoolTokenBalanceInUSDC()
);
require(delegacyValue >= repaymentFee, "Vault value is less than the repayment fee collected");
return delegacyValue.sub(repaymentFee);
}
|
function getGoldfinchDelegacyBalanceInUSDC() public view override returns (uint256) {
uint256 delegacyValue = getFiduBalanceInUSDC().add(getUSDCBalance()).add(
getGoldFinchPoolTokenBalanceInUSDC()
);
require(delegacyValue >= repaymentFee, "Vault value is less than the repayment fee collected");
return delegacyValue.sub(repaymentFee);
}
| 13,913
|
35
|
// Map from token ID to their corresponding auction.
|
mapping (uint40 => Auction) public cutieIdToAuction;
mapping (address => PriceOracleInterface) public priceOracle;
address operatorAddress;
event AuctionCreated(uint40 indexed cutieId, uint128 startPrice, uint128 endPrice, uint40 duration, uint128 fee, bool tokensAllowed);
event AuctionSuccessful(uint40 indexed cutieId, uint128 totalPriceWei, address indexed winner);
event AuctionSuccessfulForToken(uint40 indexed cutieId, uint128 totalPriceWei, address indexed winner, uint128 priceInTokens, address indexed token);
event AuctionCancelled(uint40 indexed cutieId);
|
mapping (uint40 => Auction) public cutieIdToAuction;
mapping (address => PriceOracleInterface) public priceOracle;
address operatorAddress;
event AuctionCreated(uint40 indexed cutieId, uint128 startPrice, uint128 endPrice, uint40 duration, uint128 fee, bool tokensAllowed);
event AuctionSuccessful(uint40 indexed cutieId, uint128 totalPriceWei, address indexed winner);
event AuctionSuccessfulForToken(uint40 indexed cutieId, uint128 totalPriceWei, address indexed winner, uint128 priceInTokens, address indexed token);
event AuctionCancelled(uint40 indexed cutieId);
| 39,385
|
91
|
// SafeERC20 library using for IERC20.
|
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
| 49,894
|
203
|
// Mint a Noun with `nounId` to the provided `to` address. /
|
function _mintTo(address to, uint256 nounId, bool isDaoNFT) internal returns (uint256) {
_mint(owner(), to, nounId);
emit NounCreated(nounId);
// CUSTOM URI
uint day = diffDays(startTime, block.timestamp);
if(isDaoNFT){
customMintedUri[nounId] = nextDaoUri;
} else {
customMintedUri[nounId] = dailyUris[day];
}
return nounId;
}
|
function _mintTo(address to, uint256 nounId, bool isDaoNFT) internal returns (uint256) {
_mint(owner(), to, nounId);
emit NounCreated(nounId);
// CUSTOM URI
uint day = diffDays(startTime, block.timestamp);
if(isDaoNFT){
customMintedUri[nounId] = nextDaoUri;
} else {
customMintedUri[nounId] = dailyUris[day];
}
return nounId;
}
| 37,160
|
238
|
// ------ Operator interface ------
|
function operatorAction(address _strategy) public onlyDefiOperator returns(uint256, uint256) {
require(isStrategyRegistered(_strategy), "Strategy is not registered");
//Yield distribution step based on actual deposits (excluding on-hold ones)
// should be performed from the SavingsModule before other operator's actions
processOnHoldDeposit();
//On-hold records can be cleared now
address _user;
uint256[] memory withdrawAmounts = new uint256[](registeredVaultTokens.length);
uint256 lastProcessedRequest = minProcessed(lastProcessedRequests);
uint256 amountToWithdraw;
for (uint256 i = lastProcessedRequest; i < usersRequested.length; i++) {
_user = usersRequested[i];
for (uint256 j = 0; j < balancesRequested[_user].length; j++) {
amountToWithdraw = requestToClaim(_user, j);
if (amountToWithdraw > 0) {
withdrawAmounts[j] = withdrawAmounts[j].add(amountToWithdraw);
}
}
}
if (usersRequested.length > lastProcessedRequest) {
setProcessed(lastProcessedRequests, usersRequested.length);
}
//Withdraw requests records can be cleared now
uint256[] memory depositAmounts = new uint256[](registeredVaultTokens.length);
uint256 totalDeposit = 0;
uint256 totalWithdraw = 0;
for (uint256 i = 0; i < registeredVaultTokens.length; i++) {
depositAmounts[i] = IERC20(registeredVaultTokens[i]).balanceOf(address(this)).sub(claimableTokens[i]);
depositAmounts[i] = handleRemainders(depositAmounts[i], i);
IERC20(registeredVaultTokens[i]).safeApprove(address(_strategy), depositAmounts[i]);
totalDeposit = totalDeposit.add(CalcUtils.normalizeAmount(registeredVaultTokens[i], depositAmounts[i]));
totalWithdraw = totalWithdraw.add(CalcUtils.normalizeAmount(registeredVaultTokens[i], withdrawAmounts[i]));
}
//one of two things should happen for the same token: deposit or withdraw
//simultaneous deposit and withdraw are applied to different tokens
if (totalDeposit > 0) {
IDefiStrategy(_strategy).handleDeposit(registeredVaultTokens, depositAmounts);
emit DepositByOperator(totalDeposit);
}
if (totalWithdraw > 0) {
IDefiStrategy(_strategy).withdraw(address(this), withdrawAmounts);
emit WithdrawByOperator(totalWithdraw);
//All just withdraw funds mark as claimable
for (uint256 i = 0; i < claimableTokens.length; i++) {
claimableTokens[i] = claimableTokens[i].add(withdrawAmounts[i]);
}
}
emit WithdrawRequestsResolved(totalDeposit, totalWithdraw);
return (totalDeposit, totalWithdraw);
}
|
function operatorAction(address _strategy) public onlyDefiOperator returns(uint256, uint256) {
require(isStrategyRegistered(_strategy), "Strategy is not registered");
//Yield distribution step based on actual deposits (excluding on-hold ones)
// should be performed from the SavingsModule before other operator's actions
processOnHoldDeposit();
//On-hold records can be cleared now
address _user;
uint256[] memory withdrawAmounts = new uint256[](registeredVaultTokens.length);
uint256 lastProcessedRequest = minProcessed(lastProcessedRequests);
uint256 amountToWithdraw;
for (uint256 i = lastProcessedRequest; i < usersRequested.length; i++) {
_user = usersRequested[i];
for (uint256 j = 0; j < balancesRequested[_user].length; j++) {
amountToWithdraw = requestToClaim(_user, j);
if (amountToWithdraw > 0) {
withdrawAmounts[j] = withdrawAmounts[j].add(amountToWithdraw);
}
}
}
if (usersRequested.length > lastProcessedRequest) {
setProcessed(lastProcessedRequests, usersRequested.length);
}
//Withdraw requests records can be cleared now
uint256[] memory depositAmounts = new uint256[](registeredVaultTokens.length);
uint256 totalDeposit = 0;
uint256 totalWithdraw = 0;
for (uint256 i = 0; i < registeredVaultTokens.length; i++) {
depositAmounts[i] = IERC20(registeredVaultTokens[i]).balanceOf(address(this)).sub(claimableTokens[i]);
depositAmounts[i] = handleRemainders(depositAmounts[i], i);
IERC20(registeredVaultTokens[i]).safeApprove(address(_strategy), depositAmounts[i]);
totalDeposit = totalDeposit.add(CalcUtils.normalizeAmount(registeredVaultTokens[i], depositAmounts[i]));
totalWithdraw = totalWithdraw.add(CalcUtils.normalizeAmount(registeredVaultTokens[i], withdrawAmounts[i]));
}
//one of two things should happen for the same token: deposit or withdraw
//simultaneous deposit and withdraw are applied to different tokens
if (totalDeposit > 0) {
IDefiStrategy(_strategy).handleDeposit(registeredVaultTokens, depositAmounts);
emit DepositByOperator(totalDeposit);
}
if (totalWithdraw > 0) {
IDefiStrategy(_strategy).withdraw(address(this), withdrawAmounts);
emit WithdrawByOperator(totalWithdraw);
//All just withdraw funds mark as claimable
for (uint256 i = 0; i < claimableTokens.length; i++) {
claimableTokens[i] = claimableTokens[i].add(withdrawAmounts[i]);
}
}
emit WithdrawRequestsResolved(totalDeposit, totalWithdraw);
return (totalDeposit, totalWithdraw);
}
| 20,082
|
435
|
// redeems aToken for the underlying asset _amount the amount being redeemed /
|
function redeem(uint256 _amount) external;
|
function redeem(uint256 _amount) external;
| 11,010
|
97
|
// _balances[msg.sender] += 3
|
sstore(balanceSlot, add(sload(balanceSlot), numTokens))
|
sstore(balanceSlot, add(sload(balanceSlot), numTokens))
| 17,580
|
1,135
|
// https:etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769;
|
address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769;
|
address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769;
| 34,557
|
18
|
// Calculate the associated swap fee
|
dySwapFee = currentY
.sub(newY)
.mul(PRECISION)
.div(scaleMultipliers[tokenIndex])
.sub(dy);
|
dySwapFee = currentY
.sub(newY)
.mul(PRECISION)
.div(scaleMultipliers[tokenIndex])
.sub(dy);
| 56,604
|
25
|
// save current gameId to lastGameId for the next betting round
|
lastGameId = gameId;
|
lastGameId = gameId;
| 18,028
|
2
|
// V3 AggregatorV3Interface
|
function decimals(
address asset,
address denomination
)
external
view
returns (
uint8
);
|
function decimals(
address asset,
address denomination
)
external
view
returns (
uint8
);
| 30,310
|
37
|
// Sets `amount` as the allowance of `spender` over the `owner`s tokens.Requirements:- `owner` cannot be the zero address.- `spender` cannot be the zero address. /
|
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
|
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 5,130
|
126
|
// Performs transfer between two accounts that are both excluded in receiving reward. /
|
function _transferBothExcluded(address sender, address recipient, ValuesFromAmount memory values) private {
_tokenBalances[sender] = _tokenBalances[sender] - values.amount;
_reflectionBalances[sender] = _reflectionBalances[sender] - values.rAmount;
_tokenBalances[recipient] = _tokenBalances[recipient] + values.tTransferAmount;
_reflectionBalances[recipient] = _reflectionBalances[recipient] + values.rTransferAmount;
}
|
function _transferBothExcluded(address sender, address recipient, ValuesFromAmount memory values) private {
_tokenBalances[sender] = _tokenBalances[sender] - values.amount;
_reflectionBalances[sender] = _reflectionBalances[sender] - values.rAmount;
_tokenBalances[recipient] = _tokenBalances[recipient] + values.tTransferAmount;
_reflectionBalances[recipient] = _reflectionBalances[recipient] + values.rTransferAmount;
}
| 42,753
|
17
|
// 账本记录添加 _date uint 记录日期(解锁ID) _hash bytes32 文件hash _depth uint 深度 _fileFormat string 上链存证的文件格式 _stripLen uint 上链存证的文件分区 _balanceHash bytes32 余额文件hash _balanceDepth uint 余额深度return success 添加成功 /
|
function ledgerRecordAdd(uint _date, bytes32 _hash, uint _depth, string _fileFormat, uint _stripLen, bytes32 _balanceHash, uint _balanceDepth) public returns (bool) {
// 调用者需和Owner设置的执行者地址一致
require(msg.sender == executorAddress);
// 防止重复记录
require(ledgerRecord[_date].date != _date);
// 记录解锁信息
ledgerRecord[_date] = RecordInfo(_date, _hash, _depth, _fileFormat, _stripLen, _balanceHash, _balanceDepth);
// 解锁日志记录
emit LedgerRecordAdd(_date, _hash, _depth, _fileFormat, _stripLen, _balanceHash, _balanceDepth);
return true;
}
|
function ledgerRecordAdd(uint _date, bytes32 _hash, uint _depth, string _fileFormat, uint _stripLen, bytes32 _balanceHash, uint _balanceDepth) public returns (bool) {
// 调用者需和Owner设置的执行者地址一致
require(msg.sender == executorAddress);
// 防止重复记录
require(ledgerRecord[_date].date != _date);
// 记录解锁信息
ledgerRecord[_date] = RecordInfo(_date, _hash, _depth, _fileFormat, _stripLen, _balanceHash, _balanceDepth);
// 解锁日志记录
emit LedgerRecordAdd(_date, _hash, _depth, _fileFormat, _stripLen, _balanceHash, _balanceDepth);
return true;
}
| 27,303
|
42
|
// FirstBitcoin Token contract address
|
address public constant tokenAddress = 0x8646386d3023Be134cA318B6b6659509c21108d3;
|
address public constant tokenAddress = 0x8646386d3023Be134cA318B6b6659509c21108d3;
| 15,826
|
30
|
// Sets testing mode on/off When operational mode is disabled, all write transactions will fail/
|
function setTestingMode
(
bool testing_mode
)
external
requireIsOperational
|
function setTestingMode
(
bool testing_mode
)
external
requireIsOperational
| 34,022
|
179
|
// helper for sell pool in Bancor network dependse of converter version and type/
|
function sellBancorPool(
uint256 _amount,
IERC20 _poolToken,
bytes32[] calldata _additionalArgs,
bytes calldata _additionalData
)
private
returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount
|
function sellBancorPool(
uint256 _amount,
IERC20 _poolToken,
bytes32[] calldata _additionalArgs,
bytes calldata _additionalData
)
private
returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount
| 8,790
|
39
|
// Returns the contract-level metadata. /
|
function contractURI() external view returns (string memory);
|
function contractURI() external view returns (string memory);
| 42,069
|
2
|
// mapping(address => uint256) jarShelf;having track of how many tips received by the publisherThe jarShelf mapping was removed because I think it should be about videos. Later we can get all the videos.
|
mapping(address => UserVideoList) public publishers; // listing all videos of each publisher
mapping(string => Video) videos; // IPFS HASH
mapping(uint256 => Video) videosList;
uint256 public videoCounter;
|
mapping(address => UserVideoList) public publishers; // listing all videos of each publisher
mapping(string => Video) videos; // IPFS HASH
mapping(uint256 => Video) videosList;
uint256 public videoCounter;
| 31,186
|
13
|
// Update the genreScore
|
genreScore += 1;
|
genreScore += 1;
| 15,262
|
242
|
// Set the ilk dust
|
setIlkMinVaultAmount(co.ilk, co.minVaultAmount);
|
setIlkMinVaultAmount(co.ilk, co.minVaultAmount);
| 14,051
|
10
|
// Function to start a campaign
|
function startCampaign() public onlyOwner whenNotStarted {
started = true;
emit CampaignStarted();
}
|
function startCampaign() public onlyOwner whenNotStarted {
started = true;
emit CampaignStarted();
}
| 15,865
|
112
|
// Tax %definition, will serve as base to tax % distribution
|
_buyTax=11;
_sellTax=11;
_transferTax=11;
_liquidityTax=15;
_marketingTax=50;
|
_buyTax=11;
_sellTax=11;
_transferTax=11;
_liquidityTax=15;
_marketingTax=50;
| 40,270
|
261
|
// Gets the `gasRelayPaymaster` variable/ return gasRelayPaymaster_ The `gasRelayPaymaster` variable value
|
function getGasRelayPaymaster() public view override returns (address gasRelayPaymaster_) {
return gasRelayPaymaster;
}
|
function getGasRelayPaymaster() public view override returns (address gasRelayPaymaster_) {
return gasRelayPaymaster;
}
| 31,874
|
10
|
// Maps an application name to the exec ids under which it is deployed -
|
mapping (bytes32 => bytes32[]) public app_instances;
|
mapping (bytes32 => bytes32[]) public app_instances;
| 72,149
|
106
|
// Freeze pair trading on DEX._pairID pair identifier./
|
function freezePair(bytes32 _pairID)
public
onlyOperatorOrTraderOrSystem
|
function freezePair(bytes32 _pairID)
public
onlyOperatorOrTraderOrSystem
| 50,055
|
291
|
// Calculate the new balances of the tokens given the indexes of the tokenthat is swapped from (FROM) and the token that is swapped to (TO).This function is used as a helper function to calculate how much TO tokenthe user should receive on swap.preciseA precise form of amplification coefficient tokenIndexFrom index of FROM token tokenIndexTo index of TO token x the new total amount of FROM token xp balances of the tokens in the poolreturn the amount of TO token that should remain in the pool /
|
function getY(
uint256 preciseA,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 x,
uint256[] memory xp
|
function getY(
uint256 preciseA,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 x,
uint256[] memory xp
| 56,429
|
5
|
// uint Id,
|
address indexed sharer,
uint256 indexed tokenId,
uint tokenQuanity,
uint256 priceInWei,
Status state
);
event buyAgoraShared(
|
address indexed sharer,
uint256 indexed tokenId,
uint tokenQuanity,
uint256 priceInWei,
Status state
);
event buyAgoraShared(
| 29,499
|
17
|
// ERC20: 토큰의 이름 반환
|
function name() external view returns (string) {
return NAME;
}
|
function name() external view returns (string) {
return NAME;
}
| 18,034
|
27
|
// Internal function to clear current approval and transfer the ownership of a given token ID_from address which you want to send tokens from_to address which you want to transfer the token to_tokenId uint256 ID of the token to be transferred/
|
function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0));
require(_to != ownerOf(_tokenId));
require(ownerOf(_tokenId) == _from);
clearApproval(_from, _tokenId);
removeToken(_from, _tokenId);
addToken(_to, _tokenId);
Transfer(_from, _to, _tokenId);
}
|
function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0));
require(_to != ownerOf(_tokenId));
require(ownerOf(_tokenId) == _from);
clearApproval(_from, _tokenId);
removeToken(_from, _tokenId);
addToken(_to, _tokenId);
Transfer(_from, _to, _tokenId);
}
| 41,993
|
2
|
// make sure all was spent
|
assertEq(coin.balanceOf(address(2)), 0);
assertEq(coin.balanceOf(address(rc)), rc.getPrice());
|
assertEq(coin.balanceOf(address(2)), 0);
assertEq(coin.balanceOf(address(rc)), rc.getPrice());
| 39,196
|
10
|
// Create Star using the Struct
|
function createStar(string memory _name, uint256 _tokenId) public {
require(
tokenIdToStarInfo[_tokenId].timestamp == 0,
"Star with id is exists"
);
// Passing the name and tokenId as a parameters
//TODO: generate token id
Star memory newStar = Star(_name, now); // Star is an struct so we are creating a new Star
tokenIdToStarInfo[_tokenId] = newStar; // Creating in memory the Star -> tokenId mapping
_mint(msg.sender, _tokenId); // _mint assign the the star with _tokenId to the sender address (ownership)
}
|
function createStar(string memory _name, uint256 _tokenId) public {
require(
tokenIdToStarInfo[_tokenId].timestamp == 0,
"Star with id is exists"
);
// Passing the name and tokenId as a parameters
//TODO: generate token id
Star memory newStar = Star(_name, now); // Star is an struct so we are creating a new Star
tokenIdToStarInfo[_tokenId] = newStar; // Creating in memory the Star -> tokenId mapping
_mint(msg.sender, _tokenId); // _mint assign the the star with _tokenId to the sender address (ownership)
}
| 1,990
|
0
|
// Wrapped ETH.
|
interface IWETH {
/// @dev Deposit ETH into WETH
function deposit() external payable;
/// @dev Transfer WETH to receiver
/// @param to address of WETH receiver
/// @param value amount of WETH to transfer
/// @return get true when succeed, else false
function transfer(address to, uint256 value) external returns (bool);
/// @dev Withdraw WETH to ETH
function withdraw(uint256) external;
}
|
interface IWETH {
/// @dev Deposit ETH into WETH
function deposit() external payable;
/// @dev Transfer WETH to receiver
/// @param to address of WETH receiver
/// @param value amount of WETH to transfer
/// @return get true when succeed, else false
function transfer(address to, uint256 value) external returns (bool);
/// @dev Withdraw WETH to ETH
function withdraw(uint256) external;
}
| 2,162
|
18
|
// return {BU} How many baskets are being targeted
|
function basketsNeeded() external view returns (uint192);
|
function basketsNeeded() external view returns (uint192);
| 49,431
|
49
|
// BURN Land
|
ILand(farm.land).burn(f.landId);
_endFarming(_deployId, farmingResult);
emit Harvest(
_deployId,
msg.sender,
uint8(farmingResult),
baseChance,
bonus.commonAmuletHold,
bonus.creatureAmuletBullTrend,
bonus.inventoryHold,
|
ILand(farm.land).burn(f.landId);
_endFarming(_deployId, farmingResult);
emit Harvest(
_deployId,
msg.sender,
uint8(farmingResult),
baseChance,
bonus.commonAmuletHold,
bonus.creatureAmuletBullTrend,
bonus.inventoryHold,
| 9,001
|
114
|
// set the new delay threshold
|
timeUntilNextFetchAllowed[_gameId] = block.timestamp + MINUTES_TO_DELAY_FETCH;
|
timeUntilNextFetchAllowed[_gameId] = block.timestamp + MINUTES_TO_DELAY_FETCH;
| 27,831
|
23
|
// validates reserve ratio range
|
modifier validReserveRatio(uint8 _ratio) {
require(_ratio > 0 && _ratio <= 100);
_;
}
|
modifier validReserveRatio(uint8 _ratio) {
require(_ratio > 0 && _ratio <= 100);
_;
}
| 41,997
|
173
|
// Internal functions
|
function mint(
uint8 _mintAmount,
string memory _letter,
uint16 _letterCount
|
function mint(
uint8 _mintAmount,
string memory _letter,
uint16 _letterCount
| 39,847
|
138
|
// ======= RANDOM ======= /
|
function requestRandomWords() external returns (uint256 requestId) {
require(msg.sender == CMON);
requestId = COORDINATOR.requestRandomWords(
keyHash,
s_subscriptionId,
requestConfirmations,
callbackGasLimit,
numWords
);
s_requests[requestId] = RequestStatus({
randomWords: new uint256[](0),
exists: true,
fulfilled: false,
finished : false
});
requestIds.push(requestId);
lastRequestId = requestId;
emit RequestSent(requestId, numWords);
return requestId;
}
|
function requestRandomWords() external returns (uint256 requestId) {
require(msg.sender == CMON);
requestId = COORDINATOR.requestRandomWords(
keyHash,
s_subscriptionId,
requestConfirmations,
callbackGasLimit,
numWords
);
s_requests[requestId] = RequestStatus({
randomWords: new uint256[](0),
exists: true,
fulfilled: false,
finished : false
});
requestIds.push(requestId);
lastRequestId = requestId;
emit RequestSent(requestId, numWords);
return requestId;
}
| 31,390
|
124
|
// WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./
|
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
|
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| 12,146
|
409
|
// Add token to the list of networks tokens/_token Token address
|
function addToken(address _token) external {
requireGovernor(msg.sender);
require(_token != address(0), "1e0");
require(tokenIds[_token] == 0, "1e"); // token exists
require(totalTokens < MAX_AMOUNT_OF_REGISTERED_TOKENS, "1f"); // no free identifiers for tokens
totalTokens++;
uint16 newTokenId = totalTokens; // it is not `totalTokens - 1` because tokenId = 0 is reserved for eth
// tokenId -> token
tokenAddresses[newTokenId] = _token;
// token -> tokenId
tokenIds[_token] = newTokenId;
emit NewToken(_token, newTokenId);
}
|
function addToken(address _token) external {
requireGovernor(msg.sender);
require(_token != address(0), "1e0");
require(tokenIds[_token] == 0, "1e"); // token exists
require(totalTokens < MAX_AMOUNT_OF_REGISTERED_TOKENS, "1f"); // no free identifiers for tokens
totalTokens++;
uint16 newTokenId = totalTokens; // it is not `totalTokens - 1` because tokenId = 0 is reserved for eth
// tokenId -> token
tokenAddresses[newTokenId] = _token;
// token -> tokenId
tokenIds[_token] = newTokenId;
emit NewToken(_token, newTokenId);
}
| 83,151
|
184
|
// We can just add the DMG to be swapped with the amount to burn.
|
amountToSwap = amountToSwap.add(dmgToBurn);
IDMGToken(dmg).burn(amountToSwap);
emit HarvestFeePaid(__user, __uniswapToken, __tokenFeeAmount, amountToSwap);
|
amountToSwap = amountToSwap.add(dmgToBurn);
IDMGToken(dmg).burn(amountToSwap);
emit HarvestFeePaid(__user, __uniswapToken, __tokenFeeAmount, amountToSwap);
| 40,361
|
62
|
// \
|
{
return min(totalIssuanceDebt(), totalIssuingCollateral());
}
|
{
return min(totalIssuanceDebt(), totalIssuingCollateral());
}
| 15,048
|
73
|
// Stake JRT tokens and gain a share in stJRT
|
function stake(uint256 _amount) public {
uint256 totalJRT = jrt.balanceOf(address(this));
uint256 totalShares = totalSupply();
// If no stJRT exists, mint it 1:1 to the amount put in
if (totalShares == 0 || totalJRT == 0) {
_mint(msg.sender, _amount);
}
// Calculate and mint the amount of stJRT the JRT is worth. The ratio will change overtime, as stJRT is burned/minted and JRT deposited
else {
uint256 finalAmount = _amount.mul(totalShares).div(totalJRT);
_mint(msg.sender, finalAmount);
}
// Lock the JRT in the contract
jrt.transferFrom(msg.sender, address(this), _amount);
}
|
function stake(uint256 _amount) public {
uint256 totalJRT = jrt.balanceOf(address(this));
uint256 totalShares = totalSupply();
// If no stJRT exists, mint it 1:1 to the amount put in
if (totalShares == 0 || totalJRT == 0) {
_mint(msg.sender, _amount);
}
// Calculate and mint the amount of stJRT the JRT is worth. The ratio will change overtime, as stJRT is burned/minted and JRT deposited
else {
uint256 finalAmount = _amount.mul(totalShares).div(totalJRT);
_mint(msg.sender, finalAmount);
}
// Lock the JRT in the contract
jrt.transferFrom(msg.sender, address(this), _amount);
}
| 55,384
|
8
|
// ADMINChange the tokens address between rounds
|
function newRound(uint256 date, address tokens) external{
require(block.timestamp>endDate,"too early");
require(msg.sender == admin, "admin function only");
endDate = date;
DFTokens = IERC721(tokens);
}
|
function newRound(uint256 date, address tokens) external{
require(block.timestamp>endDate,"too early");
require(msg.sender == admin, "admin function only");
endDate = date;
DFTokens = IERC721(tokens);
}
| 12,842
|
23
|
// leverageExist
|
function leverageExist(uint32 leverage_) external view returns (bool);
|
function leverageExist(uint32 leverage_) external view returns (bool);
| 13,407
|
56
|
// if there is a lockingPeriod, add tokens to record mapping
|
else
_transferLock(_msgSender(),to, tokens);
_addRecord(to, tokens, lockingPeriod);
return true;
|
else
_transferLock(_msgSender(),to, tokens);
_addRecord(to, tokens, lockingPeriod);
return true;
| 5,094
|
78
|
// Cancel one or more open orders by nonceCanceled orders are marked CANCELED (0x02)Emits a Cancel event_nonces uint256[]/
|
function cancel(
uint256[] calldata _nonces
|
function cancel(
uint256[] calldata _nonces
| 50,689
|
83
|
// check to see if this is an authorized key
|
if (address(authorizations[authVersion + uint256(signer)]) != cosigner) {
return 0;
}
|
if (address(authorizations[authVersion + uint256(signer)]) != cosigner) {
return 0;
}
| 12,116
|
287
|
// Adds a new collateral token to the protocol./collateralToken The new collateral token./priceFeed The price feed for the collateral token./newSplitLiquidationCollateral split liquidation collateral contract address.
|
function addCollateralToken(
IERC20 collateralToken,
IPriceFeed priceFeed,
ISplitLiquidationCollateral newSplitLiquidationCollateral
)
external;
|
function addCollateralToken(
IERC20 collateralToken,
IPriceFeed priceFeed,
ISplitLiquidationCollateral newSplitLiquidationCollateral
)
external;
| 6,117
|
60
|
// approve for swap
|
token.approve(address(currencyConverter()), totalAmount);
|
token.approve(address(currencyConverter()), totalAmount);
| 9,038
|
27
|
// Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens. /
|
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
|
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
| 22
|
157
|
// underlying here is WETH
|
uint256 balance = underlying.balanceOf(address(this)); // supply at most "balance"
if (amountInWETH < balance) {
balance = amountInWETH; // only supply the "amount" if its less than what we have
}
|
uint256 balance = underlying.balanceOf(address(this)); // supply at most "balance"
if (amountInWETH < balance) {
balance = amountInWETH; // only supply the "amount" if its less than what we have
}
| 53,101
|
4
|
// uint256 flags;
|
bytes fallbackAddress;
bytes data;
|
bytes fallbackAddress;
bytes data;
| 13,427
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.