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 |
|---|---|---|---|---|
0 | // This variable should never be directly accessed by users of the library: interactions must be restricted to the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add this feature: see https:github.com/ethereum/solidity/issues/4637 | uint256 _value; // default: 0
| uint256 _value; // default: 0
| 1,720 |
159 | // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied to the value of the fees computed using the hedge curve Scaled by `BASE_PARAMS` | uint64 bonusMalusMint;
| uint64 bonusMalusMint;
| 70,895 |
0 | // stores to 0 slots | function std0() external pure {
RevertHelper.revertBytes(abi.encodeWithSelector(STORES, uint(0)));
}
| function std0() external pure {
RevertHelper.revertBytes(abi.encodeWithSelector(STORES, uint(0)));
}
| 13,146 |
149 | // Assignes a new NFT to an address. Use and override this function with caution. Wrong usage can have serious consequences. _to Address to wich we want to add the NFT. _tokenId Which NFT we want to add. / | function _addNFToken(
address _to,
uint256 _tokenId
)
internal
override
virtual
| function _addNFToken(
address _to,
uint256 _tokenId
)
internal
override
virtual
| 44,083 |
23 | // Update number of Lemon Tokens remaining for drop, just in case it is needed | function updateLemontokensRemainingToDrop() public {
lemonsRemainingToDrop = lemonContract.balanceOf(this);
}
| function updateLemontokensRemainingToDrop() public {
lemonsRemainingToDrop = lemonContract.balanceOf(this);
}
| 70,692 |
17 | // Emitted when a new reward borrow speed is calculated for a market | event RewardBorrowSpeedUpdated(
uint8 rewardType,
CToken indexed cToken,
uint256 newSpeed
);
event RewardAdded(uint8 rewardType, address newRewardAddress);
event RewardAddressChanged(
uint8 rewardType,
| event RewardBorrowSpeedUpdated(
uint8 rewardType,
CToken indexed cToken,
uint256 newSpeed
);
event RewardAdded(uint8 rewardType, address newRewardAddress);
event RewardAddressChanged(
uint8 rewardType,
| 14,125 |
94 | // | * @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* h... | * @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* h... | 15,204 |
76 | // Return the sell price of 1 individual token. | function sellPrice() public pure returns (uint256) {
uint256 _eth = 1e18;
uint256 _dividends = SafeMath.div(SafeMath.mul(_eth, exitFee_), 100);
uint256 _taxedeth = SafeMath.sub(_eth, _dividends);
return _taxedeth;
}
| function sellPrice() public pure returns (uint256) {
uint256 _eth = 1e18;
uint256 _dividends = SafeMath.div(SafeMath.mul(_eth, exitFee_), 100);
uint256 _taxedeth = SafeMath.sub(_eth, _dividends);
return _taxedeth;
}
| 7,666 |
35 | // Purchase function allows incoming payments when not paused - requires payment code | function purchase(bytes8 paymentCode) whenNotPaused public payable {
// Verify they have sent ETH in
require(msg.value != 0);
// Verify the payment code was included
require(paymentCode != 0);
// If payment from addresses are being enforced, ensure the code matches the sender address
if (en... | function purchase(bytes8 paymentCode) whenNotPaused public payable {
// Verify they have sent ETH in
require(msg.value != 0);
// Verify the payment code was included
require(paymentCode != 0);
// If payment from addresses are being enforced, ensure the code matches the sender address
if (en... | 24,782 |
10 | // 同态乘法(可能会溢出) | function HE_Mul(uint _c1, uint _c2) public view returns(uint){
return decrypto(LibSafeMathForUint256Utils.mul(_c1, _c2));
}
| function HE_Mul(uint _c1, uint _c2) public view returns(uint){
return decrypto(LibSafeMathForUint256Utils.mul(_c1, _c2));
}
| 38,556 |
20 | // Address of the NFT contract | address nftContract;
| address nftContract;
| 30,927 |
36 | // Total tokens should be more than user want's to buy | require(balances[owner]>safeMul(tokens, multiplier));
| require(balances[owner]>safeMul(tokens, multiplier));
| 9,964 |
30 | // 0x51: Insufficient consensus in tally precondition clause | InsufficientConsensus,
| InsufficientConsensus,
| 82,225 |
82 | // Let's a pply a fee to this tx | uint256 feeamount = _amount.mul(_fee).div(10000);
| uint256 feeamount = _amount.mul(_fee).div(10000);
| 76,422 |
0 | // Define 2 events, one for Adding, and other for Removing | event RetailerAdded(address indexed account);
event RetailerRemoved(address indexed account);
| event RetailerAdded(address indexed account);
event RetailerRemoved(address indexed account);
| 2,759 |
59 | // Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint256 the amount of tokens to be transferred / | function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
| function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
| 40,722 |
108 | // Utility; removes a prefix from a path. _path Path to remove the prefix from.return _unprefixedKey Unprefixed key. / | function _removeHexPrefix(
bytes memory _path
)
private
pure
returns (
bytes memory _unprefixedKey
)
| function _removeHexPrefix(
bytes memory _path
)
private
pure
returns (
bytes memory _unprefixedKey
)
| 26,495 |
8 | // Minute | dt.minute = getMinute(timestamp);
| dt.minute = getMinute(timestamp);
| 20,997 |
129 | // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. | assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
| assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
| 27,621 |
29 | // emitted when protocol fees are withdrawn tokenFees array of TokenFee structs indicating address of fee token and amount / | event FeesWithdrawn(TokenFee[3] tokenFees);
| event FeesWithdrawn(TokenFee[3] tokenFees);
| 37,282 |
201 | // determine if the public droptime has passed. if the feature is disabled then assume the time has passed./ | function publicDropTimePassed() public view returns(bool) {
if(enforcePublicDropTime == false) {
return true;
}
return block.timestamp >= publicDropTime;
}
| function publicDropTimePassed() public view returns(bool) {
if(enforcePublicDropTime == false) {
return true;
}
return block.timestamp >= publicDropTime;
}
| 14,275 |
67 | // users withdraw ether rather than have it directly sent to them _amount value of ether to withdraw / | function withdrawEther(uint256 _amount) external nonReentrant {
require(_etherBalance[msg.sender] >= _amount, 'Bal < amount');
(bool success, ) = msg.sender.call.value(_amount)("");
require(success, "Transfer failed.");
}
| function withdrawEther(uint256 _amount) external nonReentrant {
require(_etherBalance[msg.sender] >= _amount, 'Bal < amount');
(bool success, ) = msg.sender.call.value(_amount)("");
require(success, "Transfer failed.");
}
| 36,790 |
2 | // The eternal platform | IEternal public eternal;
| IEternal public eternal;
| 16,181 |
1 | // Event fired when new message is deployed // sets a new message / | function setMessage(string _newMessage) public {
message = _newMessage;
NewBud(_newMessage);
}
| function setMessage(string _newMessage) public {
message = _newMessage;
NewBud(_newMessage);
}
| 27,707 |
37 | // Hour | timestamp += HOUR_IN_SECONDS * (hour);
| timestamp += HOUR_IN_SECONDS * (hour);
| 16,229 |
131 | // Check what we received | address[] memory rewardTokens = supportedRewardTokens();
uint256[] memory rewardAmounts = new uint256[](rewardTokens.length);
uint256 receivedRewardTokensCount;
for(uint256 i = 0; i < rewardTokens.length; i++) {
address rtkn = rewardTokens[i];
uint256 newBalance =... | address[] memory rewardTokens = supportedRewardTokens();
uint256[] memory rewardAmounts = new uint256[](rewardTokens.length);
uint256 receivedRewardTokensCount;
for(uint256 i = 0; i < rewardTokens.length; i++) {
address rtkn = rewardTokens[i];
uint256 newBalance =... | 86,073 |
1,003 | // Get the settlement proposal challenge nonce of the given wallet and currency/wallet The address of the concerned wallet/currency The concerned currency/ return The settlement proposal nonce | function proposalNonce(address wallet, MonetaryTypesLib.Currency memory currency)
public
view
returns (uint256)
| function proposalNonce(address wallet, MonetaryTypesLib.Currency memory currency)
public
view
returns (uint256)
| 22,163 |
165 | // Claim API helpers / | function getClaimAmountForBlock() constant returns (uint) {
return CallLib.getClaimAmountForBlock(block.number);
}
| function getClaimAmountForBlock() constant returns (uint) {
return CallLib.getClaimAmountForBlock(block.number);
}
| 17,615 |
33 | // Thrown when Semaphore tree depth is not supported.//depth Passed tree depth. | error UnsupportedTreeDepth(uint8 depth);
| error UnsupportedTreeDepth(uint8 depth);
| 31,098 |
10 | // Throws if bounty status is not ongoing._bountyID The ID of the bounty./ | modifier bountyStatusOngoing(uint256 _bountyID) {
require(bountyList[_bountyID].status == BountyStatus.Ongoing);
_;
}
| modifier bountyStatusOngoing(uint256 _bountyID) {
require(bountyList[_bountyID].status == BountyStatus.Ongoing);
_;
}
| 17,991 |
405 | // There are six possible outcomes from this search:/ 1. The currency id is in the list/- it must be set to active, do nothing/- it must be set to inactive, shift suffix and concatenate/ 2. The current id is greater than the one in the search:/- it must be set to active, append to prefix and then concatenate the suffix... | while (suffix != 0x00) {
uint256 cid = uint256(uint16(bytes2(suffix) & Constants.UNMASK_FLAGS));
| while (suffix != 0x00) {
uint256 cid = uint256(uint16(bytes2(suffix) & Constants.UNMASK_FLAGS));
| 35,521 |
34 | // MasterChef is the master of OASIS. He can make OASIS and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once OASIS is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully ... | contract MasterChef is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 lastOasisPerShare; // Oasis per share on last update
... | contract MasterChef is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 lastOasisPerShare; // Oasis per share on last update
... | 52,972 |
5 | // function to get the Proof of existence for a file/ | function GetFileExistenceProof(address dappBoxOrigin,string memory fileHash, string memory filePathHash) public view returns(uint256,address,address,BlockchainIdentification,bytes32) {
for(uint i = 0 ; i < fileExistenceProofs[dappBoxOrigin].length ; i++)
{
bool res = compare... | function GetFileExistenceProof(address dappBoxOrigin,string memory fileHash, string memory filePathHash) public view returns(uint256,address,address,BlockchainIdentification,bytes32) {
for(uint i = 0 ; i < fileExistenceProofs[dappBoxOrigin].length ; i++)
{
bool res = compare... | 1,400 |
11 | // A record of rates, by index | mapping (uint32 => RateCheckpoint) public rateCheckpoints;
| mapping (uint32 => RateCheckpoint) public rateCheckpoints;
| 52,751 |
54 | // We require that the owner should be multisig walletBecause owner can make important decisions like stopping prefundand setting TransformAgentHowever this contract can be created by any account. After creationit automatically transfers ownership to multisig wallet | transferOwnership(multisig);
multisigWallet = multisig;
| transferOwnership(multisig);
multisigWallet = multisig;
| 43,029 |
10 | // Inits the agreement / | function init(
address payable _platformAddress,
address _link,
address _oracle,
address _tokenPaymentAddress,
address payable _brand,
address payable _influencer,
uint256 _endDate,
uint256 _payPerView,
| function init(
address payable _platformAddress,
address _link,
address _oracle,
address _tokenPaymentAddress,
address payable _brand,
address payable _influencer,
uint256 _endDate,
uint256 _payPerView,
| 50,186 |
149 | // The BRRR TOKEN! | FodToken public fod;
| FodToken public fod;
| 1,320 |
5 | // Creates new token with token ID specified and assigns an ownership `_to` for this tokenChecks if `_to` is a smart contract (code size > 0). If so, it calls `onERC721Received` on `_to` and throws if the return value is not `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.Should have a restricted... | function safeMint(address _to, uint256 _tokenId, bytes memory _data) external;
| function safeMint(address _to, uint256 _tokenId, bytes memory _data) external;
| 9,371 |
25 | // Function that is run as the first thing in the fallback function.Can be redefined in derived contracts to add functionality.Redefinitions must call super._willFallback(). / | function _willFallback() internal virtual {
}
| function _willFallback() internal virtual {
}
| 25,234 |
141 | // Safe traffick transfer function, just in case if rounding error causes pool to not have enough Trafficks. | function safeTraffickTransfer(address _to, uint256 _amount) internal {
uint256 traffickBal = traffick.balanceOf(address(this));
if (_amount > traffickBal) {
traffick.transfer(_to, traffickBal);
} else {
traffick.transfer(_to, _amount);
}
}
| function safeTraffickTransfer(address _to, uint256 _amount) internal {
uint256 traffickBal = traffick.balanceOf(address(this));
if (_amount > traffickBal) {
traffick.transfer(_to, traffickBal);
} else {
traffick.transfer(_to, _amount);
}
}
| 21,913 |
13 | // Sets the distribution reward rate. This will also update the poolInfo./_tokenPerSec The number of tokens to distribute per second | function setRewardRate(uint256 _tokenPerSec) external onlyOwner {
updatePool();
uint256 oldRate = tokenPerSec;
tokenPerSec = _tokenPerSec;
emit RewardRateUpdated(oldRate, _tokenPerSec);
}
| function setRewardRate(uint256 _tokenPerSec) external onlyOwner {
updatePool();
uint256 oldRate = tokenPerSec;
tokenPerSec = _tokenPerSec;
emit RewardRateUpdated(oldRate, _tokenPerSec);
}
| 31,687 |
8 | // _exchangeIdx The private data exchange index | function finishPrivateDataExchange(uint256 _exchangeIdx) external {
require(_exchangeIdx < privateDataExchanges.length, "invalid exchange index");
PrivateDataExchange storage exchange = privateDataExchanges[_exchangeIdx];
require(PrivateDataExchangeState.Accepted == exchange.state, "exchange... | function finishPrivateDataExchange(uint256 _exchangeIdx) external {
require(_exchangeIdx < privateDataExchanges.length, "invalid exchange index");
PrivateDataExchange storage exchange = privateDataExchanges[_exchangeIdx];
require(PrivateDataExchangeState.Accepted == exchange.state, "exchange... | 10,478 |
5 | // 募资 | CrowdFunding,
CrowdFundingSuccess,
CrowdFundingFail,
UnRepay,//待还款
RepaySuccess,
Overdue,
| CrowdFunding,
CrowdFundingSuccess,
CrowdFundingFail,
UnRepay,//待还款
RepaySuccess,
Overdue,
| 36,049 |
64 | // Checks whether the period in which the crowdsale is started.return Whether crowdsale period has started / | function hasStarted() public view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp < closingTime && block.timestamp >= openingTime;
}
| function hasStarted() public view returns (bool) {
// solium-disable-next-line security/no-block-members
return block.timestamp < closingTime && block.timestamp >= openingTime;
}
| 23,644 |
18 | // insert new bid | Bid memory newBid;
newBid.from = msg.sender;
newBid.amount = ethAmountbid;
auctionBids[auctionId].push(newBid);
payable(address(this)).transfer(msg.value);
| Bid memory newBid;
newBid.from = msg.sender;
newBid.amount = ethAmountbid;
auctionBids[auctionId].push(newBid);
payable(address(this)).transfer(msg.value);
| 8,840 |
58 | // Register a service contract whose activation is deferred by the service activation timeout/service The address of the service contract to be registered | function registerServiceDeferred(address service)
public
onlyDeployer
notNullOrThisAddress(service)
| function registerServiceDeferred(address service)
public
onlyDeployer
notNullOrThisAddress(service)
| 29,011 |
64 | // transfer total ETH of investors to owner | owner.transfer(sum);
| owner.transfer(sum);
| 35,049 |
133 | // Last claimed time | mapping(address => uint256) public lastClaimedTime;
| mapping(address => uint256) public lastClaimedTime;
| 40,448 |
209 | // Copied from OpenZeppelin https:github.com/OpenZeppelin/openzeppelin-contracts/blob/c3ae4790c71b7f53cc8fff743536dcb7031fed74/contracts/token/ERC1155/ERC1155.solL440 | function asSingletonArray(uint256 element)
private
pure
returns (uint256[] memory)
| function asSingletonArray(uint256 element)
private
pure
returns (uint256[] memory)
| 27,332 |
168 | // utility, checks whether allowance for the given spender exists and approves one if it doesn't. Note that we use the non standard erc-20 interface in which `approve` has no return value so that this function will work for both standard and non standard tokens_token token to check the allowance in_spender approved add... | function ensureAllowance(IERC20Token _token, address _spender, uint256 _value) private {
uint256 allowance = _token.allowance(address(this), _spender);
if (allowance < _value) {
if (allowance > 0)
safeApprove(_token, _spender, 0);
safeApprove(_token, _spender,... | function ensureAllowance(IERC20Token _token, address _spender, uint256 _value) private {
uint256 allowance = _token.allowance(address(this), _spender);
if (allowance < _value) {
if (allowance > 0)
safeApprove(_token, _spender, 0);
safeApprove(_token, _spender,... | 5,447 |
134 | // hasBeenLinked(): returns true if the point has ever been assigned keys | function hasBeenLinked(uint32 _point)
view
external
returns (bool result)
| function hasBeenLinked(uint32 _point)
view
external
returns (bool result)
| 39,077 |
162 | // Deposit LP tokens to Chef for TOKEN allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accTokenPerShare).div(1e12).sub(user.reward... | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accTokenPerShare).div(1e12).sub(user.reward... | 13,134 |
89 | // Check that proposal creator, owner or an admin is removing a proposal. | require(msg.sender == currentProposal.creator || msg.sender == _creator || _admins.contains(msg.sender));
| require(msg.sender == currentProposal.creator || msg.sender == _creator || _admins.contains(msg.sender));
| 10,811 |
36 | // Update the mappings | recipientToGiftIds[recipient].push(nextGiftId);
giftIdToGift[nextGiftId] =
Gift(true, nextGiftId, giver, recipient, expiry,
amtGiven, false, giverName, message, now);
uint giftId = nextGiftId;
| recipientToGiftIds[recipient].push(nextGiftId);
giftIdToGift[nextGiftId] =
Gift(true, nextGiftId, giver, recipient, expiry,
amtGiven, false, giverName, message, now);
uint giftId = nextGiftId;
| 46,014 |
552 | // all clear - calculate the max principal amount that can be liquidated | vars.maxPrincipalAmountToLiquidate = vars
.userCompoundedBorrowBalance
.mul(LIQUIDATION_CLOSE_FACTOR_PERCENT)
.div(100);
vars.actualAmountToLiquidate = _purchaseAmount > vars.maxPrincipalAmountToLiquidate
? vars.maxPrincipalAmountToLiquidate
:... | vars.maxPrincipalAmountToLiquidate = vars
.userCompoundedBorrowBalance
.mul(LIQUIDATION_CLOSE_FACTOR_PERCENT)
.div(100);
vars.actualAmountToLiquidate = _purchaseAmount > vars.maxPrincipalAmountToLiquidate
? vars.maxPrincipalAmountToLiquidate
:... | 7,151 |
0 | // to convert either to wei and the other way around | uint BIGNUMBER = 10**18;
| uint BIGNUMBER = 10**18;
| 38,577 |
126 | // team -> grantable | ethealToken.generateTokens(address(this), TOKEN_FOUNDERS.add(TOKEN_TEAM));
| ethealToken.generateTokens(address(this), TOKEN_FOUNDERS.add(TOKEN_TEAM));
| 32,314 |
5 | // Returns the donation information | function getDonation(uint256 _id) external view
returns (
uint256 _originalDonationId,
uint256 _donationId,
string _description,
uint256 _goal,
uint256 _raised,
uint256 _amount,
address _beneficiary,
address _donor,
| function getDonation(uint256 _id) external view
returns (
uint256 _originalDonationId,
uint256 _donationId,
string _description,
uint256 _goal,
uint256 _raised,
uint256 _amount,
address _beneficiary,
address _donor,
| 12,469 |
24 | // Set the WBTC-A stability fee Previous: 2% New: 4% | JugAbstract(mcd_jug931).DRIP219("WBTC-A"); // drip right before
JugAbstract(mcd_jug931).FILE40("WBTC-A", "duty", four_pct_rate701);
| JugAbstract(mcd_jug931).DRIP219("WBTC-A"); // drip right before
JugAbstract(mcd_jug931).FILE40("WBTC-A", "duty", four_pct_rate701);
| 30,409 |
45 | // Info of each user that stakes LP tokens. poolId => address => staker | mapping (uint256 => mapping (address => Staker)) public stakers;
| mapping (uint256 => mapping (address => Staker)) public stakers;
| 67,514 |
42 | // lock the address value, set the unlock time / | function lockedValuesAndTime(address target, uint256 lockedSupply, uint lockedTimes, uint unlockTime) internal onlyOwner returns (bool success) {
require(0x0 != target);
releasedBalance[target] = 0;
lockedBalance[target] = lockedSupply;
for (uint i = 0; i < lockedTimes; i++)... | function lockedValuesAndTime(address target, uint256 lockedSupply, uint lockedTimes, uint unlockTime) internal onlyOwner returns (bool success) {
require(0x0 != target);
releasedBalance[target] = 0;
lockedBalance[target] = lockedSupply;
for (uint i = 0; i < lockedTimes; i++)... | 68,458 |
256 | // Upper tick of the position | int24 upper;
| int24 upper;
| 38,618 |
75 | // https:docs.synthetix.io/contracts/source/interfaces/isynthetix | interface ISynthetix {
// Views
function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availableSynthCount() external view returns (uint);
function availableSynths(uint index) external ... | interface ISynthetix {
// Views
function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availableSynthCount() external view returns (uint);
function availableSynths(uint index) external ... | 13,057 |
0 | // Event emits after token minting / | event MintNTT(address indexed account, uint256 indexed tokenId, Metadata metadata);
| event MintNTT(address indexed account, uint256 indexed tokenId, Metadata metadata);
| 24,495 |
10 | // 0x08 id of precompiled bn256Pairing contract (checking the elliptic curve pairings) add(input, 0x20) since we have an unbounded array, the first 256 bits refer to its length mul(inputSize, 0x20) size of call parameters, each word is 0x20 bytes 0x20 size of result (one 32 byte boolean!) | success := staticcall(not(0), 0x08, add(input, 0x20), mul(inputSize, 0x20), result, 0x20)
| success := staticcall(not(0), 0x08, add(input, 0x20), mul(inputSize, 0x20), result, 0x20)
| 20,491 |
1 | // Fixed point scale / | uint256 internal constant FIXED_POINT_SCALE = 1e18;
| uint256 internal constant FIXED_POINT_SCALE = 1e18;
| 16,402 |
0 | // Set at contract creation and is not able to updated or changed | address public transactionsContract;
constructor(
QuicToken _Quic,
address _devaddr,
address _liquidityaddr,
address _comfundaddr,
address _founderaddr,
uint256 _rewardPerBlock,
uint256 _startBlock,
| address public transactionsContract;
constructor(
QuicToken _Quic,
address _devaddr,
address _liquidityaddr,
address _comfundaddr,
address _founderaddr,
uint256 _rewardPerBlock,
uint256 _startBlock,
| 13,706 |
1,147 | // Indicates that the contract is in the process of being initialized. / | bool private _initializing;
| bool private _initializing;
| 3,664 |
347 | // Called by owner to increase the LMSR parameter `b` by depositing base tokens. `b` uses same decimals as baseToken / | function increaseB(uint256 _b) external payable onlyOwner nonReentrant returns (uint256 amountIn) {
require(_b > b, "New b must be higher");
// increase b and calculate amount to be paid by owner
uint256 costBefore = lastCost;
b = _b;
lastCost = currentCumulativeCost();
... | function increaseB(uint256 _b) external payable onlyOwner nonReentrant returns (uint256 amountIn) {
require(_b > b, "New b must be higher");
// increase b and calculate amount to be paid by owner
uint256 costBefore = lastCost;
b = _b;
lastCost = currentCumulativeCost();
... | 7,529 |
18 | // 查询id | function getTransactionId(uint fromChainId, bytes memory txHash, address toToken, address recipient, uint256 amount) pure public returns (bytes32){
// 根据来源跨链交易生成唯一hash id,作为这笔跨链的id
bytes32 transactionId = keccak256(abi.encodePacked(fromChainId, txHash, toToken, recipient, amount));
return t... | function getTransactionId(uint fromChainId, bytes memory txHash, address toToken, address recipient, uint256 amount) pure public returns (bytes32){
// 根据来源跨链交易生成唯一hash id,作为这笔跨链的id
bytes32 transactionId = keccak256(abi.encodePacked(fromChainId, txHash, toToken, recipient, amount));
return t... | 9,969 |
25 | // use totalBurn for Record the number of burns | mapping (address => uint256) public balanceBurn;
| mapping (address => uint256) public balanceBurn;
| 19,625 |
13 | // Burn DAIPoints | _burn(msg.sender, _amount);
| _burn(msg.sender, _amount);
| 32,946 |
295 | // The list is not full yet.Just add the player to the list. | leaderBoardPlayers.push(_addressToUpdate);
addressToIsInLeaderboard[_addressToUpdate] = true;
isChanged = true;
| leaderBoardPlayers.push(_addressToUpdate);
addressToIsInLeaderboard[_addressToUpdate] = true;
isChanged = true;
| 17,406 |
3 | // This generates a public event on the blockchain | event Transfer(address indexed from, address indexed to, uint256 value);
event FundTransfer(address backer, uint amount, bool isContribution);
| event Transfer(address indexed from, address indexed to, uint256 value);
event FundTransfer(address backer, uint amount, bool isContribution);
| 50,377 |
7 | // Returns the message sender as address. _message ABI encoded Hyperlane message.return Sender of `_message` as address / | function senderAddress(bytes calldata _message)
internal
pure
returns (address)
| function senderAddress(bytes calldata _message)
internal
pure
returns (address)
| 25,181 |
200 | // MasterChef is the master of SDefo. He can make SDefo and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once SDEFO is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully ... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | 5,682 |
10 | // NOTE: this interface lacks return values for transfer/transferFrom/approve on purpose, as we use the SafeERC20 library to check the return value | interface GeneralERC20 {
function transfer(address to, uint256 amount) external;
function transferFrom(address from, address to, uint256 amount) external;
function approve(address spender, uint256 amount) external;
function balanceOf(address spender) external view returns (uint);
function allowance(address owner, ... | interface GeneralERC20 {
function transfer(address to, uint256 amount) external;
function transferFrom(address from, address to, uint256 amount) external;
function approve(address spender, uint256 amount) external;
function balanceOf(address spender) external view returns (uint);
function allowance(address owner, ... | 51,429 |
137 | // Validates that an interest collection does not exceed a maximum APY. If last collectionwas under 30 mins ago, simply check it does not exceed 10bps _newSupply New total supply of the mAsset _interestIncrease in total supply since last collection _timeSinceLastCollection Seconds since last collection / | function validateCollection(
uint256 _newSupply,
uint256 _interest,
uint256 _timeSinceLastCollection
| function validateCollection(
uint256 _newSupply,
uint256 _interest,
uint256 _timeSinceLastCollection
| 38,494 |
0 | // Set in case the core contract is broken and an upgrade is required | address public newContractAddress;
event Mint(address _to, uint256 attack, uint256 defend, uint256 rank, uint256 _tokenId);
event UpdateSkill(uint256 _id, uint256 _attack, uint256 _defend, uint256 _rank);
| address public newContractAddress;
event Mint(address _to, uint256 attack, uint256 defend, uint256 rank, uint256 _tokenId);
event UpdateSkill(uint256 _id, uint256 _attack, uint256 _defend, uint256 _rank);
| 26,686 |
146 | // View function to see pending SUMMAs on frontend. | function pendingSumma(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSummaPerShare = pool.accSummaPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingSumma(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSummaPerShare = pool.accSummaPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 68,179 |
1 | // enum GoodsStatus | uint16 constant internal None = 0;
uint16 constant internal Available = 1;
uint16 constant internal Canceled = 2;
| uint16 constant internal None = 0;
uint16 constant internal Available = 1;
uint16 constant internal Canceled = 2;
| 40,206 |
54 | // Delight와 DPlay 교역소는 모든 토큰을 전송할 수 있습니다. | msg.sender == delightItemManager ||
msg.sender == dplayTradingPost;
| msg.sender == delightItemManager ||
msg.sender == dplayTradingPost;
| 21,596 |
16 | // no need to check lid, wrapTokenX, wrapTokenY because core will revert unenough deposit and this contract will not save any token(including eth) theorily so we donot care that some one will steal token from this contract | uint256 actualLimX = _recvTokenFromUser(tokenX, tokenXIsWrap, addParam.xLim);
uint256 actualLimY = _recvTokenFromUser(tokenY, tokenYIsWrap, addParam.yLim);
delete isMintOrAddLiquidity;
ILiquidityManager.AddLiquidityParam memory actualParam = addParam;
actualParam.xLim = uint128(a... | uint256 actualLimX = _recvTokenFromUser(tokenX, tokenXIsWrap, addParam.xLim);
uint256 actualLimY = _recvTokenFromUser(tokenY, tokenYIsWrap, addParam.yLim);
delete isMintOrAddLiquidity;
ILiquidityManager.AddLiquidityParam memory actualParam = addParam;
actualParam.xLim = uint128(a... | 26,712 |
6 | // the TRIBE token contract | ITribe public override tribe;
| ITribe public override tribe;
| 73,720 |
175 | // Private function to add a token to this extension's token tracking data structures. tokenId uint256 ID of the token to be added to the tokens list / | function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
| function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
| 142 |
159 | // fetch the rate and treat is as current, so inverse limits if frozen will always be applied regardless of current rate | (rates[i], times[i]) = _getRateAndTimestampAtRound(currencyKey, roundId);
if (roundId == 0) {
| (rates[i], times[i]) = _getRateAndTimestampAtRound(currencyKey, roundId);
if (roundId == 0) {
| 26,073 |
18 | // Emitted when the ownership is transferred. | event OwnershipTransferred(address indexed from, address indexed to);
| event OwnershipTransferred(address indexed from, address indexed to);
| 3,693 |
2 | // All type hashes have this format: (bytes calldata, address sender, uint256 nonce, uint256 deadline). | bytes32 structHash = keccak256(
abi.encode(typeHash, keccak256(_calldata()), msg.sender, getNextNonce(user), deadline)
);
_ensureValidSignature(user, structHash, _signature(), deadline, errorCode);
| bytes32 structHash = keccak256(
abi.encode(typeHash, keccak256(_calldata()), msg.sender, getNextNonce(user), deadline)
);
_ensureValidSignature(user, structHash, _signature(), deadline, errorCode);
| 12,218 |
26 | // Emit an event to notify listeners of the withdrawal | emit WithdrawFunds(projectId, msg.sender, amount);
| emit WithdrawFunds(projectId, msg.sender, amount);
| 206 |
13 | // if the new size is smaller, removed array elements will be cleared | m_pairsOfFlags.length = newSize;
| m_pairsOfFlags.length = newSize;
| 27,062 |
54 | // Interface for Bank NFT | interface I_TokenBank {
function Mint(uint8, address) external; //amount, to
function totalSupply() external view returns (uint256);
function setApprovalForAll(address, bool) external; //address, operator
function transferFrom(address, address, uint256) external;
function ownerOf(uint256) ext... | interface I_TokenBank {
function Mint(uint8, address) external; //amount, to
function totalSupply() external view returns (uint256);
function setApprovalForAll(address, bool) external; //address, operator
function transferFrom(address, address, uint256) external;
function ownerOf(uint256) ext... | 75,033 |
312 | // Increase the boost total proportionately. | totalFeiBoosted += feiAmount;
| totalFeiBoosted += feiAmount;
| 71,868 |
0 | // key is the cToken address, value is the priceFeed address | mapping(address => address) priceFeeds;
event NewPriceFeed(address cToken, address oldPriceFeed, address newPriceFeed);
| mapping(address => address) priceFeeds;
event NewPriceFeed(address cToken, address oldPriceFeed, address newPriceFeed);
| 40,789 |
193 | // update loan end time | loanLocal.endTimestamp = loanLocal.endTimestamp
.add(maxDuration);
uint256 interestAmountRequired = loanLocal.endTimestamp
.sub(block.timestamp);
interestAmountRequired = interestAmountRequired
.mul(loanInterestLocal.owedPerDay);
interestAmountRequire... | loanLocal.endTimestamp = loanLocal.endTimestamp
.add(maxDuration);
uint256 interestAmountRequired = loanLocal.endTimestamp
.sub(block.timestamp);
interestAmountRequired = interestAmountRequired
.mul(loanInterestLocal.owedPerDay);
interestAmountRequire... | 15,634 |
97 | // See {ERC20-_burn} and {ERC20-allowance}. / | function burnFrom(address _account, uint256 _amount) public virtual {
uint256 decreasedAllowance = allowance(_account, msg.sender).sub(_amount, "ERC20: burn amount exceeds allowance");
_approve(_account, msg.sender, decreasedAllowance);
_burn(_account, _amount);
_moveDelegates(_deleg... | function burnFrom(address _account, uint256 _amount) public virtual {
uint256 decreasedAllowance = allowance(_account, msg.sender).sub(_amount, "ERC20: burn amount exceeds allowance");
_approve(_account, msg.sender, decreasedAllowance);
_burn(_account, _amount);
_moveDelegates(_deleg... | 36,635 |
13 | // 1. player mints a base character NFT/ TODO add whitelist | function mintGenesis(uint256 _donation) external {
require(dlc.balanceOf(msg.sender) >= 10e18, "mintGenesisCharacter: Love balance is not enough");
BaseCharacterStorage.Layout storage bcs = BaseCharacterStorage.layout();
/// @dev player can only mint 1
// require(erc.holderTokens[msg.sender].length(... | function mintGenesis(uint256 _donation) external {
require(dlc.balanceOf(msg.sender) >= 10e18, "mintGenesisCharacter: Love balance is not enough");
BaseCharacterStorage.Layout storage bcs = BaseCharacterStorage.layout();
/// @dev player can only mint 1
// require(erc.holderTokens[msg.sender].length(... | 19,889 |
147 | // The NOVA TOKEN! | NovaToken public nova;
| NovaToken public nova;
| 49,815 |
24 | // helper function to transfer the ownership of a video's tokenId./ Only accessible to trusted contracts./_from address which you want to send the token from./_to address which you want to transfer the token to./_tokenId uint256 ID of the token of the video to be transferred. | function transferVideoTrusted(
address _from,
address _to,
uint256 _tokenId)
public
whenNotPaused
| function transferVideoTrusted(
address _from,
address _to,
uint256 _tokenId)
public
whenNotPaused
| 44,286 |
4 | // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators). | mapping(address => bool) private _defaultOperators;
| mapping(address => bool) private _defaultOperators;
| 6,293 |
192 | // GalacticApes Extends ERC721 Non-Fungible Token Standard basic implementation / | contract vagagagga is ERC721Enumerable, Ownable {
using Strings for uint256;
using Address for address;
struct Conf {
bool mintEnabled;
uint8 perMint;
uint16 perAccount;
uint16 supply;
uint16 maxApes;
uint64 price;
}
address private controller;
u... | contract vagagagga is ERC721Enumerable, Ownable {
using Strings for uint256;
using Address for address;
struct Conf {
bool mintEnabled;
uint8 perMint;
uint16 perAccount;
uint16 supply;
uint16 maxApes;
uint64 price;
}
address private controller;
u... | 12,128 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.