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
46
// for each order
for (uint256 i = 0; i < numOrders; i++) { bytes32 orderHash = orderHashes[i]; output[i] = OrderQueryOutput({ orderStatus: g_status[orderHash], filledAmount: g_filledAmount[orderHash] });
for (uint256 i = 0; i < numOrders; i++) { bytes32 orderHash = orderHashes[i]; output[i] = OrderQueryOutput({ orderStatus: g_status[orderHash], filledAmount: g_filledAmount[orderHash] });
28,075
1
// Check if a payment token is allowed for a collection /
function isAllowedPaymentToken(address collectionAddress, address token) external view returns (bool);
function isAllowedPaymentToken(address collectionAddress, address token) external view returns (bool);
16,574
320
// Can no longer update max mint, code locations, or series parameters
series[sid].locked = true;
series[sid].locked = true;
25,524
20
// wolves fur
rarities[9] = [210, 90, 9, 9, 9, 150, 9, 255, 9]; aliases[9] = [5, 0, 0, 5, 5, 7, 5, 7, 5];
rarities[9] = [210, 90, 9, 9, 9, 150, 9, 255, 9]; aliases[9] = [5, 0, 0, 5, 5, 7, 5, 7, 5];
7,922
284
// Total weight
uint256 totalWeight;
uint256 totalWeight;
50,665
35
// Delegate votes from `msg.sender` to `delegatee` delegatee The address to delegate votes to /
function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); }
function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); }
8,922
105
// set new UID's mapping to index to old UID's mapping
uidToAacIndex[newUid] = uidToAacIndex[_currentUid];
uidToAacIndex[newUid] = uidToAacIndex[_currentUid];
6,772
7
// INTERNAL FUNCTIONS
function returnRecoveredEIP712Internal( bytes32 hash, bytes memory signature) internal pure returns (address recovered)
function returnRecoveredEIP712Internal( bytes32 hash, bytes memory signature) internal pure returns (address recovered)
13,817
129
// The operator can only update the transfer tax rate
address private _operator;
address private _operator;
27,989
80
// if there's any deposit left,
if (slot.depositWei > 0) { pool.liquidityToken.transfer(slot.owner, slot.depositWei); }
if (slot.depositWei > 0) { pool.liquidityToken.transfer(slot.owner, slot.depositWei); }
62,873
8
// Debt adapter for Liquity protocol. Implementation of ProtocolAdapter interface. Igor Sobolev <[email protected]> /
contract LiquityDebtAdapter is ProtocolAdapter { string public constant override adapterType = "Debt"; string public constant override tokenType = "ERC20"; address internal constant LUSD = 0x5f98805A4E8be255a32880FDeC7F6728C6568bA0; address internal constant TROVE_MANAGER = 0xA39739EF8b0231DbFA0DcdA0...
contract LiquityDebtAdapter is ProtocolAdapter { string public constant override adapterType = "Debt"; string public constant override tokenType = "ERC20"; address internal constant LUSD = 0x5f98805A4E8be255a32880FDeC7F6728C6568bA0; address internal constant TROVE_MANAGER = 0xA39739EF8b0231DbFA0DcdA0...
75,312
1
// Emits when ownership of any NFT changes by any mechanism. This event emits when NFTs arecreated (`from` == 0) and destroyed (`to` == 0). Exception: during contract creation, anynumber of NFTs may be created and assigned without emitting Transfer. At the time of anytransfer, the approved address for that NFT (if any)...
event Transfer( address indexed _from, address indexed _to, uint256 indexed _tokenId );
event Transfer( address indexed _from, address indexed _to, uint256 indexed _tokenId );
40,514
7
// NOTE: the sender must give the tokensale contract the allowance before the tokensale can start! like this token.approve(sale, whateverAmount);
return (sale, token);
return (sale, token);
15,180
16
// Transfers _value amount of tokens to address _to, and MUST fire the Transfer event.The function SHOULD throw if the _from account balance does not have enough tokens to spend.A token contract which creates new tokens SHOULD trigger a Transfer event with the _from address set to 0x0 when tokens are created. Note Tran...
function transfer(address _to, uint256 _value) public
function transfer(address _to, uint256 _value) public
18,631
4
// This WILL halt the call frame on completion.
_doProxyCall();
_doProxyCall();
17,431
87
// Upvote post automatically
_upvote(_postID);
_upvote(_postID);
18,175
202
// Just in case, reward program can be re-opened
function resetStartBlockAndFarmingPeriod(uint256 _start, uint256 _period) public onlyOwner { startBlock = _start; farmPeriod = _period; }
function resetStartBlockAndFarmingPeriod(uint256 _start, uint256 _period) public onlyOwner { startBlock = _start; farmPeriod = _period; }
26,632
7
// Balance for current bin in memory (initialized with first transfer)
uint256 balTo = _viewUpdateBinValue( balances[_to][bin], index, _amounts[0], Operations.Add );
uint256 balTo = _viewUpdateBinValue( balances[_to][bin], index, _amounts[0], Operations.Add );
26,205
14
// Returns the ABI associated with an ENS node.Defined in EIP205. node The ENS node to query contentTypes A bitwise OR of the ABI formats accepted by the caller.return contentType The content type of the return valuereturn data The ABI data /
function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory) { mapping(uint256=>bytes) storage abiset = abis[node]; for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) { if ((contentType & contentTypes) != 0 && abiset[contentTy...
function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory) { mapping(uint256=>bytes) storage abiset = abis[node]; for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) { if ((contentType & contentTypes) != 0 && abiset[contentTy...
13,181
326
// default amount
platformAmount = saleAmount .mul(defaultPlatformSecondSalePercentage) .div(100);
platformAmount = saleAmount .mul(defaultPlatformSecondSalePercentage) .div(100);
15,351
75
// Modifier to revert if msg.sender is not an Administrator or the Owner account.
modifier onlyAdministratorOrOwner() { require(isAdministrator(msg.sender) || isOwner()); _; }
modifier onlyAdministratorOrOwner() { require(isAdministrator(msg.sender) || isOwner()); _; }
23,266
22
// Choose a winner and pay him
function payWinner() internal returns (address) { uint256 balance = address(this).balance; uint256 number = PRNG(); // generates a pseudorandom number address winner = entries[number]; // choose the winner with the pseudorandom number winner.transfer(balance); // payout winner ...
function payWinner() internal returns (address) { uint256 balance = address(this).balance; uint256 number = PRNG(); // generates a pseudorandom number address winner = entries[number]; // choose the winner with the pseudorandom number winner.transfer(balance); // payout winner ...
33,593
16
// Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, a...
function doTransferOut(address payable to, uint amount) internal { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); token.transfer(to, amount); bool success; assembly { switch returndatasize() case 0 { // This ...
function doTransferOut(address payable to, uint amount) internal { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); token.transfer(to, amount); bool success; assembly { switch returndatasize() case 0 { // This ...
30,791
66
// Throws if `account` is blacklistedaccount The address to check/
modifier notBlacklisted(address account) { require(blacklisted[account] == false, BLACKLISTED); _; }
modifier notBlacklisted(address account) { require(blacklisted[account] == false, BLACKLISTED); _; }
15,948
45
// Loop through the items
for(uint256 i = 1; i < total+1;){
for(uint256 i = 1; i < total+1;){
21,363
3
// metadata
bool[] bid_done; bool[] committed; bool[] validated; bool[] fastest;
bool[] bid_done; bool[] committed; bool[] validated; bool[] fastest;
31,029
138
//
constructor( address _bomb, address _link, uint256 _poolStartTime
constructor( address _bomb, address _link, uint256 _poolStartTime
5,383
182
// Returns true if the contract is paused, and false otherwise. /
function paused() public view virtual returns (bool) { return _paused; }
function paused() public view virtual returns (bool) { return _paused; }
2,353
5
// Injects new veBAL performData required by chainlink keeper interface but not used in this contract, can be 0x0 or anything else.return upkeepNeeded signals if upkeep is needed/
function performUpkeep(bytes calldata performData) external onlyKeeperRegistry whenNotPaused { uint256 timeCursor = FeeDistributor.getTimeCursor(); require(LastRunTimeCurser < timeCursor, "Not ready"); uint counter = 0; for(uint i=0; i< ManagedTokens.length; i++){ if (ManagedTokens[i].balanceO...
function performUpkeep(bytes calldata performData) external onlyKeeperRegistry whenNotPaused { uint256 timeCursor = FeeDistributor.getTimeCursor(); require(LastRunTimeCurser < timeCursor, "Not ready"); uint counter = 0; for(uint i=0; i< ManagedTokens.length; i++){ if (ManagedTokens[i].balanceO...
32,466
88
// set new wallet address _addr The new wallet address /
function setWallet(address _addr) onlyAdmin public returns (bool) { require(_addr != address(0) && _addr != address(this)); wallet = _addr; emit NewWallet(wallet); return true; }
function setWallet(address _addr) onlyAdmin public returns (bool) { require(_addr != address(0) && _addr != address(this)); wallet = _addr; emit NewWallet(wallet); return true; }
15,802
40
// we may disregard totalEurUlps as curve is flat, round down when calculating tokens
return Math.mul(committedEurUlps, EQUITY_TOKEN_POWER) / FULL_TOKEN_PRICE_FRACTION;
return Math.mul(committedEurUlps, EQUITY_TOKEN_POWER) / FULL_TOKEN_PRICE_FRACTION;
5,856
3
// store Candidate count
uint public candidatesCount;
uint public candidatesCount;
53,245
308
// Maps strategies to data the Vault holds on them.
mapping(Strategy => StrategyData) public getStrategyData; /* ////////////////////////////////////////////////////////////// HARVEST STORAGE
mapping(Strategy => StrategyData) public getStrategyData; /* ////////////////////////////////////////////////////////////// HARVEST STORAGE
30,427
2
// Emitted when the admin claims all protocol revenues accrued for a particular ERC-20 asset./admin The address of the contract admin./asset The contract address of the ERC-20 asset the protocol revenues have been claimed for./protocolRevenues The amount of protocol revenues claimed, denoted in units of the asset's dec...
event ClaimProtocolRevenues(address indexed admin, IERC20 indexed asset, uint128 protocolRevenues);
event ClaimProtocolRevenues(address indexed admin, IERC20 indexed asset, uint128 protocolRevenues);
31,207
459
// attempt rageQuit notification
try IRageQuit(delegate).rageQuit{gas: RAGEQUIT_GAS}() {
try IRageQuit(delegate).rageQuit{gas: RAGEQUIT_GAS}() {
41,998
314
// TokenID -> Satellite Info
mapping(uint256 => SateInfo) public sateInfo;
mapping(uint256 => SateInfo) public sateInfo;
43,992
7
// get attack power of Skully;
(,attackPower,,,) = skullCore.getSkull(attackId);
(,attackPower,,,) = skullCore.getSkull(attackId);
22,354
18
// ----------- External Functions -----------/ Check when the presale ends.return The date in completion timestamp. /
function endsAt() external view returns (uint256) { return ROUNDS[2].endTime; }
function endsAt() external view returns (uint256) { return ROUNDS[2].endTime; }
1,670
45
// 添加玩家个人资料和最新名称
games_[_gameID].receivePlayerInfo(_pID, _addr, plyr_[_pID].name, plyr_[_pID].laff);
games_[_gameID].receivePlayerInfo(_pID, _addr, plyr_[_pID].name, plyr_[_pID].laff);
3,032
210
// Internal asset array portfolio state
struct PortfolioState { // Array of currently stored assets PortfolioAsset[] storedAssets; // Array of new assets to add PortfolioAsset[] newAssets; uint256 lastNewAssetIndex; // Holds the length of stored assets after accounting for deleted assets uint256 storedAssetLength; }
struct PortfolioState { // Array of currently stored assets PortfolioAsset[] storedAssets; // Array of new assets to add PortfolioAsset[] newAssets; uint256 lastNewAssetIndex; // Holds the length of stored assets after accounting for deleted assets uint256 storedAssetLength; }
2,167
120
// IERC20(parameters.tokenB).safeIncreaseAllowance(parameters.router02, amountB.sub(parameters.amountBMin));
safeIncreaseMaxUint(parameters.tokenB, parameters.router02, amountB.mul(2)); // We are passing an amount higher because we do not know how much is going to be spent. amountBCoveringDebt = IUniswapV2Router02(parameters...
safeIncreaseMaxUint(parameters.tokenB, parameters.router02, amountB.mul(2)); // We are passing an amount higher because we do not know how much is going to be spent. amountBCoveringDebt = IUniswapV2Router02(parameters...
10,152
20
// Get the lending pool token amount in rewards of the specified bank node//bankNodeId The id of the bank node/ return BankNodeTokenBalanceInRewards The lending pool token balance in rewards
function getPoolLiquidityTokensStakedInRewards(uint32 bankNodeId) public view returns (uint256) { return getStakingTokenForBankNode(bankNodeId).balanceOf(address(this)); }
function getPoolLiquidityTokensStakedInRewards(uint32 bankNodeId) public view returns (uint256) { return getStakingTokenForBankNode(bankNodeId).balanceOf(address(this)); }
49,288
26
// increase shared profit
shared_profit = shared_profit.add(fee_funds); emit Selling(msg.sender, tokens, funds, price / precision_factor, now);
shared_profit = shared_profit.add(fee_funds); emit Selling(msg.sender, tokens, funds, price / precision_factor, now);
60,933
26
// Receive the WEDU token from other user _from The users who will transmit WEDU token _to The users who will receive WEDU token _value The amount of WEDU token transmits to userreturn True when the WEDU token transfer success /
function transferFrom(address _from, address _to, uint _value) public returns (bool){ // Check the unlocked balance and allowed balance of a user require(allowed[_from][msg.sender] <= balanceValue[_from].unlocked, "Unsufficient allowed balance"); require(_value <= allowed[_from][msg.sender],...
function transferFrom(address _from, address _to, uint _value) public returns (bool){ // Check the unlocked balance and allowed balance of a user require(allowed[_from][msg.sender] <= balanceValue[_from].unlocked, "Unsufficient allowed balance"); require(_value <= allowed[_from][msg.sender],...
18,245
120
// Invariant: There will always be an ownership that has an address and is not burned before an ownership that does not have an address and is not burned. Hence, curr will not underflow.
while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; }
while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; }
6,376
650
// Mapping from currency id to maturity to its tightly packed cash group parameters
function getCashGroupStorage() internal pure returns (mapping(uint256 => bytes32) storage store)
function getCashGroupStorage() internal pure returns (mapping(uint256 => bytes32) storage store)
6,178
397
// adjustments[9]/mload(0x4ee0), Constraint expression for pedersen/hash3/ec_subset_sum/add_points/x: column17_row0column17_row0 - pedersen__hash3__ec_subset_sum__bit_0(column15_row0 + pedersen__points__x + column15_row1).
let val := addmod( mulmod(/*column17_row0*/ mload(0x3340), /*column17_row0*/ mload(0x3340), PRIME), sub( PRIME, mulmod(
let val := addmod( mulmod(/*column17_row0*/ mload(0x3340), /*column17_row0*/ mload(0x3340), PRIME), sub( PRIME, mulmod(
20,799
10
// 更改isCanBuy狀態
function changeCanBuyStatus(string calldata account, bool isCanBuy) external onlyOwner { require(users[account].isCanBuy != isCanBuy, "Already in this isCanBuy states"); users[account].isCanBuy = isCanBuy; emit ChangeStatus(account, isCanBuy); }
function changeCanBuyStatus(string calldata account, bool isCanBuy) external onlyOwner { require(users[account].isCanBuy != isCanBuy, "Already in this isCanBuy states"); users[account].isCanBuy = isCanBuy; emit ChangeStatus(account, isCanBuy); }
16,686
30
// all tokens
uint256[] internal allTokens;
uint256[] internal allTokens;
50,991
9
// wl only mint
function whitelistMint(uint256 tokens, bytes32[] calldata merkleProof) external payable { require(whitelistSale, "SARU: You can not mint right now"); require(MerkleProof.verify(merkleProof, merkleRoot, keccak256(abi.encodePacked(msg.sender))), "SARU: Please wait to mint on public sale"); req...
function whitelistMint(uint256 tokens, bytes32[] calldata merkleProof) external payable { require(whitelistSale, "SARU: You can not mint right now"); require(MerkleProof.verify(merkleProof, merkleRoot, keccak256(abi.encodePacked(msg.sender))), "SARU: Please wait to mint on public sale"); req...
16,089
77
// Fees breaker, to protect withdraws if anything ever goes wrong /
constructor(address _lpToken, address _rewardToken) public LPTokenWrapper(_lpToken) { admin = msg.sender; rewardToken = IERC20(_rewardToken); }
constructor(address _lpToken, address _rewardToken) public LPTokenWrapper(_lpToken) { admin = msg.sender; rewardToken = IERC20(_rewardToken); }
69,869
5
// String comparison utility
function stringsEqual(string _a, string _b) internal returns (bool) { //temp allocation bytes memory a = bytes(_a); bytes memory b = bytes(_b); if (a.length != b.length) return false; for (uint i = 0; i < a.length; i ++) if (a[i] != b[i]) return false; return true; }
function stringsEqual(string _a, string _b) internal returns (bool) { //temp allocation bytes memory a = bytes(_a); bytes memory b = bytes(_b); if (a.length != b.length) return false; for (uint i = 0; i < a.length; i ++) if (a[i] != b[i]) return false; return true; }
42,487
44
// ============ Constructor ============ //Initializes the initial fee recipient on deployment._feeRecipientAddress of the initial protocol fee recipient /
constructor(address _feeRecipient) public { feeRecipient = _feeRecipient; }
constructor(address _feeRecipient) public { feeRecipient = _feeRecipient; }
20,006
290
// Ensure enough principal
uint256 allowedAmount = Math.min256(requestedAmount, position.principal);
uint256 allowedAmount = Math.min256(requestedAmount, position.principal);
45,994
40
// loop through arrays, claiming each individual vote reward
for (uint i = 0; i < _challengeIDs.length; i++) { claimReward(_challengeIDs[i], _salts[i]); }
for (uint i = 0; i < _challengeIDs.length; i++) { claimReward(_challengeIDs[i], _salts[i]); }
17,389
1
// Addresses for custody and development
address public custodyWallet; address public developmentWallet; address public unlocksWallet; address public growthAccount; address public distributionAccount; address public burnAddress; // Address for burning tokens address public liquidityPool; // Address for liquidity pool
address public custodyWallet; address public developmentWallet; address public unlocksWallet; address public growthAccount; address public distributionAccount; address public burnAddress; // Address for burning tokens address public liquidityPool; // Address for liquidity pool
39,942
5
// Get the address of DAI return address of DAI contract
function dai() external view returns (address);
function dai() external view returns (address);
17,366
24
// /
function tokensToNormalized(address token, uint256 amountTokens) public view override returns(uint256 amountNormal) { IERC20Extended t = IERC20Extended(token); uint256 nativeDecimals = t.decimals(); require(nativeDecimals <= 18, "OracleCommon: unsupported token precision (greater than 18)");...
function tokensToNormalized(address token, uint256 amountTokens) public view override returns(uint256 amountNormal) { IERC20Extended t = IERC20Extended(token); uint256 nativeDecimals = t.decimals(); require(nativeDecimals <= 18, "OracleCommon: unsupported token precision (greater than 18)");...
4,542
19
// Tool to verify that a low level call to smart-contract was successful, and revert (either by bubblingthe revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. _Available since v4.8._ /
function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage
function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage
2,518
8
// Transfer the closing funds from the closing trader to the opening trader.
ERC20 closeERC20Contract = ERC20(swap.closeContractAddress); require(swap.closeValue <= closeERC20Contract.allowance(swap.closeTrader, address(this))); require(closeERC20Contract.transferFrom(swap.closeTrader, swap.openTrader, swap.closeValue));
ERC20 closeERC20Contract = ERC20(swap.closeContractAddress); require(swap.closeValue <= closeERC20Contract.allowance(swap.closeTrader, address(this))); require(closeERC20Contract.transferFrom(swap.closeTrader, swap.openTrader, swap.closeValue));
2,037
9
// Event which is triggered whenever an owner approves a new allowance for a spender.
event Approval( address indexed _owner, address indexed _spender, uint256 _value );
event Approval( address indexed _owner, address indexed _spender, uint256 _value );
28,059
379
// В глазах Мегги заплясали искорки смеха. ^^^^^
recognition Мегги language=Russian
recognition Мегги language=Russian
29,283
0
// Any `bytes32` value is a valid role. You can create roles by defining them like this. This below role is granted to staker smart contracts so they can upgrade the player's nfts.
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
21,967
24
// These events will be emitted when recipients are added or removed
event RecipientAdded(address newRecipient); event RecipientRemoved(address removedRecipient);
event RecipientAdded(address newRecipient); event RecipientRemoved(address removedRecipient);
23,101
93
// Hook that is called before any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokenswill be transferred to `to`.- when `from` is zero, `amount` tokens will be minted for `to`.- when `to` is zero, `amount` of ``from``'s tokens...
function _beforeTokenTransfer( address from, address to, uint256 amount
function _beforeTokenTransfer( address from, address to, uint256 amount
51
251
// Emitted when AFI is distributed to a supplier
event DistributedAFI(address indexed afiToken, address indexed supplier, uint256 afiDelta, uint256 afiSupplyIndex);
event DistributedAFI(address indexed afiToken, address indexed supplier, uint256 afiDelta, uint256 afiSupplyIndex);
11,106
36
// add update index fixed coin
tempArray=new address[](0); allIndexDefiCoinContractAddressArray=tempArray; for(uint256 i=0;i<tupleCoinArray.length;i++){ defiCoinsIndexMapping[tupleCoinArray[i].contractAddress]=tupleCoinArray[i];
tempArray=new address[](0); allIndexDefiCoinContractAddressArray=tempArray; for(uint256 i=0;i<tupleCoinArray.length;i++){ defiCoinsIndexMapping[tupleCoinArray[i].contractAddress]=tupleCoinArray[i];
2,186
190
// convert to correct decimals for collateral
uint256 collateralAmount = oneAmount.mul(reserveRatio).div(MAX_RESERVE_RATIO).mul(10 ** collateralDecimals[collateral]).div(10 ** DECIMALS); collateralAmount = collateralAmount.mul(10 ** 9).div(getCollateralUsd(collateral)); if (address(oneTokenOracle) == address(0)) return (collateralAmount, 0...
uint256 collateralAmount = oneAmount.mul(reserveRatio).div(MAX_RESERVE_RATIO).mul(10 ** collateralDecimals[collateral]).div(10 ** DECIMALS); collateralAmount = collateralAmount.mul(10 ** 9).div(getCollateralUsd(collateral)); if (address(oneTokenOracle) == address(0)) return (collateralAmount, 0...
25,964
2
// 0.01 eth converted to wei
uint256 public winningAmount = 10000000000000000;
uint256 public winningAmount = 10000000000000000;
6,078
155
// weather
bool public stormy = false; uint256 public stormDivisor = 2;
bool public stormy = false; uint256 public stormDivisor = 2;
2,572
147
// now calculate the transfer amount in reflections too. substract fee two times because of liq AND reflections.
uint256 rTransferAmount = rAmount - rFee - rFee; return (rAmount, rTransferAmount, rFee);
uint256 rTransferAmount = rAmount - rFee - rFee; return (rAmount, rTransferAmount, rFee);
26,579
4
// Calculate and mint the amount of xSUNI the SUWP is worth. The ratio will change overtime, as xSUNI is burned/minted and SUWP deposited + gained from fees / withdrawn.
else { uint256 what = _amount.mul(totalShares).div(totalSuwp); _mint(msg.sender, what); }
else { uint256 what = _amount.mul(totalShares).div(totalSuwp); _mint(msg.sender, what); }
11,431
0
// solhint-disable func-name-mixedcase
interface IGelatoRelayERC2771Base { function userNonce(address _user) external view returns (uint256); function gelato() external view returns (address); function SPONSORED_CALL_ERC2771_TYPEHASH() external pure returns (bytes32); }
interface IGelatoRelayERC2771Base { function userNonce(address _user) external view returns (uint256); function gelato() external view returns (address); function SPONSORED_CALL_ERC2771_TYPEHASH() external pure returns (bytes32); }
4,143
32
// Get user permissions
address[] memory accounts = new address[](6); accounts[0] = _user; accounts[1] = _user; accounts[2] = _user; accounts[3] = _user; accounts[4] = _user; accounts[5] = _sender; uint256[] memory ids = new uint256[](6); ids[0] = TIER_1_ID;
address[] memory accounts = new address[](6); accounts[0] = _user; accounts[1] = _user; accounts[2] = _user; accounts[3] = _user; accounts[4] = _user; accounts[5] = _sender; uint256[] memory ids = new uint256[](6); ids[0] = TIER_1_ID;
30,630
0
// minting activities' parameters (each round of activities needs to configure a set of the following parameters)
struct Parameters { bytes32 merkleRoot; // merkle root corresponding to the whitelist list uint64 startTimestamp; // start time of this round activity uint64 endTimestamp; uint256 maxTokenId; // maximum tokenId that can be minted for this activity,eg.150 or 2100 }
struct Parameters { bytes32 merkleRoot; // merkle root corresponding to the whitelist list uint64 startTimestamp; // start time of this round activity uint64 endTimestamp; uint256 maxTokenId; // maximum tokenId that can be minted for this activity,eg.150 or 2100 }
15,531
10
// Calls Withdraw function on controller
(uint256 withdrawn, uint256 fee) = IController(controller).withdraw(assets, receiver); require(withdrawn > 0, "INVALID_WITHDRAWN_SHARES");
(uint256 withdrawn, uint256 fee) = IController(controller).withdraw(assets, receiver); require(withdrawn > 0, "INVALID_WITHDRAWN_SHARES");
35,258
15
// Set 2 new feeds for MKR/USD Medianizer
exec(MKRUSD, abi.encodeWithSignature("set(address)", FEED1), 0); exec(MKRUSD, abi.encodeWithSignature("set(address)", FEED2), 0);
exec(MKRUSD, abi.encodeWithSignature("set(address)", FEED1), 0); exec(MKRUSD, abi.encodeWithSignature("set(address)", FEED2), 0);
54,382
254
// Burn parents
_burn(borgId1); _burn(borgId2);
_burn(borgId1); _burn(borgId2);
17,995
184
// only do this if absolutely necessary; as rewards won't be claimed, and this also must be 10 weeks after our last withdrawal. this will revert if we don't have anything to withdraw.
function emergencyWithdraw() external onlyEmergencyAuthorized { IStaking(staking).emergencyWithdraw(address(want)); }
function emergencyWithdraw() external onlyEmergencyAuthorized { IStaking(staking).emergencyWithdraw(address(want)); }
59,588
1
// Allows verified creation of multisignature wallet./_owners List of initial owners./_required Number of required confirmations./_dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis./ return Returns wallet address.
function create( address[] _owners, uint _required, uint _dailyLimit ) external returns (address wallet);
function create( address[] _owners, uint _required, uint _dailyLimit ) external returns (address wallet);
41,787
98
// Uniform accuracy/inputToken Initial token/inputTokenAmount Amount of token/outputToken Converted token/ return stability Amount of outputToken
function getDecimalConversion(address inputToken, uint256 inputTokenAmount,
function getDecimalConversion(address inputToken, uint256 inputTokenAmount,
53,823
64
// Return last block where trading rewards were distributed /
function lastRewardBlock() external view returns (uint256) { return _lastRewardBlock(); }
function lastRewardBlock() external view returns (uint256) { return _lastRewardBlock(); }
16,565
53
// compute without actually increasing it
uint256 increasedTotalSupply = totalSupply.add(_tokens);
uint256 increasedTotalSupply = totalSupply.add(_tokens);
54,059
20
// Transfer premium payment to writer
ethOpts[ID].writer.transfer(ethOpts[ID].premium); ethOpts[ID].buyer = msg.sender;
ethOpts[ID].writer.transfer(ethOpts[ID].premium); ethOpts[ID].buyer = msg.sender;
1,389
72
// ====== INTERNAL FUNCTIONS ====== // /
function adjust( uint _index ) internal { Adjust memory adjustment = adjustments[ _index ]; if ( adjustment.rate != 0 ) { if ( adjustment.add ) { // if rate should increase info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate if ...
function adjust( uint _index ) internal { Adjust memory adjustment = adjustments[ _index ]; if ( adjustment.rate != 0 ) { if ( adjustment.add ) { // if rate should increase info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate if ...
60,675
250
// If it was paired with a season1 nft, unpair them
uint256 pairedTokenId = user ._season2StakeInfos[__tokenIDList[i]] ._pairedTokenId; if (pairedTokenId > 0) {
uint256 pairedTokenId = user ._season2StakeInfos[__tokenIDList[i]] ._pairedTokenId; if (pairedTokenId > 0) {
2,561
6
// ERC721-claim inclusion root
bytes32 public claimMerkleRoot;
bytes32 public claimMerkleRoot;
42,033
4
// ERC1155 token with pausable token transfers, minting and burning. Useful for scenarios such as preventing trades until the end of an evaluationperiod, or having an emergency switch for freezing all token transfers in theevent of a large bug. _Available since v3.1._ /
abstract contract ERC1155PausableUpgradeable is Initializable, ERC1155Upgradeable, PausableUpgradeable { function __ERC1155Pausable_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __Pausable_init_unchained(); __ERC1155Pausable_init_unchained(...
abstract contract ERC1155PausableUpgradeable is Initializable, ERC1155Upgradeable, PausableUpgradeable { function __ERC1155Pausable_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __Pausable_init_unchained(); __ERC1155Pausable_init_unchained(...
90
30
// The struct is used to implement a modified version of a doubly linked/ list with sorted elements. The list starts from QUEUE_START to/ QUEUE_END, and each node keeps track of its predecessor and successor./ Nodes can be added or removed.// `next` and `prev` have a different role. The list is supposed to be/ traverse...
struct Data { mapping(bytes32 => bytes32) nextMap; mapping(bytes32 => bytes32) prevMap; }
struct Data { mapping(bytes32 => bytes32) nextMap; mapping(bytes32 => bytes32) prevMap; }
3,824
22
// Returns the symbol of the token, usually a shorter version of the name./
function symbol() public view virtual override returns (string memory) { return _symbol; }
function symbol() public view virtual override returns (string memory) { return _symbol; }
17,250
30
// Extract ECDSA signature variables from `sig`
assembly { r := mload(add(_sig, 32)) s := mload(add(_sig, 64)) v := byte(0, mload(add(_sig, 96))) }
assembly { r := mload(add(_sig, 32)) s := mload(add(_sig, 64)) v := byte(0, mload(add(_sig, 96))) }
47,287
25
// Reserve extra slots in the storage layout for future upgrades.A gap size of 41 was chosen here, so that the first slot used in a child contractwould be a multiple of 50. /
uint256[41] private __gap;
uint256[41] private __gap;
2,221
71
// do the transfer
tokenToTransfer.owner = _to; ownedToken[_from] = 0x0; ownedToken[_to] = _value; approvals[_from][msg.sender] = 0x0;
tokenToTransfer.owner = _to; ownedToken[_from] = 0x0; ownedToken[_to] = _value; approvals[_from][msg.sender] = 0x0;
57,235
3
// External interface of FeeDistributor declared to support ERC165 detection. /
interface IFeeDistributor is IERC165 { /** * @dev 256bits-wide structure to store recipient address along with its basisPoints */ struct FeeRecipient { /** * @notice basis points (percent * 100) of EL rewards that should go to the recipient */ uint96 basisPoints; ...
interface IFeeDistributor is IERC165 { /** * @dev 256bits-wide structure to store recipient address along with its basisPoints */ struct FeeRecipient { /** * @notice basis points (percent * 100) of EL rewards that should go to the recipient */ uint96 basisPoints; ...
5,973
6
// KYC wrapper for smart contracts respecting the users' privacy./
contract KYCWrapper is Ownable { ITuringHelper public turingHelper; string private _apiUrl; mapping (address => bool) private _excludedFromKYC; event KYCResult(address indexed _wallet, bool indexed _isKYCed); modifier onlyKYCed() { require(isKYCedOrExcluded(_msgSender()), "Only KYCed or e...
contract KYCWrapper is Ownable { ITuringHelper public turingHelper; string private _apiUrl; mapping (address => bool) private _excludedFromKYC; event KYCResult(address indexed _wallet, bool indexed _isKYCed); modifier onlyKYCed() { require(isKYCedOrExcluded(_msgSender()), "Only KYCed or e...
2,971
7
// -- Configuration --
function setArbitrator(address _arbitrator) external; function setMinimumDeposit(uint256 _minimumDeposit) external; function setFishermanRewardPercentage(uint32 _percentage) external; function setSlashingPercentage(uint32 _qryPercentage, uint32 _idxPercentage) external;
function setArbitrator(address _arbitrator) external; function setMinimumDeposit(uint256 _minimumDeposit) external; function setFishermanRewardPercentage(uint32 _percentage) external; function setSlashingPercentage(uint32 _qryPercentage, uint32 _idxPercentage) external;
42,823
178
// Sets the max gift supply emergency /
{ giftSupply = _amount; }
{ giftSupply = _amount; }
52,301
33
// Then transfer the amount to the target address
Transfer(this, target, mintedAmount);
Transfer(this, target, mintedAmount);
20,393
44
// the total amount allocated for community rewards
uint constant communityTokenAmount = 2000000000 ether;
uint constant communityTokenAmount = 2000000000 ether;
75,520
58
// mkr
ATMIv0[3] = 150000000; ivParamMap[3] = ivParam(-38611755991,38654705664,-214748365,214748365,4294967296); ATMIvRate[3] = ATMIvRate[1];
ATMIv0[3] = 150000000; ivParamMap[3] = ivParam(-38611755991,38654705664,-214748365,214748365,4294967296); ATMIvRate[3] = ATMIvRate[1];
23,180