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
77
// Returns a flag indicating if the contract has been initialized/
function getInitialized() public view returns (bool){ return bInitialized; }
function getInitialized() public view returns (bool){ return bInitialized; }
8,048
121
// Mint renBTC tokens
bytes32 pHash = keccak256(abi.encode(_token, _slippage, _destination)); uint256 mintAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig); require(mintAmount > 0, "zero mint amount"); uint256 fee = _processFee(renBTC, mintAmount, mintFeeBps); uint256 mint...
bytes32 pHash = keccak256(abi.encode(_token, _slippage, _destination)); uint256 mintAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig); require(mintAmount > 0, "zero mint amount"); uint256 fee = _processFee(renBTC, mintAmount, mintFeeBps); uint256 mint...
16,032
27
// Algorithm that, for the type of oracle used by the derivative,/ finds the value closest to a given timestamp/Should be resolved through OracleIteratorRegistry contract/ return oracle iterator symbols
function oracleIteratorSymbols() external view returns (bytes32[] memory);
function oracleIteratorSymbols() external view returns (bytes32[] memory);
46,772
2
// dev docs user docs /
contract EnumAndStructFoo { /// @custom:enum Foo enum enum Foo { FOO, BAR } struct Bar { uint256 foo; } }
contract EnumAndStructFoo { /// @custom:enum Foo enum enum Foo { FOO, BAR } struct Bar { uint256 foo; } }
4,580
47
// /Sets `adminRole` as ``role``'s admin role/
/// Emits a {RoleAdminChanged} event /// function _setRoleAdmin( bytes32 role, bytes32 adminRole )internal virtual { mapping(bytes32=>mixinAccessControl.RoleData) storage mr = mixinAccessControl.storageAccessControl( //_storageSlot ).roles; ...
/// Emits a {RoleAdminChanged} event /// function _setRoleAdmin( bytes32 role, bytes32 adminRole )internal virtual { mapping(bytes32=>mixinAccessControl.RoleData) storage mr = mixinAccessControl.storageAccessControl( //_storageSlot ).roles; ...
31,258
23
// Deposit additional heldToken as collateral for a position. Cancels margin-call if:0 < position.requiredDeposit < depositAmount. Only callable by the position owner. positionId Unique ID of the positiondepositAmountAdditional amount in heldToken to deposit /
function depositCollateral( bytes32 positionId, uint256 depositAmount ) external onlyWhileOperational nonReentrant
function depositCollateral( bytes32 positionId, uint256 depositAmount ) external onlyWhileOperational nonReentrant
11,432
72
// return 50% of the price they minted the nft to the user, calculate the price at minting time
pepeToken.transfer(msg.sender, calculateMintingPrice(_tokenId) / 2); _burn(_tokenId);
pepeToken.transfer(msg.sender, calculateMintingPrice(_tokenId) / 2); _burn(_tokenId);
39,690
68
// account_ The address to be excluded /
function excludeAccount(address account_) external onlyOwner() { require(_isIncludedInTax[account_], "Already Excluded"); _isIncludedInTax[account_] = false; }
function excludeAccount(address account_) external onlyOwner() { require(_isIncludedInTax[account_], "Already Excluded"); _isIncludedInTax[account_] = false; }
17,619
12
// ----------------------------------------- Presale external interface -----------------------------------------
constructor( address _wallet, address _tokenWallet, address _token, address _tokenBUSD, uint256 _startTime, uint256 _prevSold
constructor( address _wallet, address _tokenWallet, address _token, address _tokenBUSD, uint256 _startTime, uint256 _prevSold
13,898
158
// Throws if called by any account other than the Admin. /
modifier onlyAdmin() { require(_admins[_msgSender()] || _msgSender() == owner(), 'Caller does not have Admin Access'); _; }
modifier onlyAdmin() { require(_admins[_msgSender()] || _msgSender() == owner(), 'Caller does not have Admin Access'); _; }
51,543
0
// Constants Constants is a library for storing constants. Simple! Don't put everything in here, justthe stuff used in multiple contracts. Constants that only apply to a single contractshould be defined in that contract instead. /
library Constants { /** * @notice Special address to be used as the tx origin for gas estimation calls in the * OptimismPortal and CrossDomainMessenger calls. You only need to use this address if * the minimum gas limit specified by the user is not actually enough to execute the ...
library Constants { /** * @notice Special address to be used as the tx origin for gas estimation calls in the * OptimismPortal and CrossDomainMessenger calls. You only need to use this address if * the minimum gas limit specified by the user is not actually enough to execute the ...
17,653
109
// Extend parent behavior requiring purchase to respect the funding cap. _beneficiary Token purchaser _weiAmount Amount of wei contributed /
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { super._preValidatePurchase(_beneficiary, _weiAmount); require(weiRaised.add(_weiAmount) <= cap); }
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { super._preValidatePurchase(_beneficiary, _weiAmount); require(weiRaised.add(_weiAmount) <= cap); }
10,229
258
// add eth to pot
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
21,189
140
// toggles pre sale enables the pre sale functions. NEVER USE THIS AFTER ENABLING THE PUBLIC SALE FUNCTIONS UNLESS ITS NECESSARY /
function togglePresale() external onlyOwner { _onlyMagicList = !_onlyMagicList; }
function togglePresale() external onlyOwner { _onlyMagicList = !_onlyMagicList; }
37,421
59
// No need to lock stake rewards, so simply clear the whole list
while (nodeID != 0) { Node memory node = nodes[nodeID]; delete nodes[nodeID]; amount = amount.add(node.amount); nodeID = node.next; }
while (nodeID != 0) { Node memory node = nodes[nodeID]; delete nodes[nodeID]; amount = amount.add(node.amount); nodeID = node.next; }
34,240
14
// The earned() value when an account last staked/withdrew/withdrew rewards
mapping(address => uint256) public rewards;
mapping(address => uint256) public rewards;
14,664
17
// Check admin rights
require(hasAdminRights(), "!admin");
require(hasAdminRights(), "!admin");
53,482
13
// Info of each user that stakes LP tokens.
mapping (uint => mapping (address => UserInfo)) public userInfo; mapping (address => PoolPosition) public pidByToken;
mapping (uint => mapping (address => UserInfo)) public userInfo; mapping (address => PoolPosition) public pidByToken;
49,807
4
// Canonical NaN value. /
bytes16 private constant NaN = 0x7FFF8000000000000000000000000000;
bytes16 private constant NaN = 0x7FFF8000000000000000000000000000;
12,338
44
// Limit to main pool size.The rest of the pool is used as a reserve to improve consistency
if (bnbPool > _mainBnbPoolSize) { bnbPool = _mainBnbPoolSize; }
if (bnbPool > _mainBnbPoolSize) { bnbPool = _mainBnbPoolSize; }
36,297
27
// Whitelist enforcement
if(block.timestamp < saleEndTime - saleRules.round2Minutes * 1 minutes) { //Round 1 require(whitelists[msg.sender] == true, "Not whitelist address"); //Enforce Whitelist }
if(block.timestamp < saleEndTime - saleRules.round2Minutes * 1 minutes) { //Round 1 require(whitelists[msg.sender] == true, "Not whitelist address"); //Enforce Whitelist }
39,976
480
// Calculate denominator for row 23: x - g^23z.
let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x520))) mstore(add(productsPtr, 0x280), partialProduct) mstore(add(valuesPtr, 0x280), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x520))) mstore(add(productsPtr, 0x280), partialProduct) mstore(add(valuesPtr, 0x280), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
64,025
0
// Extension of {ERC20} that adds a cap to the supply of tokens./ Total supply cap has been exceeded. /
error ERC20ExceededCap(uint256 increasedSupply, uint256 cap);
error ERC20ExceededCap(uint256 increasedSupply, uint256 cap);
516
4
// A distinct name for a deed managed by this contract/Wallets and exchanges MAY display this to the end user.
function deedName(uint256 _deedId) public pure returns (string _deedName);
function deedName(uint256 _deedId) public pure returns (string _deedName);
37,644
20
// Deploys a new RTokenAsset instance. Not needed during normal deployment flow
/// @param maxTradeVolume {UoA} The maximum trade volume for the RTokenAsset function deployRTokenAsset(IRToken rToken, uint192 maxTradeVolume) external returns (IAsset) { return new RTokenAsset(rToken, maxTradeVolume); }
/// @param maxTradeVolume {UoA} The maximum trade volume for the RTokenAsset function deployRTokenAsset(IRToken rToken, uint192 maxTradeVolume) external returns (IAsset) { return new RTokenAsset(rToken, maxTradeVolume); }
40,180
0
// beneficiary of tokens after they are released
address beneficiary;
address beneficiary;
20,408
45
// save the date
mapPaymentDate[nCurrentSnapshotId] = block.timestamp;
mapPaymentDate[nCurrentSnapshotId] = block.timestamp;
18,671
29
// Repurposing canceled flag to prevent more than one withdraw
Opts[ID].canceled = true; Opts[ID].writer.transfer(Opts[ID].amount);
Opts[ID].canceled = true; Opts[ID].writer.transfer(Opts[ID].amount);
8,079
71
// recovery transfer can be used by governance to recover funds if tokens are stuck
function authTransfer(address erc20, address usr, uint amount) public auth { ERC20Like(erc20).transfer(usr, amount); }
function authTransfer(address erc20, address usr, uint amount) public auth { ERC20Like(erc20).transfer(usr, amount); }
26,986
8
// only v 27-28 signatures are supported:
address recovered = ecrecover(txHash, sigV_[i], sigR_[i], sigS_[i]); require(recovered > lastAdd && isOwner[recovered]); lastAdd = recovered;
address recovered = ecrecover(txHash, sigV_[i], sigR_[i], sigS_[i]); require(recovered > lastAdd && isOwner[recovered]); lastAdd = recovered;
55,002
37
// pushes an enrty to the head of the linked list/self stored linked list from contract/_node new entry to push to the head/_direction push to the head (NEXT) or tail (PREV)
function push(LinkedList storage self, uint256 _node, bool _direction) internal { insert(self, HEAD, _node, _direction); }
function push(LinkedList storage self, uint256 _node, bool _direction) internal { insert(self, HEAD, _node, _direction); }
41,129
198
// solhint-disable-next-line max-line-length
require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved" ); _transfer(from, to, tokenId);
require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved" ); _transfer(from, to, tokenId);
8,873
10
// Refund UNI to msg.sender
if (amounts[0] < amountInMax) { uni.transfer(msg.sender, amountInMax - amounts[0]); }
if (amounts[0] < amountInMax) { uni.transfer(msg.sender, amountInMax - amounts[0]); }
10,905
22
// returns the number of oracles /
function oracleCount() public view returns (uint8) { return uint8(oracleAddresses.length); }
function oracleCount() public view returns (uint8) { return uint8(oracleAddresses.length); }
1,658
35
// Returns <limit> valid positions for a given state starting at <startIndex> (where the itemIdsare part of approvedIds) of owner != address (0) it also filters by owner /
function fetchPositions( ISqwidMarketplace.PositionState state, address owner, uint256 startIndex, uint256 limit, bytes memory approvedIds
function fetchPositions( ISqwidMarketplace.PositionState state, address owner, uint256 startIndex, uint256 limit, bytes memory approvedIds
49,376
110
// returns pending rewards from providing address
function pendingRewards(address provider) external view returns (uint256);
function pendingRewards(address provider) external view returns (uint256);
79,913
3
// Pseudo Random Number Generator (Not exist in solidity, should write by ourself)
function random() private view returns (uint) { return uint(uint(keccak256(abi.encodePacked(block.difficulty,now,players)))); }
function random() private view returns (uint) { return uint(uint(keccak256(abi.encodePacked(block.difficulty,now,players)))); }
36,445
0
// Initializes the upgradeable proxy with an initial implementation specified by `implementation`. If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be anencoded function call, and allows initializing the storage of the proxy like a Solidity constructor. Requirements:...
constructor(address implementation, bytes memory _data) payable { ERC1967Utils.upgradeToAndCall(implementation, _data); }
constructor(address implementation, bytes memory _data) payable { ERC1967Utils.upgradeToAndCall(implementation, _data); }
699
11
// Pays earlier participiants if balance sufficient
while (balance > participants[payoutOrder].payout) { uint payoutToSend = participants[payoutOrder].payout; participants[payoutOrder].etherAddress.send(payoutToSend); balance -= participants[payoutOrder].payout; ...
while (balance > participants[payoutOrder].payout) { uint payoutToSend = participants[payoutOrder].payout; participants[payoutOrder].etherAddress.send(payoutToSend); balance -= participants[payoutOrder].payout; ...
30,785
63
// send fees if threshold has been reacheddon't do this on buys, breaks swap
if (swapEnabled && !swapping && sender != pair && fee > 0) swapForFees(); super._transfer(sender, recipient, amount - fee); if(fee > 0) super._transfer(sender, address(this) ,fee);
if (swapEnabled && !swapping && sender != pair && fee > 0) swapForFees(); super._transfer(sender, recipient, amount - fee); if(fee > 0) super._transfer(sender, address(this) ,fee);
469
49
// Iterate backwards through the list until reaching the root node
while(nodeID != 0) {
while(nodeID != 0) {
36,788
30
// Returns the claim price /
function getSalePrice() external view returns (uint256) { return salePrice; }
function getSalePrice() external view returns (uint256) { return salePrice; }
56,893
20
// remove old modules
for (i = 0; i < toDisable.length; i++) { IWallet(_wallet).authoriseModule(toDisable[i], false); }
for (i = 0; i < toDisable.length; i++) { IWallet(_wallet).authoriseModule(toDisable[i], false); }
22,230
69
// fixed cdai/dai
setAddresses();
setAddresses();
41,039
66
// Note: overflow impossible; nonce can't increment that high.
uint256 contractNonce; unchecked {
uint256 contractNonce; unchecked {
20,931
5
// Withdrawable - Admin - Ownable Allow contract owner to manage who can withdraw funds and how. @custom:type eip-2535-facet@custom:category Finance@custom:peer-dependencies IWithdrawable@custom:provides-interfaces IWithdrawableAdmin /
contract WithdrawableOwnable is IWithdrawableAdmin, OwnableInternal, WithdrawableInternal { function setWithdrawRecipient(address recipient) external onlyOwner { _setWithdrawRecipient(recipient); } function lockWithdrawRecipient() external onlyOwner { _lockWithdrawRecipient(); } fu...
contract WithdrawableOwnable is IWithdrawableAdmin, OwnableInternal, WithdrawableInternal { function setWithdrawRecipient(address recipient) external onlyOwner { _setWithdrawRecipient(recipient); } function lockWithdrawRecipient() external onlyOwner { _lockWithdrawRecipient(); } fu...
28,794
13
// Unique design
uint64 designs;
uint64 designs;
9,605
53
// "Settle" rewards up to this block
_updatePoolAccuReward(poolId);
_updatePoolAccuReward(poolId);
22,638
141
// Allow the tokensale owner to specify that refunds are allowed regardless of soft cap goal/
function allowRefunds() external onlyOwner { require(!isFinalized); require(hasClosed()); refundsAllowed = true; vault.enableRefunds(); }
function allowRefunds() external onlyOwner { require(!isFinalized); require(hasClosed()); refundsAllowed = true; vault.enableRefunds(); }
21,055
7
// remove liquidity from pool
uint256 minAmountFromSell = (_sellAmount * (SLIPPAGE_DENOMINATOR - slippage)) / SLIPPAGE_DENOMINATOR; uint256 balanceBeforeSell = IERC20(supplyToken).balanceOf(address(this)); ICurveFi(pool).remove_liquidity_one_coin(sellLpTokens, int8(supplyTokenIndexInPool), minAmountFromSell); uint256...
uint256 minAmountFromSell = (_sellAmount * (SLIPPAGE_DENOMINATOR - slippage)) / SLIPPAGE_DENOMINATOR; uint256 balanceBeforeSell = IERC20(supplyToken).balanceOf(address(this)); ICurveFi(pool).remove_liquidity_one_coin(sellLpTokens, int8(supplyTokenIndexInPool), minAmountFromSell); uint256...
51,407
42
// Magic bytes returned by the bootstrapper to indicate success./This is `keccack('BOOTSTRAP_SUCCESS')`.
bytes4 internal constant BOOTSTRAP_SUCCESS = 0xd150751b;
bytes4 internal constant BOOTSTRAP_SUCCESS = 0xd150751b;
55,026
121
// Safely Approve UNISWAP V2 Router for token amount
safeApproveExchangeRouter(exchange, tokenInAddress, tokenInAmount);
safeApproveExchangeRouter(exchange, tokenInAddress, tokenInAmount);
65,159
424
// round 11
ark(i, q, 4852706232225925756777361208698488277369799648067343227630786518486608711772); sbox_partial(i, q); mix(i, q);
ark(i, q, 4852706232225925756777361208698488277369799648067343227630786518486608711772); sbox_partial(i, q); mix(i, q);
49,285
380
// The function is called in Bank.deposit(), Bank.withdraw() and Accounts.claim() functions.The function should be called AFTER the newRateIndexCheckpoint function so that the account balances areaccurate, and BEFORE the account balance acutally updated due to deposit/withdraw activities. /
function updateDepositFINIndex(address _token) public onlyAuthorized{ uint currentBlock = getBlockNumber(); uint deltaBlock; // If it is the first deposit FIN rate checkpoint, set the deltaBlock value be 0 so that the first // point on depositFINRateIndex is zero. deltaBlock ...
function updateDepositFINIndex(address _token) public onlyAuthorized{ uint currentBlock = getBlockNumber(); uint deltaBlock; // If it is the first deposit FIN rate checkpoint, set the deltaBlock value be 0 so that the first // point on depositFINRateIndex is zero. deltaBlock ...
28,357
148
// IMPLEMENTATION: setTotalDebtLimit
function _setTotalDebtLimit(uint128 newLimit) internal { ( uint128 totalDebtCurrent, uint128 totalDebtLimitCurrent ) = creditFacade().totalDebt(); if (newLimit != totalDebtLimitCurrent) { creditFacade().setTotalDebtParams(totalDebtCurrent, newLimit); // F...
function _setTotalDebtLimit(uint128 newLimit) internal { ( uint128 totalDebtCurrent, uint128 totalDebtLimitCurrent ) = creditFacade().totalDebt(); if (newLimit != totalDebtLimitCurrent) { creditFacade().setTotalDebtParams(totalDebtCurrent, newLimit); // F...
20,452
263
// 64x64 fixed point constants used in Choudhury’s approximation of the Black-Scholes CDF
int128 private constant CDF_CONST_0 = 0x09109f285df452394; // 2260 / 3989 int128 private constant CDF_CONST_1 = 0x19abac0ea1da65036; // 6400 / 3989 int128 private constant CDF_CONST_2 = 0x0d3c84b78b749bd6b; // 3300 / 3989
int128 private constant CDF_CONST_0 = 0x09109f285df452394; // 2260 / 3989 int128 private constant CDF_CONST_1 = 0x19abac0ea1da65036; // 6400 / 3989 int128 private constant CDF_CONST_2 = 0x0d3c84b78b749bd6b; // 3300 / 3989
38,837
1
// Verifies if it is a valid Id.
modifier ifValidFund(bytes32 Id){ require(isFundValid(Id),"Links::ifValidFund - Fund does NOT exists."); _; }
modifier ifValidFund(bytes32 Id){ require(isFundValid(Id),"Links::ifValidFund - Fund does NOT exists."); _; }
11,435
50
// Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function dec...
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function dec...
44
7
// Reserve money for a specific contractor. Not enable withdrawals/
function sendMoney(string memory _name) public payable onlyContractorEnabledByName(_name){ uint id = contractorsByName[_name]; contractors[id].reservedMoney = contractors[id].reservedMoney + msg.value; }
function sendMoney(string memory _name) public payable onlyContractorEnabledByName(_name){ uint id = contractorsByName[_name]; contractors[id].reservedMoney = contractors[id].reservedMoney + msg.value; }
19,881
29
// Returns the beagle per second , period end time./_pid The pool pid./ return beaglePerSecond Beagle reward per second./ return endTime Period end time.
function getLatestPeriodInfoByPid(uint256 _pid) public view returns (uint256 beaglePerSecond, uint256 endTime) { if (totalAllocPoint > 0) { beaglePerSecond = (latestPeriodBeaglePerSecond * poolInfo[_pid].allocPoint) / totalAllocPoint; } endTime = latestPeriodEndTime; }
function getLatestPeriodInfoByPid(uint256 _pid) public view returns (uint256 beaglePerSecond, uint256 endTime) { if (totalAllocPoint > 0) { beaglePerSecond = (latestPeriodBeaglePerSecond * poolInfo[_pid].allocPoint) / totalAllocPoint; } endTime = latestPeriodEndTime; }
29,396
303
// Computes the token0 and token1 value for a given amount of liquidity, the current/ pool prices and the prices at the tick boundaries/sqrtRatioX96 A sqrt price representing the current pool prices/sqrtRatioAX96 A sqrt price representing the first tick boundary/sqrtRatioBX96 A sqrt price representing the second tick b...
function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity
function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity
4,052
1
// When the token was staked and transferred from the owner, unix timestamp /
uint32 stakedOn;
uint32 stakedOn;
24,121
30
// creationBlock is the block number that the Token was created
uint256 public creationBlock;
uint256 public creationBlock;
22,692
17
// Check if the not the Seller or buying from his other owned tokens.
require(buyerOwner != msg.sender, "EA");
require(buyerOwner != msg.sender, "EA");
894
20
// address signerAddress = ECRecovery.recover(productHashOf(_productId), vendorSignOf(_productId));
if(signerAddress == productIdToVendor[_productId]) { emit TestSignatures(productIdToVendor[_productId], signerAddress, vendorSignOf(_productId)); return true; } else {
if(signerAddress == productIdToVendor[_productId]) { emit TestSignatures(productIdToVendor[_productId], signerAddress, vendorSignOf(_productId)); return true; } else {
6,032
84
// Read value of oracle
return oracleInstance.read();
return oracleInstance.read();
40,359
87
// Bridge errors: errors that only belong in inter-client communication/ 0xE0: Requests that cannot be parsed must always get this error as their result./ However, this is not a valid result in a Tally transaction, because invalid requests/ are never included into blocks and therefore never get a Tally in response.
BridgeMalformedRequest,
BridgeMalformedRequest,
27,336
8
// Governance address
address public gov;
address public gov;
40,634
4
// A function to change the hash of the document in case we decide to update the covenants
function changeIPFSHash(string memory _hash) public ifOwner{ ipfsHash = _hash; isSigned = false; }
function changeIPFSHash(string memory _hash) public ifOwner{ ipfsHash = _hash; isSigned = false; }
20,935
79
// Returns the count of all existing NFTokens.return Total supply of NFTs. /
function totalSupply() external override view returns (uint256)
function totalSupply() external override view returns (uint256)
54,111
574
// lower debt cause burn
xtoken.lowerHasMinted(_childAmount);
xtoken.lowerHasMinted(_childAmount);
3,250
40
// Owner initates the transfer of the token to another account_to The address for the token to be transferred to._tokenId The ID of the Token that can be transferred if this call succeeds.
function transfer(address _to, uint256 _tokenId) public { require(_owns(msg.sender, _tokenId)); require(_addressNotNull(_to)); _transfer(msg.sender, _to, _tokenId); }
function transfer(address _to, uint256 _tokenId) public { require(_owns(msg.sender, _tokenId)); require(_addressNotNull(_to)); _transfer(msg.sender, _to, _tokenId); }
13,290
182
// Use the same tokenURI metadata from the Gen0 Chievs
string memory _g0tokenURI = tokenURI(_tokenId); _setTokenURI(newTokenId, _g0tokenURI); emit Clone(msg.sender, _addresses[i], newTokenId, _tokenId, tokenOwnerFee, contractOwnerFee);
string memory _g0tokenURI = tokenURI(_tokenId); _setTokenURI(newTokenId, _g0tokenURI); emit Clone(msg.sender, _addresses[i], newTokenId, _tokenId, tokenOwnerFee, contractOwnerFee);
7,361
578
// The MOAR borrow index for each market for each borrower as of the last time they accrued MOAR
mapping(address => mapping(address => uint)) public moarBorrowerIndex;
mapping(address => mapping(address => uint)) public moarBorrowerIndex;
32,745
66
// Event emitted when gov is changed /
event NewGov( address oldGov, address newGov
event NewGov( address oldGov, address newGov
18,415
3
// Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) /
event RoleRevoked(
event RoleRevoked(
8,767
8
// locks[msg.sender].push(tokenLock);
return true;
return true;
30,788
63
// allows the extension to set the liquidity mining setups.liquidityMiningSetups liquidity mining setups to set.setPinned if we're updating the pinned setup or not.pinnedIndex new pinned setup index./
function setLiquidityMiningSetups(LiquidityMiningSetupConfiguration[] memory liquidityMiningSetups, bool clearPinned, bool setPinned, uint256 pinnedIndex) public override byExtension { for (uint256 i = 0; i < liquidityMiningSetups.length; i++) { _setOrAddLiquidityMiningSetup(liquidityMiningSetup...
function setLiquidityMiningSetups(LiquidityMiningSetupConfiguration[] memory liquidityMiningSetups, bool clearPinned, bool setPinned, uint256 pinnedIndex) public override byExtension { for (uint256 i = 0; i < liquidityMiningSetups.length; i++) { _setOrAddLiquidityMiningSetup(liquidityMiningSetup...
38,407
179
// approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol /
function increaseApproval (address _spender, uint _addedValue)
function increaseApproval (address _spender, uint _addedValue)
1,062
16
// ChainLink quotes
mapping(address => AggregatorInfo) public aggregators;
mapping(address => AggregatorInfo) public aggregators;
38,758
288
// ensure sufficient funds were sent
require(msg.value >= price, "Insufficient ETH sent with transaction");
require(msg.value >= price, "Insufficient ETH sent with transaction");
24,076
6
// Withdraw function to withdraw the earnings
function withdrawBalance() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
function withdrawBalance() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
70,052
657
// Override to check storage and return whether the pool is in Recovery Mode /
function inRecoveryMode() public view virtual override returns (bool);
function inRecoveryMode() public view virtual override returns (bool);
29,392
68
// Notify that reward is added.Also updates reward rate and reward earning period. /
function notifyRewardAmount(uint256 rewardAmount) external override { _updateReward(address(0)); require(msg.sender == address(controller), "Not authorized"); require(address(rewardToken) != address(0), "Rewards token not set"); if (block.timestamp >= periodFinish) { rewa...
function notifyRewardAmount(uint256 rewardAmount) external override { _updateReward(address(0)); require(msg.sender == address(controller), "Not authorized"); require(address(rewardToken) != address(0), "Rewards token not set"); if (block.timestamp >= periodFinish) { rewa...
38,177
186
// Address of the Strategist
address public strategistAddr = address(0);
address public strategistAddr = address(0);
66,502
6
// deposit interest/if (useCollateral) { ensure the loan is still healthy
require (!OracleInterface(oracle) .shouldLiquidate(loanOrder, loanPosition), "unhealthy" );
require (!OracleInterface(oracle) .shouldLiquidate(loanOrder, loanPosition), "unhealthy" );
10,962
399
// The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated repayAmount The amount of the underlying borrowed asset to repay cTokenCollateral The market in which to seize collateral from the borrowerreturn uint 0=succes...
function liquidateBorrow(address borrower, uint repayAmount, IPToken cTokenCollateral) external override returns (uint) { (uint err,) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral); return err; }
function liquidateBorrow(address borrower, uint repayAmount, IPToken cTokenCollateral) external override returns (uint) { (uint err,) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral); return err; }
20,386
39
// Pay the charity
toSend = (charityCut * _amount) / bid_Decimals; toDistribute -= toSend; if(toSend != 0){ emit Payout(toSend, charity, _contributor); AuctionHouseLogicV1(address(uint160(auctionHouse))).addFundsFor{value: toSend }(charity, _contributor);
toSend = (charityCut * _amount) / bid_Decimals; toDistribute -= toSend; if(toSend != 0){ emit Payout(toSend, charity, _contributor); AuctionHouseLogicV1(address(uint160(auctionHouse))).addFundsFor{value: toSend }(charity, _contributor);
23,846
52
// Get the latest successor in the chain
require(successor != address(0)); TokenStore newExchange = TokenStore(successor); for (uint16 n = 0; n < 20; n++) { // We will look past 20 contracts in the future address nextSuccessor = newExchange.successor(); if (nextSuccessor == address(this)) { // Circular succession revert(); ...
require(successor != address(0)); TokenStore newExchange = TokenStore(successor); for (uint16 n = 0; n < 20; n++) { // We will look past 20 contracts in the future address nextSuccessor = newExchange.successor(); if (nextSuccessor == address(this)) { // Circular succession revert(); ...
2,768
0
// getter all the things
function roleCount() public view returns(uint8) { return data.roleCount; } function role2userCount(uint8 a) public view returns(uint) { return data.role2userCount[a]; } function role2index2user(uint8 a, uint b) public view returns(address) { return data.role2index2user[a][b]; } function rootCount()...
function roleCount() public view returns(uint8) { return data.roleCount; } function role2userCount(uint8 a) public view returns(uint) { return data.role2userCount[a]; } function role2index2user(uint8 a, uint b) public view returns(address) { return data.role2index2user[a][b]; } function rootCount()...
34,012
31
// add stat step
data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId), _ss1); data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId), _ss2); data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId), _ss3); data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId),...
data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId), _ss1); data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId), _ss2); data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId), _ss3); data.addElementToArrayType(ArrayType.STAT_START, uint64(_classId),...
45,368
27
// Store the length of the array.
assembly { mstore(tokenIds, tokenIdsIdx) }
assembly { mstore(tokenIds, tokenIdsIdx) }
1,269
67
// Take the fee if withFee is true
if (withFee) {
if (withFee) {
21,495
2
// initializes a new DSToken instance_name token name _symbol token short symbol, minimum 1 character _decimals for display purposes only /
constructor( string memory _name, string memory _symbol, uint8 _decimals
constructor( string memory _name, string memory _symbol, uint8 _decimals
49,453
0
// Store Candidate Name Read Candidate Name
string public candidate;
string public candidate;
30,358
5
// Adjust this using `setReserve(...)` to keep some of the position in reserve in the strategy, to accomodate larger variations needed to sustain the strategy's core positon(s)
uint256 private reserve = 0;
uint256 private reserve = 0;
10,571
14
// Store Borrower's active loan
borrowerActiveLoans[loan.borrower].add(_loanId); emit loanAccepted(_loanId, loan.lender); emit AcceptedLoanDetail(_loanId, "protocol", amountToAconomy); emit AcceptedLoanDetail(_loanId, "Pool", amountToPool); emit AcceptedLoanDetail(_loanId, "Borrower", amountToBorrower);
borrowerActiveLoans[loan.borrower].add(_loanId); emit loanAccepted(_loanId, loan.lender); emit AcceptedLoanDetail(_loanId, "protocol", amountToAconomy); emit AcceptedLoanDetail(_loanId, "Pool", amountToPool); emit AcceptedLoanDetail(_loanId, "Borrower", amountToBorrower);
24,636
35
// ------------------------------------------------------------------------ Standard ERC20 Token Contract. Fixed Supply with burn capabilities ------------------------------------------------------------------------
contract ERC20 is ERC20Interface{ using SafeMath for uint; // ------------------------------------------------------------------------ /// Token supply, balances and allowance // ------------------------------------------------------------------------ uint internal supply; mapping (address => ...
contract ERC20 is ERC20Interface{ using SafeMath for uint; // ------------------------------------------------------------------------ /// Token supply, balances and allowance // ------------------------------------------------------------------------ uint internal supply; mapping (address => ...
30,172
83
// Signals successful execution of function RejectSharingRequest
WorkbenchBase.ContractUpdated("RejectSharingRequest");
WorkbenchBase.ContractUpdated("RejectSharingRequest");
10,357
3
// returns a Trove’s entire debt and collateral, which respectively include any pending debt rewards and ETH rewards from prior redistributions. /
function getEntireDebtAndColl(address _borrower)
function getEntireDebtAndColl(address _borrower)
15,425