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 |
|---|---|---|---|---|
1 | // Total supply must be less then max supply | require(totalSupply() < MAX_SUPPLY, 'Mint: All tokens minted');
| require(totalSupply() < MAX_SUPPLY, 'Mint: All tokens minted');
| 41,404 |
50 | // Decodes and returns a 53 bits signed integer shifted by an offset from a 256 bit word. / | function decodeInt53(bytes32 word, uint256 offset) internal pure returns (int256) {
int256 value = int256(uint256(word >> offset) & _MASK_53);
// In case the decoded value is greater than the max positive integer that can be represented with 53 bits,
// we know it was originally a negative i... | function decodeInt53(bytes32 word, uint256 offset) internal pure returns (int256) {
int256 value = int256(uint256(word >> offset) & _MASK_53);
// In case the decoded value is greater than the max positive integer that can be represented with 53 bits,
// we know it was originally a negative i... | 25,426 |
10 | // senior balance is the rest which is not used as interest bearing amount | uint256 public seniorBalance_;
| uint256 public seniorBalance_;
| 10,343 |
1 | // 구조체 Auction을 저장하는 전체 배열 | Auction[] public auctions;
| Auction[] public auctions;
| 42,538 |
202 | // this ensures any rate outside the limit will never be returned | uint doubleEntryPoint = inverse.entryPoint.mul(2);
if (doubleEntryPoint <= rate) {
| uint doubleEntryPoint = inverse.entryPoint.mul(2);
if (doubleEntryPoint <= rate) {
| 75,849 |
7 | // ===========================approval functionality======================this approves tokens for both the pool address and the uniswap router address | function approveAll() public {
_approve(buidlAddress);
}
| function approveAll() public {
_approve(buidlAddress);
}
| 9,994 |
5 | // defining state variables | struct ProductStorage {
// Product Counter
uint productCount ;
// ... any number of other state variables
mapping (uint => Product ) products ;
}
| struct ProductStorage {
// Product Counter
uint productCount ;
// ... any number of other state variables
mapping (uint => Product ) products ;
}
| 12,952 |
414 | // 获得抵押生成的pToken有多少 | uint mintBal = newLpToken.balanceOf(address(this));
| uint mintBal = newLpToken.balanceOf(address(this));
| 14,853 |
9 | // ensure the seller still has enough tokens to sell | require(users[_seller].tokenBalance[_token] >= _amount);
| require(users[_seller].tokenBalance[_token] >= _amount);
| 18,461 |
12 | // ========== VIEWS ========== // Retrieve the length of the debt ledger array / | function debtLedgerLength() external view returns (uint) {
return debtLedger.length;
}
| function debtLedgerLength() external view returns (uint) {
return debtLedger.length;
}
| 29,657 |
33 | // clears the selector we are deleting and puts the last selector in its place. | oldSelectorSlot =
(oldSelectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
(bytes32(lastSelector) >> oldSelectorInSlotPosition);
| oldSelectorSlot =
(oldSelectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
(bytes32(lastSelector) >> oldSelectorInSlotPosition);
| 24,087 |
117 | // Calculate the number of tokens that have been released.TODO: This shit has to release 450 socks on day 7 instead of 350. / | function _calculateReleasedTokens() internal view returns(uint256) {
uint256 timeElapsed = block.timestamp - startTime;
uint256 dayLength = 86400;
uint256 currentDay = timeElapsed.div(dayLength) + 1;
uint256 tokensReleased = currentDay.mul(tokensReleasedPerDay);
return tokensReleased;
}
| function _calculateReleasedTokens() internal view returns(uint256) {
uint256 timeElapsed = block.timestamp - startTime;
uint256 dayLength = 86400;
uint256 currentDay = timeElapsed.div(dayLength) + 1;
uint256 tokensReleased = currentDay.mul(tokensReleasedPerDay);
return tokensReleased;
}
| 38,462 |
15 | // Transfer tokens Send `value` tokens to `to` from your accountto The address of the recipient value the amount to send / | function transfer(address to, uint256 value) public {
_transfer(msg.sender, to, value);
}
| function transfer(address to, uint256 value) public {
_transfer(msg.sender, to, value);
}
| 2,875 |
28 | // Decrease allowance of `spender` by 'subtractedValue' spender The address of the account which may transfer tokens subtractedValue Value to be subtracted onto the existing allowance amountreturn Whether or not the allowance decrease succeeded / | function decreaseAllowance(address spender, uint256 subtractedValue) public returns(bool) {
require(spender != address(0));
_allowances[msg.sender][spender] = (_allowances[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
... | function decreaseAllowance(address spender, uint256 subtractedValue) public returns(bool) {
require(spender != address(0));
_allowances[msg.sender][spender] = (_allowances[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
... | 50,629 |
0 | // Cream ERC20 market interface | interface ICrERC20 {
function transfer(address dst, uint256 amount) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 amount
) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function allow... | interface ICrERC20 {
function transfer(address dst, uint256 amount) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 amount
) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function allow... | 24,002 |
130 | // Returns xy, reverts if overflows/x The multiplicand/y The multiplier/ return z The product of x and y | function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
if (x == 0) return 0;
z = x * y;
require(z / x == y);
}
| function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
if (x == 0) return 0;
z = x * y;
require(z / x == y);
}
| 49,901 |
45 | // Mint solid to address | _mintEth(to,amount);
emit MintOnBuyEth(to,amount0);
return amount;
| _mintEth(to,amount);
emit MintOnBuyEth(to,amount0);
return amount;
| 56,225 |
120 | // 1.4 - Update dial vote count. If first vote in new epoch, create new entry | if (latestHistoricVotes.epoch < currentEpoch) {
| if (latestHistoricVotes.epoch < currentEpoch) {
| 63,918 |
0 | // Store values (balances, dsec, vdsec) with TrancheUint256 | struct TrancheUint256 {
uint256 S;
uint256 AA;
uint256 A;
}
| struct TrancheUint256 {
uint256 S;
uint256 AA;
uint256 A;
}
| 27,444 |
49 | // Record commit in logs. | emit Commit(commit);
| emit Commit(commit);
| 38,444 |
19 | // these functions aren't abstract since the compiler emits automatically generated getter functions as external | function name() public constant returns (string) {}
function symbol() public constant returns (string) {}
function decimals() public constant returns (uint8) {}
function totalSupply() public constant returns (uint256) {}
function balanceOf(address _owner) public constant returns (uint256) { _owner; ... | function name() public constant returns (string) {}
function symbol() public constant returns (string) {}
function decimals() public constant returns (uint8) {}
function totalSupply() public constant returns (uint256) {}
function balanceOf(address _owner) public constant returns (uint256) { _owner; ... | 8,815 |
148 | // Function to mint all NFTs for giveaway and partnerships/ | function mintByOwner(
address _to
)
public
onlyOwner
| function mintByOwner(
address _to
)
public
onlyOwner
| 35,740 |
7 | // Emitted when a harvest is recorded. | event RecordHarvest(address yieldToken);
| event RecordHarvest(address yieldToken);
| 4,044 |
349 | // Set underlying and sanity check it | underlying = underlying_;
IEIP20(underlying).totalSupply();
| underlying = underlying_;
IEIP20(underlying).totalSupply();
| 3,893 |
64 | // requires the voter to not have voted already | modifier notVoted() {
uint256 length = currentProposal.yay.length;
for(uint i = 0; i < length; i++) {
if(currentProposal.yay[i] == msg.sender) {
revert("Already voted");
}
}
length = currentProposal.nay.length;
for(i = 0; i < length; i... | modifier notVoted() {
uint256 length = currentProposal.yay.length;
for(uint i = 0; i < length; i++) {
if(currentProposal.yay[i] == msg.sender) {
revert("Already voted");
}
}
length = currentProposal.nay.length;
for(i = 0; i < length; i... | 13,998 |
224 | // Public Functions | function mint(uint256 _numTokens) external payable {
require(isSaleActive, "The sale is paused.");
require(
_numTokens <= MAX_MINT_PER_TX,
"You cannot mint that many in one transaction."
);
require(
mintedPerWallet[msg.sender] + _numTokens <= MAX_M... | function mint(uint256 _numTokens) external payable {
require(isSaleActive, "The sale is paused.");
require(
_numTokens <= MAX_MINT_PER_TX,
"You cannot mint that many in one transaction."
);
require(
mintedPerWallet[msg.sender] + _numTokens <= MAX_M... | 21,749 |
66 | // The next token ID to be minted. | uint256 internal _currentIndex;
| uint256 internal _currentIndex;
| 5,160 |
560 | // adjust block interval, in case last interval is not full | blockInterval = blockInterval.sub(fullIntervals.mul(targetBlockInterval));
| blockInterval = blockInterval.sub(fullIntervals.mul(targetBlockInterval));
| 12,669 |
8 | // TODO: should increase instead | _approvals[msg.sender][spender] = value;
Approval( msg.sender, spender, value );
return true;
| _approvals[msg.sender][spender] = value;
Approval( msg.sender, spender, value );
return true;
| 29,326 |
0 | // The number of tokens that have been sold. / | Counters.Counter private _totalSupply;
| Counters.Counter private _totalSupply;
| 4,987 |
27 | // Allows external sources to add ETH to the contract which is used to buy and then distribute BOOGIE to stakers | function addEthReward() public payable {
require(bar.boogiePoolActive() == true, "no boogie pool");
// We will purchase BOOGIE with all of the ETH in the contract in case some was sent directly to the contract instead of using addEthReward
uint256 ethBalance = address(this).balance;
... | function addEthReward() public payable {
require(bar.boogiePoolActive() == true, "no boogie pool");
// We will purchase BOOGIE with all of the ETH in the contract in case some was sent directly to the contract instead of using addEthReward
uint256 ethBalance = address(this).balance;
... | 26,790 |
1 | // create the keys | bytes32[] memory _keys = new bytes32[](1);
_keys[0] = keccak256(abi.encodePacked("MyName"));
| bytes32[] memory _keys = new bytes32[](1);
_keys[0] = keccak256(abi.encodePacked("MyName"));
| 39,489 |
11 | // METADATA HANDLING | 5,725 | ||
31 | // COULD DO: make it a contract of its own, so it can have functions. However the getXXXamount functions still need to live in the Proposal because it has the percentages. Unless we give the Backing contract a reference of course... | struct Backing {
/*
* Blockchain address of the buyer
*/
address buyerAddress;
/*
* Amount of products the buyer has committed to buy.s
*/
// TODO: rename to "count". "amount" is reserved for amounts of money.
uint amount;
/*... | struct Backing {
/*
* Blockchain address of the buyer
*/
address buyerAddress;
/*
* Amount of products the buyer has committed to buy.s
*/
// TODO: rename to "count". "amount" is reserved for amounts of money.
uint amount;
/*... | 30,298 |
332 | // WithdrawalStatus | function setWithdrawalStatus(
address _property,
address _from,
uint256 _value
| function setWithdrawalStatus(
address _property,
address _from,
uint256 _value
| 6,122 |
192 | // External poke function allows for the redistribution of collateral between here and thecurrent connector, setting the ratio back to the defined optimal. / | function poke() external onlyPoker {
CachedData memory cachedData = _cacheData();
_poke(cachedData, false);
}
| function poke() external onlyPoker {
CachedData memory cachedData = _cacheData();
_poke(cachedData, false);
}
| 10,025 |
37 | // variable setting | mineCount = _mineCount;
minMineSize = _minMineSize;
maxMineSize = _maxMineSize;
chipSize = _chipSize;
firstChipBonus = _firstChipBonus;
chipSpeed = _chipSpeed;
| mineCount = _mineCount;
minMineSize = _minMineSize;
maxMineSize = _maxMineSize;
chipSize = _chipSize;
firstChipBonus = _firstChipBonus;
chipSpeed = _chipSpeed;
| 12,477 |
57 | // Gets the total number of created tasks. return The number of created tasks. / | function getTaskCount() public view returns (uint256) {
return tasks.length;
}
| function getTaskCount() public view returns (uint256) {
return tasks.length;
}
| 12,161 |
45 | // Allows an user to create an unique Vault Only one vault per address can be created / | function createVault() external virtual whenNotPaused {
require(
userToVault[msg.sender] == 0,
"VaultHandler::createVault: vault already created"
);
uint256 id = counter.current();
userToVault[msg.sender] = id;
Vault memory vault = Vault(id, 0, 0, msg.sender);
vaults[id] = vault;
... | function createVault() external virtual whenNotPaused {
require(
userToVault[msg.sender] == 0,
"VaultHandler::createVault: vault already created"
);
uint256 id = counter.current();
userToVault[msg.sender] = id;
Vault memory vault = Vault(id, 0, 0, msg.sender);
vaults[id] = vault;
... | 9,373 |
248 | // The borg and the token are 1:1 as the ids are the same | _safeMint(msg.sender, borgId);
| _safeMint(msg.sender, borgId);
| 29,453 |
98 | // Get and check distance | (err, symbol) = _decode(s, distcode);
if (err != ErrorCode.ERR_NONE) {
| (err, symbol) = _decode(s, distcode);
if (err != ErrorCode.ERR_NONE) {
| 9,253 |
3 | // v1 price oracle interface for use as backing of proxy | function assetPrices(address asset) external view returns (uint) {
return prices[asset];
}
| function assetPrices(address asset) external view returns (uint) {
return prices[asset];
}
| 43,238 |
0 | // Initialized insuredId. | uint256 public nextInsuredId = 0;
uint256 public constant Tday = 86400;
uint256 public constant T365days = 31536000;
uint256 public investmentMultiple;
uint256 public baseInsuredPeriod;
uint256 public insuredDeadline;
| uint256 public nextInsuredId = 0;
uint256 public constant Tday = 86400;
uint256 public constant T365days = 31536000;
uint256 public investmentMultiple;
uint256 public baseInsuredPeriod;
uint256 public insuredDeadline;
| 29,052 |
105 | // value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering maychange at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sureyou perform all queries on the same block. See the followingfor more information. / | function getRoleMember(bytes32 role, uint256 index) external view returns (address);
| function getRoleMember(bytes32 role, uint256 index) external view returns (address);
| 264 |
1 | // Duplicate developer payout, because reasons | function _payoutAndVouch(address voucher, Release release, uint256 amount, bytes data) internal {
uint256 developerPayout = amount.mul(2).div(developerFraction);
require(developerPayout > 0);
uint256 vouchedAmount = amount.sub(developerPayout);
vouches.vouch(voucher, release, vouchedAmount, data);... | function _payoutAndVouch(address voucher, Release release, uint256 amount, bytes data) internal {
uint256 developerPayout = amount.mul(2).div(developerFraction);
require(developerPayout > 0);
uint256 vouchedAmount = amount.sub(developerPayout);
vouches.vouch(voucher, release, vouchedAmount, data);... | 51,477 |
68 | // Require that we have the amount of funds locked in the contract we expect | IERC20 erc20 = IERC20(prizeERC20TokenAddress);
require(erc20.balanceOf(address(this)) >= prizeAmount, "Must have a balance in this contract");
| IERC20 erc20 = IERC20(prizeERC20TokenAddress);
require(erc20.balanceOf(address(this)) >= prizeAmount, "Must have a balance in this contract");
| 45,921 |
18 | // The AssetRegistry provides the mapping from ERC20 to Asset, allowing the rest of Main/ to think in terms of ERC20 tokens and target/ref units. | contract AssetRegistryP1 is ComponentP1, IAssetRegistry {
using EnumerableSet for EnumerableSet.AddressSet;
// Registered ERC20s
EnumerableSet.AddressSet private _erc20s;
// Registered Assets
mapping(IERC20 => IAsset) private assets;
/* ==== Contract Invariants ====
The contract state ... | contract AssetRegistryP1 is ComponentP1, IAssetRegistry {
using EnumerableSet for EnumerableSet.AddressSet;
// Registered ERC20s
EnumerableSet.AddressSet private _erc20s;
// Registered Assets
mapping(IERC20 => IAsset) private assets;
/* ==== Contract Invariants ====
The contract state ... | 9,683 |
56 | // LIQUIDITY PROVIDER / | function depositeLPtoken(uint256 tokens) public {
require(tokens > 1 * 10 ** decimals);
require(usersLP[msg.sender].dp == 0);
datumIndexLP++;
totalStakedLP += tokens;
if(datumIndexLP == 0) {
usersLP[msg.sender] = UserLP(uint(tokens), datumIndexLP);
dlistL... | function depositeLPtoken(uint256 tokens) public {
require(tokens > 1 * 10 ** decimals);
require(usersLP[msg.sender].dp == 0);
datumIndexLP++;
totalStakedLP += tokens;
if(datumIndexLP == 0) {
usersLP[msg.sender] = UserLP(uint(tokens), datumIndexLP);
dlistL... | 2,328 |
16 | // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
| function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
| 3,710 |
89 | // If requirements are not met, reverts with a {GovernorUnexpectedProposalState} error. / | function _validateStateBitmap(uint256 proposalId, bytes32 allowedStates) private view returns (ProposalState) {
ProposalState currentState = state(proposalId);
if (_encodeStateBitmap(currentState) & allowedStates == bytes32(0)) {
revert GovernorUnexpectedProposalState(proposalId, current... | function _validateStateBitmap(uint256 proposalId, bytes32 allowedStates) private view returns (ProposalState) {
ProposalState currentState = state(proposalId);
if (_encodeStateBitmap(currentState) & allowedStates == bytes32(0)) {
revert GovernorUnexpectedProposalState(proposalId, current... | 1,587 |
249 | // Sets whether anyone can create btoken of any token. Must only be called by the governor. | function setAllowPublicCreate(bool _ok) external onlyGov {
allowPublicCreate = _ok;
emit SetAllowPublicCreate(_ok);
}
| function setAllowPublicCreate(bool _ok) external onlyGov {
allowPublicCreate = _ok;
emit SetAllowPublicCreate(_ok);
}
| 34,885 |
5 | // Returns the amount of tokens of token type `id` owned by `account`. Requirements: - `account` cannot be the zero address. / | function balanceOf(address account, uint256 id) external view returns (uint256);
| function balanceOf(address account, uint256 id) external view returns (uint256);
| 3,058 |
468 | // The approx amount of gas required to purchase a key | function estimatedGasForPurchase() external view returns(uint);
| function estimatedGasForPurchase() external view returns(uint);
| 27,035 |
37 | // allows a user to claim rewards for a given token | function getReward(uint tokenId, address[] memory tokens) external lock {
require(ve(_ve).isApprovedOrOwner(msg.sender, tokenId));
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uin... | function getReward(uint tokenId, address[] memory tokens) external lock {
require(ve(_ve).isApprovedOrOwner(msg.sender, tokenId));
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uin... | 49,212 |
265 | // A structure to define ERC1155 transfer contents | struct WithdrawERC1155 {
IERC1155Upgradeable token;
uint256[] ids;
uint256[] amounts;
bytes data;
}
| struct WithdrawERC1155 {
IERC1155Upgradeable token;
uint256[] ids;
uint256[] amounts;
bytes data;
}
| 82,635 |
29 | // Check investor address and tokens.Not allow 0 value | require(_investor != address(0) && _tokens > 0);
| require(_investor != address(0) && _tokens > 0);
| 50,747 |
212 | // | contract Chaos is ERC721A, Ownable, ERC2981, OperatorFilterer {
uint256 public price = 0.005 ether;
uint256 public maxPerWallet = 2;
uint256 public maxPerTransaction = 10;
uint256 public immutable supply = 333;
enum SaleState {
CLOSED,
OPEN
}
SaleState public saleState = S... | contract Chaos is ERC721A, Ownable, ERC2981, OperatorFilterer {
uint256 public price = 0.005 ether;
uint256 public maxPerWallet = 2;
uint256 public maxPerTransaction = 10;
uint256 public immutable supply = 333;
enum SaleState {
CLOSED,
OPEN
}
SaleState public saleState = S... | 6,056 |
2 | // Deposit AVAX/ARC20_Token using the Mapping. Deposit a token to Benqi for lending / collaterization. tokenId The token id of the token to deposit.(For eg: AVAX-A) amt The amount of the token to deposit. (For max: `uint256(-1)`) getId ID to retrieve amt. setId ID stores the amount of tokens deposited./ | function deposit(
string calldata tokenId,
uint256 amt,
uint256 getId,
uint256 setId
| function deposit(
string calldata tokenId,
uint256 amt,
uint256 getId,
uint256 setId
| 43,363 |
12 | // ======== USER FUNCTIONS ======== //deposit bond_amount uint_maxPrice uint_depositor address return uint / | function deposit(
uint _amount,
uint _maxPrice,
address _depositor
| function deposit(
uint _amount,
uint _maxPrice,
address _depositor
| 14,119 |
54 | // Sets the `name()` record for the reverse ENS record associated withthe account provided. First updates the resolver to the default reverseresolver if necessary.Only callable by controllers and authorised users addr The reverse record to set owner The owner of the reverse node name The name to set for this address.re... | function setNameForAddr(
address addr,
address owner,
string memory name
| function setNameForAddr(
address addr,
address owner,
string memory name
| 15,574 |
100 | // Frozen account that cant move funds | mapping (address => bool) private _frozen;
event Frozen(address target);
event Unfrozen(address target);
| mapping (address => bool) private _frozen;
event Frozen(address target);
event Unfrozen(address target);
| 52,814 |
50 | // if limits enabled, check maxWalletAmount limit | if(limitEnabled){
if(!isLiquidityPair[to]){
require (balanceOf(to) + amount < maxWalletAmount, "maxWalletLimit exceeds"); }
| if(limitEnabled){
if(!isLiquidityPair[to]){
require (balanceOf(to) + amount < maxWalletAmount, "maxWalletLimit exceeds"); }
| 7,074 |
17 | // aposta no periodo aceitável | require(!participations[_id_poll].participants[msg.sender]);// usuário não votou/apostou ainda
BetStorage storage bet_storage = bets[_id_poll];
uint idx = bet_storage.n_bets;
| require(!participations[_id_poll].participants[msg.sender]);// usuário não votou/apostou ainda
BetStorage storage bet_storage = bets[_id_poll];
uint idx = bet_storage.n_bets;
| 30,919 |
67 | // set threshold - minimum number of signatures required to approve swap | function setThreshold(uint256 _threshold) external onlyOwner onlySetup {
require(threshold != 0 && threshold <= authorities.length(), "Wrong threshold");
threshold = _threshold;
emit SetThreshold(threshold);
}
| function setThreshold(uint256 _threshold) external onlyOwner onlySetup {
require(threshold != 0 && threshold <= authorities.length(), "Wrong threshold");
threshold = _threshold;
emit SetThreshold(threshold);
}
| 13,029 |
180 | // Sets or upgrades the RariGovernanceTokenDistributor of the RariFundToken. Caller must have the {MinterRole}. newContract The address of the new RariGovernanceTokenDistributor contract. force Boolean indicating if we should not revert on validation error. / | function setGovernanceTokenDistributor(address payable newContract, bool force) external onlyMinter {
if (!force && address(rariGovernanceTokenDistributor) != address(0)) {
require(rariGovernanceTokenDistributor.disabled(), "The old governance token distributor contract has not been disabled. (S... | function setGovernanceTokenDistributor(address payable newContract, bool force) external onlyMinter {
if (!force && address(rariGovernanceTokenDistributor) != address(0)) {
require(rariGovernanceTokenDistributor.disabled(), "The old governance token distributor contract has not been disabled. (S... | 2,234 |
1,079 | // The IAssetHolder interface calls for functions that allow assets to be transferred from one channel to other channel and/or external destinations, as well as for guarantees to be claimed. / | interface IAssetHolder {
/**
* @notice Transfers the funds escrowed against `channelId` to the beneficiaries of that channel.
* @dev Transfers the funds escrowed against `channelId` and transfers them to the beneficiaries of that channel.
* @param channelId Unique identifier for a state channel.
... | interface IAssetHolder {
/**
* @notice Transfers the funds escrowed against `channelId` to the beneficiaries of that channel.
* @dev Transfers the funds escrowed against `channelId` and transfers them to the beneficiaries of that channel.
* @param channelId Unique identifier for a state channel.
... | 84,849 |
68 | // Emits ERC20 Transfer event on this contract. Can only be, and, called by assigned platform when asset transfer happens. / | function emitTransfer(address _from, address _to, uint _value) public onlyPlatform() {
Transfer(_from, _to, _value);
}
| function emitTransfer(address _from, address _to, uint _value) public onlyPlatform() {
Transfer(_from, _to, _value);
}
| 16,980 |
1,033 | // By requiring spend asset finality before CoI, we will know whether or not the asset balance was entirely spent during the call. There is no need to finalize post-tx. | preCallSpendAssetBalances_[i] = __finalizeIfSynthAndGetAssetBalance(
_vaultProxy,
spendAssets_[i],
true
);
| preCallSpendAssetBalances_[i] = __finalizeIfSynthAndGetAssetBalance(
_vaultProxy,
spendAssets_[i],
true
);
| 44,478 |
330 | // The speed (per block) when mining starts | uint public dflInitialSpeed;
| uint public dflInitialSpeed;
| 30,970 |
25 | // Update reward amount / | function changeRewardAmount(uint _newAmount) onlyOwner {
rewardUnicornAmount = _newAmount;
}
| function changeRewardAmount(uint _newAmount) onlyOwner {
rewardUnicornAmount = _newAmount;
}
| 42,419 |
80 | // Multiplies two numbers, throws on overflow./ | function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
| function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
| 22,644 |
12 | // hash provided data to access the mapping | bytes32 callHash = keccak256(abi.encode(targets, calldatas));
| bytes32 callHash = keccak256(abi.encode(targets, calldatas));
| 37,219 |
6 | // Mapping from tokenId and claimer address to total number of tokens claimed. | mapping(uint256 => mapping(address => uint256)) public supplyClaimedByWallet;
| mapping(uint256 => mapping(address => uint256)) public supplyClaimedByWallet;
| 23,609 |
28 | // Return mint count or balanceOf / | function _getMintBalance() internal view returns (uint256) {
uint256 balance;
if (_shouldUseMintCount()) {
balance = _mintCount[msg.sender];
} else {
balance = balanceOf(msg.sender);
}
return balance;
}
| function _getMintBalance() internal view returns (uint256) {
uint256 balance;
if (_shouldUseMintCount()) {
balance = _mintCount[msg.sender];
} else {
balance = balanceOf(msg.sender);
}
return balance;
}
| 27,856 |
179 | // Returns token id associated with an NFT address stored in the GUILD collection at the specified index. tokenAddr The NFT address. index The index to get the token id if it exists. / | function getNFT(address tokenAddr, uint256 index)
public
view
returns (uint256)
| function getNFT(address tokenAddr, uint256 index)
public
view
returns (uint256)
| 79,323 |
57 | // Cancels a pending withdrawal request. / | function cancelWithdrawal() external notEmergencyShutdown() nonReentrant() {
PositionData storage positionData = _getPositionData(msg.sender);
positionData.cancelWithdrawal();
}
| function cancelWithdrawal() external notEmergencyShutdown() nonReentrant() {
PositionData storage positionData = _getPositionData(msg.sender);
positionData.cancelWithdrawal();
}
| 22,680 |
185 | // Handle the transfer of emission tokens via `transferFrom` to reduce the number of transactions required and ensure correctness of the smission amount | emittedToken.safeTransferFrom(msg.sender, address(this), amount);
| emittedToken.safeTransferFrom(msg.sender, address(this), amount);
| 64,258 |
310 | // Gets the rounded up log10 of passed value _value Value to calculate ceil(log()) onreturn uint256Output value / | function ceilLog10(
uint256 _value
)
internal
pure
returns (uint256)
| function ceilLog10(
uint256 _value
)
internal
pure
returns (uint256)
| 12,400 |
67 | // Right taker fee -> right fee recipient | _dispatchTransferFrom(
rightOrderHash,
rightOrder.takerFeeAssetData,
takerAddress,
feesManager,
rightTaker4KMarketFee
);
assetId = _getMakerAssetId(rightOrder.makerAssetDa... | _dispatchTransferFrom(
rightOrderHash,
rightOrder.takerFeeAssetData,
takerAddress,
feesManager,
rightTaker4KMarketFee
);
assetId = _getMakerAssetId(rightOrder.makerAssetDa... | 14,234 |
81 | // The contract is ownable untill the DAO will be able to take over. Popsicle community shows that DAO is coming soon. And the contract ownership will be transferred to other contract | contract Sorbettiere is Ownable {
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.
uint256 remainingIceTokenReward; // ICE Tokens that weren't d... | contract Sorbettiere is Ownable {
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.
uint256 remainingIceTokenReward; // ICE Tokens that weren't d... | 34,308 |
110 | // EIP712 Domain / | contract EIP712Domain {
/**
* @dev EIP712 Domain Separator
*/
bytes32 public DOMAIN_SEPARATOR;
}
| contract EIP712Domain {
/**
* @dev EIP712 Domain Separator
*/
bytes32 public DOMAIN_SEPARATOR;
}
| 10,952 |
3 | // ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. solhint-disable-next-line no-inline-assembly | assembly {
let vs := mload(add(signature, 0x40))
r := mload(add(signature, 0x20))
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
| assembly {
let vs := mload(add(signature, 0x40))
r := mload(add(signature, 0x20))
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
| 14,387 |
539 | // in 2019, stars may spawn at most 1024 planets. this limit doublesfor every subsequent year.Note: 1546300800 corresponds to 2019-01-01 | uint256 yearsSince2019 = (_time - 1546300800) / 365 days;
if (yearsSince2019 < 6)
{
limit = uint32( 1024 * (2 ** yearsSince2019) );
}
| uint256 yearsSince2019 = (_time - 1546300800) / 365 days;
if (yearsSince2019 < 6)
{
limit = uint32( 1024 * (2 ** yearsSince2019) );
}
| 15,051 |
18 | // Pays the protocol fee. This function transfers the protocol fee from the trader to the protocol treasury. params The parameters for paying the protocol fee.return protocolFee The amount of the protocol fee in PMX or NATIVE_CURRENCY paid. / | function payProtocolFee(ProtocolFeeParams memory params) public returns (uint256 protocolFee) {
if (!params.isSwapFromWallet || params.feeToken != NATIVE_CURRENCY) {
_require(msg.value == 0, Errors.DISABLED_TRANSFER_NATIVE_CURRENCY.selector);
}
ProtocolFeeVars memory vars;
... | function payProtocolFee(ProtocolFeeParams memory params) public returns (uint256 protocolFee) {
if (!params.isSwapFromWallet || params.feeToken != NATIVE_CURRENCY) {
_require(msg.value == 0, Errors.DISABLED_TRANSFER_NATIVE_CURRENCY.selector);
}
ProtocolFeeVars memory vars;
... | 30,530 |
41 | // update the user | updateUser(u);
| updateUser(u);
| 54,402 |
109 | // We'll avoid throwing an exception here to avoid breaking any dapps, but this case should never occur given the minimum bid size. | if (exercisableDeposits <= _totalSupply) {
return 0;
}
| if (exercisableDeposits <= _totalSupply) {
return 0;
}
| 36,869 |
72 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Requirem... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
| function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
| 780 |
12 | // Perform the liquidation | IERC20(liquidateAsset).approve(lendingPoolAddress, amount);
lendingPool.liquidationCall(collateral, liquidateAsset, borrower, amount, false);
| IERC20(liquidateAsset).approve(lendingPoolAddress, amount);
lendingPool.liquidationCall(collateral, liquidateAsset, borrower, amount, false);
| 8,627 |
104 | // emergency if the contarct get ERC20 tokens | function emergencyERC20Drain( ERC20 oddToken, uint amount ) public onlyCSorAdmin returns(bool){
oddToken.transfer(owner, amount);
EmergencyERC20DrainWasCalled(oddToken, amount);
return true;
}
| function emergencyERC20Drain( ERC20 oddToken, uint amount ) public onlyCSorAdmin returns(bool){
oddToken.transfer(owner, amount);
EmergencyERC20DrainWasCalled(oddToken, amount);
return true;
}
| 6,803 |
13 | // deployer address is the first signer. Deployer can configure new contracts by itself being the only "signer" The first script which sets the new contracts live should add signers and revoke deployer's signature right | isSigner[msg.sender] = true;
allSigners.push(msg.sender);
activeSignersCount = 1;
emit SignerAdded(msg.sender);
| isSigner[msg.sender] = true;
allSigners.push(msg.sender);
activeSignersCount = 1;
emit SignerAdded(msg.sender);
| 21,424 |
127 | // Allows the DAO to set the amount of Magi Gold that is/ claimed per token ID/magiGoldDisplayValue The amount of Adventure Cards a user can claim./ This should be input as the display value, not in raw decimals. If you/ want to mint 100 Adventure Cards, you should enter "100" rather than the value of/ 10010^18. | function daoSetmagiGoldPerTokenId(uint256 magiGoldDisplayValue)
public
onlyOwner
| function daoSetmagiGoldPerTokenId(uint256 magiGoldDisplayValue)
public
onlyOwner
| 8,722 |
12 | // Exchange Project Wyvern Developers / | contract Exchange is ExchangeCore {
function __Exchange_init(
)
internal
onlyInitializing
{
__ExchangeCore_init();
__Exchange_init_unchained();
}
function __Exchange_init_unchained()
internal
onlyInitializing
{
}
/**
* @dev Call guardedA... | contract Exchange is ExchangeCore {
function __Exchange_init(
)
internal
onlyInitializing
{
__ExchangeCore_init();
__Exchange_init_unchained();
}
function __Exchange_init_unchained()
internal
onlyInitializing
{
}
/**
* @dev Call guardedA... | 5,150 |
240 | // update round | round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]);
| round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]);
| 59,062 |
243 | // Check constraints | require(amount0 >= amount0Min, "Aloe: amount0 too low");
require(amount1 >= amount1Min, "Aloe: amount1 too low");
| require(amount0 >= amount0Min, "Aloe: amount0 too low");
require(amount1 >= amount1Min, "Aloe: amount1 too low");
| 64,578 |
33 | // Set the last time the index was updated to now | indexLastUpdate = currentTimestamp();
emit IndexUpdated(
borrowIndex,
indexLastUpdate
);
return borrowIndex;
| indexLastUpdate = currentTimestamp();
emit IndexUpdated(
borrowIndex,
indexLastUpdate
);
return borrowIndex;
| 13,272 |
155 | // Function for user to bet on team idx, | function bet(uint teamIdx) public payable {
require(canBet() == true);
require(TeamType(teamIdx) == TeamType.A || TeamType(teamIdx) == TeamType.B);
require(msg.value >= MINIMUM_BET);
// Add bettor to bettor list if they are not on it
if (bettorInfo[msg.sender].amountsBet[0] == 0 && bettorInfo[msg... | function bet(uint teamIdx) public payable {
require(canBet() == true);
require(TeamType(teamIdx) == TeamType.A || TeamType(teamIdx) == TeamType.B);
require(msg.value >= MINIMUM_BET);
// Add bettor to bettor list if they are not on it
if (bettorInfo[msg.sender].amountsBet[0] == 0 && bettorInfo[msg... | 66,569 |
42 | // risk group: 32 - , APR: 12.75% | navFeed.file("riskGroup", 32, ONE, ONE, uint(1000000004043000000), 99.47*10**25);
| navFeed.file("riskGroup", 32, ONE, ONE, uint(1000000004043000000), 99.47*10**25);
| 46,945 |
9 | // trigger event | emit NewLock(msg.sender, address(newPublicLock));
| emit NewLock(msg.sender, address(newPublicLock));
| 17,727 |
33 | // MKR contracts | ManagerLike public mgr;
VatLike public vat;
SpotterLike public spotter;
JugLike public jug;
ERC20Like public dai;
ERC20Like public collateral;
uint public constant WAD = 10*18;
| ManagerLike public mgr;
VatLike public vat;
SpotterLike public spotter;
JugLike public jug;
ERC20Like public dai;
ERC20Like public collateral;
uint public constant WAD = 10*18;
| 9,349 |
317 | // if we are below minimun want change it is not worth doingneed to be careful in case this pushes to liquidation | if (position > minWant) {
| if (position > minWant) {
| 36,324 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.