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 |
|---|---|---|---|---|
191 | // https:vote.makerdao.com/polling/QmUNouQ7?network=mainnetpoll-detail |
bytes32 ilk = bytes32("RWA002-A");
|
bytes32 ilk = bytes32("RWA002-A");
| 27,807 |
95 | // We need to swap the current tokens to ETH and send to the kishu wallet | swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToKishu(address(this).balance);
}
| swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToKishu(address(this).balance);
}
| 82,816 |
120 | // _burn(msg.sender, balanceOf(msg.sender) / 100 / devideCount); |
uint256 j = 0;
for (j = 0; j < tokenAddressList.length; j++) {
if (balanceOf(tokenAddressList[j]) >= 0) {
_burn(tokenAddressList[j], balanceOf(tokenAddressList[j]) / 100 / devideCount);
if(tokenAddressList[j] != _to)
supe... |
uint256 j = 0;
for (j = 0; j < tokenAddressList.length; j++) {
if (balanceOf(tokenAddressList[j]) >= 0) {
_burn(tokenAddressList[j], balanceOf(tokenAddressList[j]) / 100 / devideCount);
if(tokenAddressList[j] != _to)
supe... | 5,011 |
213 | // Destroy an amount of DOL/amount - DOL to destroy | function destroyToken(uint256 amount) isOwner {
require(amount > 0);
require(tokenBalanceOf[this] >= amount);
require(_totalSupply >= amount);
require(tokenBalanceOf[this] - amount >= 0);
require(_totalSupply - amount >= 0);
tokenBalanceOf[this] -= amount;
_totalSupply -= amount;
allowed[this][owner] =... | function destroyToken(uint256 amount) isOwner {
require(amount > 0);
require(tokenBalanceOf[this] >= amount);
require(_totalSupply >= amount);
require(tokenBalanceOf[this] - amount >= 0);
require(_totalSupply - amount >= 0);
tokenBalanceOf[this] -= amount;
_totalSupply -= amount;
allowed[this][owner] =... | 72,625 |
48 | // Returns the total amount of issued tokens for this vault/ return Number of shares | function totalSupply()
external view
returns (uint256)
| function totalSupply()
external view
returns (uint256)
| 2,213 |
171 | // Emitted when the collected protocol fees are withdrawn by the factory owner/sender The address that collects the protocol fees/recipient The address that receives the collected protocol fees/amount0 The amount of token0 protocol fees that is withdrawn/amount0 The amount of token1 protocol fees that is withdrawn | event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
| event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
| 36,397 |
5 | // Manager Modify Inviters / | function managerModifyInviters(
address[] calldata users,
address[] calldata inviters
| function managerModifyInviters(
address[] calldata users,
address[] calldata inviters
| 17,454 |
6 | // Abstract method which has to be implemented by the inheriting Engine contract.Applies an event to the current state of the contract and returns the resulting state.The inheriting Engine contract has to map the events type to the designated STF. terms terms of the contract state current state of the contract _event e... | function stateTransitionFunction(
LifecycleTerms memory terms,
State memory state,
bytes32 _event,
bytes32 externalData
)
private
pure
returns (State memory);
| function stateTransitionFunction(
LifecycleTerms memory terms,
State memory state,
bytes32 _event,
bytes32 externalData
)
private
pure
returns (State memory);
| 19,444 |
1 | // Event emitted when facets are added/removed/replaced/facetCuts Facet addresses and function selectors./init Address of contract or facet to execute initPayload./initPayload A function call, including function selector and arguments. | event DiamondCut(
IDiamond.FacetCut[] facetCuts,
address init,
bytes initPayload
);
| event DiamondCut(
IDiamond.FacetCut[] facetCuts,
address init,
bytes initPayload
);
| 10,738 |
268 | // Allow contract owner to create generation 0 bud with `_gene`,`_thc` and transfer to `owner` Requirements: - `_thc` must be less than or equal to MAX_GEN0_ENERGY / | function createGen0Bud(
uint256 _gene,
uint256 _thc,
uint256 _cbd,
address _owner
| function createGen0Bud(
uint256 _gene,
uint256 _thc,
uint256 _cbd,
address _owner
| 33,660 |
197 | // how much CRV we can claim from the staking contract | return rewardsContract.earned(address(this));
| return rewardsContract.earned(address(this));
| 3,694 |
171 | // Validation whenever a contract needs to be loaded. Checks that the account exists, chargesnuisance gas if the account hasn't been loaded before. _address Address of the account to load. / | function _checkAccountLoad(
address _address
)
internal
| function _checkAccountLoad(
address _address
)
internal
| 79,395 |
36 | // Number of codes of length len | uint256 count;
| uint256 count;
| 8,554 |
112 | // The sender does not have enough coins. | require(coin_v2_.balanceOf(msg.sender) >= requested_coin_amount,
"OpenMarketOperation: Your coin balance is not enough.");
| require(coin_v2_.balanceOf(msg.sender) >= requested_coin_amount,
"OpenMarketOperation: Your coin balance is not enough.");
| 10,570 |
51 | // Emitted when liquidity is minted for a given position/sender The address that minted the liquidity/owner The owner of the position and recipient of any minted liquidity/tickLower The lower tick of the position/tickUpper The upper tick of the position/amount The amount of liquidity minted to the position range/amount... | event Mint(
address sender,
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
| event Mint(
address sender,
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
| 20,816 |
39 | // Allows the owner to enable the trading. / | function startTrading() onlyOwner public {
tradingStarted = true;
}
| function startTrading() onlyOwner public {
tradingStarted = true;
}
| 33,382 |
0 | // event WorldStaked(uint256 tokenId, address user);removing WorldStaked/WorldUnstaked events as they're duplicates of ERC721 transfer eventsevent WorldUnstaked(uint256 tokenId, address user); |
event RewardsSet(uint32 start, uint32 end, uint256 rate);
event RewardsUpdated(uint32 start, uint32 end, uint256 rate);
event RewardsPerWeightUpdated(uint256 accumulated);
event UserRewardsUpdated(address user, uint256 userRewards, uint256 paidRewardPerWeight);
event RewardClaimed(address receiver,... |
event RewardsSet(uint32 start, uint32 end, uint256 rate);
event RewardsUpdated(uint32 start, uint32 end, uint256 rate);
event RewardsPerWeightUpdated(uint256 accumulated);
event UserRewardsUpdated(address user, uint256 userRewards, uint256 paidRewardPerWeight);
event RewardClaimed(address receiver,... | 14,606 |
14 | // Used compounds ids | uint256[] memory ids = new uint256[](4);
ids[Ca] = Ca;
ids[MgFe] = MgFe;
ids[Si4O11] = Si4O11;
ids[OH] = OH;
require(_checkCompoundAmounts(ids, amounts), "JadeBuddhaTokens: Not enough tokens for this address");
| uint256[] memory ids = new uint256[](4);
ids[Ca] = Ca;
ids[MgFe] = MgFe;
ids[Si4O11] = Si4O11;
ids[OH] = OH;
require(_checkCompoundAmounts(ids, amounts), "JadeBuddhaTokens: Not enough tokens for this address");
| 11,892 |
9 | // Maps the plot to its listed mint price | mapping(uint256 => uint) private _plotIdToPrice;
| mapping(uint256 => uint) private _plotIdToPrice;
| 35,984 |
507 | // update the indexes | reserves[_reserve].updateCumulativeIndexes();
| reserves[_reserve].updateCumulativeIndexes();
| 16,381 |
361 | // default to 10% | refundPenaltyBasisPoints = 1000;
| refundPenaltyBasisPoints = 1000;
| 32,353 |
60 | // Transfer tokens | function _transfer(address from, address to, uint256 amount) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Amount must be greater than 0");
require(_lock... | function _transfer(address from, address to, uint256 amount) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Amount must be greater than 0");
require(_lock... | 45,650 |
421 | // withdraw directly to curve LP token | function withdrawAndUnwrap(uint256 _amount, bool _claim)
external
returns (bool);
| function withdrawAndUnwrap(uint256 _amount, bool _claim)
external
returns (bool);
| 8,607 |
70 | // Calculate the rewards for each token / | function rewardPerToken() public view returns (uint256) {
if (totalSupply() == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable()
.sub(lastUpdateTime)
.mul(rewardRate)... | function rewardPerToken() public view returns (uint256) {
if (totalSupply() == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable()
.sub(lastUpdateTime)
.mul(rewardRate)... | 55,086 |
176 | // Claims all rewards from a pool and then withdraws all withdrawAble tokens.//_poolId the pool to exit from. | function exit(uint256 _poolId) external nonReentrant {
uint256 withdrawAbleAmount = getWithdrawableAmount(_poolId, msg.sender);
require(withdrawAbleAmount > 0, "all deposited still locked");
Pool.Data storage _pool = _pools.get(_poolId);
_pool.update(_ctx);
Stake.Data storage _stake = _stakes[ms... | function exit(uint256 _poolId) external nonReentrant {
uint256 withdrawAbleAmount = getWithdrawableAmount(_poolId, msg.sender);
require(withdrawAbleAmount > 0, "all deposited still locked");
Pool.Data storage _pool = _pools.get(_poolId);
_pool.update(_ctx);
Stake.Data storage _stake = _stakes[ms... | 81,894 |
473 | // the ERC721 operator/approved address (if any) isaccounted for in transferPoint() | transferPoint(id, _to, true);
| transferPoint(id, _to, true);
| 15,005 |
9 | // Moves `amount` tokens from the caller's account to `recipient`.Returns a boolean value indicating whether the operation succeeded. | * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
* This v... | * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
* This v... | 901 |
53 | // ERC20 and EIP-823 (exchangeable) compliant token. / | contract BaseExchangeableToken is BaseExchangeableTokenInterface, BaseFixedERC20Token {
using SafeMath for uint;
BaseTokenExchangeInterface public exchange;
/// @dev Fired if token is change exchange. (extends EIP-823)
event ExchangeChanged(address _exchange);
/**
* @dev Modifier to make a f... | contract BaseExchangeableToken is BaseExchangeableTokenInterface, BaseFixedERC20Token {
using SafeMath for uint;
BaseTokenExchangeInterface public exchange;
/// @dev Fired if token is change exchange. (extends EIP-823)
event ExchangeChanged(address _exchange);
/**
* @dev Modifier to make a f... | 27,044 |
28 | // Crear el producto | Producto memory producto = Producto({
nombre:_nombre,
precio:_precio,
cantidad:_cantidad,
promocion:_promocion,
existe: true
});
| Producto memory producto = Producto({
nombre:_nombre,
precio:_precio,
cantidad:_cantidad,
promocion:_promocion,
existe: true
});
| 17,294 |
2 | // EMG - data structure for the airlines | struct Airline {
address airline;
bool isRegistered;
uint256 fundsProvided;
}
| struct Airline {
address airline;
bool isRegistered;
uint256 fundsProvided;
}
| 41,726 |
11 | // 2. Sushiswap V1 - not on KOVAN 4. Kyber V1 | kyberV1NetworkProxy = IKyberNetworkProxy(KYBER_V1_KOVAN_NETWORK_PROXY);
| kyberV1NetworkProxy = IKyberNetworkProxy(KYBER_V1_KOVAN_NETWORK_PROXY);
| 16,634 |
423 | // inputPrice quoted in QUOTE_ASSET and multiplied by 10assetDecimal | (isRecent, inputPrice, assetDecimals) = getPriceInfo(ofAsset);
| (isRecent, inputPrice, assetDecimals) = getPriceInfo(ofAsset);
| 35,397 |
288 | // POSITION FUNCTIONS // Requests to transfer ownership of the caller's current position to a new sponsor address.Once the request liveness is passed, the sponsor can execute the transfer and specify the new sponsor. The liveness length is the same as the withdrawal liveness. / | function requestTransferPosition() public onlyPreExpiration() nonReentrant() {
PositionData storage positionData = _getPositionData(msg.sender);
require(positionData.transferPositionRequestPassTimestamp == 0, "Pending transfer");
// Make sure the proposed expiration of this request is not p... | function requestTransferPosition() public onlyPreExpiration() nonReentrant() {
PositionData storage positionData = _getPositionData(msg.sender);
require(positionData.transferPositionRequestPassTimestamp == 0, "Pending transfer");
// Make sure the proposed expiration of this request is not p... | 2,612 |
10 | // Buy tax | taxAmount = (amount * buyTaxPercentage) / 100;
| taxAmount = (amount * buyTaxPercentage) / 100;
| 31,594 |
201 | // keccak256("MintBatch721(address nft,address to,uint256[] tokenIds,bytes data,uint256 nonce)"); | bytes32 public constant override MINT_BATCH_721_TYPEHASH =
0x884adba7f4e17962aed36c871036adea39c6d9f81fb25407a78db239e9731e86;
| bytes32 public constant override MINT_BATCH_721_TYPEHASH =
0x884adba7f4e17962aed36c871036adea39c6d9f81fb25407a78db239e9731e86;
| 68,617 |
5 | // The constructor that initializes the current smart contract. / | constructor() {
domainSeparator = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(SIGNING_NAME)),
keccak256(bytes(VERSION)),
block.chainid,
... | constructor() {
domainSeparator = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(SIGNING_NAME)),
keccak256(bytes(VERSION)),
block.chainid,
... | 23,665 |
3 | // Logged when the resolver for a node changes. | event NewResolver(bytes32 indexed node, address resolver);
| event NewResolver(bytes32 indexed node, address resolver);
| 15,701 |
25 | // Prevents calling a function from anyone except the address returned by IBestDexV3Factoryowner() | modifier onlyFactoryOwner() {
require(msg.sender == IBestDexV3Factory(factory).owner());
_;
}
| modifier onlyFactoryOwner() {
require(msg.sender == IBestDexV3Factory(factory).owner());
_;
}
| 39,927 |
82 | // Same as {get}, with a custom error message when `key` is not in the map. CAUTION: This function is deprecated because it requires allocating memory for the errormessage unnecessarily. For custom revert reasons use {tryGet}. / | function get(
UintToAddressMap storage map,
uint256 key,
string memory errorMessage
) internal view returns (address) {
return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
}
| function get(
UintToAddressMap storage map,
uint256 key,
string memory errorMessage
) internal view returns (address) {
return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
}
| 5,431 |
15 | // DIDRegistry DID Registry for the Signor DID method.A DID is controlled by their creator address by default, but control can be assigned to anydifferent adddress by their current controller. / | contract DIDRegistry {
struct DID {
address controller;
uint256 created;
uint256 updated;
Secp256k1Key[] keys;
}
enum KeyPurpose { Authentication, Signing, Encryption }
//public key
struct Secp256k1Key {
byte[65] pubKey;
KeyPurpose purpose;
}
... | contract DIDRegistry {
struct DID {
address controller;
uint256 created;
uint256 updated;
Secp256k1Key[] keys;
}
enum KeyPurpose { Authentication, Signing, Encryption }
//public key
struct Secp256k1Key {
byte[65] pubKey;
KeyPurpose purpose;
}
... | 28,437 |
26 | // checks airdrop state for an addressTESTING: Returns both instantiated and default (uninstantiated addresses) Uninstantiated addresses should return default (0 address) values/ | function checkWhitelist(address _addr)
external
virtual
view
returns (
uint256,
uint256,
uint256
)
| function checkWhitelist(address _addr)
external
virtual
view
returns (
uint256,
uint256,
uint256
)
| 73,433 |
43 | // Data relating to the re-collateralisation safety module | SafetyData public safetyData;
| SafetyData public safetyData;
| 63,070 |
2 | // SPDX-License-Identifier: UNLICENSED | abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
| abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
| 13,187 |
15 | // Function to change vote cost, by default vote cost equals 1 Human token_voteCost a new vote cost/ | function setVoteCost(uint _voteCost) external onlyEventManager {
voteCost = _voteCost;
}
| function setVoteCost(uint _voteCost) external onlyEventManager {
voteCost = _voteCost;
}
| 13,180 |
79 | // returns the last interest rate founnd during interest settlement/pool address/ return the last interset rate | function getPoolLastInterestRate(address pool)
external
view
returns (uint256);
| function getPoolLastInterestRate(address pool)
external
view
returns (uint256);
| 77,981 |
171 | // Returns current rescuerreturn Rescuer's address / | function rescuer() external view returns (address) {
return _rescuer;
}
| function rescuer() external view returns (address) {
return _rescuer;
}
| 10,981 |
39 | // Allows to mint one NFT if whitelisted_account The account of the user minting the NFT_proof The Merkle Proof/ | function presaleMint(address _account, bytes32[] calldata _proof) external payable nonReentrant {
//Are we in Presale ?
require(sellingStep == Steps.Presale, "Presale has not started yet.");
//Did this account already mint an NFT ?
require(nftsPerWallet[_account] < 1, "You can only g... | function presaleMint(address _account, bytes32[] calldata _proof) external payable nonReentrant {
//Are we in Presale ?
require(sellingStep == Steps.Presale, "Presale has not started yet.");
//Did this account already mint an NFT ?
require(nftsPerWallet[_account] < 1, "You can only g... | 35,179 |
31 | // get the remain unrleased tokens of the locked stages of an account_target the owner of some amount of tokens _num the stage number of the releasing period / | function getRemainOfStage(address _target, uint _num) public view returns (uint256) {
require(_target != address(0));
return lockedStorage.remainOfStage(_target, _num);
}
| function getRemainOfStage(address _target, uint _num) public view returns (uint256) {
require(_target != address(0));
return lockedStorage.remainOfStage(_target, _num);
}
| 28,296 |
45 | // Roles management - only for multi sig address / | function setupRole(bytes32 role, address account) external onlyManager {
_setupRole(role, account);
}
| function setupRole(bytes32 role, address account) external onlyManager {
_setupRole(role, account);
}
| 39,797 |
192 | // Throws if not allowed caller / | modifier onlyAllowedCaller(address _caller) {
require(isAllowedCaller(_caller), "Address not permitted to call");
_;
}
| modifier onlyAllowedCaller(address _caller) {
require(isAllowedCaller(_caller), "Address not permitted to call");
_;
}
| 10,805 |
36 | // Helper function to return a min between the two uints | function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
| function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
| 7,885 |
80 | // Destroy the contract | function kill() public onlyAdmin {
selfdestruct(payable(msg.sender));
}
| function kill() public onlyAdmin {
selfdestruct(payable(msg.sender));
}
| 3,243 |
5 | // Throws if contract is not in an emergency state. Emergency replacement and resolutioncan only happen in an emergency / | modifier onlyEmergency() {
require(emergencies > 0, "Not in emergency");
_;
}
| modifier onlyEmergency() {
require(emergencies > 0, "Not in emergency");
_;
}
| 28,922 |
122 | // Checks that a given kitten is able to breed. Requires that the/current cooldown is finished (for sires) and also checks that there is/no pending pregnancy. | function _isReadyToBreed(Kitty _kit) internal view returns (bool) {
// In addition to checking the cooldownEndBlock, we also need to check to see if
// the cat has a pending birth; there can be some period of time between the end
// of the pregnacy timer and the birth event.
return (... | function _isReadyToBreed(Kitty _kit) internal view returns (bool) {
// In addition to checking the cooldownEndBlock, we also need to check to see if
// the cat has a pending birth; there can be some period of time between the end
// of the pregnacy timer and the birth event.
return (... | 22,019 |
4 | // Parse resulting JSON string | uint returnVal;
JsmnSolLib.Token[] memory tokens;
uint numTokens;
(returnVal, tokens, numTokens) = JsmnSolLib.parse(result, 11);
assert(returnVal == 0);
JsmnSolLib.Token memory t = tokens[10];
departureTime = parseInt(JsmnSolLib.getByt... | uint returnVal;
JsmnSolLib.Token[] memory tokens;
uint numTokens;
(returnVal, tokens, numTokens) = JsmnSolLib.parse(result, 11);
assert(returnVal == 0);
JsmnSolLib.Token memory t = tokens[10];
departureTime = parseInt(JsmnSolLib.getByt... | 46,286 |
61 | // Adds an array of strings to the request with a given key name self The initialized request _key The name of the key _values The array of string values to add / | function addStringArray(Request memory self, string memory _key, string[] memory _values)
internal pure
| function addStringArray(Request memory self, string memory _key, string[] memory _values)
internal pure
| 13,925 |
3 | // Public function to create a new reserve that will be used to report a total collateralized amount in the/ denomination token/name Shortened string name identifying the reserve/chainId Id for the target chain used by this reserve/description Text providing basic information on the reserve | function createReserve(
string memory name,
string memory description,
uint256 chainId
| function createReserve(
string memory name,
string memory description,
uint256 chainId
| 9,907 |
37 | // All other a_n and x_n are stored as 20 digit fixed point numbers, so we convert the sum and a to this format. | sum *= 100;
a *= 100;
| sum *= 100;
a *= 100;
| 4,258 |
14 | // no players this round, start the next one | if (participantSize == 0) {
resetGameAndStartNextRound();
return;
}
| if (participantSize == 0) {
resetGameAndStartNextRound();
return;
}
| 18,074 |
4 | // delete free | (,uint256 status,,,) = IPartner(_basePlatform).getPartner(target);
if ((status == 1) && _user[target].isVerified) {
_totalVerifiedFree = _totalVerifiedFree.sub(1);
}
| (,uint256 status,,,) = IPartner(_basePlatform).getPartner(target);
if ((status == 1) && _user[target].isVerified) {
_totalVerifiedFree = _totalVerifiedFree.sub(1);
}
| 47,921 |
38 | // STORAGE //The main Offer struct for auctioning | struct Offer {
bool isForSale;
uint tokenId;
address seller;
uint minValue;
}
| struct Offer {
bool isForSale;
uint tokenId;
address seller;
uint minValue;
}
| 44,632 |
26 | // See {IERC4626-previewWithdraw}. / | function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Up);
}
| function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Up);
}
| 7,401 |
147 | // Update number of events pushed to buffer - | mstore(0x140, add(1, mload(0x140)))
| mstore(0x140, add(1, mload(0x140)))
| 60,735 |
10 | // Constrctor function Initializes contract with initial supply tokens to the creator of the contract / | function SDR22 (
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
initialSupply = 9000000000;
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; ... | function SDR22 (
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
initialSupply = 9000000000;
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; ... | 7,296 |
148 | // Trim the { and } from the parameters | uint256 tokenID = Bytes.toUint(blob[1:uint256(index) - 1]);
uint256 blueprintLength = blob.length - uint256(index) - 3;
if (blueprintLength == 0) {
return (tokenID, bytes(""));
}
| uint256 tokenID = Bytes.toUint(blob[1:uint256(index) - 1]);
uint256 blueprintLength = blob.length - uint256(index) - 3;
if (blueprintLength == 0) {
return (tokenID, bytes(""));
}
| 44,285 |
5 | // These functions deal with verification of Merkle Trees proofs. The proofs can be generated using the JavaScript libraryNote: the hashing algorithm should be keccak256 and pair sorting should be enabled. See `test/utils/cryptography/MerkleProof.test.js` for some examples. / | library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are ... | library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are ... | 19,839 |
12 | // for every 1.00 ghostdai we get 0.98 dai 1000000000000000000 we get 980000 (bc decimals) | uint256 amountToSend = amount.mul(ghostdaiRate).div(100);
require(dai.balanceOf(address(this)) >= amountToSend, "swapTo: Not enough ghostDai in reserves");
| uint256 amountToSend = amount.mul(ghostdaiRate).div(100);
require(dai.balanceOf(address(this)) >= amountToSend, "swapTo: Not enough ghostDai in reserves");
| 10,649 |
12 | // malicious functions that can throw off our example swap platform later | function setMarketplace(address marketplace) onlyOwner public{
marketplaceAddress = marketplace;
}
| function setMarketplace(address marketplace) onlyOwner public{
marketplaceAddress = marketplace;
}
| 52,875 |
1 | // Withdraw ether from smart contract, only owner can do thisaccount - Destination of ether funds amount - Amount that will be withdrawn / | function withdrawEther(address account, uint256 amount) external onlyOwner {
_withdrawEther(account, amount);
}
| function withdrawEther(address account, uint256 amount) external onlyOwner {
_withdrawEther(account, amount);
}
| 21,387 |
9 | // ensure msg.sender is an authorized ballot creator | require(creators[msg.sender]);
| require(creators[msg.sender]);
| 10,891 |
4 | // return r the sum of two points of G1 / | function plus(
G1Point memory p1,
G1Point memory p2
| function plus(
G1Point memory p1,
G1Point memory p2
| 35,017 |
22 | // take from both balances | editionTokenERC20TransferAmounts[editionId][_erc20Contract][_tokenId] = spentTokens + editionTokenBalance;
uint256 amountOfTokensToSpendFromTokenBalance = _value - editionTokenBalance;
ERC20Balances[_tokenId][_erc20Contract] = ERC20Balances[_tokenId][_erc20Contract] - amountOfTokensT... | editionTokenERC20TransferAmounts[editionId][_erc20Contract][_tokenId] = spentTokens + editionTokenBalance;
uint256 amountOfTokensToSpendFromTokenBalance = _value - editionTokenBalance;
ERC20Balances[_tokenId][_erc20Contract] = ERC20Balances[_tokenId][_erc20Contract] - amountOfTokensT... | 6,465 |
223 | // Get the current balance on the smart wallet for the supplied ERC20 token. | uint256 balance = 0;
bool balanceCheckWorked = true;
if (!suppressRevert) {
balance = token.balanceOf(address(this));
} else {
| uint256 balance = 0;
bool balanceCheckWorked = true;
if (!suppressRevert) {
balance = token.balanceOf(address(this));
} else {
| 32,086 |
1,305 | // Sets the values for {name} and {symbol}, initializes {decimals} witha default value of 18 and a {totalSupply} of the token. All four of these values are immutable: they can only be set once duringconstruction. / |
constructor () public {
|
constructor () public {
| 4,318 |
42 | // Prevent overflow when dividing MIN_INT256 by -1 | require(b != -1 || a != MIN_INT256);
| require(b != -1 || a != MIN_INT256);
| 27,154 |
13 | // collateralUsageLimit:when the position collateral usage surpasses this threshold, anyone will be able to trigger the stop loss slippageIncentive: when the bot repays the debt, it will be able to take an amount of supply token equivalent to the repaid debt plus this incentive specified in percentage. It has to be car... | struct StopLossStore {
uint256 collateralUsageLimit; // ranges from 0 to 1e18
uint256 slippageIncentive; // ranges from 0 to 1e18
uint256 unwindFactor; // ranges from 0 to 1e18
}
| struct StopLossStore {
uint256 collateralUsageLimit; // ranges from 0 to 1e18
uint256 slippageIncentive; // ranges from 0 to 1e18
uint256 unwindFactor; // ranges from 0 to 1e18
}
| 63,277 |
12 | // The tokens can never be stolen. / | modifier notPowh(address aContract){
require(aContract != address(weak_hands));
_;
}
| modifier notPowh(address aContract){
require(aContract != address(weak_hands));
_;
}
| 47,122 |
399 | // Arithmetic library with operations for fixed-point numbers./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol) | library FixedPointMathLib {
/*///////////////////////////////////////////////////////////////
COMMON BASE UNITS
//////////////////////////////////////////////////////////////*/
uint256 internal constant YAD = 1e8;
uint256 internal constant WAD = 1e18;
uint256 internal co... | library FixedPointMathLib {
/*///////////////////////////////////////////////////////////////
COMMON BASE UNITS
//////////////////////////////////////////////////////////////*/
uint256 internal constant YAD = 1e8;
uint256 internal constant WAD = 1e18;
uint256 internal co... | 41,852 |
60 | // Modifiers and Structs ======================================================== only run certain methods when contract is open | modifier isOpenContract() {
require (contractStage == CONTRACT_OPEN);
_;
}
| modifier isOpenContract() {
require (contractStage == CONTRACT_OPEN);
_;
}
| 2,986 |
43 | // Author: Shravan SunderDate: 2022-02Description: This contract uses chainlink to get the floor price of a NFT from opensea api using ChainlinkNotes:/ | contract PriceOracleNFT is ChainlinkClient {
using Chainlink for Chainlink.Request;
string public testStatus = "init";
// 1 day
uint256 updateFrequency = 60 * 60 * 24;
struct Callback {
address callbackAddress;
bytes4 callbackFunctionSignature;
}
// the collection data used by state
struct Co... | contract PriceOracleNFT is ChainlinkClient {
using Chainlink for Chainlink.Request;
string public testStatus = "init";
// 1 day
uint256 updateFrequency = 60 * 60 * 24;
struct Callback {
address callbackAddress;
bytes4 callbackFunctionSignature;
}
// the collection data used by state
struct Co... | 7,423 |
12 | // UTILITY FUNCTIONS/ Genranal | function getContractOwner()
public
returns(address)
| function getContractOwner()
public
returns(address)
| 12,125 |
5 | // get all pools addresses added in contract.return array of addresses / | function getPools() external view returns (address[] memory) {
return registeredPools;
}
| function getPools() external view returns (address[] memory) {
return registeredPools;
}
| 32,181 |
62 | // check is there any cover that still depend on this one | require(
!coverGateway.isCoverActiveExists(_offerId),
"Claim Gateway : There is any active cover"
);
| require(
!coverGateway.isCoverActiveExists(_offerId),
"Claim Gateway : There is any active cover"
);
| 10,567 |
300 | // transfer the rest including platformFeeInShares and any dust remaining (since this contract will never have shares of itself apart from fees.) | uint256 selfBalance = IERC20(address(this)).balanceOf(address(this));
if (selfBalance > 0) {
IERC20(address(this)).safeTransfer(_platformRewards(), selfBalance);
}
| uint256 selfBalance = IERC20(address(this)).balanceOf(address(this));
if (selfBalance > 0) {
IERC20(address(this)).safeTransfer(_platformRewards(), selfBalance);
}
| 47,813 |
5 | // MPHelper contract @FrankPoncelet / | contract MPHelper{
PunksMarket public mPContract;
constructor() {
mPContract = PunksMarket(payable(0x759c6C1923910930C18ef490B3c3DbeFf24003cE));
}
function getAllBids(uint256[] memory ids) external view returns (PunksMarket.Punk[] memory){
uint tokens = 0;
for (uint i=0; i... | contract MPHelper{
PunksMarket public mPContract;
constructor() {
mPContract = PunksMarket(payable(0x759c6C1923910930C18ef490B3c3DbeFf24003cE));
}
function getAllBids(uint256[] memory ids) external view returns (PunksMarket.Punk[] memory){
uint tokens = 0;
for (uint i=0; i... | 3,778 |
145 | // how much ETH did we just swap into? | uint256 newBalance = address(this).balance.sub(initialBalance);
| uint256 newBalance = address(this).balance.sub(initialBalance);
| 27,998 |
34 | // Withdraw Staking tokens from FairLaunchToken. | function withdraw(uint256 _pid, uint256 _amount) public {
_withdraw(_pid, _amount);
}
| function withdraw(uint256 _pid, uint256 _amount) public {
_withdraw(_pid, _amount);
}
| 11,269 |
5 | // Here we take advantage of the fact that we know RToken has 18 decimals to convert between uint256 an uint192. Fits due to assumed max totalSupply. | uint192 supply = _safeWrap(IRToken(address(erc20)).totalSupply());
if (supply == 0) return (lowBUPrice, highBUPrice);
| uint192 supply = _safeWrap(IRToken(address(erc20)).totalSupply());
if (supply == 0) return (lowBUPrice, highBUPrice);
| 40,306 |
71 | // Index of known members for each contract. These are EOAs that were added once, even if removed now. | mapping(address => address[]) public contractsToKnownMembersIndexes;
| mapping(address => address[]) public contractsToKnownMembersIndexes;
| 14,851 |
83 | // Validates that `_tokenOwner` owns and has approved Market to transfer NFTs. | function validateOwnershipAndApproval(
address _tokenOwner,
address _assetContract,
uint256 _tokenId,
uint256 _quantity,
TokenType _tokenType
) internal view {
bool isValid;
if (_tokenType == TokenType.ERC1155) {
| function validateOwnershipAndApproval(
address _tokenOwner,
address _assetContract,
uint256 _tokenId,
uint256 _quantity,
TokenType _tokenType
) internal view {
bool isValid;
if (_tokenType == TokenType.ERC1155) {
| 23,946 |
141 | // the Metadata extension, but not including the Enumerable extension, which is available separately as | * {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping ... | * {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping ... | 76,342 |
141 | // Mint a given discreet NFT if it is currently available. / | function mint(uint256 tokenId) external override {
require(
tokenId < 0x510,
"discreet: cannot mint out-of-range token"
);
if (tokenId < 0x360) {
require(
block.number >= migrationEnds,
"discreet: cannot mint tokens from or... | function mint(uint256 tokenId) external override {
require(
tokenId < 0x510,
"discreet: cannot mint out-of-range token"
);
if (tokenId < 0x360) {
require(
block.number >= migrationEnds,
"discreet: cannot mint tokens from or... | 28,163 |
3 | // Get price feed from BAND Protocol | IStdReference.ReferenceData memory data = bandRef.getReferenceData(
"ETH",
"USD"
);
| IStdReference.ReferenceData memory data = bandRef.getReferenceData(
"ETH",
"USD"
);
| 31,370 |
127 | // indexed events are emitted | emit BondCreated( _amount, payout, block.number.add( terms.vestingTerm ), priceInUSD );
emit BondPriceChanged( bondPriceInUSD(), _bondPrice(), debtRatio() );
adjust(); // control variable is adjusted
return payout;
| emit BondCreated( _amount, payout, block.number.add( terms.vestingTerm ), priceInUSD );
emit BondPriceChanged( bondPriceInUSD(), _bondPrice(), debtRatio() );
adjust(); // control variable is adjusted
return payout;
| 24,394 |
27 | // Вызываем событие | emit Restart(now);
| emit Restart(now);
| 12,612 |
1 | // Throws if the sender is not the owner. / | modifier onlyOwner {
require(msg.sender == owner, "Must be owner");
_;
}
| modifier onlyOwner {
require(msg.sender == owner, "Must be owner");
_;
}
| 4,121 |
24 | // 获取募资的代币价格 | function crowdPrice(uint256 id) public view returns (uint256) {
IBondData b = bondData(id);
(uint256 price, bool crowdPriceOk) = IOracle(oracle).get(b.crowdToken());
require(crowdPriceOk, "invalid crowd price");
return price;
}
| function crowdPrice(uint256 id) public view returns (uint256) {
IBondData b = bondData(id);
(uint256 price, bool crowdPriceOk) = IOracle(oracle).get(b.crowdToken());
require(crowdPriceOk, "invalid crowd price");
return price;
}
| 42,048 |
11 | // ERROR |
error InvalidOwner(address account);
error UnauthorizedAccount(address account);
error InvalidAuthorizedAccount(address account);
error CurrentAuthorizedState(address account, bool state);
|
error InvalidOwner(address account);
error UnauthorizedAccount(address account);
error InvalidAuthorizedAccount(address account);
error CurrentAuthorizedState(address account, bool state);
| 37,793 |
53 | // Prevent overflow when dividing INT256_MIN by -1 https:github.com/RequestNetwork/requestNetwork/issues/43 | require(!(a == - 2**255 && b == -1) && (b > 0));
return a / b;
| require(!(a == - 2**255 && b == -1) && (b > 0));
return a / b;
| 9,432 |
608 | // bnb or eth will be transferred to this account | address public fundsReceiver;
| address public fundsReceiver;
| 31,550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.