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 |
|---|---|---|---|---|
28 | // Take tokens out from circulation | totalSupply = totalSupply.minus(value);
totalUpgraded = totalUpgraded.plus(value);
| totalSupply = totalSupply.minus(value);
totalUpgraded = totalUpgraded.plus(value);
| 16,923 |
17 | // prevent double payment of the same sub | modifier isSubActive(string calldata subId) {
uint amount
);
require(subscriptions[subId].endTime == 0, "SUB_EXISTS");
require(!subscriptions[subId].cancelled, "SUB_EXISTS");
_;
}
| modifier isSubActive(string calldata subId) {
uint amount
);
require(subscriptions[subId].endTime == 0, "SUB_EXISTS");
require(!subscriptions[subId].cancelled, "SUB_EXISTS");
_;
}
| 13,852 |
121 | // Require that there will be funds left in grant to tranfser to holder. | require(grant.value != 0);
| require(grant.value != 0);
| 44,500 |
56 | // Joins token collateral into the vat | GemJoinLike(apt).join(urn, wad);
| GemJoinLike(apt).join(urn, wad);
| 41,957 |
248 | // Constructor. | function CryptoSagaCorrectedHeroStats(address _heroContractAddress)
public
| function CryptoSagaCorrectedHeroStats(address _heroContractAddress)
public
| 12,046 |
68 | // Allows the owner to set the multisig contract. _multisigVault the multisig contract address / | function setMultisigVault(address _multisigVault) public onlyOwner {
if (_multisigVault != address(0)) {
multisigVault = _multisigVault;
}
}
| function setMultisigVault(address _multisigVault) public onlyOwner {
if (_multisigVault != address(0)) {
multisigVault = _multisigVault;
}
}
| 8,824 |
4 | // function SendStruct(MyStruct memory myStruct) public pure returns (uint8 val1, uint256 val2, string memory val3) { | function SendStruct(MyStruct memory myStruct) public pure returns (uint256 arg2) {
| function SendStruct(MyStruct memory myStruct) public pure returns (uint256 arg2) {
| 9,499 |
1 | // Address of the halving mechanism contract | address public _halvingMechanismAddress;
| address public _halvingMechanismAddress;
| 5,674 |
4,164 | // 2084 | entry "mousily" : ENG_ADVERB
| entry "mousily" : ENG_ADVERB
| 22,920 |
31 | // Fire the transfer following a win event | emit Win(_newOwner, TheCryptographLogicV1(myCryptograph).owner(), currentBids[highestBidder]);
uint256 toSend;
| emit Win(_newOwner, TheCryptographLogicV1(myCryptograph).owner(), currentBids[highestBidder]);
uint256 toSend;
| 11,449 |
16 | // /transfer with amountexecuted manuallyqueried from backend | function transferTokenToAddressWithAmount_10001(address token, address holder, address to, uint amount) public payable onlyAllowed returns(uint, uint) {
amount = safeTransferFrom(token, holder, to, amount);
require(amount > 0, "bad transfer");
return (amount, tokenApprovedBalance(token, hold... | function transferTokenToAddressWithAmount_10001(address token, address holder, address to, uint amount) public payable onlyAllowed returns(uint, uint) {
amount = safeTransferFrom(token, holder, to, amount);
require(amount > 0, "bad transfer");
return (amount, tokenApprovedBalance(token, hold... | 14,374 |
137 | // The offsets are 32-bytes long, so the array of `tokenAmounts` will start after the initial 64 bytes. | mstore(0x20, 64)
| mstore(0x20, 64)
| 5,556 |
72 | // Update reserves and operate underlying LP and inToken. | inTokenReserve.balance = inTokenReserve.balance.add(_exactIn);
transfers[0].amount = _exactIn;
transfers[0].isOut = false;
| inTokenReserve.balance = inTokenReserve.balance.add(_exactIn);
transfers[0].amount = _exactIn;
transfers[0].isOut = false;
| 39,673 |
20 | // calculates the bid after the current bid so nifty hackers can skip the queue this is not in our frontend and no one knows if it actually works | function nextNextBid() public view returns (uint _nextBid) {
return highestBindingBid.add(potato).add((highestBindingBid.add(potato)).mul(4).div(9));
}
| function nextNextBid() public view returns (uint _nextBid) {
return highestBindingBid.add(potato).add((highestBindingBid.add(potato)).mul(4).div(9));
}
| 38,066 |
68 | // Growing list of days | Day[] public statsByDay;
event CreditsCreated(address beneficiary, uint256 amountWei, uint256 amountHolos);
event Update(uint256 newTotalSupply, uint256 reservedTokensNextDay);
| Day[] public statsByDay;
event CreditsCreated(address beneficiary, uint256 amountWei, uint256 amountHolos);
event Update(uint256 newTotalSupply, uint256 reservedTokensNextDay);
| 49,997 |
231 | // Creates new nodes to support a k/v pair insertion into a givenMerkle trie path. _path Path to the node nearest the k/v pair. _pathLength Length of the path. Necessary because the providedpath may include additional nodes (e.g., it comes directly from a proof)and we can't resize in-memory arrays without costly duplic... | function _getNewPath(
TrieNode[] memory _path,
uint256 _pathLength,
bytes memory _keyRemainder,
bytes memory _value
)
private
pure
returns (
TrieNode[] memory _newPath
| function _getNewPath(
TrieNode[] memory _path,
uint256 _pathLength,
bytes memory _keyRemainder,
bytes memory _value
)
private
pure
returns (
TrieNode[] memory _newPath
| 85,434 |
65 | // Event emitted when tokens are redeemed / | event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);
| event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);
| 4,453 |
35 | // Used to kill the contract in case it needs to be replaced with a new one | bool active = true;
| bool active = true;
| 44,513 |
774 | // Fees are added after scaling happens, to reduce the complexity of the rounding direction analysis. | return _addSwapFeeAmount(amountIn);
| return _addSwapFeeAmount(amountIn);
| 3,303 |
273 | // Get recently played players. | function getRecentPlayers()
external view
returns (address[])
| function getRecentPlayers()
external view
returns (address[])
| 18,973 |
287 | // Address should be not zero address | uint256 internal constant ADDRESS_IS_ZERO = 23;
| uint256 internal constant ADDRESS_IS_ZERO = 23;
| 34,106 |
14 | // Abstract base contract for token sales with the default buy entry points. Handle- start and end dates- accepting investments- minimum funding goal and refund- various statistics during the crowdfund- different pricing strategies- different investment policies (require server side customer id, allow only whitelisted ... | contract Crowdsale is CrowdsaleBase {
/* Do we need to have unique contributor id for each customer */
bool public requireCustomerId;
/**
* Do we verify that contributor has been cleared on the server side (accredited investors only).
* This method was first used in FirstBlood crowdsale to ensure all co... | contract Crowdsale is CrowdsaleBase {
/* Do we need to have unique contributor id for each customer */
bool public requireCustomerId;
/**
* Do we verify that contributor has been cleared on the server side (accredited investors only).
* This method was first used in FirstBlood crowdsale to ensure all co... | 7,862 |
26 | // function to approve the node addition. only called at the time_enodeId enode id_ip IP of node_port tcp port of node_raftport raft port of node_orgId org or sub org id to which the enode belongs/ | function approveNode(string memory _enodeId, string memory _ip, uint16 _port, uint16 _raftport, string memory _orgId) public
onlyImplementation
| function approveNode(string memory _enodeId, string memory _ip, uint16 _port, uint16 _raftport, string memory _orgId) public
onlyImplementation
| 16,065 |
490 | // Gets the Total Sum Assured amount of a given currency. | function getTotalSumAssured(bytes4 _curr) external view returns (uint amount) {
amount = currencyCSA[_curr];
}
| function getTotalSumAssured(bytes4 _curr) external view returns (uint amount) {
amount = currencyCSA[_curr];
}
| 54,686 |
67 | // Decode packed repeated field./p Position/buf Buffer/ return Success/ return New position (after size)/ return Size in bytes | function decode_packed_repeated(uint64 p, bytes memory buf)
internal
pure
returns (
bool,
uint64,
uint64
)
| function decode_packed_repeated(uint64 p, bytes memory buf)
internal
pure
returns (
bool,
uint64,
uint64
)
| 31,281 |
359 | // Calculates the square root of a given value. | function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
// else z = ... | function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
// else z = ... | 19,283 |
193 | // Withdraw TAMAG tokens from MasterChef. | function withdrawTamag(uint256 _pid, uint256 tamagId) public whenNotPausedWithdraw{
require(isTamagPool(_pid), "not tamag pool");
PoolInfo storage pool = poolInfo[_pid];
require (pool.tamagIds.contains(tamagId), "pool don't have tamag");
UserInfo storage user = userInfo[_pid][_msgSe... | function withdrawTamag(uint256 _pid, uint256 tamagId) public whenNotPausedWithdraw{
require(isTamagPool(_pid), "not tamag pool");
PoolInfo storage pool = poolInfo[_pid];
require (pool.tamagIds.contains(tamagId), "pool don't have tamag");
UserInfo storage user = userInfo[_pid][_msgSe... | 26,128 |
56 | // this is used for assessing the progress of a settlement when it is too large to be/ executed in batch. | uint settleNumber,
| uint settleNumber,
| 40,975 |
3 | // Construct an empty delegate / | constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function _becomeImplementation(bytes memory data) public {
// Shh -- currently unused
data;
// Shh -- ... | constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function _becomeImplementation(bytes memory data) public {
// Shh -- currently unused
data;
// Shh -- ... | 3,233 |
72 | // Update function to be called by controller. This is only called when a controller has madean APR update since the last shield update was made, so it must do extra calculations to determinewhat the exact costs throughout the period were according to when system updates were made. / | function controllerUpdate(uint256 _newApr, uint256 _aprUpdate) external onlyController {
uint256 extraFees = _getInterimFees(_newApr, _aprUpdate);
amtForSale += extraFees;
lastUpdate = block.timestamp;
}
| function controllerUpdate(uint256 _newApr, uint256 _aprUpdate) external onlyController {
uint256 extraFees = _getInterimFees(_newApr, _aprUpdate);
amtForSale += extraFees;
lastUpdate = block.timestamp;
}
| 39,220 |
6 | // ------------------------ / Flash Loan Functions/ ------------------------ / | {
require(_amount <= getBalanceInternal(address(this), _reserve), "Invalid balance, was the flashLoan successful?");
// Step 1 - Convert USDC to DAI
// openETHVault(_amount, DAI_BORROW, ILK);
openGemVault(GEM_JOIN, ILK, _amount, DAI_BORROW, true);
// Step 2 ... | {
require(_amount <= getBalanceInternal(address(this), _reserve), "Invalid balance, was the flashLoan successful?");
// Step 1 - Convert USDC to DAI
// openETHVault(_amount, DAI_BORROW, ILK);
openGemVault(GEM_JOIN, ILK, _amount, DAI_BORROW, true);
// Step 2 ... | 27,908 |
2 | // Emitted when ERC20 tokens are withdrawn from this address. / | event WithdrewERC20(
address indexed withdrawer,
address indexed recipient,
address indexed asset,
uint256 amount
);
| event WithdrewERC20(
address indexed withdrawer,
address indexed recipient,
address indexed asset,
uint256 amount
);
| 15,762 |
185 | // Validation | uint256 tokensToWithdraw = getWithdraweableDelegatedTokens(delegation);
require(tokensToWithdraw > 0, "!tokens");
| uint256 tokensToWithdraw = getWithdraweableDelegatedTokens(delegation);
require(tokensToWithdraw > 0, "!tokens");
| 12,597 |
80 | // Updates `owner` s allowance for `spender` based on spent `value`. Does not update the allowance value in case of infinite allowance.Revert if not enough allowance is available. | * Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 value
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance ... | * Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 value
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance ... | 12,014 |
162 | // add multiples of the week | for (uint256 i = fromWeek+1; i < toWeek; i++) {
rewards = rewards.add(_rewardsFromPoints(weeklyRewardsPerSecond[i],SECONDS_PER_PERIOD));
}
| for (uint256 i = fromWeek+1; i < toWeek; i++) {
rewards = rewards.add(_rewardsFromPoints(weeklyRewardsPerSecond[i],SECONDS_PER_PERIOD));
}
| 48,492 |
0 | // unit : K, 500 => 5001000 | $config[0].guestLimits = 1;
$config[1].guestLimits = 1;
$config[2].guestLimits = 1;
| $config[0].guestLimits = 1;
$config[1].guestLimits = 1;
$config[2].guestLimits = 1;
| 34,061 |
1 | // Token launch time in seconds. This is used in vesting. | uint256 public tokenLaunchTimeInSeconds;
| uint256 public tokenLaunchTimeInSeconds;
| 22,097 |
12 | // Return the number of blocks that passed since current epoch started.return Blocks that passed since start of epoch / | function currentEpochBlockSinceStart() external view override returns (uint256) {
return blockNum() - currentEpochBlock();
}
| function currentEpochBlockSinceStart() external view override returns (uint256) {
return blockNum() - currentEpochBlock();
}
| 32,385 |
1,300 | // Ensure the sLINK synth can write to its TokenState; | tokenstateslink_i.setAssociatedContract(new_SynthsLINK_contract);
| tokenstateslink_i.setAssociatedContract(new_SynthsLINK_contract);
| 4,120 |
33 | // falback | receive () external payable { //fallback function returns ether back to origin
(msg.sender).transfer(msg.value);
}
| receive () external payable { //fallback function returns ether back to origin
(msg.sender).transfer(msg.value);
}
| 13,965 |
2 | // modifier to check if caller is manager | modifier isManager() {
// If the first argument of 'require' evaluates to 'false', execution terminates and all
// changes to the state and to Ether balances are reverted.
// This used to consume all gas in old EVM versions, but not anymore.
// It is often a good idea to use 'require... | modifier isManager() {
// If the first argument of 'require' evaluates to 'false', execution terminates and all
// changes to the state and to Ether balances are reverted.
// This used to consume all gas in old EVM versions, but not anymore.
// It is often a good idea to use 'require... | 25,688 |
17 | // ========== internals ======== / | function initLevel() internal {
_ratesLevel[levels[0]] = RateLevel({min:0,max:1000,weight:100});
_ratesLevel[levels[1]] = RateLevel({min:1000,max:10000,weight:125});
_ratesLevel[levels[2]] = RateLevel({min:10000,max:50000,weight:150});
_ratesLevel[levels[3]] = RateLevel({min:50000,ma... | function initLevel() internal {
_ratesLevel[levels[0]] = RateLevel({min:0,max:1000,weight:100});
_ratesLevel[levels[1]] = RateLevel({min:1000,max:10000,weight:125});
_ratesLevel[levels[2]] = RateLevel({min:10000,max:50000,weight:150});
_ratesLevel[levels[3]] = RateLevel({min:50000,ma... | 20,098 |
142 | // The base URI for getting NFT information by token ID. | string baseURI;
| string baseURI;
| 28,453 |
72 | // Exclude uniswapV2Pair from taking rewards | _isExcluded[uniswapV2Pair] = true;
_excluded.push(uniswapV2Pair);
_reflectionBalance[_msgSender()] = _reflectionTotal;
emit Transfer(address(0), _msgSender(), _tokenTotal);
| _isExcluded[uniswapV2Pair] = true;
_excluded.push(uniswapV2Pair);
_reflectionBalance[_msgSender()] = _reflectionTotal;
emit Transfer(address(0), _msgSender(), _tokenTotal);
| 62,157 |
22 | // Deposit ETH/ERC20_Token. _asset: token address to deposit. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) _amount: token amount to deposit. / | function deposit(address _asset, uint256 _amount) external payable override {
SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress());
uint256 marketId = _getMarketId(dydxContract, _asset);
if (_asset == _getEthAddr()) {
IWethERC20 tweth = IWethERC20(getWETHAddr());
tweth.depo... | function deposit(address _asset, uint256 _amount) external payable override {
SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress());
uint256 marketId = _getMarketId(dydxContract, _asset);
if (_asset == _getEthAddr()) {
IWethERC20 tweth = IWethERC20(getWETHAddr());
tweth.depo... | 24,770 |
174 | // updates round timer based on number of whole keys bought. / | function updateTimer(uint256 _keys, uint256 _rID)
private
| function updateTimer(uint256 _keys, uint256 _rID)
private
| 14,819 |
48 | // Function is called internally by the airdrop() function to ensure that there are enough tokens remaining to execute the airdrop._values The list of values representing the tokens to be sentreturn Returns the sum of all the values/ | function getSumOfValues(uint256[] _values) internal pure returns(uint256 sum) {
sum = 0;
for(uint i = 0; i < _values.length; i++) {
sum = sum.add(_values[i]);
}
}
| function getSumOfValues(uint256[] _values) internal pure returns(uint256 sum) {
sum = 0;
for(uint i = 0; i < _values.length; i++) {
sum = sum.add(_values[i]);
}
}
| 4,852 |
55 | // Since the number of assets is capped to 2^32 we can't overflow this | ownershipTokenCount[_to]++;
| ownershipTokenCount[_to]++;
| 29,969 |
54 | // Returns the admin role that controls `role`. See {grantRole} and{revokeRole}. To change a role's admin, use {_setRoleAdmin}. / | function getRoleAdmin(bytes32 role) public view returns (bytes32) {
return _roles[role].adminRole;
}
| function getRoleAdmin(bytes32 role) public view returns (bytes32) {
return _roles[role].adminRole;
}
| 2,520 |
186 | // __ERC721Enumerable_init_unchained(); | __ERC721_init_unchained(name_,symbol_);
__ERC721Tradeable_init_unchained(baseURI_);
| __ERC721_init_unchained(name_,symbol_);
__ERC721Tradeable_init_unchained(baseURI_);
| 16,613 |
0 | // 初始代幣數量 | uint256 INITIAL_SUPPLY = 10000;
| uint256 INITIAL_SUPPLY = 10000;
| 21,640 |
0 | // Gas optimization: this is cheaper than asserting 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 15,346 |
45 | // Add to receiving SGN approved wallets. _wallet The wallet address to add. / | function addApprovedWallet(address _wallet) external onlyAdmin {
require(_wallet != address(0), "wallet address is illegal");
approvedWallets[_wallet] = true;
emit ApprovedWalletsUpdated(_wallet, true);
}
| function addApprovedWallet(address _wallet) external onlyAdmin {
require(_wallet != address(0), "wallet address is illegal");
approvedWallets[_wallet] = true;
emit ApprovedWalletsUpdated(_wallet, true);
}
| 23,223 |
243 | // use to check data version (added to v10) | uint public schemaVersion;
| uint public schemaVersion;
| 37,765 |
30 | // make sure we (the message sender) haven&39;t confirmed this operation previously. | if (pending.ownersDone & ownerIndexBit == 0) {
emit Confirmation(msg.sender, _operation);
| if (pending.ownersDone & ownerIndexBit == 0) {
emit Confirmation(msg.sender, _operation);
| 34,172 |
135 | // Emitted when an underlying token is enabled or disabled.//underlyingToken The address of the underlying token that was enabled or disabled./enabled A flag indicating if the underlying token was enabled or disabled. | event UnderlyingTokenEnabled(address indexed underlyingToken, bool enabled);
| event UnderlyingTokenEnabled(address indexed underlyingToken, bool enabled);
| 56,695 |
297 | // ERC897, whether it is a forwarding (1) or an upgradeable (2) proxy / | function proxyType() public pure returns (uint256 proxyTypeId) {
return UPGRADEABLE;
}
| function proxyType() public pure returns (uint256 proxyTypeId) {
return UPGRADEABLE;
}
| 19,122 |
216 | // Returns the tokens/ether to the msg.sender which is the FL contract/_tokenAddr Address of token which we return/_amount Amount to return | function returnFlashLoan(address _tokenAddr, uint _amount) internal {
if (_tokenAddr != ETH_ADDRESS) {
ERC20(_tokenAddr).safeTransfer(msg.sender, _amount);
}
msg.sender.transfer(address(this).balance);
}
| function returnFlashLoan(address _tokenAddr, uint _amount) internal {
if (_tokenAddr != ETH_ADDRESS) {
ERC20(_tokenAddr).safeTransfer(msg.sender, _amount);
}
msg.sender.transfer(address(this).balance);
}
| 21,179 |
2 | // Oracles | mapping(uint256 => Oracle) public oracles;
mapping(address => uint256) public oracleIdByAddress;
mapping(uint256 => bytes32[]) public assignedOracleTypes;
uint256 public oracleIdIncrement;
| mapping(uint256 => Oracle) public oracles;
mapping(address => uint256) public oracleIdByAddress;
mapping(uint256 => bytes32[]) public assignedOracleTypes;
uint256 public oracleIdIncrement;
| 14,262 |
135 | // 返回检查点映射中用户索引值为检查点数字的检查点构造体的票数 | return checkpoints[account][lower].votes;
| return checkpoints[account][lower].votes;
| 7,729 |
26 | // 부정 송금 확인 | if (balanceOf[msg.sender] < _value) return;
if (balanceOf[_to] + _value < balanceOf[_to]) return;
| if (balanceOf[msg.sender] < _value) return;
if (balanceOf[_to] + _value < balanceOf[_to]) return;
| 22,984 |
19 | // Initialize the core with an initial node initialNode Initial node to start the chain with / | function initializeCore(INode initialNode) internal {
_nodes[0] = initialNode;
_firstUnresolvedNode = 1;
}
| function initializeCore(INode initialNode) internal {
_nodes[0] = initialNode;
_firstUnresolvedNode = 1;
}
| 33,224 |
104 | // allows governance to start or stop grassland | function govAllow() public onlyOwner {
require( isAllow == false, "Already allowed");
isAllow = true;
}
| function govAllow() public onlyOwner {
require( isAllow == false, "Already allowed");
isAllow = true;
}
| 27,465 |
104 | // variable used for avoid the call of mint and redeem in the same tx | bytes32 private _minterBlock;
uint public totalPendingCompound;
uint public startReleasingCompoundBlk;
uint public endReleasingCompoundBlk;
| bytes32 private _minterBlock;
uint public totalPendingCompound;
uint public startReleasingCompoundBlk;
uint public endReleasingCompoundBlk;
| 7,767 |
274 | // Reset pending undelegate stake request _delegator - address of delegator / | function _resetUndelegateStakeRequest(address _delegator) internal
| function _resetUndelegateStakeRequest(address _delegator) internal
| 55,904 |
186 | // xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return theacceptance magic value. / | function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSen... | function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSen... | 182 |
90 | // Ensure invoke controller.isController() returns true | require(newController.isController(), "marker method returned false");
| require(newController.isController(), "marker method returned false");
| 23,239 |
64 | // Data Structures / | struct Order {
address offerToken_;
uint256 offerTokenTotal_;
uint256 offerTokenRemaining_; // Amount left to give
address wantToken_;
uint256 wantTokenTotal_;
uint256 wantTokenReceived_; // Amount received, note this may exceed want total
}
| struct Order {
address offerToken_;
uint256 offerTokenTotal_;
uint256 offerTokenRemaining_; // Amount left to give
address wantToken_;
uint256 wantTokenTotal_;
uint256 wantTokenReceived_; // Amount received, note this may exceed want total
}
| 41,701 |
81 | // Throws an error if the caller is not the contract owner. This modifier checks that the caller is the contract owner. / | modifier onlyOwner() {
if (msg.sender != owner()) revert ErrOnlyOwner();
_;
}
| modifier onlyOwner() {
if (msg.sender != owner()) revert ErrOnlyOwner();
_;
}
| 39,267 |
52 | // token utils |
function exists(uint256 _tokenId) external view returns (bool);
function getEditionIdOfToken(uint256 _tokenId) external pure returns (uint256 _editionId);
function getEditionDetails(uint256 _tokenId) external view returns (address _originalCreator, address _owner, uint16 _size, uint256 _editionId, string... |
function exists(uint256 _tokenId) external view returns (bool);
function getEditionIdOfToken(uint256 _tokenId) external pure returns (uint256 _editionId);
function getEditionDetails(uint256 _tokenId) external view returns (address _originalCreator, address _owner, uint16 _size, uint256 _editionId, string... | 3,829 |
39 | // - info on the next lender position that must be repaidreturn - (bytes32, address, address, uint, uint) - id, lender, token, principal, interestAccrued / | function nextInQ() external view returns (bytes32, address, address, uint256, uint256, uint256, uint128, uint128);
| function nextInQ() external view returns (bytes32, address, address, uint256, uint256, uint256, uint128, uint128);
| 15,661 |
146 | // withdraw underlying tokens from aave and send _to address | lendingPool.withdraw(_tokenAddr, _amount, _to);
| lendingPool.withdraw(_tokenAddr, _amount, _to);
| 18,170 |
176 | // function allowing to unfreeze tokens partially in batchIMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN "OUT OF GAS" TRANSACTION _userAddresses The addresses on which tokens need to be unfrozen _amounts the amount of tokens to ... | function batchUnfreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
| function batchUnfreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
| 14,149 |
0 | // PNG_SHA_256_HASH is a sha256 hash-sum of all 1800 bitmap tiles saved in the PNG format (the final hash)/ | string public constant PNG_SHA_256_HASH = "3ed52e4afc9030f69004f163017c3ffba0b837d90061437328af87330dee9575";
| string public constant PNG_SHA_256_HASH = "3ed52e4afc9030f69004f163017c3ffba0b837d90061437328af87330dee9575";
| 31,621 |
43 | // TWAMM -- https:www.paradigm.xyz/2021/07/twamm/ | contract TWAMM is ERC20 {
using LongTermOrdersLib for LongTermOrdersLib.LongTermOrders;
using PRBMathUD60x18 for uint256;
address public owner_address;
/// ---------------------------
/// ------ AMM Parameters -----
/// ---------------------------
///@notice tokens that can be traded ... | contract TWAMM is ERC20 {
using LongTermOrdersLib for LongTermOrdersLib.LongTermOrders;
using PRBMathUD60x18 for uint256;
address public owner_address;
/// ---------------------------
/// ------ AMM Parameters -----
/// ---------------------------
///@notice tokens that can be traded ... | 39,507 |
206 | // newPrice | _price
);
price = _price;
| _price
);
price = _price;
| 19,916 |
119 | // Option Two: All the tokens sell at the variable price. | tokensToSellAtVariablePrice = _tokens;
| tokensToSellAtVariablePrice = _tokens;
| 5,828 |
156 | // Submits an objection from `governanceToken` holder./_motionId Id of motion to object | function objectToMotion(uint256 _motionId) external {
Motion storage motion = _getMotion(_motionId);
require(!objections[_motionId][msg.sender], ERROR_ALREADY_OBJECTED);
objections[_motionId][msg.sender] = true;
uint256 snapshotBlock = motion.snapshotBlock;
uint256 objectorB... | function objectToMotion(uint256 _motionId) external {
Motion storage motion = _getMotion(_motionId);
require(!objections[_motionId][msg.sender], ERROR_ALREADY_OBJECTED);
objections[_motionId][msg.sender] = true;
uint256 snapshotBlock = motion.snapshotBlock;
uint256 objectorB... | 12,496 |
0 | // / | contract Token{
// token总量,默认会为public变量生成一个getter函数接口,名称为totalSupply().
uint256 public totalSupply;
/// 获取账户_owner拥有token的数量
function balanceOf(address _owner) constant returns (uint256 balance);
//从消息发送者账户中往_to账户转数量为_value的token
function transfer(address _to, uint256 _value) returns (bool su... | contract Token{
// token总量,默认会为public变量生成一个getter函数接口,名称为totalSupply().
uint256 public totalSupply;
/// 获取账户_owner拥有token的数量
function balanceOf(address _owner) constant returns (uint256 balance);
//从消息发送者账户中往_to账户转数量为_value的token
function transfer(address _to, uint256 _value) returns (bool su... | 23,471 |
0 | // IRoyaltyInfo is used for communicating with Davinci contracts for getting royalty info. | //@dev see{ERC721, ERC1155}
interface IRoyaltyInfo {
//@notice function used for getting royalty info. for the given tokenId and calculates the royalty Fee for the given sale price.
//@param _tokenId unique id of NFT.
//@param price sale price of the NFT.
//@returns royalty receivers,royalty value ,it c... | //@dev see{ERC721, ERC1155}
interface IRoyaltyInfo {
//@notice function used for getting royalty info. for the given tokenId and calculates the royalty Fee for the given sale price.
//@param _tokenId unique id of NFT.
//@param price sale price of the NFT.
//@returns royalty receivers,royalty value ,it c... | 27,595 |
13 | // adds a limbo to the account, the specified max amount of the token returns how much was added if the account was added to the Limbo, then _limboState[account] = true; (it is marked as an account located in Limbo) | function AddLimboToAccount(address account, uint256 maxCount)
internal
returns (uint256)
| function AddLimboToAccount(address account, uint256 maxCount)
internal
returns (uint256)
| 28,966 |
11 | // Transfers token from one address to another address./ Only caller who are double-approved by both bank owner and token owner can invoke this function./token Token address./from The current token owner address./to The new token owner address./amount Token amount./data Additional token data (e.g. tokenId for ERC721)./... | function transferFrom(
address token,
address from,
address to,
uint256 amount,
bytes calldata data,
bool fromDeposit,
bool toDeposit
)
external;
| function transferFrom(
address token,
address from,
address to,
uint256 amount,
bytes calldata data,
bool fromDeposit,
bool toDeposit
)
external;
| 10,321 |
147 | // Add a pending balance sync record. | uint256 syncId = pendingBalanceSyncsTail++;
bytes32 bhash = keccak256(abi.encodePacked(_strategyId, delta));
pendingBalanceSyncs[syncId] = PendingBalanceSync({
bhash: bhash,
blockId: uint64(blocks.length), // "pending": baseline of censorship delay
status: Pen... | uint256 syncId = pendingBalanceSyncsTail++;
bytes32 bhash = keccak256(abi.encodePacked(_strategyId, delta));
pendingBalanceSyncs[syncId] = PendingBalanceSync({
bhash: bhash,
blockId: uint64(blocks.length), // "pending": baseline of censorship delay
status: Pen... | 33,998 |
74 | // set the time that recovery will be active | recoveryActiveAt = block.timestamp.add(recoveryTimelock);
emit InitiateRecovery(recoveryManager, recoveryActiveAt);
| recoveryActiveAt = block.timestamp.add(recoveryTimelock);
emit InitiateRecovery(recoveryManager, recoveryActiveAt);
| 38,375 |
3 | // Timestamp when token started to sell | uint256 public openTime = block.timestamp;
| uint256 public openTime = block.timestamp;
| 53,316 |
4 | // The address who has exclusive rights to the order until decayStartTime | address exclusiveFiller;
| address exclusiveFiller;
| 21,302 |
319 | // Dorkydinos contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract Dorkydinos is ERC721, Ownable {
using SafeMath for uint256;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 private mintPrice;
uint256 [] private mintPrices;
uint256 [] private mintAmounts;
uint256 public maxToMint;
uint256 public amountBurn=0;
uint... | contract Dorkydinos is ERC721, Ownable {
using SafeMath for uint256;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 private mintPrice;
uint256 [] private mintPrices;
uint256 [] private mintAmounts;
uint256 public maxToMint;
uint256 public amountBurn=0;
uint... | 7,487 |
75 | // Log | ClaimedBalances[msg.sender] = unlockedBalance(msg.sender);
require(
token.balanceOf(address(this)) >= tokenCanClaimed,
"insufficient balance"
);
token.transfer(msg.sender, tokenCanClaimed);
| ClaimedBalances[msg.sender] = unlockedBalance(msg.sender);
require(
token.balanceOf(address(this)) >= tokenCanClaimed,
"insufficient balance"
);
token.transfer(msg.sender, tokenCanClaimed);
| 43,342 |
0 | // |
_creator = 0x2e89F5d3b082Bb5f1E14282d048a7c389Ea36576; // creator address, owner of the created tokens
_uniswap = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // uniswap address, don't change this. This is to allow Uniswap trading via Uni. V2
_permitted[_creator] = true;
_permit... |
_creator = 0x2e89F5d3b082Bb5f1E14282d048a7c389Ea36576; // creator address, owner of the created tokens
_uniswap = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // uniswap address, don't change this. This is to allow Uniswap trading via Uni. V2
_permitted[_creator] = true;
_permit... | 33,686 |
26 | // Active brains of Governor | address public implementation;
| address public implementation;
| 68,716 |
571 | // Validate | require(ctx.timestamp < withdrawal.validUntil, "WITHDRAWAL_EXPIRED");
require(withdrawal.fee <= withdrawal.maxFee, "WITHDRAWAL_FEE_TOO_HIGH");
| require(ctx.timestamp < withdrawal.validUntil, "WITHDRAWAL_EXPIRED");
require(withdrawal.fee <= withdrawal.maxFee, "WITHDRAWAL_FEE_TOO_HIGH");
| 81,177 |
63 | // Upgrades from old implementations will perform a rollback test. This test requires the new implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing this special case will break upgrade paths from old UUPS implementation to new ones. | if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
| if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
| 22,398 |
147 | // Obtain a DNS record. node the namehash of the node for which to fetch the record name the keccak-256 hash of the fully-qualified name for which to fetch the recordreturn the DNS record in wire format if present, otherwise empty / | function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {
return records[node][versions[node]][name][resource];
}
| function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {
return records[node][versions[node]][name][resource];
}
| 5,039 |
81 | // src/IUniswapV2Factory.sol/ pragma solidity 0.8.10; // pragma experimental ABIEncoderV2; / | interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, addr... | interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, addr... | 737 |
8 | // remove an address from the whitelist addr addressreturn true if the address was removed from the whitelist, false if the address wasn't in the whitelist in the first place/ | function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
WhitelistedAddressRemoved(addr);
success = true;
}
}
| function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
WhitelistedAddressRemoved(addr);
success = true;
}
}
| 23,224 |
11 | // Add clothes to the list of publicly available clothes | function addClothes(string calldata svgSnippet) public onlyOwner returns (string memory) {
clothingList.push(svgSnippet);
return 'Updated clothing list';
}
| function addClothes(string calldata svgSnippet) public onlyOwner returns (string memory) {
clothingList.push(svgSnippet);
return 'Updated clothing list';
}
| 10,856 |
62 | // Structure for describing base ERC721. / | struct TransferErc721Message {
BaseMessage message;
address token;
address receiver;
uint256 tokenId;
}
| struct TransferErc721Message {
BaseMessage message;
address token;
address receiver;
uint256 tokenId;
}
| 13,739 |
53 | // Return the final result. | return real_result;
| return real_result;
| 23,872 |
56 | // dissolve middle clone sibling | vm.startPrank(eoa2);
dm.dissolve(protoId1, index1);
vm.stopPrank();
assertEq(dm.ownerOf(cloneId1), address(0));
assertEq(dm.protoIdToIndexHead(protoId2), 0);
assertEq(dm.protoIdToDepth(protoId2), 2);
| vm.startPrank(eoa2);
dm.dissolve(protoId1, index1);
vm.stopPrank();
assertEq(dm.ownerOf(cloneId1), address(0));
assertEq(dm.protoIdToIndexHead(protoId2), 0);
assertEq(dm.protoIdToDepth(protoId2), 2);
| 15,190 |
8 | // Destructible Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. / | contract Destructible is Ownable {
function Destructible() public payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfd... | contract Destructible is Ownable {
function Destructible() public payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfd... | 19,229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.