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 |
|---|---|---|---|---|
19 | // Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds.return A uint256 specifying the amount of tokens still available for the spender. / | function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 52,554 |
4 | // check return/returns | function getCampaigns() public view returns (Campaign[] memory) {
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for (uint i=0; i<numberOfCampaigns; i++) {
Campaign storage item = campaigns[i]; // memory or storage ??, campaigns is of type storage, so, ite... | function getCampaigns() public view returns (Campaign[] memory) {
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for (uint i=0; i<numberOfCampaigns; i++) {
Campaign storage item = campaigns[i]; // memory or storage ??, campaigns is of type storage, so, ite... | 5,816 |
1 | // MINTING LIMITS / | function allowedMintCount(address minter) public view returns (uint256) {
return MINT_LIMIT_PER_WALLET - mintCountMap[minter];
}
| function allowedMintCount(address minter) public view returns (uint256) {
return MINT_LIMIT_PER_WALLET - mintCountMap[minter];
}
| 1,312 |
5 | // We offset the load address by 21 byte (operation byte + 20 address bytes) | let value := mload(add(transactions, add(i, 0x15)))
| let value := mload(add(transactions, add(i, 0x15)))
| 26,413 |
21 | // head | rarities[7] = [243];
aliases[7] = [1];
| rarities[7] = [243];
aliases[7] = [1];
| 31,701 |
32 | // Based on the OpenZepplin ERC721 implementation, licensed under MIT | contract NFTImplementation is NFTState, Context, IERC721, IERC721Metadata, ERC165 {
using Address for address;
using Strings for uint256;
function initialize(
string memory name_,
string memory symbol_,
address owner_,
uint16 chainId_,
bytes32 nativeContract_
)... | contract NFTImplementation is NFTState, Context, IERC721, IERC721Metadata, ERC165 {
using Address for address;
using Strings for uint256;
function initialize(
string memory name_,
string memory symbol_,
address owner_,
uint16 chainId_,
bytes32 nativeContract_
)... | 74,663 |
0 | // How many seconds the user has to wait between initiating the transaction and finalizing the transaction. This cannot be changed. | uint delay;
address added_by;
uint time_added;
address removed_by;
uint time_removed;
| uint delay;
address added_by;
uint time_added;
address removed_by;
uint time_removed;
| 14,584 |
30 | // Only fall back when the sender is not the admin. / | function _willFallback() virtual override internal {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
//super._willFallback();
}
| function _willFallback() virtual override internal {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
//super._willFallback();
}
| 741 |
137 | // uint256 oddEth = wethAmount.sub(totalEthSwap); if (oddEth > 0) { weth.withdraw(oddEth); msg.sender.transfer(oddEth); emit OddEth(msg.sender, oddEth); } |
return (poolAmountOut, 0);
|
return (poolAmountOut, 0);
| 34,483 |
62 | // Internal transfer, can only be called by this contractfrom The sender of the tokens. to The recipient of the tokens. valueThe number of tokens to send. / | function _transfer(address from, address to, uint256 value) internal returns (bool) {
require(isAuthorised(to), "Target of transfer has not passed KYC");
require(from != address(0x0), "Cannot send tokens from null address");
require(to != address(0x0), "Cannot transfer tokens to null");
... | function _transfer(address from, address to, uint256 value) internal returns (bool) {
require(isAuthorised(to), "Target of transfer has not passed KYC");
require(from != address(0x0), "Cannot send tokens from null address");
require(to != address(0x0), "Cannot transfer tokens to null");
... | 7,207 |
26 | // LiquidationTriggerSimple Manages triggering of liquidation process / | abstract contract LiquidationTriggerBase {
using SafeMath for uint;
uint public constant DENOMINATOR_1E5 = 1e5;
uint public constant DENOMINATOR_1E2 = 1e2;
// vault manager parameters contract
VaultManagerParameters public immutable vaultManagerParameters;
uint public immutable oracleType;
... | abstract contract LiquidationTriggerBase {
using SafeMath for uint;
uint public constant DENOMINATOR_1E5 = 1e5;
uint public constant DENOMINATOR_1E2 = 1e2;
// vault manager parameters contract
VaultManagerParameters public immutable vaultManagerParameters;
uint public immutable oracleType;
... | 60,789 |
5 | // 0,000000000000001 | mapping(uint256 => ItemData) public items;
uint256 itemIndex;
event SupplyChainStep(
uint256 _itemIndex,
uint256 _step,
address _itemAddress
);
function createItem(string memory _identifier, uint256 _itemPrice)
| mapping(uint256 => ItemData) public items;
uint256 itemIndex;
event SupplyChainStep(
uint256 _itemIndex,
uint256 _step,
address _itemAddress
);
function createItem(string memory _identifier, uint256 _itemPrice)
| 30,660 |
4 | // ========================================================================================= //User-facing// ========================================================================================= //Mint xAssetCLR tokens by sending amount of inputAsset tokensamount of the other asset is auto-calculated / | function mint(uint8 inputAsset, uint256 amount)
external
notLocked(msg.sender)
whenNotPaused()
| function mint(uint8 inputAsset, uint256 amount)
external
notLocked(msg.sender)
whenNotPaused()
| 56,172 |
521 | // Returns the address of a valid Uniswap V3 Pool/factory The contract address of the Uniswap V3 factory/tokenA The contract address of either token0 or token1/tokenB The contract address of the other token/fee The fee collected upon every swap in the pool, denominated in hundredths of a bip/ return pool The V3 pool co... | function verifyCallback(
address factory,
address tokenA,
address tokenB,
uint24 fee
| function verifyCallback(
address factory,
address tokenA,
address tokenB,
uint24 fee
| 24,127 |
15 | // 1. verify price and not address(0) | require(payAmount >= amount, "Price issue");
| require(payAmount >= amount, "Price issue");
| 608 |
14 | // Triggered whenever approve(address _spender, uint256 _value) is called. | event Approval(address indexed _owner, address indexed _spender, uint256 _value);
| event Approval(address indexed _owner, address indexed _spender, uint256 _value);
| 27,524 |
272 | // Internal function to submit evidence for a dispute_disputeManager Dispute manager to be used_disputeId Id of the dispute in the Court_submitter Address of the account submitting the evidence_evidence Data submitted for the evidence related to the dispute/ | function _submitEvidence(IDisputeManager _disputeManager, uint256 _disputeId, address _submitter, bytes memory _evidence) internal {
IArbitrable subject = IArbitrable(msg.sender);
_disputeManager.submitEvidence(subject, _disputeId, _submitter, _evidence);
}
| function _submitEvidence(IDisputeManager _disputeManager, uint256 _disputeId, address _submitter, bytes memory _evidence) internal {
IArbitrable subject = IArbitrable(msg.sender);
_disputeManager.submitEvidence(subject, _disputeId, _submitter, _evidence);
}
| 69,032 |
103 | // 40 = 2.5% | uint8 private lpRewardDivisor = 40;
| uint8 private lpRewardDivisor = 40;
| 16,797 |
111 | // Assert that amount of tokens to be withdrawn is less than amount of tokens unlocked | require(amountOfTokens < getAmountOfTokensUnlockedForWithdrawal(block.timestamp));
| require(amountOfTokens < getAmountOfTokensUnlockedForWithdrawal(block.timestamp));
| 49,422 |
6 | // EVENTS // CONSTRUCTOR & INITIALIZATION // Initializes the contract with immutable variables _weth is the Wrapped Ether contract _usdc is the USDC contract _wsteth is the LDO contract _ldo is the LDO contract _oTokenFactory is the contract address for minting new opyn option types (strikes, asset, expiry) _gammaContr... | constructor(
address _weth,
address _usdc,
address _wsteth,
address _ldo,
address _oTokenFactory,
address _gammaController,
address _marginPool,
| constructor(
address _weth,
address _usdc,
address _wsteth,
address _ldo,
address _oTokenFactory,
address _gammaController,
address _marginPool,
| 71,048 |
38 | // Base exchange rate is set to 1 ETH = 325000 MNT. | uint256 public constant BASE_RATE = 325000;
| uint256 public constant BASE_RATE = 325000;
| 3,161 |
7 | // Start a new period needs corresponding permissions for sender / | function startNewPeriod() public virtual override nextPeriodAvailable periodsActive nonReentrant {
require(hasRole(CONTROLLER_ROLE, msg.sender), "ERR_CALLER");
_switchPeriod();
// Rate
IBTRates[getCurrentPeriodIndex()] = getIBTRate();
// Stream
scaledTotals[getCurrent... | function startNewPeriod() public virtual override nextPeriodAvailable periodsActive nonReentrant {
require(hasRole(CONTROLLER_ROLE, msg.sender), "ERR_CALLER");
_switchPeriod();
// Rate
IBTRates[getCurrentPeriodIndex()] = getIBTRate();
// Stream
scaledTotals[getCurrent... | 36,567 |
111 | // Emits a {Contribution} event. Parameters:- `amount` is amount to contribute/ | function contributeToken(uint256 amount) external nonReentrant whenNotPaused {
require(WETH != address(contributionToken), "invalid token");
uint256 cAmount = contributeInternal(amount);
contributionToken.safeTransferFrom(msg.sender, address(this), cAmount);
emit Contribution(msg.sen... | function contributeToken(uint256 amount) external nonReentrant whenNotPaused {
require(WETH != address(contributionToken), "invalid token");
uint256 cAmount = contributeInternal(amount);
contributionToken.safeTransferFrom(msg.sender, address(this), cAmount);
emit Contribution(msg.sen... | 41,719 |
210 | // Setter for arbitrationFeePerJuror._arbitrationFeePerJuror The fee which will be paid to each juror. / | function setArbitrationFeePerJuror(uint _arbitrationFeePerJuror) public onlyGovernor {
arbitrationFeePerJuror = _arbitrationFeePerJuror;
}
| function setArbitrationFeePerJuror(uint _arbitrationFeePerJuror) public onlyGovernor {
arbitrationFeePerJuror = _arbitrationFeePerJuror;
}
| 76,125 |
12 | // prevent price submission from being revealed twice | delete epochVoterHash[_epochId][_voter];
revealedPrices[_epochId][_voter] = _price;
| delete epochVoterHash[_epochId][_voter];
revealedPrices[_epochId][_voter] = _price;
| 27,316 |
85 | // Refund the highest bidder. | _refundHighestBid(listingId, listing);
| _refundHighestBid(listingId, listing);
| 30,914 |
0 | // Interface to NFT contract | interface wrappedcompanion{
////Interface to RCVR
function balanceOf(address owner) external view returns (uint256);
function tokenURI(uint256 tokenId ) external view returns (string memory);
function getArtApproval(uint _tokennumber,address _wallet)external view returns(bool);
function ownerOf(uint256 toke... | interface wrappedcompanion{
////Interface to RCVR
function balanceOf(address owner) external view returns (uint256);
function tokenURI(uint256 tokenId ) external view returns (string memory);
function getArtApproval(uint _tokennumber,address _wallet)external view returns(bool);
function ownerOf(uint256 toke... | 52,893 |
4 | // Remove oneself as a member of the community. | function leaveCommunity() public virtual { // Roles will check membership.
renounceMembership(COMMUNITY_ROLE_ID);
}
| function leaveCommunity() public virtual { // Roles will check membership.
renounceMembership(COMMUNITY_ROLE_ID);
}
| 7,720 |
76 | // freeze system' balance | function systemFreeze(uint256 _value, uint256 _unfreezeTime) internal {
uint256 unfreezeIndex = uint256(_unfreezeTime.parseTimestamp().year) * 10000 + uint256(_unfreezeTime.parseTimestamp().month) * 100 + uint256(_unfreezeTime.parseTimestamp().day);
balances[owner] = balances[owner].sub(_value);
... | function systemFreeze(uint256 _value, uint256 _unfreezeTime) internal {
uint256 unfreezeIndex = uint256(_unfreezeTime.parseTimestamp().year) * 10000 + uint256(_unfreezeTime.parseTimestamp().month) * 100 + uint256(_unfreezeTime.parseTimestamp().day);
balances[owner] = balances[owner].sub(_value);
... | 63,575 |
19 | // call the staking smart contract to init the epoch | epochs[epochId] = _getPoolSize(epochId);
| epochs[epochId] = _getPoolSize(epochId);
| 48,069 |
66 | // See OpenZeppelin ReentrancyGuard implementation | uint256 constant _NOT_ENTERED = 1;
uint256 constant _ENTERED = 2;
event PendingGovernorshipTransfer(
address indexed previousGovernor,
address indexed newGovernor
);
event GovernorshipTransferred(
address indexed previousGovernor,
| uint256 constant _NOT_ENTERED = 1;
uint256 constant _ENTERED = 2;
event PendingGovernorshipTransfer(
address indexed previousGovernor,
address indexed newGovernor
);
event GovernorshipTransferred(
address indexed previousGovernor,
| 5,146 |
73 | // Change game interval./ | function toogleInterval() internal {
uint256 interval = getCurrentInterval();
gameStartedAt += interval;
isFristInterval = !isFristInterval;
}
| function toogleInterval() internal {
uint256 interval = getCurrentInterval();
gameStartedAt += interval;
isFristInterval = !isFristInterval;
}
| 2,564 |
3,552 | // 1778 | entry "rememberingly" : ENG_ADVERB
| entry "rememberingly" : ENG_ADVERB
| 22,614 |
17 | // This event will be emitted every time the implementation gets upgradedversion representing the version name of the upgraded implementationimplementation representing the address of the upgraded implementation/ | event Upgraded(string version, address indexed implementation);
| event Upgraded(string version, address indexed implementation);
| 40,690 |
37 | // troves can only be created after the token owner has been set. This is a safety check not security | require(address(tokenOwner_cached) != address(0x0), "66c10 the token owner must be set");
require(tokenOwner_cached.owner() == address(this), "66c10 the token owner's owner must be the trove factory");
| require(address(tokenOwner_cached) != address(0x0), "66c10 the token owner must be set");
require(tokenOwner_cached.owner() == address(this), "66c10 the token owner's owner must be the trove factory");
| 20,525 |
26 | // import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IVoteToken} from "contracts/governance/interface/IVoteToken.sol"; | function stake(uint256 amount) external;
function unstake(uint256 amount) external;
function cooldown() external;
function withdraw(uint256 amount) external;
function claim() external;
| function stake(uint256 amount) external;
function unstake(uint256 amount) external;
function cooldown() external;
function withdraw(uint256 amount) external;
function claim() external;
| 13,692 |
7 | // Approve the MasterContract to transfer these BoringCryptoTokenScanner | lpToken.approve(address(chef), balance);
| lpToken.approve(address(chef), balance);
| 50,306 |
67 | // check that msg.value is higher than 0, don't really want to have to deal with minus in case the network breaks this somehow | if(allowedPaymentMethod(_payment_method) && canAcceptPayment(msg.value) ) {
uint256 contributed_value = msg.value;
uint256 amountOverCap = getValueOverCurrentCap(contributed_value);
if ( amountOverCap > 0 ) {
| if(allowedPaymentMethod(_payment_method) && canAcceptPayment(msg.value) ) {
uint256 contributed_value = msg.value;
uint256 amountOverCap = getValueOverCurrentCap(contributed_value);
if ( amountOverCap > 0 ) {
| 50,019 |
4 | // returns `2 ^ f` by calculating `e ^ (fln(2))`, where `e` is Euler's number:- Rewrite the input as a sum of binary exponents and a single residual r, as small as possible- The exponentiation of each binary exponent is given (pre-calculated)- The exponentiation of r is calculated via Taylor series for e^x, where x = r... | function exp2(Fraction memory f) internal pure returns (Fraction memory) {
uint256 x = MathEx.mulDivF(LN2, f.n, f.d);
uint256 y;
uint256 z;
uint256 n;
if (x >= (ONE << 4)) {
revert Overflow();
}
unchecked {
z = y = x % (ONE >> 3); // ... | function exp2(Fraction memory f) internal pure returns (Fraction memory) {
uint256 x = MathEx.mulDivF(LN2, f.n, f.d);
uint256 y;
uint256 z;
uint256 n;
if (x >= (ONE << 4)) {
revert Overflow();
}
unchecked {
z = y = x % (ONE >> 3); // ... | 22,940 |
57 | // only do real calculations if the windup time is over | uint256 realStart = start.add(batch.windup);
if ( block.timestamp > realStart )
{
| uint256 realStart = start.add(batch.windup);
if ( block.timestamp > realStart )
{
| 35,608 |
7 | // The block number when VXL mining starts. | uint256 public START_BLOCK;
| uint256 public START_BLOCK;
| 16,711 |
8 | // uint basePrice = 0.0005 ether; | uint basePrice = 0 ether;
return basePrice + (totalSupply * 0.000001 ether);
| uint basePrice = 0 ether;
return basePrice + (totalSupply * 0.000001 ether);
| 17,573 |
110 | // 2^x = 2^(floor(x))2^(x-floor(x)) ^^^^^^^^^^^^^^ is a bit shift of ceil(x) so Taylor expand on z = x-floor(x), z in [0, 1) | int shift;
int z;
if (x >= 0) {
shift = x / int(ONE);
z = x % int(ONE);
}
| int shift;
int z;
if (x >= 0) {
shift = x / int(ONE);
z = x % int(ONE);
}
| 20,465 |
23 | // Check if staker's balance is enough | require(
_amount < ftgToken.balanceOf(msg.sender),
"Insufficient FTG Balance"
);
| require(
_amount < ftgToken.balanceOf(msg.sender),
"Insufficient FTG Balance"
);
| 37,498 |
11 | // Get percentage of a total value totalAmount value equal to 100% of total quantity percentage percentage as integer i.e. 3 == 3% / | function getPercentageOf(uint256 totalAmount, uint256 percentage)
public view returns(uint256)
| function getPercentageOf(uint256 totalAmount, uint256 percentage)
public view returns(uint256)
| 28,454 |
9 | // Terminate flag | bool public terminated;
| bool public terminated;
| 4,878 |
4 | // Override to remove check that block exists / | function isDeposit(uint256 blockNum) public view returns (bool) {
return blockNum % childBlockInterval != 0;
}
| function isDeposit(uint256 blockNum) public view returns (bool) {
return blockNum % childBlockInterval != 0;
}
| 23,259 |
38 | // CelerIM Facet/LI.FI (https:li.fi)/Provides functionality for bridging tokens and data through CBridge/ @custom:version 1.0.1 | contract CelerIMFacet is ILiFi, ReentrancyGuard, SwapperV2, Validatable {
/// Storage ///
/// @dev The contract address of the cBridge Message Bus
IMessageBus private immutable cBridgeMessageBus;
/// @dev The contract address of the RelayerCelerIM
RelayerCelerIM private immutable relayer;
///... | contract CelerIMFacet is ILiFi, ReentrancyGuard, SwapperV2, Validatable {
/// Storage ///
/// @dev The contract address of the cBridge Message Bus
IMessageBus private immutable cBridgeMessageBus;
/// @dev The contract address of the RelayerCelerIM
RelayerCelerIM private immutable relayer;
///... | 21,573 |
106 | // The current and previous epoch | Epoch public currentEpoch;
Epoch public previousEpoch;
| Epoch public currentEpoch;
Epoch public previousEpoch;
| 38,081 |
16 | // Sets the system surplus buffer from 500k Dai to 2mm Dai | VowAbstract(MCD_VOW).file("hump", 2 * MILLION * RAD);
| VowAbstract(MCD_VOW).file("hump", 2 * MILLION * RAD);
| 45,510 |
9 | // require(_operator == deviceAgentAddress, "You are not authorized to register devices."); | roleMapping[_contract][uint(RBAC.OWNER)].add(_operator);
roleMapping[_contract][uint(RBAC.DEVICEAGENT)].add(_deviceAgent);
| roleMapping[_contract][uint(RBAC.OWNER)].add(_operator);
roleMapping[_contract][uint(RBAC.DEVICEAGENT)].add(_deviceAgent);
| 25,155 |
26 | // Mapping from withdrawal | mapping(uint8 => uint32) public withdrawalMode;
| mapping(uint8 => uint32) public withdrawalMode;
| 21,821 |
5 | // Lock the Swipe in the contract | swipe.transferFrom(msg.sender, address(this), _amount);
| swipe.transferFrom(msg.sender, address(this), _amount);
| 56,332 |
4 | // return The fee amount that will be collected from `value` when/ value is transferred to the contract | function calculateAnticSellFee(uint256 value)
external
view
returns (uint256);
| function calculateAnticSellFee(uint256 value)
external
view
returns (uint256);
| 16,280 |
96 | // get correct cbor output length | uint outputlen = 0;
bytes[] memory elemArray = new bytes[](arrlen);
for (uint i = 0; i < arrlen; i++) {
elemArray[i] = (bytes(arr[i]));
outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
}
| uint outputlen = 0;
bytes[] memory elemArray = new bytes[](arrlen);
for (uint i = 0; i < arrlen; i++) {
elemArray[i] = (bytes(arr[i]));
outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
}
| 49,406 |
229 | // Helper methods for integration with SaverExchange | contract ExchangeHelper is ConstantAddressesExchange {
using SafeERC20 for ERC20;
address public constant ZRX_ALLOWLIST_ADDR = 0x019739e288973F92bDD3c1d87178E206E51fd911;
/// @notice Swaps 2 tokens on the Saver Exchange
/// @dev ETH is sent with Weth address
/// @param _data [amount, minPrice, ex... | contract ExchangeHelper is ConstantAddressesExchange {
using SafeERC20 for ERC20;
address public constant ZRX_ALLOWLIST_ADDR = 0x019739e288973F92bDD3c1d87178E206E51fd911;
/// @notice Swaps 2 tokens on the Saver Exchange
/// @dev ETH is sent with Weth address
/// @param _data [amount, minPrice, ex... | 14,055 |
6 | // An array of list addresses. | address[] public lists;
| address[] public lists;
| 35,134 |
0 | // ========== STATE VARIABLES ========== // ========== Event ========== // ========== MODIFIERS ========== / | modifier onlyKeeper() {
require(msg.sender == keeper || msg.sender == owner(), "Qore: caller is not the owner or keeper");
_;
}
| modifier onlyKeeper() {
require(msg.sender == keeper || msg.sender == owner(), "Qore: caller is not the owner or keeper");
_;
}
| 12,226 |
23 | // slither-disable-next-line unused-return | Address.functionCallWithValue(deployedAddress, _initializeData, _value);
| Address.functionCallWithValue(deployedAddress, _initializeData, _value);
| 19,390 |
62 | // See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}; Requirements:- `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for ... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
| function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
| 21,488 |
84 | // if value of B is lower, users are incentivized to trade in B for A to make pool evenly balanced | _weightInOut[0] = currentWeightB();
_weightInOut[1] = currentWeightA();
_balanceInOut[0] = pooledBalanceB();
_balanceInOut[1] = pooledBalanceA();
_amountIn = _idealBUsd.sub(_debtBUsd).mul(10 ** providerB.getPriceFeedDecimals()).div(providerB.getPriceFeed());
... | _weightInOut[0] = currentWeightB();
_weightInOut[1] = currentWeightA();
_balanceInOut[0] = pooledBalanceB();
_balanceInOut[1] = pooledBalanceA();
_amountIn = _idealBUsd.sub(_debtBUsd).mul(10 ** providerB.getPriceFeedDecimals()).div(providerB.getPriceFeed());
... | 41,230 |
20 | // Conforms to ERC-1155 Standard / | function _beforeTokenTransfer(address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal override
| function _beforeTokenTransfer(address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal override
| 26,692 |
35 | // SmtPriceFeed Protofire Contract module to retrieve SMT price per asset. / | contract SmtPriceFeed is Ownable {
using SafeMath for uint256;
uint256 public constant decimals = 18;
uint256 public constant ONE = 10**18;
address public immutable WETH_ADDRESS;
/// @dev Address smt
address public smt;
/// @dev Address of BRegistry
IBRegistry public registry;
/// ... | contract SmtPriceFeed is Ownable {
using SafeMath for uint256;
uint256 public constant decimals = 18;
uint256 public constant ONE = 10**18;
address public immutable WETH_ADDRESS;
/// @dev Address smt
address public smt;
/// @dev Address of BRegistry
IBRegistry public registry;
/// ... | 13,039 |
174 | // Helper to decode the encoded call arguments for claiming rewards and swapping | function __decodeClaimRewardsAndSwapCallArgs(bytes memory _encodedCallArgs)
private
pure
returns (
bool useFullBalances_,
address incomingAsset_,
uint256 minIncomingAssetAmount_
)
| function __decodeClaimRewardsAndSwapCallArgs(bytes memory _encodedCallArgs)
private
pure
returns (
bool useFullBalances_,
address incomingAsset_,
uint256 minIncomingAssetAmount_
)
| 83,837 |
24 | // Script format errors/ 0x01: At least one of the source scripts is not a valid CBOR-encoded value. | SourceScriptNotCBOR,
| SourceScriptNotCBOR,
| 36,530 |
386 | // txAwareHashNotAllowed() | returns (address _wallet)
| returns (address _wallet)
| 42,742 |
5 | // set new message | message = _message;
return message;
| message = _message;
return message;
| 1,410 |
149 | // scope to remove the error Stack too deep | (uint _nthday,uint _daystoclose,uint _totalBonusToReceive,uint _dailyEarnings,uint _principalPmtDaily) = _deposits(_month,_amount,_interest);
uint _localid = allDeposits.length++;
| (uint _nthday,uint _daystoclose,uint _totalBonusToReceive,uint _dailyEarnings,uint _principalPmtDaily) = _deposits(_month,_amount,_interest);
uint _localid = allDeposits.length++;
| 63,295 |
27 | // i = 2h | mstore(i, mulmod(mload(h), 2, MODULUS))
mstore(add(i, 0x20), mulmod(mload(add(h, 0x20)), 2, MODULUS))
| mstore(i, mulmod(mload(h), 2, MODULUS))
mstore(add(i, 0x20), mulmod(mload(add(h, 0x20)), 2, MODULUS))
| 1,986 |
5 | // Returns the amount of tokens owned by `account`. / | function balanceOf(address account) external view returns (uint256);
| function balanceOf(address account) external view returns (uint256);
| 316 |
59 | // Returns the address that signed on the given block hash./blockHash The block hash that the validator signed data on. | function recoverSigner(Data memory self, bytes32 blockHash)
internal
pure
returns (address)
| function recoverSigner(Data memory self, bytes32 blockHash)
internal
pure
returns (address)
| 7,363 |
308 | // emit an ERC20 approval event to reflect the decrease | emit Approval(_from, msg.sender, _allowance);
| emit Approval(_from, msg.sender, _allowance);
| 49,886 |
6 | // Utility function that converts the msg.sender viewed in the L2 to the/ address in the L1 that submitted a tx to the inbox/l1Address L2 address as viewed in msg.sender/ return The address in the L1 that triggered the tx to L2 | function applyL1ToL2Alias(address l1Address) internal pure returns (address) {
return address(uint160(l1Address) + offset);
}
| function applyL1ToL2Alias(address l1Address) internal pure returns (address) {
return address(uint160(l1Address) + offset);
}
| 6,363 |
41 | // Adding the created proposal to the proposal queue | proposalQueue.push(proposal);
| proposalQueue.push(proposal);
| 52,650 |
144 | // removes a collateral from minting. Still allows withdrawals however | function removeCollateral(address collateral_)
external
oneLPGov
| function removeCollateral(address collateral_)
external
oneLPGov
| 60,943 |
3 | // Indicate that a `_party` won full custody._party The party that won full custody. / | event PartyWonCustody(address _party);
| event PartyWonCustody(address _party);
| 39,155 |
7 | // Subtract 256 bit number from 512 bit number | assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
| assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
| 17,476 |
81 | // event for token purchases loggingpurchaser who paid for the tokensvalue weis paid for purchasepurchaseDate time of log/ | event TokenPurchased(address indexed purchaser, uint256 value, uint256 purchaseDate);
| event TokenPurchased(address indexed purchaser, uint256 value, uint256 purchaseDate);
| 59,463 |
13 | // Scopes calls to an address, limited to specific function signatures, and per function scoping rules./Only callable by owner./role Role to set for./targetAddress Address to be scoped. | function scopeTarget(uint16 role, address targetAddress)
external
onlyOwner
| function scopeTarget(uint16 role, address targetAddress)
external
onlyOwner
| 28,210 |
124 | // generate the uniSwap pair path of token -> weth | address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniSwapRouter.WETH();
_approve(address(this), address(uniSwapRouter), tokenAmount);
| address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniSwapRouter.WETH();
_approve(address(this), address(uniSwapRouter), tokenAmount);
| 6,668 |
33 | // This is used to send tokens and execute code on other smart contract, this method is disabled if emergencyLock is activated_spender Contract that is receiving tokens_value The amount that msg.sender is sending_extraData Additional params that can be used on reciving smart contract return if successful returns true/ | function approveAndCall(address _spender, uint256 _value, bytes _extraData) lockAffected public returns (bool success) {
tokenRecipientInterface spender = tokenRecipientInterface(_spender);
approve(_spender, _value);
spender.receiveApproval(msg.sender, _value, this, _extraData);
retu... | function approveAndCall(address _spender, uint256 _value, bytes _extraData) lockAffected public returns (bool success) {
tokenRecipientInterface spender = tokenRecipientInterface(_spender);
approve(_spender, _value);
spender.receiveApproval(msg.sender, _value, this, _extraData);
retu... | 8,331 |
12 | // only if maturity has not arrived yet | IEURxb(_eurxb).removeMaturity(value, maturity);
| IEURxb(_eurxb).removeMaturity(value, maturity);
| 76,447 |
17 | // require(proposed_purchase.set,"There is no proposition !!!");We can check there is a proposition or not. | require(!proposed_purchase.approvedAccounts[msg.sender],"You've approved once.");
proposed_purchase.approval_state += 1;
proposed_purchase.approvedAccounts[msg.sender] = true; // Preventing more than once voting situation
| require(!proposed_purchase.approvedAccounts[msg.sender],"You've approved once.");
proposed_purchase.approval_state += 1;
proposed_purchase.approvedAccounts[msg.sender] = true; // Preventing more than once voting situation
| 34,789 |
31 | // require(_timeOfAuction[_saleId] >= block.timestamp,"Auction Over"); |
if (_tokenMeta[_saleId].currency != address(0)) {
IERC20(_tokenMeta[_saleId].currency).transferFrom(
msg.sender,
address(this),
_bidPrice
);
}
|
if (_tokenMeta[_saleId].currency != address(0)) {
IERC20(_tokenMeta[_saleId].currency).transferFrom(
msg.sender,
address(this),
_bidPrice
);
}
| 23,773 |
41 | // ensure that destination chain has enrolled router | bytes32 _router = _mustHaveRouter(_destination);
| bytes32 _router = _mustHaveRouter(_destination);
| 21,438 |
36 | // WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist.- `to` cannot be the zero address. Emits a {Transfer} event. / | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), 'A: you are stupid');
require(_rednecks[tokenId] == address(0), 'A: you are slowpoke');
_rednecks[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
| function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), 'A: you are stupid');
require(_rednecks[tokenId] == address(0), 'A: you are slowpoke');
_rednecks[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
| 6,805 |
27 | // 启动区块检测 异常的处理 | function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external {
if (isFunding) throw;
if (_fundingStartBlock >= _fundingStopBlock) throw;
if (block.number >= _fundingStartBlock) throw;
fundingStartBlock = _fundingStartBlock;
fundingStopBlock = _fundingStopBlock;
isFunding = true;
}
| function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external {
if (isFunding) throw;
if (_fundingStartBlock >= _fundingStopBlock) throw;
if (block.number >= _fundingStartBlock) throw;
fundingStartBlock = _fundingStartBlock;
fundingStopBlock = _fundingStopBlock;
isFunding = true;
}
| 39,658 |
3 | // operation -> ValidatorIndex | mapping(bytes32 => uint8) internal operationsByValidatorIndex;
mapping(uint8 => uint8) internal operationsCountByValidatorIndex;
| mapping(bytes32 => uint8) internal operationsByValidatorIndex;
mapping(uint8 => uint8) internal operationsCountByValidatorIndex;
| 4,289 |
231 | // oracle token price update term | uint256 public updateTokenPriceTerm = 120;
| uint256 public updateTokenPriceTerm = 120;
| 6,467 |
71 | // Clear metadata (if any) | if (bytes(tokenURIs[_tokenId]).length != 0) {
delete tokenURIs[_tokenId];
}
| if (bytes(tokenURIs[_tokenId]).length != 0) {
delete tokenURIs[_tokenId];
}
| 5,159 |
11 | // Find the length of the conversion path | uint256 len = 0;
for(; len < orderAddresses.length; len++) {
if(orderAddresses[len] == 0) {
break;
}
| uint256 len = 0;
for(; len < orderAddresses.length; len++) {
if(orderAddresses[len] == 0) {
break;
}
| 39,883 |
32 | // Constructors | constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
| constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
| 9,818 |
28 | // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such that denominatorinv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for four bits. That is, denominatorinv = 1 mod 2^4. | uint256 inverse = (3 * denominator) ^ 2;
| uint256 inverse = (3 * denominator) ^ 2;
| 53,714 |
176 | // log contribution event | LogContribution(
userAddress,
msg.sender,
msg.value,
totalRaised,
userAssignedTokens,
userId
);
| LogContribution(
userAddress,
msg.sender,
msg.value,
totalRaised,
userAssignedTokens,
userId
);
| 22,791 |
89 | // Next, work backwards and fill in the remaining gaps (proofPtr + 0x260) = proofOutputs[1].outputNotes[0].length (0xc0 + metadataLength) | mstore(add(proofPtr, 0x260), add(0xc0, metadataLength))
| mstore(add(proofPtr, 0x260), add(0xc0, metadataLength))
| 19,269 |
3 | // Tells the address of the COMP token in the Ethereum Mainnet. / | function compToken() public pure returns (ERC20) {
return ERC20(0xc00e94Cb662C3520282E6f5717214004A7f26888);
}
| function compToken() public pure returns (ERC20) {
return ERC20(0xc00e94Cb662C3520282E6f5717214004A7f26888);
}
| 2,562 |
29 | // _fromsource address_totarget address_value transfer amountreturn true if the transfer was successful, false if it wasn't/ | function _transfer(address _from, address _to, uint256 _value)
internal
returns (bool success)
| function _transfer(address _from, address _to, uint256 _value)
internal
returns (bool success)
| 22,886 |
23 | // Get the migration request. | function getMigrationRequest(uint256 _requestId) external view onlyOwner returns (RequestStateChange memory) {
return _requestMigrateToPublicStorage[_requestId];
}
| function getMigrationRequest(uint256 _requestId) external view onlyOwner returns (RequestStateChange memory) {
return _requestMigrateToPublicStorage[_requestId];
}
| 185 |
14 | // An array containing what is actively being voted on. | address[] activeVotes;
| address[] activeVotes;
| 51,197 |
0 | // An entry relating (tld, address) => {add, release, transfer} may modify thepermissions the address has inside this tld. By default, a user in this rolewill have no permissions over a given TLD unless the TLD has an entry for it,being the entry the one which enables the action by setting it to true. However, if the a... | bytes32 public domainRegistrantRole;
| bytes32 public domainRegistrantRole;
| 6,118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.