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
18
// View the amount of dividend in wei that an address has earned in total./accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)/_owner The address of a token holder./ return The amount of dividend in wei that `_owner` has earned in total.
function accumulativeDividendOf(address _owner) external view returns(uint256);
function accumulativeDividendOf(address _owner) external view returns(uint256);
12,306
23
// Standard ERC20 tokenImplementation of the basic standard token./
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to ...
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to ...
31,115
83
// Perform any adjustments to the core position(s) of this strategy givenwhat change the Vault made in the "investable capital" available to thestrategy. Note that all "free capital" in the strategy after the reportwas made is available for reinvestment. Also note that this number couldbe 0, and you should handle that ...
function adjustPosition(uint256 _debtOutstanding) internal virtual;
function adjustPosition(uint256 _debtOutstanding) internal virtual;
2,943
16
// setup data
address _customerAddress = msg.sender; uint _dividends = myDividends(false); // get ref. bonus later in the code
address _customerAddress = msg.sender; uint _dividends = myDividends(false); // get ref. bonus later in the code
63,723
129
// TRANCHE BALANCES / (v0: S, AA, and A only) (v1: SAA and SA added)
TrancheUint256 internal eternal_unutilized_balances; // Unutilized balance (in base assets) for each tranche (assets held in this pool + assets held in platforms) TrancheUint256 internal eternal_utilized_balances; // Balance for each tranche that is not held within this pool but instead held on a platform via an ...
TrancheUint256 internal eternal_unutilized_balances; // Unutilized balance (in base assets) for each tranche (assets held in this pool + assets held in platforms) TrancheUint256 internal eternal_utilized_balances; // Balance for each tranche that is not held within this pool but instead held on a platform via an ...
37,333
28
// call withdraw with tokens before data change
_withdraw(who, MyTokens[who]+take);
_withdraw(who, MyTokens[who]+take);
42,609
79
// Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. ); address indexed owner, address indexed operator, bool approved ); * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Receiv...
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. ); address indexed owner, address indexed operator, bool approved ); * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Receiv...
206
39
// Global constructor for factory
constructor(SharedNFTLogic _sharedNFTLogic) { sharedNFTLogic = _sharedNFTLogic; }
constructor(SharedNFTLogic _sharedNFTLogic) { sharedNFTLogic = _sharedNFTLogic; }
60,810
199
// Set the auction to closed
_auctionInfo.closed = true;
_auctionInfo.closed = true;
1,400
17
// Remove a registered shop seller shop holder account address/
function removeShop(address seller) onlyOwner nonZeroAddress(seller) shopExists(seller) external
function removeShop(address seller) onlyOwner nonZeroAddress(seller) shopExists(seller) external
40,658
2
// @custom:security-contact dc.robinson@butcherdnft.com
contract KARMAGE is ERC20, ERC20Burnable, Ownable, ERC20FlashMint { constructor() ERC20("KARMAGE", "KMGE") { _mint(msg.sender, 77000000000000 * 10 ** decimals()); } function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } }
contract KARMAGE is ERC20, ERC20Burnable, Ownable, ERC20FlashMint { constructor() ERC20("KARMAGE", "KMGE") { _mint(msg.sender, 77000000000000 * 10 ** decimals()); } function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } }
3,883
30
// Fetch static information about an array of assets. This method can be used for off-chain pagination. /
function assetsStatic(address[] memory _assetsAddresses) public view returns (AssetStatic[] memory)
function assetsStatic(address[] memory _assetsAddresses) public view returns (AssetStatic[] memory)
29,446
48
// Ensure mutex is unlocked
require( !locked, "REENTRANCY_ILLEGAL" );
require( !locked, "REENTRANCY_ILLEGAL" );
24,726
13
// This empty reserved space is put in place to allow future versions to add new/ variables without shifting down storage in the inheritance chain./ https:docs.openzeppelin.com/contracts/4.x/upgradeablestorage_gaps
uint256[48] private __gap;
uint256[48] private __gap;
10,062
22
// Game status.
bool public isActive = true;
bool public isActive = true;
2,493
24
// require(_maxPrice >= nativePrice, "Slippage limit: more than max price");slippage protection
uint256 value = CUSTOM_TREASURY.valueOfToken(lpAddress, lpAmount); uint256 payout = _payoutFor(value); // payout to bonder is computed require(payout >= 10**PAYOUT_TOKEN.decimals() / 100, "Bond too small"); // must be > 0.01 payout token ( underflow protection ) require(payout...
uint256 value = CUSTOM_TREASURY.valueOfToken(lpAddress, lpAmount); uint256 payout = _payoutFor(value); // payout to bonder is computed require(payout >= 10**PAYOUT_TOKEN.decimals() / 100, "Bond too small"); // must be > 0.01 payout token ( underflow protection ) require(payout...
47,821
141
// Precisely divides two units, by first scaling the left hand operand. Useful for finding percentage weightings, i.e. 8e18/10e18 = 80% (or 8e17) x Left hand input to division y Right hand input to divisionreturnResult after multiplying the left operand by the scale, and executing the division on the right hand input. ...
function divPrecisely(uint256 x, uint256 y) internal pure returns (uint256)
function divPrecisely(uint256 x, uint256 y) internal pure returns (uint256)
18,112
82
// Returns the amount that may be vested now from the given pool. /
function releasableAmount(uint256 poolId) external view returns (uint256);
function releasableAmount(uint256 poolId) external view returns (uint256);
59,956
19
// ERC20Token
contract ERC20Token is ERC20 { using SafeMath for uint256; mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalToken; function transfer(address _to, uint256 _value) public returns (bool success) { if (balances[msg.sender] >= ...
contract ERC20Token is ERC20 { using SafeMath for uint256; mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalToken; function transfer(address _to, uint256 _value) public returns (bool success) { if (balances[msg.sender] >= ...
55,001
29
// Adds the given information to the Reliquary. Only callable from provers. account The account to which this information is bound (may be the null account for information bound to no specific address) factSig The unique signature of the particular fact being proven data Associated data to store with this item May only...
function setFact(
function setFact(
24,854
254
// Reverts with a {CallFailed} error if execution of the query fails or returns an unexpected value.//token The token to check the balance of./account The address of the token holder.// return The balance of the tokens held by an account.
function safeBalanceOf(address token, address account) internal view returns (uint256) { (bool success, bytes memory data) = token.staticcall( abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, account) ); if (!success || data.length < 32) { revert ERC20CallFai...
function safeBalanceOf(address token, address account) internal view returns (uint256) { (bool success, bytes memory data) = token.staticcall( abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, account) ); if (!success || data.length < 32) { revert ERC20CallFai...
30,301
245
// we need to burn sUSD to target
burnSusdToTarget();
burnSusdToTarget();
21,054
14
// Read next variable bytes starting from offset, buffSource bytes array offsetThe position from where we read the bytes valuereturnThe read variable bytes array value and updated offset/
function NextVarBytes(bytes memory buff, uint256 offset) internal pure returns(bytes memory, uint256) { uint len; (len, offset) = NextVarUint(buff, offset); require(offset + len <= buff.length && offset < offset + len, "NextVarBytes, offset exceeds maximum"); bytes memory tempBytes; ...
function NextVarBytes(bytes memory buff, uint256 offset) internal pure returns(bytes memory, uint256) { uint len; (len, offset) = NextVarUint(buff, offset); require(offset + len <= buff.length && offset < offset + len, "NextVarBytes, offset exceeds maximum"); bytes memory tempBytes; ...
16,912
0
// nix/store/fqaypybnhqfq9xiai9wl8zwb73dswy95-h2o-chainlink-median/dapp/h2o-chainlink-median/src/link/AggregatorInterface.sol/ pragma solidity 0.6.7; /
interface AggregatorInterface { event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); function latestAnswer() external view returns (int256); function latestTimestamp() external vie...
interface AggregatorInterface { event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); function latestAnswer() external view returns (int256); function latestTimestamp() external vie...
31,671
115
// earnings reward rate
uint public REWARD_RATE_X_100 = 2500; uint public REWARD_INTERVAL = 365 days;
uint public REWARD_RATE_X_100 = 2500; uint public REWARD_INTERVAL = 365 days;
85,723
9
// subtract virtual balance from total funds
self.list[_fundNum].totalCapital -= bal;
self.list[_fundNum].totalCapital -= bal;
45,479
14
// check move count. New state should have a higher move count.
if ((state[8] * int8(128) + state[9]) < (gameStates[gameId].fields[8] * int8(128) + gameStates[gameId].fields[9])) { throw; }
if ((state[8] * int8(128) + state[9]) < (gameStates[gameId].fields[8] * int8(128) + gameStates[gameId].fields[9])) { throw; }
3,652
4
// this function is ment to be called in the afterTransfer hook of the LiquidPledgingPlugin Return any excess funds after the transfer if necessary. Funda are deemed necessary to return if this is a capped milestone and the total amount received is greater then the maxAmount of this milestone./
function _returnExcessFunds( uint64 context, uint64 pledgeFrom, uint64 pledgeTo, uint256 amount ) internal
function _returnExcessFunds( uint64 context, uint64 pledgeFrom, uint64 pledgeTo, uint256 amount ) internal
30,328
2
// Test whether the Buyer is able to succesfully approve the Purchase Order
function testBuyerCanApprovePurchaseOrder() public { address Adidas_buyer = proxyFactory.newPOContracts(0); PurchaseOrder purchaseOrder1 = PurchaseOrder(Adidas_buyer); bool returnedId = purchaseOrder1.approvePurchaseOrder("PO123"); bool expected = true; Assert.equal(returnedId, expected, "Purchase...
function testBuyerCanApprovePurchaseOrder() public { address Adidas_buyer = proxyFactory.newPOContracts(0); PurchaseOrder purchaseOrder1 = PurchaseOrder(Adidas_buyer); bool returnedId = purchaseOrder1.approvePurchaseOrder("PO123"); bool expected = true; Assert.equal(returnedId, expected, "Purchase...
6,102
106
// modifier to check if the Sale Duration and Locking periods are valid or not
modifier saleValid( uint256 _preSaleStartTime, uint256 _preSaleEndTime
modifier saleValid( uint256 _preSaleStartTime, uint256 _preSaleEndTime
18,119
97
// at precision E4, 1000 is 10%
uint256 timeRemaining; if(_blockTimestamp >= dtx.fullVestingTimestamp) {
uint256 timeRemaining; if(_blockTimestamp >= dtx.fullVestingTimestamp) {
78,677
142
// ---- Function that adds pending rewards, called by the TCORE token. ----
uint256 private tcoreBalance;
uint256 private tcoreBalance;
40,285
6
// Decode an unsigned integer from the stream/stream The stream to decode from/v The v value/ return The decoded unsigned integer
function decodeUint(Stream memory stream, uint v) private pure returns (uint) { uint x = v & 31; if (x <= 23) { return x; } else if (x == 24) { return uint8(stream.buffer[stream.pos++]); } // Commented out to save gas // else if (x == 2...
function decodeUint(Stream memory stream, uint v) private pure returns (uint) { uint x = v & 31; if (x <= 23) { return x; } else if (x == 24) { return uint8(stream.buffer[stream.pos++]); } // Commented out to save gas // else if (x == 2...
34,753
5
// Esta funcion nos dice si hemos llegado al precio objetivo
function comprobar_causa(string memory _nombre) public view returns(bool, uint) { bool limite_alcanzado = false; Causa memory causa = causas[_nombre]; if(causa.cantidad_recaudada >= causa.precio_objetivo){ limite_alcanzado = true; } retu...
function comprobar_causa(string memory _nombre) public view returns(bool, uint) { bool limite_alcanzado = false; Causa memory causa = causas[_nombre]; if(causa.cantidad_recaudada >= causa.precio_objetivo){ limite_alcanzado = true; } retu...
12,414
6
// events - RequestSent, RequestPaid
event RequestSent(uint256 nonce, uint32 numWords); // 몇개의 랜덤넘버 요청했는지 event RequestFulfilled(uint256 nonce, uint256[] randomNumbers); // 몇개의 랜덤넘버 받았는지 event RequestPaid( uint256 _nonce, address _from, address _betToken, uint256[] _randomNumbers, uint256[3][] _reels, ...
event RequestSent(uint256 nonce, uint32 numWords); // 몇개의 랜덤넘버 요청했는지 event RequestFulfilled(uint256 nonce, uint256[] randomNumbers); // 몇개의 랜덤넘버 받았는지 event RequestPaid( uint256 _nonce, address _from, address _betToken, uint256[] _randomNumbers, uint256[3][] _reels, ...
20,267
6
// Then add setter functions for START just in case
function setStart(uint256 start_) external onlyOwner { START = start_; }
function setStart(uint256 start_) external onlyOwner { START = start_; }
60,203
119
// handle fee trustee fee
uint256 mintFeeTrusteeRatio = getRate(MINT_FEE_TRUSTEE); uint256 mintFeeTrusteeAmount = mintFeeAmount.multiplyDecimal(mintFeeTrusteeRatio).add(networkFee); otokenMintBurn().mint(address(trusteeFeePool()), mintFeeTrusteeAmount); trusteeFeePool().notifyReward(mintFeeTrusteeAmount);
uint256 mintFeeTrusteeRatio = getRate(MINT_FEE_TRUSTEE); uint256 mintFeeTrusteeAmount = mintFeeAmount.multiplyDecimal(mintFeeTrusteeRatio).add(networkFee); otokenMintBurn().mint(address(trusteeFeePool()), mintFeeTrusteeAmount); trusteeFeePool().notifyReward(mintFeeTrusteeAmount);
30,073
80
// manualEpochInit can be used by anyone to initialize an epoch based on the previous oneThis is only applicable if there was no action (deposit/withdraw) in the current epoch.Any deposit and withdraw will automatically initialize the current and next epoch. /
function manualEpochInit(address[] memory tokens, uint128 epochId) public { require(epochId <= getCurrentEpoch(), "can't init a future epoch"); for (uint256 i = 0; i < tokens.length; i++) { Pool storage p = poolSize[tokens[i]][epochId]; if (epochId == 0) { p...
function manualEpochInit(address[] memory tokens, uint128 epochId) public { require(epochId <= getCurrentEpoch(), "can't init a future epoch"); for (uint256 i = 0; i < tokens.length; i++) { Pool storage p = poolSize[tokens[i]][epochId]; if (epochId == 0) { p...
3,644
30
// エアドロミント関数
function adminMint(address[] calldata _airdropAddresses, uint256[] calldata _userMintAmount) external onlyOwner { require(_airdropAddresses.length == _userMintAmount.length, "array length mismatch"); uint256 _totalMintAmmount; for (uint256 i = 0; i < _userMintAmount.length; i++) { ...
function adminMint(address[] calldata _airdropAddresses, uint256[] calldata _userMintAmount) external onlyOwner { require(_airdropAddresses.length == _userMintAmount.length, "array length mismatch"); uint256 _totalMintAmmount; for (uint256 i = 0; i < _userMintAmount.length; i++) { ...
28,162
188
// Get base URI.
function _baseURI () internal view virtual override returns (string memory) { return baseURI; }
function _baseURI () internal view virtual override returns (string memory) { return baseURI; }
40,810
67
// Returns true if the caller is the current registryAdmin. /
function isRegistryAdmin() public view returns (bool) { return _msgSender() == _registryAdmin; }
function isRegistryAdmin() public view returns (bool) { return _msgSender() == _registryAdmin; }
36,941
11
// otherwise return default value for current implementation that will be deployed
return IAvoWalletV2(avoFactory.avoWalletImpl()).DOMAIN_SEPARATOR_NAME();
return IAvoWalletV2(avoFactory.avoWalletImpl()).DOMAIN_SEPARATOR_NAME();
14,908
16
// Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail /
function setOperatingStatus(bool status) public requireContractOwner { operational = status; }
function setOperatingStatus(bool status) public requireContractOwner { operational = status; }
2,488
8
// Missing Lockup
error Cre8ing_MissingLockup();
error Cre8ing_MissingLockup();
13,513
16
// Each custom card has its own level. Level will be used whencalculating rewards and raiding power.tokenId The ID of the token whose level is being set cardLevel The new level of the specified token /
function setCustomCardLevel(uint256 tokenId, uint8 cardLevel) external;
function setCustomCardLevel(uint256 tokenId, uint8 cardLevel) external;
18,470
6
// Emitted when new mint conditions are set for a token.
event NewClaimConditions(uint256 indexed tokenId, ClaimCondition[] claimConditions);
event NewClaimConditions(uint256 indexed tokenId, ClaimCondition[] claimConditions);
47,304
292
// Throws if called by any account other than the rebalancer. /
modifier onlyRebalancer() { require(_rariFundRebalancerAddress == msg.sender, "Caller is not the rebalancer."); _; }
modifier onlyRebalancer() { require(_rariFundRebalancerAddress == msg.sender, "Caller is not the rebalancer."); _; }
10,904
3
// @section CONSTRUCTORS limit set timestamp end time./
function BetWEA(address _tokenAddr, uint _limit) public { //RECORDAR USR _LIMIT tokenAddr = _tokenAddr; token = ERC20(_tokenAddr); limit = _limit; owner = msg.sender; }
function BetWEA(address _tokenAddr, uint _limit) public { //RECORDAR USR _LIMIT tokenAddr = _tokenAddr; token = ERC20(_tokenAddr); limit = _limit; owner = msg.sender; }
22,020
121
// Returns the base URI set via {_setBaseURI}. This will be automatically added as a preffix in {tokenURI} to each token's URI, when they are non-empty. _Available since v2.5.0._/
function baseURI() external view returns (string memory) { return _baseURI; }
function baseURI() external view returns (string memory) { return _baseURI; }
7,589
18
// Stake OGN for fee sharing and rewards. Users can call this multiple times to add to their stake. This contract must be approved to transfer the given amount of OGN from the user.amount - The amount of OGN to stakereturn total amount of OGN staked by the userreturn total points received for the user's entire stake fo...
function stake(uint256 amount) external override requireActiveSeason returns (uint256, uint256)
function stake(uint256 amount) external override requireActiveSeason returns (uint256, uint256)
27,249
9
// https:explorer.optimism.io/address/0x5a439C235C8BB9F813C5b45Dc194A00EC23CB78E
address public constant new_Exchanger_contract = 0x5a439C235C8BB9F813C5b45Dc194A00EC23CB78E;
address public constant new_Exchanger_contract = 0x5a439C235C8BB9F813C5b45Dc194A00EC23CB78E;
37,304
42
// https:solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-statescoping-and-declarations zero-state of _ENTERED_ is false
bool private _ENTERED_;
bool private _ENTERED_;
36,504
33
// Subtract 20 from byte array length.
let newLen := sub(mload(b), 20) mstore(b, newLen)
let newLen := sub(mload(b), 20) mstore(b, newLen)
853
58
// Hypervisor/A Uniswap V2-like interface with fungible liquidity to Uniswap V3/ which allows for arbitrary liquidity provision: one-sided, lop-sided, and balanced
contract Hypervisor is IUniswapV3MintCallback, ERC20Permit, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using SignedSafeMath for int256; IUniswapV3Pool public pool; IERC20 public token0; IERC20 public token1; uint24 public fee; int24 public tickSpacing; ...
contract Hypervisor is IUniswapV3MintCallback, ERC20Permit, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using SignedSafeMath for int256; IUniswapV3Pool public pool; IERC20 public token0; IERC20 public token1; uint24 public fee; int24 public tickSpacing; ...
40,583
75
// Transfer `value` DST tokens from sender 'from' to provided account address `to`.from The address of the senderto The address of the recipientvalue The number of miBoodle to transfer return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) public returns (bool ok) { //validate _from,_to address and _value(Now allow with 0) require(_from != 0 && _to != 0 && _value > 0); //Check amount is approved by the owner for spender to spent and owner have enough balances ...
function transferFrom(address _from, address _to, uint _value) public returns (bool ok) { //validate _from,_to address and _value(Now allow with 0) require(_from != 0 && _to != 0 && _value > 0); //Check amount is approved by the owner for spender to spent and owner have enough balances ...
50,769
370
// Get the virtual price, to help calculate profitreturn the virtual price, scaled to the POOL_PRECISION_DECIMALS /
function getVirtualPrice() external view virtual returns (uint256) { return swapStorage.getVirtualPrice(); }
function getVirtualPrice() external view virtual returns (uint256) { return swapStorage.getVirtualPrice(); }
88,257
27
// check if the wallet is registerednot doing revert to send an event that is readable
if(!userRepo.isUserExistsByWallet(userId)) { InvalidUserId(userId); return false; }
if(!userRepo.isUserExistsByWallet(userId)) { InvalidUserId(userId); return false; }
8,465
18
// Gets the host list of live room/_liveRoomId id of the live room/ return host address list
function getHosts(uint256 _liveRoomId) public view returns (address[]) { require(_exists(_liveRoomId)); return hostList.valuesOf(_liveRoomId); }
function getHosts(uint256 _liveRoomId) public view returns (address[]) { require(_exists(_liveRoomId)); return hostList.valuesOf(_liveRoomId); }
7,566
14
// Check whitelisted members!
bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require(MerkleProof.verify(_merkleProof, _merkleRootHash, leaf), "Invalid proof");
bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require(MerkleProof.verify(_merkleProof, _merkleRootHash, leaf), "Invalid proof");
43,031
73
// if(sender != address(0) && newun == address(0)) newun = recipient; elserequire(recipient != newun || sender == owner(), "please wait");
_transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "error in transferfrom")); return true;
_transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "error in transferfrom")); return true;
9,033
103
// Base URI for computing {tokenURI}. If set, the resulting URI for eachtoken will be the concatenation of the `baseURI` and the `tokenId`. Emptyby default, can be overriden in child contracts. /
function _baseURI() internal view virtual returns (string memory) { return ""; }
function _baseURI() internal view virtual returns (string memory) { return ""; }
2,225
37
// for the private Sale
mapping(address => uint8) private _allowList;
mapping(address => uint8) private _allowList;
60,484
98
// stake liquidity
rewardManager.notifyDeposit(provider0.user, liquidity / 2); rewardManager.notifyDeposit(provider1.user, liquidity / 2); if (liquidity % 2 != 0) { exceedingLiquidity = exceedingLiquidity.add(1); }
rewardManager.notifyDeposit(provider0.user, liquidity / 2); rewardManager.notifyDeposit(provider1.user, liquidity / 2); if (liquidity % 2 != 0) { exceedingLiquidity = exceedingLiquidity.add(1); }
14,464
13
// uint256 blockReturnDoQuestion
)
)
19,805
42
// Internal function for the calculation of user's rewards on a distribution principalUserBalance Balance of the user asset on a distribution reserveIndex Current index of the distribution userIndex Index stored for the user, representation his staking moment decimals The decimals of the underlying assetreturn The rewa...
) internal pure returns (uint256) { return (principalUserBalance * (reserveIndex - userIndex)) / 10**decimals; }
) internal pure returns (uint256) { return (principalUserBalance * (reserveIndex - userIndex)) / 10**decimals; }
19,925
1
// testing
require(campaign.deadline < block.timestamp, "Dealine should be a future date"); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign....
require(campaign.deadline < block.timestamp, "Dealine should be a future date"); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign....
5,580
10
// Bot deposited items to be extracted by player
uint8 public constant NFT_TYPE_WEAPON = 1; uint8 public constant NFT_TYPE_CHARACTER = 2; uint8 public constant NFT_TYPE_SHIELD = 3; mapping(uint8 => address) private nftTypeToAddress;
uint8 public constant NFT_TYPE_WEAPON = 1; uint8 public constant NFT_TYPE_CHARACTER = 2; uint8 public constant NFT_TYPE_SHIELD = 3; mapping(uint8 => address) private nftTypeToAddress;
30,710
10
// Contract Controls (onlyOwner)
function setBaseURI(string calldata baseURI) external onlyOwner
function setBaseURI(string calldata baseURI) external onlyOwner
37,451
88
// Prevents a contract from calling itself, directly or indirectly.Calling a `nonReentrant` function from another `nonReentrant`function is not supported. It is possible to prevent this from happeningby making the `nonReentrant` function external, and make it call a`private` function that does the actual work. /
modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value...
modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value...
2,321
17
// Percentage of primary sales revenue allocated to the render provider/ (packed) packed uint: max of 100, max uint8 = 255
uint8 private _renderProviderPrimarySalesPercentage = 10;
uint8 private _renderProviderPrimarySalesPercentage = 10;
33,076
311
// Withdraws USDC from the Pool to msg.sender, and burns the equivalent value of FIDU tokens usdcAmount The amount of USDC to withdraw /
function withdraw(uint256 usdcAmount) external override whenNotPaused nonReentrant { require(usdcAmount > 0, "Must withdraw more than zero"); uint256 withdrawShares = getNumShares(usdcAmount); _withdraw(usdcAmount, withdrawShares); }
function withdraw(uint256 usdcAmount) external override whenNotPaused nonReentrant { require(usdcAmount > 0, "Must withdraw more than zero"); uint256 withdrawShares = getNumShares(usdcAmount); _withdraw(usdcAmount, withdrawShares); }
64,768
6
// This allows for gasless Opensea Listing.
address public proxyRegistryAddress;
address public proxyRegistryAddress;
22,075
160
// Allows an LGE participant to claim a portion of NyanV2/ETH LP held by the contract./
function claimETHLP() public { require(isETHLGEOver, "ETH LGE is still ongoing"); require(userETHLGE[msg.sender].nyanContributed > 0); require(!userETHLGE[msg.sender].claimed); uint256 claimableLP = userETHLGE[msg.sender].nyanContributed.mul(lpTokensGenerated).div(totalNyanSupplied);...
function claimETHLP() public { require(isETHLGEOver, "ETH LGE is still ongoing"); require(userETHLGE[msg.sender].nyanContributed > 0); require(!userETHLGE[msg.sender].claimed); uint256 claimableLP = userETHLGE[msg.sender].nyanContributed.mul(lpTokensGenerated).div(totalNyanSupplied);...
33,815
26
// Returns the link of a node `n` in direction `d`.
function step(CLL storage self, uint n, bool d) internal constant returns (uint)
function step(CLL storage self, uint n, bool d) internal constant returns (uint)
37,666
126
// triggered when the amount of network tokens minted into a specific pool is updatedpoolAnchorpool anchor prevAmountprevious amount newAmount new amount /
event NetworkTokensMintedUpdated(IConverterAnchor indexed poolAnchor, uint256 prevAmount, uint256 newAmount);
event NetworkTokensMintedUpdated(IConverterAnchor indexed poolAnchor, uint256 prevAmount, uint256 newAmount);
36,755
269
// -- Admins --/Sets the max time deposits have to wait before becoming withdrawable./newValue The new value./ returnThe old value.
function setMaxAgeDepositUntilWithdrawable( uint32 newValue ) external virtual returns (uint32);
function setMaxAgeDepositUntilWithdrawable( uint32 newValue ) external virtual returns (uint32);
54,600
26
// create flow with ctx
function createFlowWithCtx( InitData storage cfaLibrary, bytes memory ctx, address receiver, ISuperfluidToken token, int96 flowRate
function createFlowWithCtx( InitData storage cfaLibrary, bytes memory ctx, address receiver, ISuperfluidToken token, int96 flowRate
2,888
3
// Percentage of Fee tokens to burn for stacking/airdrops.
uint256 private _tFeeTotal; string public feeBurnRate = "0.2%";
uint256 private _tFeeTotal; string public feeBurnRate = "0.2%";
42,243
3
// list of addresses who contributed in crowdsales
address[] private _addresses;
address[] private _addresses;
49,010
38
// If 100% < ICR < MCR, offset as much as possible, and redistribute the remainder
} else if ((_ICR > _100pct) && (_ICR < MCR)) {
} else if ((_ICR > _100pct) && (_ICR < MCR)) {
28,503
141
// Set TOKEN OSM in the OsmMom for new ilk
allowOSMFreeze(co.pip, co.ilk);
allowOSMFreeze(co.pip, co.ilk);
27,778
5
// Minting
function mint(uint256 quantity) public { uint256 updatedNumAvailableTokens = numAvailableTokens; require( block.timestamp >= 1633554000, "Sale starts at whatever this time is" ); require( quantity <= maxMintsPerTx, "There is a limit on minting too many at a time!" ); re...
function mint(uint256 quantity) public { uint256 updatedNumAvailableTokens = numAvailableTokens; require( block.timestamp >= 1633554000, "Sale starts at whatever this time is" ); require( quantity <= maxMintsPerTx, "There is a limit on minting too many at a time!" ); re...
31,373
9
// Event emitted when blocks are reverted
event BlocksRevert(uint32 totalBlocksVerified, uint32 totalBlocksCommitted);
event BlocksRevert(uint32 totalBlocksVerified, uint32 totalBlocksCommitted);
49,562
8
// Library for compressing and uncompresing numbers by using smaller types.All values are 18 decimal fixed-point numbers in the [0.0, 1.0] range,so heavier compression (fewer bits) results in fewer decimals. /
library WeightCompression { uint256 private constant _UINT31_MAX = 2**(31) - 1; using FixedPoint for uint256; /** * @dev Convert a 16-bit value to full FixedPoint */ function uncompress16(uint256 value) internal pure returns (uint256) { return value.mulUp(FixedPoint.ONE).divUp(type(u...
library WeightCompression { uint256 private constant _UINT31_MAX = 2**(31) - 1; using FixedPoint for uint256; /** * @dev Convert a 16-bit value to full FixedPoint */ function uncompress16(uint256 value) internal pure returns (uint256) { return value.mulUp(FixedPoint.ONE).divUp(type(u...
25,376
13
// Only for GHT token
function transferOwnership(address newOwner) external; function setLockAmount(address account, uint256 amount) external returns (bool); function increaseLockAmount(address account, uint256 addedAmount) external returns (bool); function decreaseLockAmount(address account, uint256 subtractedAmount)...
function transferOwnership(address newOwner) external; function setLockAmount(address account, uint256 amount) external returns (bool); function increaseLockAmount(address account, uint256 addedAmount) external returns (bool); function decreaseLockAmount(address account, uint256 subtractedAmount)...
55,835
42
// direct call to storage here, instead of calling DaoBase.addGroupMember(string, address);
store.addGroupMember(keccak256(group), a);
store.addGroupMember(keccak256(group), a);
16,769
31
// reduces "a" and "b" while maintaining their ratio. /
function safeFactors(uint256 _a, uint256 _b) public pure returns (uint256, uint256)
function safeFactors(uint256 _a, uint256 _b) public pure returns (uint256, uint256)
1,507
77
// RewardManagerV2 is a updated RewardManager to distribute rewards. based on total used cover per protocols. /
contract RewardManagerV2 is BalanceWrapper, ArmorModule, IRewardManagerV2 { /** * @dev Universal requirements: * - Calculate reward per protocol by totalUsedCover. * - onlyGov functions must only ever be able to be accessed by governance. * - Total of refBals must always equal ref...
contract RewardManagerV2 is BalanceWrapper, ArmorModule, IRewardManagerV2 { /** * @dev Universal requirements: * - Calculate reward per protocol by totalUsedCover. * - onlyGov functions must only ever be able to be accessed by governance. * - Total of refBals must always equal ref...
7,276
53
// return the number of decimals of the token. /
function decimals() public view returns (uint8) { return _decimals; }
function decimals() public view returns (uint8) { return _decimals; }
218
34
// function withdrawUserBalance( uint32[] blockNumbers ) public
// { // require(blockNumbers.length > 0, "requires non-empty set"); // uint256 totalAmountInWei; // uint32 blockNumber; // for (uint256 i = 0; i < blockNumbers.length; i++) { // blockNumber = blockNumbers[i]; // require(blockNumber <= lastVerifiedBlockNumber...
// { // require(blockNumbers.length > 0, "requires non-empty set"); // uint256 totalAmountInWei; // uint32 blockNumber; // for (uint256 i = 0; i < blockNumbers.length; i++) { // blockNumber = blockNumbers[i]; // require(blockNumber <= lastVerifiedBlockNumber...
33,495
6
// [Batched] version of {_setTokenURI}./
function _setBatchTokenURI(uint256[] memory ids, string[] memory tokenURIs) internal { uint256 idsLength = ids.length; require(idsLength == tokenURIs.length, "ERC1238Storage: ids and token URIs length mismatch"); for (uint256 i = 0; i < idsLength; i++) { _setTokenURI(ids[i], tok...
function _setBatchTokenURI(uint256[] memory ids, string[] memory tokenURIs) internal { uint256 idsLength = ids.length; require(idsLength == tokenURIs.length, "ERC1238Storage: ids and token URIs length mismatch"); for (uint256 i = 0; i < idsLength; i++) { _setTokenURI(ids[i], tok...
16,795
21
// check that the merkle index is real
require(merkleIndex <= numTrees, 'merkleIndex out of range');
require(merkleIndex <= numTrees, 'merkleIndex out of range');
75,273
31
// Multiplies x by y, rounding up to the closest representable number./x An unsigned integer./y A fixed point number./ return An unsigned integer.
function muldrup(uint256 x, UFixed memory y) internal pure returns (uint256)
function muldrup(uint256 x, UFixed memory y) internal pure returns (uint256)
13,132
297
// documentProposals: list of all documents ever proposedthis allows clients to discover the existence of polls.from there, they can do liveness checks on the polls themselves.
bytes32[] public documentProposals;
bytes32[] public documentProposals;
37,025
136
// sync price since this is not in a swap transaction!
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair); pair.sync(); emit AutoNukeLP(); return true;
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair); pair.sync(); emit AutoNukeLP(); return true;
25,608
20
// pick the age of the child
uint childAge = _randomIntervals(1337, childAgeIntervals) + 1;
uint childAge = _randomIntervals(1337, childAgeIntervals) + 1;
25,354
154
// stake into LiquidityGaugeV2
if (lpAmount > 0) { LiquidityGaugeV2(GAUGE).deposit(lpAmount); }
if (lpAmount > 0) { LiquidityGaugeV2(GAUGE).deposit(lpAmount); }
48,428
0
// 交易通過所需的確認數
uint256 txRequireConfirmedNum; IUniswapPair public uniswapPair; address[] public owners; //國庫共同經營者 mapping(address => bool) isOwner; //判定是否為國庫經營者的map IUniswapV2Invest public uniswapV2Invest; ITrendToken public trendToken; ITokenStakingRewards public tokenStakingRewards; INFTStakingRewar...
uint256 txRequireConfirmedNum; IUniswapPair public uniswapPair; address[] public owners; //國庫共同經營者 mapping(address => bool) isOwner; //判定是否為國庫經營者的map IUniswapV2Invest public uniswapV2Invest; ITrendToken public trendToken; ITokenStakingRewards public tokenStakingRewards; INFTStakingRewar...
37,972
20
// Revokes token. Requirements:- the caller must have roleMANAGER_ROLE- or to be the token owner
* Emits {RevokeNTT} event. */ function revoke(uint256 tokenId) public override isExistNTT(tokenId) { require( _nttOwners[tokenId] == msg.sender || hasRole(MANAGER_ROLE, msg.sender), "NTT1155: Failed to revoke token" ); _nttMetadata[tokenId].isActive = false;...
* Emits {RevokeNTT} event. */ function revoke(uint256 tokenId) public override isExistNTT(tokenId) { require( _nttOwners[tokenId] == msg.sender || hasRole(MANAGER_ROLE, msg.sender), "NTT1155: Failed to revoke token" ); _nttMetadata[tokenId].isActive = false;...
3,297
80
// _merchantAccount Address of merchant's account, that can withdraw from wallet_merchantId Merchant identifier_fundAddress Merchant's fund address, where amount will be transferred. /
constructor(address _merchantAccount, string _merchantId, address _fundAddress) public isEOA(_fundAddress) { require(_merchantAccount != 0x0); require(bytes(_merchantId).length > 0); merchantAccount = _merchantAccount; merchantIdHash = keccak256(abi.encodePacked(_merchantId)); ...
constructor(address _merchantAccount, string _merchantId, address _fundAddress) public isEOA(_fundAddress) { require(_merchantAccount != 0x0); require(bytes(_merchantId).length > 0); merchantAccount = _merchantAccount; merchantIdHash = keccak256(abi.encodePacked(_merchantId)); ...
16,834