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 |
|---|---|---|---|---|
124 | // Convert from seconds to ledger timer ticks | _delay *= 10;
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(_nbytes);
bytes memory unonce = new bytes(32);
bytes memory sessionKeyHash = new bytes(32);
bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
assembly {
mstore(... | _delay *= 10;
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(_nbytes);
bytes memory unonce = new bytes(32);
bytes memory sessionKeyHash = new bytes(32);
bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
assembly {
mstore(... | 27,950 |
30 | // Sets data for an address/caller THROWS when the account doesn't existaddr The addressindex The index of the datacustomData The data store set / | function setAccountData(address addr, uint8 index, bytes32 customData)
isUnlocked
isAllowed(get(addr).kind)
| function setAccountData(address addr, uint8 index, bytes32 customData)
isUnlocked
isAllowed(get(addr).kind)
| 30,863 |
21 | // recordDealRefundReason creates an event of not paid deal that was cancelled _orderId Identifier of deal's order_clientAddress Address of client's account_clientReputation Updated reputation of the client_merchantReputation Updated reputation of the merchant_dealHash Hashcode of the deal, describing the order (used f... | function recordDealRefundReason(
uint _orderId,
address _clientAddress,
uint32 _clientReputation,
uint32 _merchantReputation,
uint _dealHash,
string _refundReason)
external onlyMonetha
| function recordDealRefundReason(
uint _orderId,
address _clientAddress,
uint32 _clientReputation,
uint32 _merchantReputation,
uint _dealHash,
string _refundReason)
external onlyMonetha
| 25,706 |
0 | // Computes the result of a swap within ticks/Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick. | interface ISwapMath {
/// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap
/// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive
/// @param sqrtRatioCurrentX96 The current sqrt price of ... | interface ISwapMath {
/// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap
/// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive
/// @param sqrtRatioCurrentX96 The current sqrt price of ... | 3,939 |
1 | // releaseTime = now + 3 minutes; | allocate();
| allocate();
| 20,348 |
191 | // Whether boosting is currently frozen. | bool public frozen;
| bool public frozen;
| 19,137 |
4 | // These functions call with hidden parameters | function callFuncNoParams() external {
doCall(abi.encodeWithSelector(dest.funcNoParams.selector));
}
| function callFuncNoParams() external {
doCall(abi.encodeWithSelector(dest.funcNoParams.selector));
}
| 38,449 |
92 | // Burn mineCoin to account when account redeem collateral to collateral pool, only manager contract can modify database. account user's account amount the mine shared amount / | function burnMinerCoin(address /*account*/,uint256 /*amount*/) public {
delegateAndReturn();
}
| function burnMinerCoin(address /*account*/,uint256 /*amount*/) public {
delegateAndReturn();
}
| 34,232 |
36 | // Distribution contract / | contract Distribution is Ownable {
using SafeMath for uint256;
uint16 public stages;
uint256 public stageDuration;
uint256 public startTime;
uint256 public soldTokens;
uint256 public bonusClaimedTokens;
uint256 public raisedETH;
uint256 public raisedUSD;
uint256 public weiUsdRate;
BurnableToken ... | contract Distribution is Ownable {
using SafeMath for uint256;
uint16 public stages;
uint256 public stageDuration;
uint256 public startTime;
uint256 public soldTokens;
uint256 public bonusClaimedTokens;
uint256 public raisedETH;
uint256 public raisedUSD;
uint256 public weiUsdRate;
BurnableToken ... | 33,496 |
740 | // amount to return for the bucket | uint256 owedTokenToWithdraw = MathHelpers.getPartialAmount(
userWeight,
bucketWeight,
availableForBucket[bucket].add(getBucketOwedAmount(bucket))
);
| uint256 owedTokenToWithdraw = MathHelpers.getPartialAmount(
userWeight,
bucketWeight,
availableForBucket[bucket].add(getBucketOwedAmount(bucket))
);
| 39,142 |
16 | // Fixed point arithmetic library/Taken from https:github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol | library FixedMath {
uint256 internal constant WAD = 1e18;
uint256 internal constant RAY = 1e27;
function fmul(
uint256 x,
uint256 y,
uint256 baseUnit
) internal pure returns (uint256) {
return mulDivDown(x, y, baseUnit); // Equivalent to (x * y) / baseUnit rounded down.
... | library FixedMath {
uint256 internal constant WAD = 1e18;
uint256 internal constant RAY = 1e27;
function fmul(
uint256 x,
uint256 y,
uint256 baseUnit
) internal pure returns (uint256) {
return mulDivDown(x, y, baseUnit); // Equivalent to (x * y) / baseUnit rounded down.
... | 11,199 |
14 | // Event emitted when external ERC20s are awarded to a winner | event AwardedExternalERC20(
address indexed winner,
address indexed token,
uint256 amount
);
| event AwardedExternalERC20(
address indexed winner,
address indexed token,
uint256 amount
);
| 16,339 |
543 | // Fees in fee period [0] are not yet available for withdrawal | for (uint i = 1; i < FEE_PERIOD_LENGTH; i++) {
totalFees = totalFees.add(_recentFeePeriodsStorage(i).feesToDistribute);
totalFees = totalFees.sub(_recentFeePeriodsStorage(i).feesClaimed);
}
| for (uint i = 1; i < FEE_PERIOD_LENGTH; i++) {
totalFees = totalFees.add(_recentFeePeriodsStorage(i).feesToDistribute);
totalFees = totalFees.sub(_recentFeePeriodsStorage(i).feesClaimed);
}
| 48,795 |
20 | // funding round status of the FrAactionHub | FundingStatus public fundingStatus;
| FundingStatus public fundingStatus;
| 9,504 |
85 | // Swap the bnb for tokens | pancakeswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(
| pancakeswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(
| 21,980 |
104 | // To see if the minimum goal of tokens of the ICO has been reached / return bool True if the tokens raised are bigger than the goal or false otherwise | function goalReached() public view returns(bool) {
return tokensRaised >= minimumGoal;
}
| function goalReached() public view returns(bool) {
return tokensRaised >= minimumGoal;
}
| 42,601 |
2 | // accept beneficiary role over timelocked TRIBE | function acceptBeneficiary() public override {
_setBeneficiary(msg.sender);
}
| function acceptBeneficiary() public override {
_setBeneficiary(msg.sender);
}
| 52,424 |
158 | // Withdraw all from Gauge | (, uint256 gaugePTokens, uint256 totalPTokens) = _getTotalPTokens();
ICurveGauge(crvGaugeAddress).withdraw(gaugePTokens);
uint256[3] memory minWithdrawAmounts = [
uint256(0),
uint256(0),
uint256(0)
];
| (, uint256 gaugePTokens, uint256 totalPTokens) = _getTotalPTokens();
ICurveGauge(crvGaugeAddress).withdraw(gaugePTokens);
uint256[3] memory minWithdrawAmounts = [
uint256(0),
uint256(0),
uint256(0)
];
| 43,337 |
55 | // Log ETH contributed and tokens generated | TokensBought(contributor, msg.value, tokens);
| TokensBought(contributor, msg.value, tokens);
| 5,544 |
3 | // ALPHA price | uint256 public ALPHA_PRICE = 1000000;
uint256 public ALPHA_PRICE_WAVG = 1000000;
| uint256 public ALPHA_PRICE = 1000000;
uint256 public ALPHA_PRICE_WAVG = 1000000;
| 31,023 |
259 | // Returns whether `tokenId` exists. | * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
... | * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
... | 3,111 |
59 | // Token decimals | uint public constant DECIMALS = 18;
| uint public constant DECIMALS = 18;
| 46,448 |
174 | // pay outstanding interest to lender | _PAYINTEREST683(
loanLocal.lender,
loanParamsLocal.loanToken
);
LoanInterest storage loanInterestLocal = loanInterest[loanLocal.id];
LenderInterest storage lenderInterestLocal = lenderInterest[loanLocal.lender][loanParamsLocal.loanToken];
_SETTLEFEEREWAR... | _PAYINTEREST683(
loanLocal.lender,
loanParamsLocal.loanToken
);
LoanInterest storage loanInterestLocal = loanInterest[loanLocal.id];
LenderInterest storage lenderInterestLocal = lenderInterest[loanLocal.lender][loanParamsLocal.loanToken];
_SETTLEFEEREWAR... | 43,509 |
14 | // this eth is now is the contract's possession floatETH += value; | floatETH = ExternalSafeMath.add(floatETH, value);
emit Purchase(msg.sender, amount);
return true;
| floatETH = ExternalSafeMath.add(floatETH, value);
emit Purchase(msg.sender, amount);
return true;
| 5,005 |
13 | // calculate the next installment date | uint256 duration = repaidInstallments.add(1);
duration = duration > params.duration ? params.duration : duration;
_nextInstallment.timestamp = DateTime.addMonths(issuedAt, duration);
_nextInstallment.principal = _nextInstallment.total.sub(
_nextInstallment.interest
)... | uint256 duration = repaidInstallments.add(1);
duration = duration > params.duration ? params.duration : duration;
_nextInstallment.timestamp = DateTime.addMonths(issuedAt, duration);
_nextInstallment.principal = _nextInstallment.total.sub(
_nextInstallment.interest
)... | 6,628 |
16 | // EnsSubdomainFactoryAllows to create and configure a subdomain for Ethereum ENS in one call. After deploying this contract, change the owner of the top level domain you want to use to this deployed contract address./ | contract EnsSubdomainFactory is Ownable {
EnsRegistry public registry = EnsRegistry(0x314159265dD8dbb310642f98f50C066173C1259b);
EnsResolver public resolver = EnsResolver(0x5FfC014343cd971B7eb70732021E26C35B744cc4);
event SubdomainCreated(bytes32 indexed subdomain, address indexed owner);
constructor() public {
... | contract EnsSubdomainFactory is Ownable {
EnsRegistry public registry = EnsRegistry(0x314159265dD8dbb310642f98f50C066173C1259b);
EnsResolver public resolver = EnsResolver(0x5FfC014343cd971B7eb70732021E26C35B744cc4);
event SubdomainCreated(bytes32 indexed subdomain, address indexed owner);
constructor() public {
... | 37,468 |
7 | // single asset deposit | function singleAssetDeposit(address _token, uint256 _tokenAmount) external payable{
require(tokenData.length>0, "Funds can not be deposited before the owner initializes the pool");
Coin _coin = Coin(payable(_token));
uint256 _issuedValue;
//calc new pool value and added user value
... | function singleAssetDeposit(address _token, uint256 _tokenAmount) external payable{
require(tokenData.length>0, "Funds can not be deposited before the owner initializes the pool");
Coin _coin = Coin(payable(_token));
uint256 _issuedValue;
//calc new pool value and added user value
... | 26,813 |
2 | // Sets the per-item price. | function setPrice(uint256 _price) public onlyOwner {
price = _price;
}
| function setPrice(uint256 _price) public onlyOwner {
price = _price;
}
| 9,024 |
2 | // Set oracle address locally Since we use sendChainlinkRequestTo instead of sendChainlinkRequest we set this locally _oracleThis is the address of the oracle registered with chainlink / | function setOracle(address _oracle) external onlyOwner {
require(_oracle != address(0)); //Check that it is not the zeroth address
oracle = _oracle;
}
| function setOracle(address _oracle) external onlyOwner {
require(_oracle != address(0)); //Check that it is not the zeroth address
oracle = _oracle;
}
| 20,568 |
21 | // calculate dividend holders' shares | uint256 dividendPerRecipient = getDividendPayout(
currentPrice,
stock.dividendAmount,
sharesForStock.length - 1
);
| uint256 dividendPerRecipient = getDividendPayout(
currentPrice,
stock.dividendAmount,
sharesForStock.length - 1
);
| 21,590 |
53 | // Sets `adminRole` as ``role``'s admin role. Emits a {RoleAdminChanged} event. / | function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
| function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
| 16,522 |
211 | // Set contract state. contractState_ The new state of the contract. / | function setContractState(uint256 contractState_) external onlyOwner {
require(contractState_ < 2, "Invalid State!");
if (contractState_ == 0) {
contractState = ContractState.OFF;
}
else {
contractState = ContractState.ON;
}
}
| function setContractState(uint256 contractState_) external onlyOwner {
require(contractState_ < 2, "Invalid State!");
if (contractState_ == 0) {
contractState = ContractState.OFF;
}
else {
contractState = ContractState.ON;
}
}
| 31,940 |
37 | // |/ Get the number of prints minted for the corresponding seed seed The seed/original NFT token id / | function seedToPrintsSupply(uint256 seed)
public
view
returns (uint256)
| function seedToPrintsSupply(uint256 seed)
public
view
returns (uint256)
| 7,946 |
261 | // Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does | * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeaco... | * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeaco... | 37,754 |
130 | // Initializes the ownership slot minted at `index` for efficiency purposes. / | function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
| function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
| 32,838 |
79 | // Returns the number of values in the set. O(1). / | function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
| function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
| 32,319 |
10 | // Emit an event notifying about the update. | emit ProtocolFeeChanged(
address(uint160(oldProtocolFee >> 96)),
_newProtocolFeeRecipient,
uint256(uint96(oldProtocolFee)),
_newProtocolFeePercent
);
| emit ProtocolFeeChanged(
address(uint160(oldProtocolFee >> 96)),
_newProtocolFeeRecipient,
uint256(uint96(oldProtocolFee)),
_newProtocolFeePercent
);
| 21,082 |
23 | // require(prizeIds.length <= _prizeID, "DP1"); uint256 rewardAmt; for (uint256 i = 0; i < prizeIds.length; i++) {string memory prizeId = prizeIds[i]; rewardAmt += prizes[prizeId].rewardAmount; delete prizes[prizeId]; _prizeID--; } prizeVault.transfer(address(registrationVault), rewardAmt);emit PrizesDeleted(prizeIds,r... | 3,435 | ||
43 | // BaseCDPManager all common logic should be moved here in future / | abstract contract BaseCDPManager is ReentrancyGuard {
import "../helpers/ReentrancyGuard.sol";
import '../helpers/TransferHelper.sol';
import "../helpers/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
using SafeMath for uint;
IVault public immutable vault;
IVaultManagerParamete... | abstract contract BaseCDPManager is ReentrancyGuard {
import "../helpers/ReentrancyGuard.sol";
import '../helpers/TransferHelper.sol';
import "../helpers/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
using SafeMath for uint;
IVault public immutable vault;
IVaultManagerParamete... | 19,079 |
61 | // Transfer back un-sold tokens | if(amountRemaining > 0) {
require(
Token(tokens.tokenAddresses[tokenIndex]).transfer(msg.sender, amountRemaining),
"TotlePrimary - failed to transfer remaining tokens to msg.sender after sell"
);
}
| if(amountRemaining > 0) {
require(
Token(tokens.tokenAddresses[tokenIndex]).transfer(msg.sender, amountRemaining),
"TotlePrimary - failed to transfer remaining tokens to msg.sender after sell"
);
}
| 20,493 |
56 | // Exit the function once typehash has been located. | leave
| leave
| 37,194 |
13 | // Some old tokens are implemented without a retrun parameter (this was prior to the ERC20 standart change) | function transfer(address to, uint256 value) external;
function balanceOf(address who) external view returns (uint256);
| function transfer(address to, uint256 value) external;
function balanceOf(address who) external view returns (uint256);
| 37,879 |
116 | // Constructor/_exchange Address of the IExchangeCore exchange | constructor(
address _exchange,
address _weth
)
public
| constructor(
address _exchange,
address _weth
)
public
| 16,072 |
538 | // Get total delegation from a given address _delegator - delegator address / | function getTotalDelegatorStake(address _delegator)
external view returns (uint256)
| function getTotalDelegatorStake(address _delegator)
external view returns (uint256)
| 45,427 |
25 | // 残高の参照/_owner 保有者のアドレス/ return 残高数量 | function balanceOf(address _owner)
public
view
override
returns (uint256)
| function balanceOf(address _owner)
public
view
override
returns (uint256)
| 48,853 |
67 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. / | function increaseApproval(
address spender,
uint256 addedValue
)
public
virtual
returns (bool)
{
return super.increaseAllowance(spender, addedValue);
}
| function increaseApproval(
address spender,
uint256 addedValue
)
public
virtual
returns (bool)
{
return super.increaseAllowance(spender, addedValue);
}
| 26,958 |
24 | // Updates the logic contract for the SuperTokenFactory/This function updates the logic contract for the SuperTokenFactory/newAddress the new address of the SuperTokenFactory logic contract | function updateCode(address newAddress) external override {
if (msg.sender != address(_host)) {
revert SUPER_TOKEN_FACTORY_ONLY_HOST();
}
_updateCodeAddress(newAddress);
// Upgrade the Flow NFT logic contracts on the canonical proxies
// We only do this if the ne... | function updateCode(address newAddress) external override {
if (msg.sender != address(_host)) {
revert SUPER_TOKEN_FACTORY_ONLY_HOST();
}
_updateCodeAddress(newAddress);
// Upgrade the Flow NFT logic contracts on the canonical proxies
// We only do this if the ne... | 35,215 |
48 | // The account is only partially vaporizable using excess funds | else {
state.setParFromDeltaWei(
args.vaporAccount,
args.owedMarket,
excessWei
);
return (false, excessWei);
}
| else {
state.setParFromDeltaWei(
args.vaporAccount,
args.owedMarket,
excessWei
);
return (false, excessWei);
}
| 24,273 |
4 | // etherbots | (bool found, uint index) = getEtherbotsIndex(proto);
if (found) {
return uint16(380 + index);
}
| (bool found, uint index) = getEtherbotsIndex(proto);
if (found) {
return uint16(380 + index);
}
| 38,459 |
222 | // mint unsold to mintAmount | if (uniVars.mintToReserves > 0) {
yuan.mint(reservesContracts[0], uniVars.mintToReserves);
}
| if (uniVars.mintToReserves > 0) {
yuan.mint(reservesContracts[0], uniVars.mintToReserves);
}
| 14,320 |
89 | // Gets the token holder at the specified index. / | function tokenHolder(uint256 _index) accountReaderOnly constant returns (address) {
return allTokenHolders[_index];
}
| function tokenHolder(uint256 _index) accountReaderOnly constant returns (address) {
return allTokenHolders[_index];
}
| 38,945 |
0 | // https:docs.synthetix.io/contracts/source/interfaces/ifeepool | interface IFeePool {
// Views
// solhint-disable-next-line func-name-mixedcase
function FEE_ADDRESS() external view returns (address);
function feesAvailable(address account) external view returns (uint, uint);
function feePeriodDuration() external view returns (uint);
function isFeesClaimab... | interface IFeePool {
// Views
// solhint-disable-next-line func-name-mixedcase
function FEE_ADDRESS() external view returns (address);
function feesAvailable(address account) external view returns (uint, uint);
function feePeriodDuration() external view returns (uint);
function isFeesClaimab... | 19,792 |
217 | // settle vested BZRX only if needed | IVestingToken(vBZRX).claim();
| IVestingToken(vBZRX).claim();
| 40,214 |
96 | // Tracking mint status | bool private _paused = true;
| bool private _paused = true;
| 76,690 |
68 | // Events |
event Embark(address indexed sender, uint index, uint amount, uint amountAfterFee, uint timestamp);
event Disembark(uint start, uint end, bytes32 hash);
event Depart(uint batchNo,uint start,uint end,bytes32 hash);
event RemoveBatch(uint batchNo);
event DisputeBatch(uint batchNo, bytes32 hash);
e... |
event Embark(address indexed sender, uint index, uint amount, uint amountAfterFee, uint timestamp);
event Disembark(uint start, uint end, bytes32 hash);
event Depart(uint batchNo,uint start,uint end,bytes32 hash);
event RemoveBatch(uint batchNo);
event DisputeBatch(uint batchNo, bytes32 hash);
e... | 50,871 |
568 | // Expecting 60 bytes _extraData for stake delegation. | require(_extraData.length == 60, "Stake delegation data must be provided.");
address operator = _extraData.toAddress(20);
| require(_extraData.length == 60, "Stake delegation data must be provided.");
address operator = _extraData.toAddress(20);
| 7,069 |
7 | // OpenSea's Proxy Registry | IProxyRegistry public immutable proxyRegistry;
| IProxyRegistry public immutable proxyRegistry;
| 10,854 |
6 | // Adicionando um NFT aleatoriamente para uma carteira | buyers[msg.sender].push(random());
| buyers[msg.sender].push(random());
| 20,542 |
52 | // return leaf | function getLeaf() external view onlyOwner returns (LeafToken) {
return leaf;
}
| function getLeaf() external view onlyOwner returns (LeafToken) {
return leaf;
}
| 14,902 |
139 | // See {ERC20-_beforeTokenTransfer}. Requirements: - minted tokens must not cause the total supply to go over the cap. / | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) { // When minting tokens
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) { // When minting tokens
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
| 16,228 |
35 | // calculate the pending token rewards, use actual user stake rewards will be denoted in token decimals, not 1e18 | uint256 userTokenPending = userInfo[_pid][_user].staked.mul(poolInfo[_pid].accTokenPerShare).div(1e12).sub(userInfo[_pid][_user].tokenRewardDebt);
if (userTokenPending > 0) {
userInfo[_pid][_user].tokenClaimed = userInfo[_pid][_user].tokenClaimed.add(userTokenPending);
userInfo[_... | uint256 userTokenPending = userInfo[_pid][_user].staked.mul(poolInfo[_pid].accTokenPerShare).div(1e12).sub(userInfo[_pid][_user].tokenRewardDebt);
if (userTokenPending > 0) {
userInfo[_pid][_user].tokenClaimed = userInfo[_pid][_user].tokenClaimed.add(userTokenPending);
userInfo[_... | 30,200 |
359 | // Update liquidities | _updateLiqAmts(staker_address, liquidity, false);
emit WithdrawLocked(staker_address, liquidity, kek_id, destination_address);
| _updateLiqAmts(staker_address, liquidity, false);
emit WithdrawLocked(staker_address, liquidity, kek_id, destination_address);
| 17,918 |
298 | // Controller errors | string public constant LIST_SIZES_NOT_EQUAL = '36';
string public constant POOL_LIST_ALREADY_SET = '37';
string public constant POOL_ALREADY_LISTED = '38';
string public constant POOL_NOT_LISTED = '39';
string public constant CALLER_NOT_POOL = '40';
string public constant REWARDS_CASH_TOO_LOW = ... | string public constant LIST_SIZES_NOT_EQUAL = '36';
string public constant POOL_LIST_ALREADY_SET = '37';
string public constant POOL_ALREADY_LISTED = '38';
string public constant POOL_NOT_LISTED = '39';
string public constant CALLER_NOT_POOL = '40';
string public constant REWARDS_CASH_TOO_LOW = ... | 75,073 |
234 | // New position has been created./position The address of the user opening new position./collateralToken The token used as collateral for the created position. | event PositionCreated(address indexed position, IERC20 indexed collateralToken);
| event PositionCreated(address indexed position, IERC20 indexed collateralToken);
| 21,833 |
250 | // unsold tokens allocation oraclize gas limit | uint256 public unsoldAllocationOraclizeGasLimit = 2500000;
| uint256 public unsoldAllocationOraclizeGasLimit = 2500000;
| 24,242 |
89 | // assmble order parameters into Order struct./ return A list of orders. | function assembleOrders(
RingParams params,
TokenTransferDelegate delegate,
address[4][] addressList,
uint[6][] uintArgsList,
uint8[1][] uint8ArgsList,
bool[] buyNoMoreThanAmountBList
)
private
view
| function assembleOrders(
RingParams params,
TokenTransferDelegate delegate,
address[4][] addressList,
uint[6][] uintArgsList,
uint8[1][] uint8ArgsList,
bool[] buyNoMoreThanAmountBList
)
private
view
| 21,583 |
40 | // Enjin Team timelock | modifier safeTimelock() {
require(now >= endTime + 6 * 4 weeks);
_;
}
| modifier safeTimelock() {
require(now >= endTime + 6 * 4 weeks);
_;
}
| 41,455 |
42 | // user receives the amount + the srcReward | amountLD = amountSDtoLD(_s.amount.add(_s.eqReward));
_safeTransfer(token, _to, amountLD);
emit SwapRemote(_to, _s.amount.add(_s.eqReward), _s.protocolFee, _s.eqFee);
| amountLD = amountSDtoLD(_s.amount.add(_s.eqReward));
_safeTransfer(token, _to, amountLD);
emit SwapRemote(_to, _s.amount.add(_s.eqReward), _s.protocolFee, _s.eqFee);
| 33,750 |
20 | // Receives native currency, wraps it into WETH-like token and sends cross-chain | function sendNativeDeposit(
bytes32 salt,
address refundAddress,
string calldata destinationChain,
string calldata destinationAddress
| function sendNativeDeposit(
bytes32 salt,
address refundAddress,
string calldata destinationChain,
string calldata destinationAddress
| 9,963 |
14 | // toggle token invisibility | function toggleInvisible(uint256 tokenId) external {
require(ownerOf(tokenId) == _msgSender(), "Token owner only");
_invisibilities[tokenId] = !_invisibilities[tokenId];
}
| function toggleInvisible(uint256 tokenId) external {
require(ownerOf(tokenId) == _msgSender(), "Token owner only");
_invisibilities[tokenId] = !_invisibilities[tokenId];
}
| 28,142 |
4 | // approve the router to spend | inputToken.safeIncreaseAllowance(address(uniswapRouter), amount);
uint[] memory amounts = uniswapRouter.swapExactTokensForTokens(
amount,
minOutput,
path,
to,
deadline
);
| inputToken.safeIncreaseAllowance(address(uniswapRouter), amount);
uint[] memory amounts = uniswapRouter.swapExactTokensForTokens(
amount,
minOutput,
path,
to,
deadline
);
| 23,502 |
116 | // Creates `amount` tokens of token type `id`, and assigns them to `to`. | * Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
ui... | * Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
ui... | 2,012 |
284 | // check the period has rolled over first | rolloverFee(sender, lastTransferTimestamp[sender], state.balanceOf(sender));
| rolloverFee(sender, lastTransferTimestamp[sender], state.balanceOf(sender));
| 35,873 |
20 | // getABPrice This function wll call internal function _getABPrice that will calculate thecalculate the ABPrice based on current market conditions. It calculates only the unit price AB, not taking inconsideration the slippage. return ABPrice ABPrice is the unit price AB. Meaning how many units of B, buys 1 unit of A / | function getABPrice() external override view returns (uint256 ABPrice) {
return _getABPrice();
}
| function getABPrice() external override view returns (uint256 ABPrice) {
return _getABPrice();
}
| 56,874 |
30 | // Calculates sqrt(a), following the selected rounding direction. / | function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
uint256 result = sqrt(a);
if (rounding == Rounding.Up && result * result < a) {
result += 1;
}
return result;
}
| function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
uint256 result = sqrt(a);
if (rounding == Rounding.Up && result * result < a) {
result += 1;
}
return result;
}
| 18,593 |
154 | // want = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) | address constant public weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address constant public dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
address public cdp_manager = address(0x5ef30b9986345249bc32d8928B7ee64DE9435E39);
address public vat = address(0x35D1b3F3D7966A1DFe207aa... | address constant public weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address constant public dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
address public cdp_manager = address(0x5ef30b9986345249bc32d8928B7ee64DE9435E39);
address public vat = address(0x35D1b3F3D7966A1DFe207aa... | 43,989 |
12 | // ERC721 events/transfer event/from address transfer from/to address transfer to/tokenId NFT token ID to transfer | event Transfer(address from, address to, uint256 tokenId);
| event Transfer(address from, address to, uint256 tokenId);
| 50,910 |
62 | // returns the number of contributors in the list of contributors/ return count of contributors/As the `collectAll` function is called the contributor array is cleaned up/ consequently this method only returns the remaining contributor count. | function contributorCount() public view returns (uint) {
return contributors.length;
}
| function contributorCount() public view returns (uint) {
return contributors.length;
}
| 26,760 |
32 | // modifier for some action only admin or owner can do / | modifier onlyAdmins() {
require(msg.sender == owner || admins[msg.sender]);
_;
}
| modifier onlyAdmins() {
require(msg.sender == owner || admins[msg.sender]);
_;
}
| 62,264 |
15 | // Adds a country to countryList if the country is not in this list | if (campaignsByCountry[country].length == 0){
bytes2 countryCode;
assembly {
countryCode := mload(add(country, 32))
}
| if (campaignsByCountry[country].length == 0){
bytes2 countryCode;
assembly {
countryCode := mload(add(country, 32))
}
| 70,147 |
113 | // Emits a {BeneficiaryChanged} event. / | function setBeneficiary(address _beneficiary) public {
require(msg.sender == beneficiary, "TokenVestingWallet: only beneficiary");
require(_beneficiary != address(0), "TokenVestingWallet: beneficiary is zero address");
emit BeneficiaryChanged(beneficiary, _beneficiary);
beneficiary =... | function setBeneficiary(address _beneficiary) public {
require(msg.sender == beneficiary, "TokenVestingWallet: only beneficiary");
require(_beneficiary != address(0), "TokenVestingWallet: beneficiary is zero address");
emit BeneficiaryChanged(beneficiary, _beneficiary);
beneficiary =... | 30,857 |
487 | // ABI encode calldata for `fillOrder` | bytes memory fillOrderCalldata = abi.encodeWithSelector(
IExchange(address(0)).fillOrder.selector,
order,
takerAssetFillAmount,
signature
);
address exchange = address(EXCHANGE);
(bool didSucceed, bytes memory returnData) = exchange.call(f... | bytes memory fillOrderCalldata = abi.encodeWithSelector(
IExchange(address(0)).fillOrder.selector,
order,
takerAssetFillAmount,
signature
);
address exchange = address(EXCHANGE);
(bool didSucceed, bytes memory returnData) = exchange.call(f... | 37,168 |
32 | // in this case, the market is skewed long so its free to short. | if (longSupply > shortSupply) {
return (0, rateIsInvalid);
}
| if (longSupply > shortSupply) {
return (0, rateIsInvalid);
}
| 21,502 |
36 | // Set the arbitration price. Only callable by the owner._arbitrationPrice Amount to be paid for arbitration. / | function setArbitrationPrice(uint _arbitrationPrice) external onlyOwner {
arbitrationPrice = _arbitrationPrice;
}
| function setArbitrationPrice(uint _arbitrationPrice) external onlyOwner {
arbitrationPrice = _arbitrationPrice;
}
| 51,886 |
4 | // Basic. Deposit & Withdraw ERC721 from DSA. / | import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {DSMath} from "../../common/math.sol";
import {Basic} from "../../common/basic.sol";
import {Events} from "./events.sol";
abstract contract BasicResolver is Events, DSMath, Basic {
/**
* @dev Deposit Assets To Smart Account.
... | import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {DSMath} from "../../common/math.sol";
import {Basic} from "../../common/basic.sol";
import {Events} from "./events.sol";
abstract contract BasicResolver is Events, DSMath, Basic {
/**
* @dev Deposit Assets To Smart Account.
... | 25,955 |
147 | // jsons/toddlerpillars.json |
string constant _name = "Toddlerpillars";
string constant _symbol = "TDPL";
|
string constant _name = "Toddlerpillars";
string constant _symbol = "TDPL";
| 63,588 |
4 | // proposers | mapping(bytes32 => bool) internal addedProposal;
VotingStatus internal currentStatus;
| mapping(bytes32 => bool) internal addedProposal;
VotingStatus internal currentStatus;
| 48,299 |
0 | // All assets are stored with 4 decimal shift unless specified | uint128 public constant MO_DECIMALS = 10**4;
uint256 public constant RWA_DECIMALS = 10**12;
event RWAUnitCreated(uint256 indexed rWAUnitId);
event RWAUnitAddedUnitsForTokenId(
uint256 indexed rWAUnitId,
uint16 indexed tokenId,
uint64 units
);
event RWAUnitRedeemedUnitsFo... | uint128 public constant MO_DECIMALS = 10**4;
uint256 public constant RWA_DECIMALS = 10**12;
event RWAUnitCreated(uint256 indexed rWAUnitId);
event RWAUnitAddedUnitsForTokenId(
uint256 indexed rWAUnitId,
uint16 indexed tokenId,
uint64 units
);
event RWAUnitRedeemedUnitsFo... | 33,829 |
678 | // Calculate the max amount of fyTokens that can be bought from the pool without making the interest rate negative.See section 6.3 of the YieldSpace White paper baseReserves Base reserves amount fyTokenReserves fyToken reserves amount timeTillMaturity time till maturity in seconds ts time till maturity coefficient, mul... | function maxFYTokenOut(
uint128 baseReserves, uint128 fyTokenReserves,
uint128 timeTillMaturity, int128 ts, int128 g)
| function maxFYTokenOut(
uint128 baseReserves, uint128 fyTokenReserves,
uint128 timeTillMaturity, int128 ts, int128 g)
| 20,184 |
43 | // 读取个人信息 | function getUserById(uint256 _userId) view returns(string _name,uint256 _regTime,uint8 _identity,bool _enable, uint256[] _itemIds){
User memory user = indexToUser[_userId];
_name = user.name;
_regTime=user.regTime;
_identity=user.identity;
_enable=user.enable;
_item... | function getUserById(uint256 _userId) view returns(string _name,uint256 _regTime,uint8 _identity,bool _enable, uint256[] _itemIds){
User memory user = indexToUser[_userId];
_name = user.name;
_regTime=user.regTime;
_identity=user.identity;
_enable=user.enable;
_item... | 45,283 |
8 | // VERC MetaProxy construction via calldata. | function createProxy (
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _totalSupply,
bytes32 _domainSeparator
| function createProxy (
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _totalSupply,
bytes32 _domainSeparator
| 12,826 |
61 | // Internal function to withdraw funds from RariFund to `msg.sender` in exchange for REPT burned from `from`.Please note that you must approve RariFundManager to burn of the necessary amount of REPT. from The address from which REPT will be burned. amount The amount of tokens to be withdrawn.return Boolean indicating s... | function _withdrawFrom(address from, uint256 amount) internal fundEnabled cachePoolBalance returns (bool) {
// Input validation
require(amount > 0, "Withdrawal amount must be greater than 0.");
// Check contract balance of ETH and withdraw from pools if necessary
uint256 contractBal... | function _withdrawFrom(address from, uint256 amount) internal fundEnabled cachePoolBalance returns (bool) {
// Input validation
require(amount > 0, "Withdrawal amount must be greater than 0.");
// Check contract balance of ETH and withdraw from pools if necessary
uint256 contractBal... | 34,352 |
59 | // Returns how much a user could earn plus the giving block number. | function takeWithBlock() external override view returns (uint, uint) {
if(mintCumulation >= maxMintCumulation)
return (0, block.number);
(, , , uint amount) = _computeUserProduct();
return (amount, block.number);
}
| function takeWithBlock() external override view returns (uint, uint) {
if(mintCumulation >= maxMintCumulation)
return (0, block.number);
(, , , uint amount) = _computeUserProduct();
return (amount, block.number);
}
| 33,435 |
5 | // NFTs that have been withdrawn to the root chain | mapping (uint256 => bool) public withdrawnTokens;
| mapping (uint256 => bool) public withdrawnTokens;
| 29,442 |
4 | // The address in which the funds reserved for futuredevelopments are sent.They correspond to the % of the supply specified in the whitepaper. / | TokenVault immutable public RESERVED_FUNDS_VAULT;
| TokenVault immutable public RESERVED_FUNDS_VAULT;
| 14,381 |
14 | // Token Functions / | function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
| function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
| 69,846 |
42 | // Address of OneSplitAudit | address public immutable OneSplitAudit;
| address public immutable OneSplitAudit;
| 37,087 |
99 | // token The address of the token that will be removed from farming. / | function removeAllowableToken(address token) external;
| function removeAllowableToken(address token) external;
| 46,611 |
14 | // put in WAVAX, take out sAVAX | uint256 inAmount = ((wAvaxResTarget * (10_000 - windowPer10k)) /
1000 -
wAvaxRes);
uint256 outAmount = getAmountOut(inAmount, wAvaxRes, sAvaxRes);
if (
wAvaxBalance >= inAmount &&
sAvax.getPooledAvaxByShares(outAmount) ... | uint256 inAmount = ((wAvaxResTarget * (10_000 - windowPer10k)) /
1000 -
wAvaxRes);
uint256 outAmount = getAmountOut(inAmount, wAvaxRes, sAvaxRes);
if (
wAvaxBalance >= inAmount &&
sAvax.getPooledAvaxByShares(outAmount) ... | 2,837 |
3 | // Fees paid to the contract that have not yet been withdrawn | uint public contractFeesAccrued;
| uint public contractFeesAccrued;
| 30,949 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.