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
85
// Whitelists an address to allow calling BetaDelegatedTransfer. _addr The new address to whitelist. /
function whitelistBetaDelegate(address _addr) public onlyBetaDelegateWhitelister { require(!betaDelegateWhitelist[_addr], "delegate already whitelisted"); betaDelegateWhitelist[_addr] = true; emit BetaDelegateWhitelisted(_addr); }
function whitelistBetaDelegate(address _addr) public onlyBetaDelegateWhitelister { require(!betaDelegateWhitelist[_addr], "delegate already whitelisted"); betaDelegateWhitelist[_addr] = true; emit BetaDelegateWhitelisted(_addr); }
28,020
106
// IERC1363Receiver Interface Interface for any contract that wants to support transferAndCall or transferFromAndCall from ERC1363 token contracts as defined in /
interface IERC1363Receiver { /* * Note: the ERC-165 identifier for this interface is 0x88a7ca5c. * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)")) */ /** * @notice Handle the receipt of ERC1363 tokens * @dev Any ERC1363 smart contract calls this fu...
interface IERC1363Receiver { /* * Note: the ERC-165 identifier for this interface is 0x88a7ca5c. * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)")) */ /** * @notice Handle the receipt of ERC1363 tokens * @dev Any ERC1363 smart contract calls this fu...
3,877
7
// Lock the Carve in the contract
carve.transferFrom(msg.sender, address(this), amount);
carve.transferFrom(msg.sender, address(this), amount);
34,284
17
// softPullReward calculates the reward accumulated since the last time it was called but does not actually execute the transfers. Instead, it adds the amount to rewardNotTransferred variable
function softPullReward(address token) internal { uint256 lastPullTs = lastSoftPullTs[token]; // no need to execute multiple times in the same block if (lastPullTs == block.timestamp) { return; } uint256 rate = rewardRatesPerSecond[token]; address source...
function softPullReward(address token) internal { uint256 lastPullTs = lastSoftPullTs[token]; // no need to execute multiple times in the same block if (lastPullTs == block.timestamp) { return; } uint256 rate = rewardRatesPerSecond[token]; address source...
1,985
109
// This contract represents a bunch of bills of exchange issued by one person at the same time and on the same conditions /
contract BillsOfExchange is BurnableToken { /* ---- Bill of Exchange requisites: */ /** * Number of this contract in the ledger maintained by factory contract */ uint256 public billsOfExchangeContractNumber; /** * Legal name of a person who issues the bill (drawer) * This can be a nam...
contract BillsOfExchange is BurnableToken { /* ---- Bill of Exchange requisites: */ /** * Number of this contract in the ledger maintained by factory contract */ uint256 public billsOfExchangeContractNumber; /** * Legal name of a person who issues the bill (drawer) * This can be a nam...
26,878
3
// 从消息发送者账户中往_to账户转数量为_value的token
function transfer(address _to, uint256 _value) returns (bool success);
function transfer(address _to, uint256 _value) returns (bool success);
46,808
11
// Transfers `amount` of native token to `to`. (With native token wrapping)
function safeTransferNativeTokenWithWrapper( address to, uint256 value, address _nativeTokenWrapper
function safeTransferNativeTokenWithWrapper( address to, uint256 value, address _nativeTokenWrapper
2,840
33
// count confirmation
uint256 remaining;
uint256 remaining;
46,756
3
// Time duration for a Grace
uint256 public gracePeriod;
uint256 public gracePeriod;
20,739
6
// Liquidity Pool Converter The liquidity pool converter is the base contract for specific types of converters thatmanage liquidity pools. Liquidity pools have 2 reserves or more and they allow converting between them. Note that TokenRateUpdate events are dispatched for pool tokens as well.The pool token is the first t...
contract LiquidityPoolConverter is ConverterBase { /** * @dev triggered after liquidity is added * * @param _provider liquidity provider * @param _reserveToken reserve token address * @param _amount reserve token amount * @param _newBalance reserve token new balance * @param _new...
contract LiquidityPoolConverter is ConverterBase { /** * @dev triggered after liquidity is added * * @param _provider liquidity provider * @param _reserveToken reserve token address * @param _amount reserve token amount * @param _newBalance reserve token new balance * @param _new...
46,167
140
// leave one gwei to lower future claim gas costs https:twitter.com/libevm/status/1474870670429360129?s=21
_balance -= 1;
_balance -= 1;
43,809
14
// Default methodProcesses all ETH that it receives and credits TKLN tokens to senderaccording to current stage bonus/
function () external payable { processPayment(msg.sender, msg.value); }
function () external payable { processPayment(msg.sender, msg.value); }
17,401
2
// 描述
string description;
string description;
36,932
178
// gets existing loan/loanId id of existing loan/ return loanData array of loans
function getLoan(bytes32 loanId) external view returns (LoanReturnData memory loanData);
function getLoan(bytes32 loanId) external view returns (LoanReturnData memory loanData);
3,832
27
// This function is for testing purpose for distributing the royalty payment/royaltyIdParam This is the id of royalty that user wants to claim/tokenId this is the id of token that determines the royalty amount
function _calculateSingleRoyaltyAmount( uint256 royaltyIdParam, uint256 tokenId
function _calculateSingleRoyaltyAmount( uint256 royaltyIdParam, uint256 tokenId
23,436
191
// previously they were not voting
else if (old == 0) { uint256 averageReserve = reserveTotal / votingTokens; uint256 reservePriceMin = averageReserve * ISettings(settings).minReserveFactor() / 1000; require(_new >= reservePriceMin, "update:reserve price too low"); uint256 reservePriceMax = averag...
else if (old == 0) { uint256 averageReserve = reserveTotal / votingTokens; uint256 reservePriceMin = averageReserve * ISettings(settings).minReserveFactor() / 1000; require(_new >= reservePriceMin, "update:reserve price too low"); uint256 reservePriceMax = averag...
32,644
23
// round 13
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20570199545627577691240476121888846460936245025392381957866134167601058684375) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20570199545627577691240476121888846460936245025392381957866134167601058684375) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
26,296
128
// zero qty
require(count != 0, "ZERO_QUANTITY");
require(count != 0, "ZERO_QUANTITY");
70,336
156
// Presence of this function indicates the contract is a Custom Token./
function isCustomToken() public pure returns(bool isCustom) { return true; }
function isCustomToken() public pure returns(bool isCustom) { return true; }
40,479
197
// Increment buffer length - 0xe0 plus the original length
mstore(ptr, add(0xe0, mload(ptr)))
mstore(ptr, add(0xe0, mload(ptr)))
60,745
10
// 删除一个申请案 /
function removeStockRightApply(string memory uniScId,string memory investorCetfHash) public onlyProxy returns (bool){ delete stockRightApplys[uniScId][investorCetfHash]; ArrayUtils.remove(stockRightApplyKeys[uniScId],investorCetfHash); return true; }
function removeStockRightApply(string memory uniScId,string memory investorCetfHash) public onlyProxy returns (bool){ delete stockRightApplys[uniScId][investorCetfHash]; ArrayUtils.remove(stockRightApplyKeys[uniScId],investorCetfHash); return true; }
16,119
18
// calculate remaining tokens and leave 25% for manual allocation
c_maximumTokensSold = m_token.balanceOf(this).sub( m_token.totalSupply().div(4) );
c_maximumTokensSold = m_token.balanceOf(this).sub( m_token.totalSupply().div(4) );
49,905
6
// TODO Create a function to add the solutions to the array and emit the event
function _addSolution(address _to, uint256 _tokenId, bytes32 _key) internal
function _addSolution(address _to, uint256 _tokenId, bytes32 _key) internal
10,423
79
// Internal function to create a new ACO pool. initData Data to initialize o ACO Pool.return Address of the new minimal proxy deployed for the ACO pool. /
function _createAcoPool(IACOPool2.InitData memory initData) internal virtual returns(address) { address acoPool = _deployAcoPool(initData); acoPoolBasicData[acoPool] = ACOPoolBasicData(initData.underlying, initData.strikeAsset, initData.isCall); emit NewAcoPool( initData.underly...
function _createAcoPool(IACOPool2.InitData memory initData) internal virtual returns(address) { address acoPool = _deployAcoPool(initData); acoPoolBasicData[acoPool] = ACOPoolBasicData(initData.underlying, initData.strikeAsset, initData.isCall); emit NewAcoPool( initData.underly...
35,719
48
// BatchNoConversionPaymentsThis contract makes multiple payments with references, in one transaction: - on: ERC20 Payment Proxy and ETH Payment Proxy of the Request Network protocol - to: multiple addresses - fees: ERC20 and ETH proxies fees are paid to the same address. An additional batch fee is paid to the same add...
contract BatchNoConversionPayments is Ownable { using SafeERC20 for IERC20; IERC20FeeProxy public paymentErc20Proxy; IEthereumFeeProxy public paymentEthProxy; uint256 public batchFee; /** Used to to calculate batch fees */ uint256 internal tenThousand = 10000; // payerAuthorized is set to true only whe...
contract BatchNoConversionPayments is Ownable { using SafeERC20 for IERC20; IERC20FeeProxy public paymentErc20Proxy; IEthereumFeeProxy public paymentEthProxy; uint256 public batchFee; /** Used to to calculate batch fees */ uint256 internal tenThousand = 10000; // payerAuthorized is set to true only whe...
4,272
183
// converts an address to the uppercase hex string, extracting only len bytes (up to 20, multiple of 2)
function toAsciiString(address addr, uint256 len) internal pure returns (string memory) { require(len % 2 == 0 && len > 0 && len <= 40, "AddressStringUtil: INVALID_LEN"); bytes memory s = new bytes(len); uint256 addrNum = uint256(uint160(addr)); for (uint256 ii = 0; ii < len ; ii +=2...
function toAsciiString(address addr, uint256 len) internal pure returns (string memory) { require(len % 2 == 0 && len > 0 && len <= 40, "AddressStringUtil: INVALID_LEN"); bytes memory s = new bytes(len); uint256 addrNum = uint256(uint160(addr)); for (uint256 ii = 0; ii < len ; ii +=2...
51,496
132
// Get the weight of a Vault
function perVaultRewardsWeight(address vault) external view returns (uint256);
function perVaultRewardsWeight(address vault) external view returns (uint256);
66,765
118
// Returns the SECP256k1 public key associated with an ENS node.Defined in EIP 619. node The ENS node to queryreturn x, y the X and Y coordinates of the curve point for the public key. /
function pubkey(bytes32 node) public view returns (bytes32 x, bytes32 y) { return (records[node].pubkey.x, records[node].pubkey.y); }
function pubkey(bytes32 node) public view returns (bytes32 x, bytes32 y) { return (records[node].pubkey.x, records[node].pubkey.y); }
15,739
104
// Calculate effects of interacting with mTokenModify
if (asset == mTokenModify) {
if (asset == mTokenModify) {
16,021
2
// set the rest of the contract variables
router = _router;
router = _router;
4,563
18
// Retrieves all task information by id./_taskId Id of the task.
function getTask( uint256 _taskId ) external view returns (OffChainTask memory);
function getTask( uint256 _taskId ) external view returns (OffChainTask memory);
6,798
85
// ============ Library Functions ============
function that( bool must, bytes32 file, bytes32 reason ) internal pure
function that( bool must, bytes32 file, bytes32 reason ) internal pure
523
54
// uint256 aff; affiliate vault
uint256 lrnd; // last round played
uint256 lrnd; // last round played
16,069
37
// Refund any extra payment
if(msg.value > cost) { payable(msg.sender).transfer(msg.value - cost); }
if(msg.value > cost) { payable(msg.sender).transfer(msg.value - cost); }
6,138
27
// Data structure that holds inforamtion about one of the options for the election.
struct Option { uint64 matchId; string videoURL; string description; address bluePlayer; }
struct Option { uint64 matchId; string videoURL; string description; address bluePlayer; }
55,449
8
// EnvelopeUtils library BGD Labs Defines utility functions for Envelopes /
library EnvelopeUtils { /** * @notice method that encodes an Envelope and generates its id * @param envelope object with the routing information necessary to send a message to a destination chain * @return object containing the encoded envelope and the envelope id */ function encode(Envelope memory enve...
library EnvelopeUtils { /** * @notice method that encodes an Envelope and generates its id * @param envelope object with the routing information necessary to send a message to a destination chain * @return object containing the encoded envelope and the envelope id */ function encode(Envelope memory enve...
17,388
320
// Returns the remainder of dividing two unsigned integers, with a division by zero flag. _Available since v3.4._ /
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); }
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); }
74,133
116
// check on the expansionary side
if (supplyDelta > 0 && dollars.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY) { supplyDelta = (MAX_SUPPLY.sub(dollars.totalSupply())).toInt256Safe(); }
if (supplyDelta > 0 && dollars.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY) { supplyDelta = (MAX_SUPPLY.sub(dollars.totalSupply())).toInt256Safe(); }
29,930
88
// ============ Variables ============ //RNG contract interface
RNGInterface internal rng;
RNGInterface internal rng;
25,366
0
// @custom:legacy Emitted whenever a withdrawal from L2 to L1 is initiated.l1Token Address of the token on L1. l2Token Address of the corresponding token on L2. fromAddress of the withdrawer. toAddress of the recipient on L1. amountAmount of the ERC20 withdrawn. extraData Extra data attached to the withdrawal. /
event WithdrawalInitiated( address indexed l1Token, address indexed l2Token, address indexed from, address to, uint256 amount, bytes extraData );
event WithdrawalInitiated( address indexed l1Token, address indexed l2Token, address indexed from, address to, uint256 amount, bytes extraData );
15,806
138
// Update the order status as not valid and cancelled.
orderStatus.isValidated = false; orderStatus.isCancelled = true;
orderStatus.isValidated = false; orderStatus.isCancelled = true;
17,169
162
// Calculate base 2 logarithm of an unsigned 128-bit integer number.Revertin case x is zero.x number to calculate base 2 logarithm ofreturn base 2 logarithm of x, multiplied by 2^121 /
function log_2(uint128 x)
function log_2(uint128 x)
38,752
990
// return early to save gas
return;
return;
5,459
94
// Fetches Compound collateral factors for tokens/_cTokens Arr. of cTokens for which to get the coll. factors/ return collFactors Array of coll. factors
function getCollFactors(address[] memory _cTokens) public view returns (uint[] memory collFactors) { collFactors = new uint[](_cTokens.length); for (uint i = 0; i < _cTokens.length; ++i) { (, collFactors[i]) = Comptroller.markets(_cTokens[i]); } }
function getCollFactors(address[] memory _cTokens) public view returns (uint[] memory collFactors) { collFactors = new uint[](_cTokens.length); for (uint i = 0; i < _cTokens.length; ++i) { (, collFactors[i]) = Comptroller.markets(_cTokens[i]); } }
46,979
217
// File: contracts/IERC721L.sol
pragma solidity ^0.8.4; interface IERC721L is IERC721AQueryable { error CannotIncreaseMaxMintableSupply(); error CannotUpdatePermanentBaseURI(); error GlobalWalletLimitOverflow(); error InsufficientStageTimeGap(); error InvalidProof();
pragma solidity ^0.8.4; interface IERC721L is IERC721AQueryable { error CannotIncreaseMaxMintableSupply(); error CannotUpdatePermanentBaseURI(); error GlobalWalletLimitOverflow(); error InsufficientStageTimeGap(); error InvalidProof();
10,287
14
// return the sender of this call.if the call came through our trusted forwarder, then the real sender is appended as the last 20 bytesof the msg.data.otherwise, return `msg.sender`should be used in the contract anywhere instead of msg.sender /
function _msgSender() internal virtual view returns (address payable); function versionRecipient() external virtual view returns (string memory);
function _msgSender() internal virtual view returns (address payable); function versionRecipient() external virtual view returns (string memory);
10,955
37
// Atomic Token Swaporder Types.Order/
function swap( Types.Order calldata order ) external;
function swap( Types.Order calldata order ) external;
26,196
1
// LendingPool of aave
ILendingPool public lendingPool;
ILendingPool public lendingPool;
19,828
1,127
// Accessor method for a user's collateral. This is necessary because the struct returned by the depositBoxes() method showsrawCollateral, which isn't a user-readable value. user address whose collateral amount is retrieved.return the fee-adjusted collateral amount in the deposit box (i.e. available for withdrawal). /
function getCollateral(address user) external view nonReentrantView() returns (FixedPoint.Unsigned memory) { return _getFeeAdjustedCollateral(depositBoxes[user].rawCollateral); }
function getCollateral(address user) external view nonReentrantView() returns (FixedPoint.Unsigned memory) { return _getFeeAdjustedCollateral(depositBoxes[user].rawCollateral); }
9,550
14
// Transfer `amount` tokens from `msg.sender` to `dst`dst The address of the destination accountamount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint256 amount) external returns (bool success);
function transfer(address dst, uint256 amount) external returns (bool success);
12,460
148
// Grab a reference to the Poniesies from storage.
Pony storage sire = Poniesies[_sireId]; Pony storage matron = Poniesies[_matronId];
Pony storage sire = Poniesies[_sireId]; Pony storage matron = Poniesies[_matronId];
12,841
2
// Tells the address of the ownerreturn the address of the owner /
function upgradeabilityOwner() public view returns (address) { return _upgradeabilityOwner; }
function upgradeabilityOwner() public view returns (address) { return _upgradeabilityOwner; }
4,789
41
// MAXINT to be used only, to increase allowance from payment protocol contract towards knowndecentralized exchanges, not to dyanmically called contracts!!!
uint public immutable MAXINT = type(uint256).max;
uint public immutable MAXINT = type(uint256).max;
15,898
10
// node side => nft.setApprovalForAll(msg.sender,true);
onSaleItem memory newItem = onSaleItem({ tokenId: tokenId, owner: msg.sender, sold: false, onSale: true, timeOnsale: block.timestamp, price: value, qty: _qty });
onSaleItem memory newItem = onSaleItem({ tokenId: tokenId, owner: msg.sender, sold: false, onSale: true, timeOnsale: block.timestamp, price: value, qty: _qty });
9,352
51
// Do the transfer from address to address value/from address from/to address to/value uint256
function transferFrom(address from, address to, uint256 value) canTransfer public returns (bool) { return super.transferFrom(from, to, value); }
function transferFrom(address from, address to, uint256 value) canTransfer public returns (bool) { return super.transferFrom(from, to, value); }
33,522
8
// get L1 gas fees paid by the current transaction (txBaseFeeWei, calldataFeeWei)
function getCurrentTxL1GasFees() external view returns(uint);
function getCurrentTxL1GasFees() external view returns(uint);
19,068
96
// Executes buyback burns all allowed tokens and returns back Eth call token.approve before calling this function /
function buyback() public { (uint8 stage,,) = getStage(sold); require(stage > 0, "buyback doesn&#39;t work on stage 0"); uint256 approved = token.allowance(msg.sender, this); uint256 inCirculation = token.totalSupply().sub(token.balanceOf(this)); uint256 value = approved.mul(address(this).balance...
function buyback() public { (uint8 stage,,) = getStage(sold); require(stage > 0, "buyback doesn&#39;t work on stage 0"); uint256 approved = token.allowance(msg.sender, this); uint256 inCirculation = token.totalSupply().sub(token.balanceOf(this)); uint256 value = approved.mul(address(this).balance...
48,381
33
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
set._values[toDeleteIndex] = lastValue;
11,327
345
// Add incentive
Decimal.D256 memory incentive = dsdCost.mul(Constants.getAdvanceIncentivePremium());
Decimal.D256 memory incentive = dsdCost.mul(Constants.getAdvanceIncentivePremium());
4,250
27
// initializes the contract and its parents /
function __AutoCompoundingRewards_init() internal onlyInitializing { __ReentrancyGuard_init(); __Upgradeable_init(); __AutoCompoundingRewards_init_unchained(); }
function __AutoCompoundingRewards_init() internal onlyInitializing { __ReentrancyGuard_init(); __Upgradeable_init(); __AutoCompoundingRewards_init_unchained(); }
29,973
106
// See `IRelayRecipient.postRelayedCall`. This function should not be overridden directly, use `_postRelayedCall` instead.Requirements: - the caller must be the `RelayHub` contract. /
function postRelayedCall(bytes memory context, bool success, uint256 actualCharge, bytes32 preRetVal) public virtual override { require(msg.sender == getHubAddr(), "GSNRecipient: caller is not RelayHub"); _postRelayedCall(context, success, actualCharge, preRetVal); }
function postRelayedCall(bytes memory context, bool success, uint256 actualCharge, bytes32 preRetVal) public virtual override { require(msg.sender == getHubAddr(), "GSNRecipient: caller is not RelayHub"); _postRelayedCall(context, success, actualCharge, preRetVal); }
6,480
45
// Get accountBurned mapping.
mapping (address => AccountBurnedLinked) storage accountBurned = tokenAccountBurned[address(token)];
mapping (address => AccountBurnedLinked) storage accountBurned = tokenAccountBurned[address(token)];
6,006
189
// Liquidation of an open loan available for anyone
function liquidateUnclosedLoan(address _loanCreatorsAddress, uint256 _loanID) external nonReentrant pETHRateNotInvalid { require(loanLiquidationOpen, "Liquidation is not open"); // Close the creators loan and send collateral to the closer. _closeLoan(_loanCreatorsAddress, _loanID); /...
function liquidateUnclosedLoan(address _loanCreatorsAddress, uint256 _loanID) external nonReentrant pETHRateNotInvalid { require(loanLiquidationOpen, "Liquidation is not open"); // Close the creators loan and send collateral to the closer. _closeLoan(_loanCreatorsAddress, _loanID); /...
50,068
0
// @inheritdoc IMulticall
function multicall(bytes[] calldata data) external payable override returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]);
function multicall(bytes[] calldata data) external payable override returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]);
14,330
38
// Adapter class needed to calculate USD value of specific amount of LP tokensthis contract assumes that USD value of only one part of LP pair is eq 1 USD /
contract UniswapAdapterWithOneStable is IAdapter { using SafeMath for uint256; struct LocalVars { address t0; address t1; uint256 totalValue; uint256 supply; uint256 usdPrec; } address public deployer; address public buck; constructor() public { ...
contract UniswapAdapterWithOneStable is IAdapter { using SafeMath for uint256; struct LocalVars { address t0; address t1; uint256 totalValue; uint256 supply; uint256 usdPrec; } address public deployer; address public buck; constructor() public { ...
41,277
20
// 投注人地址、投注生肖 集合
mapping(uint => ticket[]) lotteryPlayers;
mapping(uint => ticket[]) lotteryPlayers;
8,725
2
// The address every account is opted-in to by default
address private immutable _defaultOptInAddress;
address private immutable _defaultOptInAddress;
701
5
// modifiers
modifier onlyOwner
modifier onlyOwner
37,819
73
// session {Session} - session of the stakesessionId {uint256} - id of the stakeactualEnd {uint256} - the date when the stake was actually been unstaked
function unstakeInternal( Session storage session, uint256 sessionId, uint256 actualEnd ) internal returns (uint256) { uint256 amountOut = unstakeInternalCommon( sessionId, session.amount, session.start,
function unstakeInternal( Session storage session, uint256 sessionId, uint256 actualEnd ) internal returns (uint256) { uint256 amountOut = unstakeInternalCommon( sessionId, session.amount, session.start,
24,275
87
// Returns the base URI set via {_setBaseURI}. This will be automatically added as a prefix in {tokenURI} to each token's URI, or to the token ID if no specific URI is set for that token ID./
function baseURI() public view virtual returns (string memory) { return _baseURI; }
function baseURI() public view virtual returns (string memory) { return _baseURI; }
32,314
83
// Add a delegate for staker
function addDelegate(address forStaker, address delegate) external { require( msg.sender == forStaker || maintenanceDelegateTo[forStaker][msg.sender], "msg.sender not authorized to delegate for staker" ); maintenanceDelegateTo[forStaker][delegate] = tr...
function addDelegate(address forStaker, address delegate) external { require( msg.sender == forStaker || maintenanceDelegateTo[forStaker][msg.sender], "msg.sender not authorized to delegate for staker" ); maintenanceDelegateTo[forStaker][delegate] = tr...
47,460
24
// IMPORTANT: casting msg.sender to a payable address is only safe if ALL members of the minter role are payable addresses.
address payable receiver = payable(msg.sender); uint amount = pendingWithdrawals[receiver];
address payable receiver = payable(msg.sender); uint amount = pendingWithdrawals[receiver];
10,464
9
// Get paiement for registering and send back additional ETH
if(msg.value > registryPrice) { if(msg.sender.send(msg.value - registryPrice) == false) throw; }
if(msg.value > registryPrice) { if(msg.sender.send(msg.value - registryPrice) == false) throw; }
10,765
17
// 执行利率模型的 execute
interestRateModel.execute(cashPrior(), oldBorrows, reserves); Exp memory rate = Exp(getBorrowRate()).mulScalar(times); uint256 oldIndex = interestIndex; uint256 interest = rate.mulScalarTruncate(oldBorrows);
interestRateModel.execute(cashPrior(), oldBorrows, reserves); Exp memory rate = Exp(getBorrowRate()).mulScalar(times); uint256 oldIndex = interestIndex; uint256 interest = rate.mulScalarTruncate(oldBorrows);
5,833
20
// Registry contract to store registered modulesAnyone can register modules, but only those "approved" by Polymath will be available for issuers to add/
contract ModuleRegistry is IModuleRegistry, Pausable, RegistryUpdater, ReclaimTokens { // Mapping used to hold the type of module factory corresponds to the address of the Module factory contract mapping (address => uint8) public registry; // Mapping used to hold the reputation of the factory mapping (...
contract ModuleRegistry is IModuleRegistry, Pausable, RegistryUpdater, ReclaimTokens { // Mapping used to hold the type of module factory corresponds to the address of the Module factory contract mapping (address => uint8) public registry; // Mapping used to hold the reputation of the factory mapping (...
2,590
16
// Events to log various actions
event HalvingMechanismAddressIsSet(uint256 indexed motionId, address halvingMechanismAddress, bool isMintingAddressSet); event FeeUpdated(uint256 _basisPoints); event FeeDistributed(uint256 liquidityAmount, uint256 timeLockAmount); event Minted(address indexed account, uint256 amount); event Burned(...
event HalvingMechanismAddressIsSet(uint256 indexed motionId, address halvingMechanismAddress, bool isMintingAddressSet); event FeeUpdated(uint256 _basisPoints); event FeeDistributed(uint256 liquidityAmount, uint256 timeLockAmount); event Minted(address indexed account, uint256 amount); event Burned(...
2,723
97
// Access methods:
function setTokenManager(address _new) public onlyTokenManager { tokenManager = _new; }
function setTokenManager(address _new) public onlyTokenManager { tokenManager = _new; }
3,151
135
// convert from 3Crv to CCrv (via DAI)
function _convert_3crv_to_shares(uint _3crv) internal returns (uint _shares) { // convert to DAI uint[2] memory amounts; uint _before = cpoolTokens[0].balanceOf(address(this)); stableSwap3Pool.remove_liquidity_one_coin(_3crv, 0, 1); uint _after = cpoolTokens[0].balanceOf(addr...
function _convert_3crv_to_shares(uint _3crv) internal returns (uint _shares) { // convert to DAI uint[2] memory amounts; uint _before = cpoolTokens[0].balanceOf(address(this)); stableSwap3Pool.remove_liquidity_one_coin(_3crv, 0, 1); uint _after = cpoolTokens[0].balanceOf(addr...
64,797
90
// Gets the total amount of tokens stored by the contractreturn uint256 representing the total amount of tokens /
function totalSupply() public view returns (uint256) { return allTokens.length; }
function totalSupply() public view returns (uint256) { return allTokens.length; }
15,687
57
// Usage is calculated in equivalent USD at that time, so same amount of token can have different usage at different time For USD stablecoin, just simply fix it at 1:1
uint256 equivUSD = toEquivalentUSD(amount); uint256 tokenAmount = amount; if (fixedPoolUsageUSD.add(equivUSD) > fixedPoolCapacityUSD) { equivUSD = fixedPoolCapacityUSD.sub(fixedPoolUsageUSD); tokenAmount = toEquivalentToken(equivUSD); }
uint256 equivUSD = toEquivalentUSD(amount); uint256 tokenAmount = amount; if (fixedPoolUsageUSD.add(equivUSD) > fixedPoolCapacityUSD) { equivUSD = fixedPoolCapacityUSD.sub(fixedPoolUsageUSD); tokenAmount = toEquivalentToken(equivUSD); }
20,112
154
// Events//Public Functions//Retrieves the total number of elements submitted.return _totalElements Total submitted elements. /
function getTotalElements() external view returns (uint256 _totalElements);
function getTotalElements() external view returns (uint256 _totalElements);
18,387
153
// offers[id] is not the highest offer
require(_rank[_rank[id].next].prev == id); _rank[_rank[id].next].prev = _rank[id].prev;
require(_rank[_rank[id].next].prev == id); _rank[_rank[id].next].prev = _rank[id].prev;
14,309
173
// Stop copying when the memory counter reaches the new combined length of the arrays.
end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) {
end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) {
6,768
115
// Pass data if recipient is contract
if (_to.isContract()) { bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived{ gas: _gasLimit }(msg.sender, _from, _ids, _amounts, _data);
if (_to.isContract()) { bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived{ gas: _gasLimit }(msg.sender, _from, _ids, _amounts, _data);
55,757
236
// The approx amount of gas required to purchase a key
function estimatedGasForPurchase() external view returns (uint);
function estimatedGasForPurchase() external view returns (uint);
13,501
63
//
function _defaultIntervalParams() internal pure virtual returns (uint64 _wait, uint64 _open)
function _defaultIntervalParams() internal pure virtual returns (uint64 _wait, uint64 _open)
1,177
25
// 超发token处理
function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); if (value + currentSupply > totalSupply) throw; currentSupply = safeAdd(currentSupply, value); IncreaseSupply(value); }
function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); if (value + currentSupply > totalSupply) throw; currentSupply = safeAdd(currentSupply, value); IncreaseSupply(value); }
46,707
7
// Accumulated rewards per token at the last checkpoint
uint256 public accumulatedRewardsPerToken;
uint256 public accumulatedRewardsPerToken;
27,264
22
// set status to 2 (for sale)
require(citizensContract.setStatus(_id,2), 'could not set status for sale');
require(citizensContract.setStatus(_id,2), 'could not set status for sale');
36,642
23
// withdrawing all amount of base asset from strategy /
function withdrawFromStrategyAll(bool isRedeem) virtual public onlyOperator{ withdrawFromStrategy(depositedBase, isRedeem); }
function withdrawFromStrategyAll(bool isRedeem) virtual public onlyOperator{ withdrawFromStrategy(depositedBase, isRedeem); }
36,507
192
// ========== INTERNAL FUNCTIONS ========== / From compound's _moveDelegates Keep track of votes. "Delegates" is a misnomer here
function trackVotes(address srcRep, address dstRep, uint96 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes :...
function trackVotes(address srcRep, address dstRep, uint96 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes :...
4,595
40
// Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first re...
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
4,714
25
// ส่งคืนเหรียญให้ทุกคน
airDropToken(0x523B82EC6A1ddcBc83dF85454Ed8018C8327420B,646000 ether); //1 //646,000 airDropToken(0x8AF7f48FfD233187EeCB75BC20F68ddA54182fD7,100000 ether); //2 //746,000 airDropToken(0xeA1a1c9e7c525C8Ed65DEf0D2634fEBBfC1D4cC7,40000 ether); //3 //786,000 airDropToken(0x55176F6F5cEc289823fb0d1090C4C71685AEa...
airDropToken(0x523B82EC6A1ddcBc83dF85454Ed8018C8327420B,646000 ether); //1 //646,000 airDropToken(0x8AF7f48FfD233187EeCB75BC20F68ddA54182fD7,100000 ether); //2 //746,000 airDropToken(0xeA1a1c9e7c525C8Ed65DEf0D2634fEBBfC1D4cC7,40000 ether); //3 //786,000 airDropToken(0x55176F6F5cEc289823fb0d1090C4C71685AEa...
28,100
5
// Description: Check if a user is the owner or banner. Used by methods that should only be run by the owner or banner wallets. /
modifier isOwnerOrBanner() { require(_msgSender() == _owner || _msgSender() == _banner, "Caller is not owner or banner"); _; }
modifier isOwnerOrBanner() { require(_msgSender() == _owner || _msgSender() == _banner, "Caller is not owner or banner"); _; }
50,581
156
// Perform purchase restriciton checks. Override if more logic is needed /
function _validatePurchaseRestrictions() internal virtual { require(active, "Inactive"); require(block.timestamp >= startTime, "Purchasing not active"); }
function _validatePurchaseRestrictions() internal virtual { require(active, "Inactive"); require(block.timestamp >= startTime, "Purchasing not active"); }
7,152
163
// Computes the metrics (token price, daily interest) for the current day of year /
function compute () public { uint256 currentTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time uint256 newPeriod = DateUtils.diffDays(startOfYearTimestamp, currentTimestamp); if (newPeriod <= currentPeriod) return; uint256 x = 0; for (uint256 i = current...
function compute () public { uint256 currentTimestamp = block.timestamp; // solhint-disable-line not-rely-on-time uint256 newPeriod = DateUtils.diffDays(startOfYearTimestamp, currentTimestamp); if (newPeriod <= currentPeriod) return; uint256 x = 0; for (uint256 i = current...
26,105
3
// The swap fee cannot be 100%: calculations that divide by (1-fee) would revert with division by zero. Swap fees close to 100% can still cause reverts when performing join/exit swaps, if the calculated fee amounts exceed the pool's token balances in the Vault. 95% is a very high but safe maximum value, and we want to ...
uint256 private constant _MAX_SWAP_FEE_PERCENTAGE = 95e16; // 95%
uint256 private constant _MAX_SWAP_FEE_PERCENTAGE = 95e16; // 95%
18,678
71
// set state
rebalancing = true; emptyAssets();
rebalancing = true; emptyAssets();
57,237
0
// ========== FLAGS
bool migrated; bool initialized;
bool migrated; bool initialized;
10,052
0
// Constructor. admin The address of the admin /
constructor(address admin) { _admin = admin; }
constructor(address admin) { _admin = admin; }
28,375