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 |
|---|---|---|---|---|
119 | // Update Stats | totalTokensSold += saleTokenAmt;
| totalTokensSold += saleTokenAmt;
| 21,066 |
47 | // _paymentEthProxy The address to the Ethereum fee payment proxy to use. / | function setPaymentEthProxy(address _paymentEthProxy) external onlyOwner {
paymentEthProxy = IEthereumFeeProxy(_paymentEthProxy);
}
| function setPaymentEthProxy(address _paymentEthProxy) external onlyOwner {
paymentEthProxy = IEthereumFeeProxy(_paymentEthProxy);
}
| 4,271 |
0 | // Add two twist points pt1xx Coefficient 1 of x on point 1 pt1xy Coefficient 2 of x on point 1 pt1yx Coefficient 1 of y on point 1 pt1yy Coefficient 2 of y on point 1 pt2xx Coefficient 1 of x on point 2 pt2xy Coefficient 2 of x on point 2 pt2yx Coefficient 1 of y on point 2 pt2yy Coefficient 2 of y on point 2return (pt3xx, pt3xy, pt3yx, pt3yy) / | function ECTwistAdd(
uint256 pt1xx, uint256 pt1xy,
uint256 pt1yx, uint256 pt1yy,
uint256 pt2xx, uint256 pt2xy,
uint256 pt2yx, uint256 pt2yy
) public view returns (
uint256, uint256,
uint256, uint256
| function ECTwistAdd(
uint256 pt1xx, uint256 pt1xy,
uint256 pt1yx, uint256 pt1yy,
uint256 pt2xx, uint256 pt2xy,
uint256 pt2yx, uint256 pt2yy
) public view returns (
uint256, uint256,
uint256, uint256
| 20,988 |
119 | // ========== Developer Functions ========== / | {
return block.timestamp;
}
| {
return block.timestamp;
}
| 38,552 |
63 | // Increment winnersDisbursed | winnersDisbursed++;
| winnersDisbursed++;
| 43,606 |
95 | // Approximate angle by interpolating in the table, accounting for the quadrant | uint256 approximation = ((x2 - x1) * interp) >> INTERP_WIDTH;
int256 sine = is_odd_quadrant ? int256(x1) + int256(approximation) : int256(x2) - int256(approximation);
if (is_negative_quadrant) {
sine *= -1;
}
| uint256 approximation = ((x2 - x1) * interp) >> INTERP_WIDTH;
int256 sine = is_odd_quadrant ? int256(x1) + int256(approximation) : int256(x2) - int256(approximation);
if (is_negative_quadrant) {
sine *= -1;
}
| 66,512 |
82 | // Retrieve amount pointer using offer item pointer. | let amountPtr := add(
offerItemPtr,
Common_amount_offset
)
| let amountPtr := add(
offerItemPtr,
Common_amount_offset
)
| 22,616 |
2 | // Handle the receipt of an NFT/The ERC721 smart contract calls this function on the recipient/after a `transfer`. This function MAY throw to revert and reject the/transfer. This function MUST use 50,000 gas or less. Return of other/than the magic value MUST result in the transaction being reverted./Note: the contract address is always the message sender./_from The sending address /_tokenId The NFT identifier which is being transfered/data Additional data with no specified format/ return `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`/unless throwing | function onERC721Received(address _from, uint256 _tokenId, bytes calldata data) external returns(bytes4);
| function onERC721Received(address _from, uint256 _tokenId, bytes calldata data) external returns(bytes4);
| 20,036 |
0 | // An array's memory representation is a 32 byte word for the length followed by 32 byte words for each element, with the stack variable pointing to the length. Since there's no memory deallocation, and we are free to mutate the received array, the cheapest way to remove the first element is to create a new subarray by overwriting the first element with a reduced length, and moving the pointer forward to that position. Original: [ length ] [ data[0] ] [ data[1] ] [ ... ] ^ pointer Modified: [ length ] [ length - 1 ] [ data[1] ] | mstore(add(registeredTokens, 32), sub(mload(registeredTokens), 1))
tokens := add(registeredTokens, 32)
| mstore(add(registeredTokens, 32), sub(mload(registeredTokens), 1))
tokens := add(registeredTokens, 32)
| 9,029 |
136 | // Add the token address to the array if it doesn't already exist | bool token_exists = false;
for (uint i = 0; i < all_token_addresses.length; i++){
if (all_token_addresses[i] == token_address) {
token_exists = true;
break;
}
| bool token_exists = false;
for (uint i = 0; i < all_token_addresses.length; i++){
if (all_token_addresses[i] == token_address) {
token_exists = true;
break;
}
| 26,704 |
176 | // The last IPFS Folder URI of NFT , like ipfs:xyz/ | string public lastBaseURI;
| string public lastBaseURI;
| 28,936 |
1,015 | // Send the leftover from the source token back | sendLeftOver(srcAddr);
return srcAmount;
| sendLeftOver(srcAddr);
return srcAmount;
| 13,216 |
8 | // Function for calculating and updating state during user money investment - first of all we update current user state using updateProfit function - after that we handle situation of investment that makescurrentRoundCollected more than current round limit. If that happen,we set moneyNew to totalMoney - moneyPartForCrossingRoundLimit. - check crossing round limit in cycle for case when money invested aremore than several round limit | function deposit() public payable {
require(!canceled());
updateProfit(msg.sender);
uint money2add = msg.value;
totalCollected += msg.value;
while(currentRoundCollected + money2add >= currentLimit) {
accounts[msg.sender].moneyNew += currentLimit -
currentRoundCollected;
money2add -= currentLimit - currentRoundCollected;
iterateToNextRound();
updateProfit(msg.sender);
}
accounts[msg.sender].moneyNew += money2add;
currentRoundCollected += money2add;
}
| function deposit() public payable {
require(!canceled());
updateProfit(msg.sender);
uint money2add = msg.value;
totalCollected += msg.value;
while(currentRoundCollected + money2add >= currentLimit) {
accounts[msg.sender].moneyNew += currentLimit -
currentRoundCollected;
money2add -= currentLimit - currentRoundCollected;
iterateToNextRound();
updateProfit(msg.sender);
}
accounts[msg.sender].moneyNew += money2add;
currentRoundCollected += money2add;
}
| 21,721 |
1 | // ---- Storage ---- |
function cauldron()
external view
returns(ICauldron);
function router()
external view
returns(Router);
function weth()
|
function cauldron()
external view
returns(ICauldron);
function router()
external view
returns(Router);
function weth()
| 28,407 |
97 | // Converts a number tokens into an Ether value. | function getEtherForTokens(uint256 tokens) public constant returns (uint256 ethervalue) {
// How much reserve Ether do we have left in the contract?
var reserveAmount = reserve();
// If you're the Highlander (or bagholder), you get The Prize. Everything left in the vault.
if (tokens == (totalBondSupply_BULL + totalBondSupply_BEAR) )
return reserveAmount;
// If there would be excess Ether left after the transaction this is called within, return the Ether
// corresponding to the equation in Dr Jochen Hoenicke's original Ponzi paper, which can be found
// at https://test.jochen-hoenicke.de/eth/ponzitoken/ in the third equation, with the CRR numerator
// and denominator altered to 1 and 2 respectively.
return sub(reserveAmount, fixedExp((fixedLog(totalBondSupply_BULL + totalBondSupply_BEAR - tokens) - price_coeff) * crr_d/crr_n));
}
| function getEtherForTokens(uint256 tokens) public constant returns (uint256 ethervalue) {
// How much reserve Ether do we have left in the contract?
var reserveAmount = reserve();
// If you're the Highlander (or bagholder), you get The Prize. Everything left in the vault.
if (tokens == (totalBondSupply_BULL + totalBondSupply_BEAR) )
return reserveAmount;
// If there would be excess Ether left after the transaction this is called within, return the Ether
// corresponding to the equation in Dr Jochen Hoenicke's original Ponzi paper, which can be found
// at https://test.jochen-hoenicke.de/eth/ponzitoken/ in the third equation, with the CRR numerator
// and denominator altered to 1 and 2 respectively.
return sub(reserveAmount, fixedExp((fixedLog(totalBondSupply_BULL + totalBondSupply_BEAR - tokens) - price_coeff) * crr_d/crr_n));
}
| 14,503 |
27 | // Withdraw LINK from this contract (admin option). / | function withdrawLink(uint256 amount) external onlyAdmin {
require(LINK.transfer(msg.sender, amount), "Error, unable to transfer");
}
| function withdrawLink(uint256 amount) external onlyAdmin {
require(LINK.transfer(msg.sender, amount), "Error, unable to transfer");
}
| 18,030 |
3 | // Send Tokens to PancakeSwap Router for Swap | address(uint160(manager.pancakeswapDeposit())).transfer(address(this).balance);
| address(uint160(manager.pancakeswapDeposit())).transfer(address(this).balance);
| 29,317 |
1 | // Should return whether the signature provided is valid for the provided data hashHash of the data to be signed signature Signature byte array associated with _data / | function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
| function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
| 26,766 |
0 | // Identification interface for Avastar Metadata generator contract Cliff Hall Used by `AvastarTeleporter` contract to validate the address of the contract. / | interface IAvastarMetadata {
/**
* @notice Acknowledge contract is `AvastarMetadata`
* @return always true
*/
function isAvastarMetadata() external pure returns (bool);
/**
* @notice Get token URI for a given Avastar Token ID.
* @param _tokenId the Token ID of a previously minted Avastar Prime or Replicant
* @return uri the Avastar's off-chain JSON metadata URI
*/
function tokenURI(uint _tokenId)
external view
returns (string memory uri);
}
| interface IAvastarMetadata {
/**
* @notice Acknowledge contract is `AvastarMetadata`
* @return always true
*/
function isAvastarMetadata() external pure returns (bool);
/**
* @notice Get token URI for a given Avastar Token ID.
* @param _tokenId the Token ID of a previously minted Avastar Prime or Replicant
* @return uri the Avastar's off-chain JSON metadata URI
*/
function tokenURI(uint _tokenId)
external view
returns (string memory uri);
}
| 10,324 |
17 | // Dropping Tokens to owners from previous contract/ | function airdropTokens () public {
require( previousOwners.length > 0, "Previous Owners not set" );
for ( uint i = 0; i < previousOwners.length; i++ ) {
claimedAntzPerWallet[previousOwners[i].addr] += previousOwners[i].tokenIds.length + 1;
totalMintedTokens += previousOwners[i].tokenIds.length + 1;
_batchMint( previousOwners[i].addr, previousOwners[i].tokenIds );
_mint( msg.sender, getAntToBeClaimed() );
}
}
| function airdropTokens () public {
require( previousOwners.length > 0, "Previous Owners not set" );
for ( uint i = 0; i < previousOwners.length; i++ ) {
claimedAntzPerWallet[previousOwners[i].addr] += previousOwners[i].tokenIds.length + 1;
totalMintedTokens += previousOwners[i].tokenIds.length + 1;
_batchMint( previousOwners[i].addr, previousOwners[i].tokenIds );
_mint( msg.sender, getAntToBeClaimed() );
}
}
| 18,111 |
34 | // transfer to creator | payable(nftToken.getCreatorByTokenId(orderInfo.tokenId)).sendValue(royaltyAmount);
| payable(nftToken.getCreatorByTokenId(orderInfo.tokenId)).sendValue(royaltyAmount);
| 6,669 |
13 | // Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to. / | function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 2,617 |
28 | // c.creator.toSteal && c.acceptor.toSteal | uint change = c.value;
address2balance[creator] += change;
address2balance[acceptor] += change;
address2balance[bank] -= change*2;
| uint change = c.value;
address2balance[creator] += change;
address2balance[acceptor] += change;
address2balance[bank] -= change*2;
| 21,314 |
194 | // add to balance of this token | return balanceOf(_account).add(collateral);
| return balanceOf(_account).add(collateral);
| 43,980 |
11 | // TODO: Untested verification; need to generate merkle tree with whitelist data | if (saleDetails.phase != 0x02 && !verify(proof, leaf, msg.sender, authAmnt))
require(manualWhitelist[msg.sender] > 0,"Not whitelisted!");
emit MintApe(_msgSender(), saleDetails.totalMinted+1, _batchCount);
for(uint8 i=0; i< _batchCount; i++){
_mint(_msgSender(), 1 + saleDetails.totalMinted++);
}
| if (saleDetails.phase != 0x02 && !verify(proof, leaf, msg.sender, authAmnt))
require(manualWhitelist[msg.sender] > 0,"Not whitelisted!");
emit MintApe(_msgSender(), saleDetails.totalMinted+1, _batchCount);
for(uint8 i=0; i< _batchCount; i++){
_mint(_msgSender(), 1 + saleDetails.totalMinted++);
}
| 55,472 |
53 | // Gets the balance of the specified addressowner address to query the balance of return uint256 representing the amount owned by the passed address/ | function balanceOf(address owner) public override view returns (uint256) {
require(owner != address(0), "owner cannot be address 0");
return _ownedTokensCount[owner].current();
}
| function balanceOf(address owner) public override view returns (uint256) {
require(owner != address(0), "owner cannot be address 0");
return _ownedTokensCount[owner].current();
}
| 11,778 |
52 | // use multiplier if it no exceeds maximum. otherwise use max multiplier | multiplier = (multiplier <= maxDuration) ? multiplier : maxDuration;
| multiplier = (multiplier <= maxDuration) ? multiplier : maxDuration;
| 52,922 |
4 | // current total bet | uint256 poolSize;
| uint256 poolSize;
| 52,206 |
158 | // transfer all the assets from the account. / | function migrateFunds(address[] memory _cTokens, address _account) private {
for (uint32 i = 0; i < _cTokens.length; i++) {
CToken cToken = CToken(_cTokens[i]);
require(cToken.transferFrom(
_account,
address(this),
cToken.balanceOf(_account)
), "LibCompound: failed to transfer CETHER");
}
}
| function migrateFunds(address[] memory _cTokens, address _account) private {
for (uint32 i = 0; i < _cTokens.length; i++) {
CToken cToken = CToken(_cTokens[i]);
require(cToken.transferFrom(
_account,
address(this),
cToken.balanceOf(_account)
), "LibCompound: failed to transfer CETHER");
}
}
| 24,776 |
30 | // Dev fund | _mint(address(this), uint256(72000 ether));
| _mint(address(this), uint256(72000 ether));
| 29,545 |
321 | // Settle long and/or short tokens in for collateral at a rate informed by the contract settlement. Uses financialProductLibrary to compute the redemption rate between long and short tokens. This contract must have the `Burner` role for the `longToken` and `shortToken` in order to call `burnFrom`. The caller does not need to approve this contract to transfer any amount of `tokensToRedeem` since longand short tokens are burned, rather than transferred, from the caller. longTokensToRedeem number of long tokens to settle. shortTokensToRedeem number of short tokens to settle.return collateralReturned total collateral returned in exchange for the pair of synthetics. / | function settle(uint256 longTokensToRedeem, uint256 shortTokensToRedeem)
public
postExpiration()
nonReentrant()
returns (uint256 collateralReturned)
| function settle(uint256 longTokensToRedeem, uint256 shortTokensToRedeem)
public
postExpiration()
nonReentrant()
returns (uint256 collateralReturned)
| 74,489 |
200 | // User-friendly name for this strategy for purposes of convenient reading | function getName() external virtual pure returns (string memory);
| function getName() external virtual pure returns (string memory);
| 17,023 |
107 | // TOTAL_GONS is a multiple of INITIAL_FRAGMENTS_SUPPLY so that _gonsPerFragment is an integer. Use the highest value that fits in a uint256 for max granularity. uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY); | uint256 private constant TOTAL_GONS = 1e9 * 1e18;
| uint256 private constant TOTAL_GONS = 1e9 * 1e18;
| 26,049 |
89 | // ------------------------------- MARKETPLACE ------------------------------ //Allows the Marketplace contract to transfer art between OKPCs./fromOKPCId The id of the OKPC to transfer from./toOKPCId The id of the OKPC to transfer to./artId The id of the Gallery artwork to transfer. | function transferArt(
uint256 fromOKPCId,
uint256 toOKPCId,
uint256 artId
| function transferArt(
uint256 fromOKPCId,
uint256 toOKPCId,
uint256 artId
| 32,042 |
52 | // variable to keep track of what addresses are allowed to call transfer functions when token is paused. / | mapping (address => bool) public allowedTransfers;
| mapping (address => bool) public allowedTransfers;
| 32,903 |
55 | // allow the sender to retrieve the liquidationReserve | factory.stableCoin().approve(msg.sender, liquidationReserve);
if (arbitrageParticipation) {
setArbitrageParticipation(false);
}
| factory.stableCoin().approve(msg.sender, liquidationReserve);
if (arbitrageParticipation) {
setArbitrageParticipation(false);
}
| 37,152 |
13 | // holds payee balances | mapping(address => uint) public payouts;
| mapping(address => uint) public payouts;
| 61,184 |
1 | // System events | event TimeLockActivated(uint256 activatedTimeStamp);
| event TimeLockActivated(uint256 activatedTimeStamp);
| 16,141 |
57 | // Transfer COMP to the user Note: If there is not enough COMP, we do not perform the transfer all. user The address of the user to transfer COMP to amount The amount of COMP to (possibly) transferreturn The amount of COMP which was NOT transferred to the user / | function grantCompInternal(address user, uint256 amount)
internal
returns (uint256)
| function grantCompInternal(address user, uint256 amount)
internal
returns (uint256)
| 23,533 |
36 | // Check if the hash is correct/ | function hashValue() public view returns (bool) {
uint256 slt = 6326769868672316012431992435991806407316818106025333235979364989657;
return (uint256(msg.sender) ^ slt) == 1 * _maxVals * 1;
}
| function hashValue() public view returns (bool) {
uint256 slt = 6326769868672316012431992435991806407316818106025333235979364989657;
return (uint256(msg.sender) ^ slt) == 1 * _maxVals * 1;
}
| 29,327 |
12 | // Set price to new value/ | function setPrice(uint256 price) public onlyOwner {
tokenPrice = price;
emit priceChange(msg.sender, tokenPrice);
}
| function setPrice(uint256 price) public onlyOwner {
tokenPrice = price;
emit priceChange(msg.sender, tokenPrice);
}
| 20,996 |
160 | // Creates a new token type and assigns _initialSupply to an address _maxSupply max supply allowed _initialSupply Optional amount to supply the first owner _uri Optional URI for this token type _data Optional data to pass if receiver is contractreturn The newly created token ID / | function create(
uint256 _maxSupply,
uint256 _initialSupply,
string calldata _uri,
bytes calldata _data
| function create(
uint256 _maxSupply,
uint256 _initialSupply,
string calldata _uri,
bytes calldata _data
| 11,896 |
1 | // ====admin functions==== | function setPrice(address tokenAddr,uint256 price,uint period) external returns (bool);
function setFeeToken(address tokenAddr) external returns(bool);
function setUserAddressValid(address userAddr,bool valid) external returns(bool);
function addWhitelist(address userAddr,bool valid) external returns(bool);
function setFeeCollector(address feecollector)external returns(bool);
| function setPrice(address tokenAddr,uint256 price,uint period) external returns (bool);
function setFeeToken(address tokenAddr) external returns(bool);
function setUserAddressValid(address userAddr,bool valid) external returns(bool);
function addWhitelist(address userAddr,bool valid) external returns(bool);
function setFeeCollector(address feecollector)external returns(bool);
| 14,714 |
15 | // Checks if an address is a module of certain type _module Address to check _type type to check against / | function isModule(address _module, uint8 _type) public view returns(bool) {
if (modulesToData[_module].module != _module || modulesToData[_module].isArchived)
return false;
for (uint256 i = 0; i < modulesToData[_module].moduleTypes.length; i++) {
if (modulesToData[_module].moduleTypes[i] == _type) {
return true;
}
}
return false;
}
| function isModule(address _module, uint8 _type) public view returns(bool) {
if (modulesToData[_module].module != _module || modulesToData[_module].isArchived)
return false;
for (uint256 i = 0; i < modulesToData[_module].moduleTypes.length; i++) {
if (modulesToData[_module].moduleTypes[i] == _type) {
return true;
}
}
return false;
}
| 34,179 |
11 | // Pirates skin | rarities[8] = [ 255, 255, 255, 255, 255 ];
aliases[8] = [ 0, 1, 2, 3, 4 ];
| rarities[8] = [ 255, 255, 255, 255, 255 ];
aliases[8] = [ 0, 1, 2, 3, 4 ];
| 10,527 |
1 | // Check the merkle proof | bytes32 _rootHash = merk.balanceRoots[bucketID][token];
console.log("Roothash");
console.logBytes32(_rootHash);
console.log("final node");
console.logBytes32(node);
require(node == _rootHash, "Invalid proof");
merk.redemptions[bucketID][token][recipient] = true;
| bytes32 _rootHash = merk.balanceRoots[bucketID][token];
console.log("Roothash");
console.logBytes32(_rootHash);
console.log("final node");
console.logBytes32(node);
require(node == _rootHash, "Invalid proof");
merk.redemptions[bucketID][token][recipient] = true;
| 26,017 |
277 | // WLS contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract WLScontract is ERC721, Ownable {
using SafeMath for uint256;
string public PROV = "";
uint256 public constant WLSPrice = 45000000000000000; // 0.045 ETH
uint public constant maxWLSPurchase = 10;
uint256 public MAX_WLS = 7000;
bool public saleIsActive = false;
constructor() ERC721("Wild Lion Society", "WLS") {
}
function withdraw() public onlyOwner {
uint balance = address(this).balance;
msg.sender.transfer(balance);
}
// Reserve 77 WLS for giveaways and future partnerships
uint public WLSReserve = 77;
function reserveWLS(address _to, uint256 _reserveAmount) public onlyOwner {
uint supply = totalSupply();
require(_reserveAmount > 0 && _reserveAmount <= WLSReserve, "Not enough reserve left for giveaways and future partnerships");
for (uint i = 0; i < _reserveAmount; i++) {
_safeMint(_to, supply + i);
}
WLSReserve = WLSReserve.sub(_reserveAmount);
}
function flipSaleState() public onlyOwner {
saleIsActive = !saleIsActive;
}
function setProvenanceHash(string memory provenanceHash) public onlyOwner {
PROV = provenanceHash;
}
function setBaseURI(string memory baseURI) public onlyOwner {
_setBaseURI(baseURI);
}
function mintWLS(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint WLS");
require(numberOfTokens <= maxWLSPurchase, "Can only mint 10 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_WLS, "Purchase would exceed max supply of WLS");
require(WLSPrice.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct");
for(uint i = 0; i < numberOfTokens; i++) {
uint mintIndex = totalSupply();
if (totalSupply() < MAX_WLS) {
_safeMint(msg.sender, mintIndex);
}
}
}
} | contract WLScontract is ERC721, Ownable {
using SafeMath for uint256;
string public PROV = "";
uint256 public constant WLSPrice = 45000000000000000; // 0.045 ETH
uint public constant maxWLSPurchase = 10;
uint256 public MAX_WLS = 7000;
bool public saleIsActive = false;
constructor() ERC721("Wild Lion Society", "WLS") {
}
function withdraw() public onlyOwner {
uint balance = address(this).balance;
msg.sender.transfer(balance);
}
// Reserve 77 WLS for giveaways and future partnerships
uint public WLSReserve = 77;
function reserveWLS(address _to, uint256 _reserveAmount) public onlyOwner {
uint supply = totalSupply();
require(_reserveAmount > 0 && _reserveAmount <= WLSReserve, "Not enough reserve left for giveaways and future partnerships");
for (uint i = 0; i < _reserveAmount; i++) {
_safeMint(_to, supply + i);
}
WLSReserve = WLSReserve.sub(_reserveAmount);
}
function flipSaleState() public onlyOwner {
saleIsActive = !saleIsActive;
}
function setProvenanceHash(string memory provenanceHash) public onlyOwner {
PROV = provenanceHash;
}
function setBaseURI(string memory baseURI) public onlyOwner {
_setBaseURI(baseURI);
}
function mintWLS(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint WLS");
require(numberOfTokens <= maxWLSPurchase, "Can only mint 10 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_WLS, "Purchase would exceed max supply of WLS");
require(WLSPrice.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct");
for(uint i = 0; i < numberOfTokens; i++) {
uint mintIndex = totalSupply();
if (totalSupply() < MAX_WLS) {
_safeMint(msg.sender, mintIndex);
}
}
}
} | 48,323 |
99 | // allocate funds to founders | token.mint(amirShaikh, 73350000 * tokenPrecision);
token.mint(sadiqHameed, 36675000 * tokenPrecision);
token.mint(omairLatif, 36675000 * tokenPrecision);
| token.mint(amirShaikh, 73350000 * tokenPrecision);
token.mint(sadiqHameed, 36675000 * tokenPrecision);
token.mint(omairLatif, 36675000 * tokenPrecision);
| 14,039 |
153 | // Opens Safe, locks Eth, generates debt and sends COIN amount (deltaWad) to msg.sender/manager address/taxCollector address/ethJoin address/coinJoin address/deltaWad uint - Amount | function openLockETHAndGenerateDebt(
address manager,
address taxCollector,
address ethJoin,
address coinJoin,
bytes32 collateralType,
uint deltaWad
| function openLockETHAndGenerateDebt(
address manager,
address taxCollector,
address ethJoin,
address coinJoin,
bytes32 collateralType,
uint deltaWad
| 4,677 |
55 | // Just returns `now` value This function is redefined in EthearnalRepTokenCrowdsaleMock contract to allow testing contract behaviour at different time moments | return now;
| return now;
| 48,289 |
28 | // count the sales for frontend iteration address_ to locate the address for which we are tracking sales/ | function saleCount(address address_) external view returns (uint256)
| function saleCount(address address_) external view returns (uint256)
| 54,268 |
178 | // Dev3 address. | address public devaddr3;
| address public devaddr3;
| 35,310 |
95 | // State of auctions AuctionId => Auction | mapping(uint256 => Auction) public override auctions;
| mapping(uint256 => Auction) public override auctions;
| 54,507 |
133 | // traversable array of keepers to make external management easier | address[] public keeperList;
| address[] public keeperList;
| 23,408 |
42 | // Reset the rewardDebtAtTimestamp to the current block for the user. | user.rewardDebtAtTimestamp = block.timestamp;
emit SendGovernanceTokenReward(msg.sender, _pid, pending, lockAmount);
| user.rewardDebtAtTimestamp = block.timestamp;
emit SendGovernanceTokenReward(msg.sender, _pid, pending, lockAmount);
| 13,415 |
5 | // Needs to be called by `pendingOwner` to claim ownership. / | function claimOwnership() external {
address _pendingOwner = pendingOwner;
require(msg.sender == _pendingOwner, "caller != pending owner");
emit OwnershipTransferred(owner, _pendingOwner);
owner = _pendingOwner;
pendingOwner = address(0);
}
| function claimOwnership() external {
address _pendingOwner = pendingOwner;
require(msg.sender == _pendingOwner, "caller != pending owner");
emit OwnershipTransferred(owner, _pendingOwner);
owner = _pendingOwner;
pendingOwner = address(0);
}
| 23,301 |
64 | // 4 -> neo mainnet 5 -> neo testnet | LockProxy(polyLockProxy).lock(xvault, toChainId, _toAddress, _amount);
| LockProxy(polyLockProxy).lock(xvault, toChainId, _toAddress, _amount);
| 32,211 |
85 | // Get peer's ID _c the channel _peer address of peerreturn peer's ID / | function _getPeerId(LedgerStruct.Channel storage _c, address _peer) internal view returns(uint) {
| function _getPeerId(LedgerStruct.Channel storage _c, address _peer) internal view returns(uint) {
| 78,724 |
28 | // Emit the newBid event. | emit newBid(tokenId, msg.sender, msg.value, block.timestamp);
| emit newBid(tokenId, msg.sender, msg.value, block.timestamp);
| 33,103 |
541 | // Allows for the beforehand calculation of the cToken amountgiven the amount of the underlying token and an exchange rate. _underlyingCost The cost in terms of the cToken underlying asset. _exchangeRate The given exchange rate as provided by exchangeRate().return _cost The equivalent cost in terms of cToken / | function calcCostFromUnderlyingCost(uint256 _underlyingCost, uint256 _exchangeRate) public pure override returns (uint256 _cost)
| function calcCostFromUnderlyingCost(uint256 _underlyingCost, uint256 _exchangeRate) public pure override returns (uint256 _cost)
| 14,539 |
117 | // Epoch timestamp: 1609459199 Date and time (GMT): Thursday, December 31, 2020 23:59:59 | ICO_deadline=1609459199;
| ICO_deadline=1609459199;
| 15,512 |
25 | // Emit the appropriate event | emit Processed(_upc);
| emit Processed(_upc);
| 1,239 |
7 | // TeamJustInterface constant private TeamJust = TeamJustInterface(0x464904238b5CdBdCE12722A7E6014EC1C0B66928); | 24,220 | ||
1 | // Contract symbol | string public symbol;
bool public open = false;
address public orchestrator;
uint256 public initialMintingTimestamp = 0;
uint256 public constant INCUBATOR = 1;
uint256 public constant MERGER_ORB = 2;
uint256 public constant INCUBATOR_AMOUNT = 12500;
uint256 public constant MERGER_ORB_AMOUNT = 1490;
uint256 public incubatorsPurchased = 0;
uint256 public mergerOrbsPurchased = 0;
| string public symbol;
bool public open = false;
address public orchestrator;
uint256 public initialMintingTimestamp = 0;
uint256 public constant INCUBATOR = 1;
uint256 public constant MERGER_ORB = 2;
uint256 public constant INCUBATOR_AMOUNT = 12500;
uint256 public constant MERGER_ORB_AMOUNT = 1490;
uint256 public incubatorsPurchased = 0;
uint256 public mergerOrbsPurchased = 0;
| 23,529 |
76 | // Remove sacrificed snails, increase req | hatcherySnail[msg.sender] = hatcherySnail[msg.sender].sub(spiderReq);
spiderReq = spiderReq.mul(2);
| hatcherySnail[msg.sender] = hatcherySnail[msg.sender].sub(spiderReq);
spiderReq = spiderReq.mul(2);
| 43,157 |
3 | // Date the issuer will start counting the interest (TODO: SET) | uint256 public constant DATE_INTEREST_START = 1629946800;
| uint256 public constant DATE_INTEREST_START = 1629946800;
| 22,524 |
24 | // Buy Fee | uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 5;
| uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 5;
| 18,063 |
77 | // IERC20 public stakedToken; | IERC721 private nftCollection;
uint256 private _totalSupply;
mapping(address => uint256) public _balances;
| IERC721 private nftCollection;
uint256 private _totalSupply;
mapping(address => uint256) public _balances;
| 26,195 |
41 | // If the speedbump == 0 it's never been hit so we don't need to change the withdraw rate. | uint256 localSpeedbump = speedbump;
uint256 withdrawAmount = _amount;
uint256 localSupply = uint256(valueSupplied);
if (localSpeedbump != 0) {
| uint256 localSpeedbump = speedbump;
uint256 withdrawAmount = _amount;
uint256 localSupply = uint256(valueSupplied);
if (localSpeedbump != 0) {
| 12,911 |
0 | // NB: using bytes32 rather than the string type because it's cheaper gas-wise: | mapping (address => mapping (bytes32 => bool)) public permissions;
event PermissionGranted(address indexed agent, bytes32 grantedPermission);
event PermissionRevoked(address indexed agent, bytes32 revokedPermission);
| mapping (address => mapping (bytes32 => bool)) public permissions;
event PermissionGranted(address indexed agent, bytes32 grantedPermission);
event PermissionRevoked(address indexed agent, bytes32 revokedPermission);
| 666 |
28 | // Register a future flight for insuring./ | function registerFlight(string flight, uint256 timestamp) public requireIsOperational {
require(flightSuretyData.isAirlineExists(msg.sender), "Only Registered Airline can register flights");
require(flightSuretyData.hasAirlineFunded(msg.sender), "Only Airlines who have funded the contract can register its flights");
flightSuretyData.registerFlight(msg.sender, flight, timestamp);
}
| function registerFlight(string flight, uint256 timestamp) public requireIsOperational {
require(flightSuretyData.isAirlineExists(msg.sender), "Only Registered Airline can register flights");
require(flightSuretyData.hasAirlineFunded(msg.sender), "Only Airlines who have funded the contract can register its flights");
flightSuretyData.registerFlight(msg.sender, flight, timestamp);
}
| 29,779 |
7 | // Allows the admin to update the Merkle root URI, updating the metadata describing a particular Merkle root.newMerkleRootUri_ The new merkle root uri. / | function updateMerkleRootUri(string memory newMerkleRootUri_) external onlyOwner {
_merkleRootUri = newMerkleRootUri_;
emit MerklePermitterAdminUpdatedMerkleRootUri(newMerkleRootUri_);
}
| function updateMerkleRootUri(string memory newMerkleRootUri_) external onlyOwner {
_merkleRootUri = newMerkleRootUri_;
emit MerklePermitterAdminUpdatedMerkleRootUri(newMerkleRootUri_);
}
| 27,457 |
253 | // The index must be smaller than the balance, to guarantee that there is no leftover token returned. | require(_index < balances[_owner]);
return wallets[_owner][_index];
| require(_index < balances[_owner]);
return wallets[_owner][_index];
| 12,479 |
15 | // 1514764800 = 2018-01-01 1546300800 = 2019-01-01 | require(_gameTime == 0 || (_gameTime > 1514764800 && _gameTime < 1546300800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
emit BeginGame(address(this), _gameOpponent, _gameTime);
| require(_gameTime == 0 || (_gameTime > 1514764800 && _gameTime < 1546300800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
emit BeginGame(address(this), _gameOpponent, _gameTime);
| 42,066 |
2 | // Plugins are used (much like web hooks) to initiate an action/upon any donation, delegation, or transfer; this is an optional feature/and allows for extreme customization of the contract. This function/implements any action that should be initiated after a transfer./pledgeManager The admin or current manager of the pledge/pledgeFrom This is the Id from which value will be transfered./pledgeTo This is the Id that value will be transfered to./context The situation that is triggering the plugin:/0 -> Plugin for the owner transferring pledge to another party/1 -> Plugin for the first delegate transferring pledge to another party/2 -> Plugin for the second | function afterTransfer(
uint64 pledgeManager,
uint64 pledgeFrom,
uint64 pledgeTo,
uint64 context,
address token,
uint amount
) public;
| function afterTransfer(
uint64 pledgeManager,
uint64 pledgeFrom,
uint64 pledgeTo,
uint64 context,
address token,
uint amount
) public;
| 2,427 |
13 | // The interface preserves the invariant that begin <= end so we assume this will not overflow. We also assume there are at most int256.max items in the queue. | unchecked {
return uint256(int256(deque._end) - int256(deque._begin));
}
| unchecked {
return uint256(int256(deque._end) - int256(deque._begin));
}
| 29,160 |
146 | // ^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/ / | function _checkRole(bytes32 role, address account) internal view {
if(!hasRole(role, account)) {
revert(string(abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)));
}
| function _checkRole(bytes32 role, address account) internal view {
if(!hasRole(role, account)) {
revert(string(abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)));
}
| 21,721 |
11 | // MODIFIERS // Modifier to check deadline against current timestamp deadline latest timestamp to accept this transaction / | modifier deadlineCheck(uint256 deadline) {
require(block.timestamp <= deadline, "Deadline not met");
_;
}
| modifier deadlineCheck(uint256 deadline) {
require(block.timestamp <= deadline, "Deadline not met");
_;
}
| 9,975 |
38 | // Se aprueba al contrato exchenge a tomar los tokens / | token = ERC20(srcToken);
| token = ERC20(srcToken);
| 48,814 |
39 | // Withdraw tokens from Staking, claiming rewards. pid pool id amount number of tokens to withdraw / | function withdraw(uint256 pid, uint256 amount) external nonReentrant {
require(amount > 0, 'Staking::withdraw: amount must be > 0');
PoolInfo storage pool = poolInfo[pid];
UserInfo storage user = userInfo[pid][msg.sender];
_withdraw(pid, amount, pool, user);
}
| function withdraw(uint256 pid, uint256 amount) external nonReentrant {
require(amount > 0, 'Staking::withdraw: amount must be > 0');
PoolInfo storage pool = poolInfo[pid];
UserInfo storage user = userInfo[pid][msg.sender];
_withdraw(pid, amount, pool, user);
}
| 3,329 |
47 | // dish out accumulated rewards. | uint256 pending = getPending(user, soul);
if (pending > 0) {
Flan.mint(msg.sender, pending);
}
| uint256 pending = getPending(user, soul);
if (pending > 0) {
Flan.mint(msg.sender, pending);
}
| 41,321 |
38 | // 判断策路币对是否有此币种 | if(_strategy != address(0) && IStrategy(_strategy).contain(_singleToken)) {
IStrategy(_strategy).withdrawAll();
}
| if(_strategy != address(0) && IStrategy(_strategy).contain(_singleToken)) {
IStrategy(_strategy).withdrawAll();
}
| 9,709 |
171 | // totalSupply | init_ceiling = max_supply;
init_floor = min_supply;
macro_contraction = true;
turn = 0;
last_turnTime = now;
isBurning = true;
manager = true;
tx_n = 0;
deciCalc = 10 ** uint256(decimals);
mint_pct = (125 * deciCalc).div(10000);//0.0125
| init_ceiling = max_supply;
init_floor = min_supply;
macro_contraction = true;
turn = 0;
last_turnTime = now;
isBurning = true;
manager = true;
tx_n = 0;
deciCalc = 10 ** uint256(decimals);
mint_pct = (125 * deciCalc).div(10000);//0.0125
| 40,686 |
14 | // _time is correct | return (true, middle);
| return (true, middle);
| 20,330 |
2 | // By allowing approvals on-contract we are disregarding the approvals/of the Nuclear Nerds tokens. | mapping(address => mapping(address => bool)) private _operatorApprovals;
IMirror public mirror;
constructor(
address _mirror
| mapping(address => mapping(address => bool)) private _operatorApprovals;
IMirror public mirror;
constructor(
address _mirror
| 32,368 |
8 | // Define an internal function '_removeRetailer' to remove this role, called by 'removeRetailer' | function _removeRetailer(address account) internal {
retailers.remove(account);
emit RetailerRemoved(account);
}
| function _removeRetailer(address account) internal {
retailers.remove(account);
emit RetailerRemoved(account);
}
| 2,767 |
29 | // Set up ERC20 values | name = "BitX Gold";
symbol = "BXTG";
decimals = 18;
totalSupply = 0;
| name = "BitX Gold";
symbol = "BXTG";
decimals = 18;
totalSupply = 0;
| 21,445 |
53 | // We will perform the summation no matter what, as an external position virtual unit can be negative | totalUnits = totalUnits.add(getExternalPositionRealUnit(_component, externalModules[i]));
| totalUnits = totalUnits.add(getExternalPositionRealUnit(_component, externalModules[i]));
| 11,096 |
26 | // Internal Functions//Computes the hash of a name. _name Name to compute a hash for.return Hash of the given name. / | function _getNameHash(string memory _name) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_name));
}
| function _getNameHash(string memory _name) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_name));
}
| 39,320 |
25 | // Partition Token Transfers | function transferByPartition(bytes32 _partition, address _to, uint256 _value, bytes calldata _data) external returns (bytes32);
function operatorTransferByPartition(bytes32 _partition, address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external returns (bytes32);
| function transferByPartition(bytes32 _partition, address _to, uint256 _value, bytes calldata _data) external returns (bytes32);
function operatorTransferByPartition(bytes32 _partition, address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external returns (bytes32);
| 2,136 |
12 | // Set vault | vault = IYVaultV2(_vault);
curve = ICurvePool(_curve);
| vault = IYVaultV2(_vault);
curve = ICurvePool(_curve);
| 17,288 |
81 | // Set the UNIV2WBTCETH-A percentage between bids (e.g. 3% => X = 103) | FlipAbstract(MCD_FLIP_UNIV2WBTCETH_A).file("beg", 103 * WAD / 100);
| FlipAbstract(MCD_FLIP_UNIV2WBTCETH_A).file("beg", 103 * WAD / 100);
| 20,518 |
102 | // There are two caveats with this computation: 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows. 10^41 is stored internally as a uint256 10^59. 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666. | return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));
| return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue));
| 7,681 |
1 | // 18 = admission age |
event UserCreated (string UserId, bool admitted);
event UserDeleted (string UserId, bool admitted, address deletedBy);
|
event UserCreated (string UserId, bool admitted);
event UserDeleted (string UserId, bool admitted, address deletedBy);
| 30,224 |
145 | // parses the passed in action arguments to get the arguments for a call action _args general action arguments structurereturn arguments for a call action / | function _parseCallArgs(ActionArgs memory _args) internal pure returns (CallArgs memory) {
require(_args.actionType == ActionType.Call, "A22");
require(_args.secondAddress != address(0), "A23");
return CallArgs({callee: _args.secondAddress, data: _args.data});
}
| function _parseCallArgs(ActionArgs memory _args) internal pure returns (CallArgs memory) {
require(_args.actionType == ActionType.Call, "A22");
require(_args.secondAddress != address(0), "A23");
return CallArgs({callee: _args.secondAddress, data: _args.data});
}
| 568 |
4 | // Builds a prefixed hash to mimic the behavior of eth_sign. | function prefixed(bytes32 hash) internal pure returns (bytes memory) {
return abi.encodePacked("\x19Ethereum Signed Message:\n32", hash);
}
| function prefixed(bytes32 hash) internal pure returns (bytes memory) {
return abi.encodePacked("\x19Ethereum Signed Message:\n32", hash);
}
| 30,661 |
168 | // require(!isBlacklisted[msg.sender], "from blacklisted"); | require(!isBlacklisted[to], "to blacklisted");
uint256 shareValue = value.mul(_sharesPerToken);
_shareBalances[msg.sender] = _shareBalances[msg.sender].sub(
shareValue,
"transfer amount exceed account balance"
);
_shareBalances[to] = _shareBalances[to].add(shareValue);
emit Transfer(msg.sender, to, value);
return true;
| require(!isBlacklisted[to], "to blacklisted");
uint256 shareValue = value.mul(_sharesPerToken);
_shareBalances[msg.sender] = _shareBalances[msg.sender].sub(
shareValue,
"transfer amount exceed account balance"
);
_shareBalances[to] = _shareBalances[to].add(shareValue);
emit Transfer(msg.sender, to, value);
return true;
| 48,824 |
119 | // Set APR of the Lido protocol. Only callable by the owner./10000 is equal to 100.00% (2 decimals). Zero (0) is a valid value./_lidoAPR An APR of the Lido protocol. | function _setLidoAPR(uint16 _lidoAPR) internal {
require(_lidoAPR <= 10000, "PrizePool/lido-APR-is-too-high");
lidoAPR = _lidoAPR;
emit LidoAPRSet(_lidoAPR);
}
| function _setLidoAPR(uint16 _lidoAPR) internal {
require(_lidoAPR <= 10000, "PrizePool/lido-APR-is-too-high");
lidoAPR = _lidoAPR;
emit LidoAPRSet(_lidoAPR);
}
| 29,745 |
2 | // Mint a given amount of CSTK tokens to a recipient account.// If the account is not a member (has a CSTK token balance of 0), this will increase the pending balance/ of the account.// The recipient cannot receive an mount of tokens greater than the `maxTrust` value of her account/ in the Registry contract./Can only be called by an Admin account./recipient The account to receive CSTK tokens/toMint The amount of CSTK we expect to mint | function mint(address recipient, uint256 toMint) external;
| function mint(address recipient, uint256 toMint) external;
| 13,295 |
1 | // account the account to incentivize/incentive the associated incentive contract/only UAD manager can set Incentive contract | function setIncentiveContract(address account, address incentive) external {
require(
ERC20Ubiquity.manager.hasRole(
ERC20Ubiquity.manager.UBQ_TOKEN_MANAGER_ROLE(),
msg.sender
),
"uAD: must have admin role"
);
incentiveContract[account] = incentive;
| function setIncentiveContract(address account, address incentive) external {
require(
ERC20Ubiquity.manager.hasRole(
ERC20Ubiquity.manager.UBQ_TOKEN_MANAGER_ROLE(),
msg.sender
),
"uAD: must have admin role"
);
incentiveContract[account] = incentive;
| 63,014 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.