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 |
|---|---|---|---|---|
170 | // _cashPosition The total cash position on the token _balance The balance (dept/borrow) in crypto _price The momentary price of the crypto _lendingFee The yearly average lending fee for borrowed balance _days The days since the last fee calculation (Natural number) _changeInBalancePrecision The change in balance precision / | function calculatePCFWithoutMin(
| function calculatePCFWithoutMin(
| 48,960 |
6 | // Tracks amount already spent by users / | mapping(address => uint256) private _amountSpentByUser;
| mapping(address => uint256) private _amountSpentByUser;
| 33,164 |
38 | // Create a Pancake pair for this new token | pancakeswapV2Pair = IPancakeFactory(_pancakeswapV2Router.factory())
.createPair(address(this), _pancakeswapV2Router.WETH());
whitelistFee[msg.sender] = true;
whitelistFee[address(this)] = true;
excludedFromStack[_pancakeRouterAddress] = true;
excludedFromStack[pancakeswapV2Pair] = true;
| pancakeswapV2Pair = IPancakeFactory(_pancakeswapV2Router.factory())
.createPair(address(this), _pancakeswapV2Router.WETH());
whitelistFee[msg.sender] = true;
whitelistFee[address(this)] = true;
excludedFromStack[_pancakeRouterAddress] = true;
excludedFromStack[pancakeswapV2Pair] = true;
| 35,510 |
379 | // move voting power associated with the tokens transferred | __moveVotingPower(votingDelegates[_from], votingDelegates[_to], _value);
| __moveVotingPower(votingDelegates[_from], votingDelegates[_to], _value);
| 31,623 |
29 | // Get admins / | function getAdmins(address _sender) public view returns (address[] memory)
| function getAdmins(address _sender) public view returns (address[] memory)
| 33,856 |
4 | // Struct to store NFT information | struct NFTInfo {
string tokenId; /// @param tokenId NFT token ID
uint256 rarity; /// @param rarity rarity of the NFT
}
| struct NFTInfo {
string tokenId; /// @param tokenId NFT token ID
uint256 rarity; /// @param rarity rarity of the NFT
}
| 23,284 |
6 | // The number of sell tax checkpoints in the registry. | uint256 private _sellTaxPoints;
| uint256 private _sellTaxPoints;
| 83,265 |
87 | // This is an emergency pause, which should be called in case of seriousissues. Deposit / withdraw and rewards are disabled while pause is set to true._farmAddress Contract address of farm to pause _pause To pause / unpause a farm / | function pauseFarm(address _farmAddress, bool _pause) external onlyOwner {
// Load state
Farm storage farm = farms[_farmAddress];
// Validate state
require(farm.farmStartedAtBlock > 0, 'Not a farm');
// Update state
farm.paused = _pause;
// Dispatch event
emit FarmPaused(_farmAddress, _pause);
_checkActive(farm);
}
| function pauseFarm(address _farmAddress, bool _pause) external onlyOwner {
// Load state
Farm storage farm = farms[_farmAddress];
// Validate state
require(farm.farmStartedAtBlock > 0, 'Not a farm');
// Update state
farm.paused = _pause;
// Dispatch event
emit FarmPaused(_farmAddress, _pause);
_checkActive(farm);
}
| 21,342 |
0 | // Add the diamondCut external function from the diamondCutFacet | IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1);
bytes4[] memory functionSelectors = new bytes4[](1);
functionSelectors[0] = IDiamondCut.diamondCut.selector;
cut[0] = IDiamondCut.FacetCut({
facetAddress: _diamondCutFacet,
action: IDiamondCut.FacetCutAction.Add,
functionSelectors: functionSelectors
});
| IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1);
bytes4[] memory functionSelectors = new bytes4[](1);
functionSelectors[0] = IDiamondCut.diamondCut.selector;
cut[0] = IDiamondCut.FacetCut({
facetAddress: _diamondCutFacet,
action: IDiamondCut.FacetCutAction.Add,
functionSelectors: functionSelectors
});
| 23,225 |
22 | // 3. Interaction Note that this is not visible on the blockchain, it is only executed through the contract itself https:ethereum.stackexchange.com/questions/8315/confused-by-internal-transactionstodo: give winner possibility to withdraw money (safer) |
winner.transfer(payoutsum);
|
winner.transfer(payoutsum);
| 4,122 |
112 | // it is a dice game – all is very simple, to win the user should bet on a particular number, thus check if the mask has the bit set at the position corresponding to the dice roll | isWin = (mask >> gameOutcome) & 1 != 0;
| isWin = (mask >> gameOutcome) & 1 != 0;
| 17,937 |
57 | // Returns the name of the token. / | function name() public view override returns (string memory) {
return _name;
}
| function name() public view override returns (string memory) {
return _name;
}
| 41,649 |
41 | // transfer the tokens from the sender to the contract | dividendsToken.transferFrom(_msgSender(), address(this), nPaymentValue);
| dividendsToken.transferFrom(_msgSender(), address(this), nPaymentValue);
| 8,022 |
0 | // magic value indicating successfull EIP1271 signature validation. | bytes4 private constant EIP1271_MAGICVALUE = 0x1626ba7e;
| bytes4 private constant EIP1271_MAGICVALUE = 0x1626ba7e;
| 23,759 |
107 | // inverse of calcOutToken1 amountOut = amountIn.mul(_op.erc20Amount).mul(K_BASE.sub(_op.K)).mul(THETA_BASE.sub(_op.theta)).div(_op.ethAmount).div(K_BASE).div(THETA_BASE); | amountInNeeded = amountOut.mul(_op.ethAmount).mul(K_BASE).mul(THETA_BASE).div(_op.erc20Amount).div(K_BASE.sub(_op.K)).div(THETA_BASE.sub(_op.theta));
if (_op.theta != 0) {
| amountInNeeded = amountOut.mul(_op.ethAmount).mul(K_BASE).mul(THETA_BASE).div(_op.erc20Amount).div(K_BASE.sub(_op.K)).div(THETA_BASE.sub(_op.theta));
if (_op.theta != 0) {
| 13,206 |
97 | // Update the EOA where ETH is forwarded | function updateForwardAddress(address _new) public onlyOwner returns (bool) {
forwardAddress = payable(_new);
return true;
}
| function updateForwardAddress(address _new) public onlyOwner returns (bool) {
forwardAddress = payable(_new);
return true;
}
| 60,378 |
63 | // 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
| 29,498 |
35 | // called by the owner to pause, triggers stopped state / | function pause() onlyOwner whenNotPaused public {
require(canPause == true);
paused = true;
emit Pause();
}
| function pause() onlyOwner whenNotPaused public {
require(canPause == true);
paused = true;
emit Pause();
}
| 5,634 |
11 | // transfer frosted tokens to a specified address to is the address to which frosted tokens are transferred. amount is the frosted amount which is transferred. / | function frost(address to, uint256 amount) public onlyOwner returns (bool) {
_frost(_msgSender(), to, amount);
return true;
}
| function frost(address to, uint256 amount) public onlyOwner returns (bool) {
_frost(_msgSender(), to, amount);
return true;
}
| 41,955 |
139 | // burns tokens from the contract (holding them) | function burnToken(uint256 amount) public governanceLevel(1) {
_burn(address(this), amount); //only Works if tokens are on the token contract. They need to be sent here 1st. (by the team Treasury)
}
| function burnToken(uint256 amount) public governanceLevel(1) {
_burn(address(this), amount); //only Works if tokens are on the token contract. They need to be sent here 1st. (by the team Treasury)
}
| 32,356 |
24 | // The Treasury Price Index (TPI) Oracle / | function tpiOracle() external view returns (ITreasuryPriceIndexOracle);
| function tpiOracle() external view returns (ITreasuryPriceIndexOracle);
| 2,354 |
62 | // Store announcement | _nextForkName = name;
_nextForkUrl = url;
_nextForkBlockNumber = blockNumber;
| _nextForkName = name;
_nextForkUrl = url;
_nextForkBlockNumber = blockNumber;
| 18,750 |
109 | // the reward minter | address public mintr;
| address public mintr;
| 12,341 |
19 | // 获取所有者 | function getOwner(uint _id) public view returns (address) {
return ownerOf(_id);
}
| function getOwner(uint _id) public view returns (address) {
return ownerOf(_id);
}
| 40,208 |
37 | // Bid in an active auction. _auctionId The ID of the auction to bid in._bidAmount The bid amount in the currency specified by the auction. / | function bidInAuction(uint256 _auctionId, uint256 _bidAmount) external payable;
| function bidInAuction(uint256 _auctionId, uint256 _bidAmount) external payable;
| 7,319 |
85 | // Get imbalanced token/amount0Desired The desired amount of token0/amount1Desired The desired amount of token1/amount0 Amounts of token0 that can be stored in base range/amount1 Amounts of token1 that can be stored in base range/ return zeroGreaterOne true if token0 is imbalanced. False if token1 is imbalanced | function amountsDirection(uint256 amount0Desired, uint256 amount1Desired, uint256 amount0, uint256 amount1) internal pure returns (bool zeroGreaterOne) {
zeroGreaterOne = amount0Desired.sub(amount0).mul(amount1Desired) > amount1Desired.sub(amount1).mul(amount0Desired) ? true : false;
}
| function amountsDirection(uint256 amount0Desired, uint256 amount1Desired, uint256 amount0, uint256 amount1) internal pure returns (bool zeroGreaterOne) {
zeroGreaterOne = amount0Desired.sub(amount0).mul(amount1Desired) > amount1Desired.sub(amount1).mul(amount0Desired) ? true : false;
}
| 2,840 |
204 | // Set the amount of CRV to be locked in Yearn's veCRV voter from each harvest. Default is 10%. | function setKeepCRV(uint256 _keepCRV) external onlyAuthorized {
require(_keepCRV <= 10_000);
keepCRV = _keepCRV;
}
| function setKeepCRV(uint256 _keepCRV) external onlyAuthorized {
require(_keepCRV <= 10_000);
keepCRV = _keepCRV;
}
| 18,848 |
18 | // reset the velocity so we can track the velocity for the next epoch | velocity = 0;
_afterRebase();
| velocity = 0;
_afterRebase();
| 16,687 |
7 | // Set a mark for a student.student addess of the student contract.mark uint8 of the mark.senderProfessor address of the professor contract./ | function setMark(address student, uint8 mark, address senderProfessor)
public
onlyOwner()
onlySubscribed(student)
onlyReferenceProf(senderProfessor)
| function setMark(address student, uint8 mark, address senderProfessor)
public
onlyOwner()
onlySubscribed(student)
onlyReferenceProf(senderProfessor)
| 2,516 |
237 | // Finally, update our realWorldPlayer record to reflect the fact that we just minted a new one, and there is an active commish auction. | leagueRosterContract.updateRealWorldPlayer(uint32(_rosterIndex), _rwp.prevCommissionerSalePrice, uint64(now), _rwp.mintedCount + 1, true, _rwp.mintingEnabled);
| leagueRosterContract.updateRealWorldPlayer(uint32(_rosterIndex), _rwp.prevCommissionerSalePrice, uint64(now), _rwp.mintedCount + 1, true, _rwp.mintingEnabled);
| 23,754 |
10 | // Returns an `Bytes32Slot` with member `value` located at `slot`. / | function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
| function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
| 8,276 |
4 | // Basic ERC20 implementation. | contract Token {
string public name;
string public symbol;
uint8 constant public decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
constructor(address owner, string memory _name, string memory _symbol, uint _totalSupply) {
name = _name;
symbol = _symbol;
totalSupply = _totalSupply;
balanceOf[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function approve(address to, uint amount) external returns (bool) {
allowance[msg.sender][to] = amount;
emit Approval(msg.sender, to, amount);
return true;
}
function transfer(address to, uint amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint amount) external returns (bool) {
if (allowance[from][msg.sender] != type(uint).max)
allowance[from][msg.sender] -= amount;
balanceOf[from] -= amount;
balanceOf[to] += amount;
emit Transfer(from, to, amount);
return true;
}
}
| contract Token {
string public name;
string public symbol;
uint8 constant public decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
constructor(address owner, string memory _name, string memory _symbol, uint _totalSupply) {
name = _name;
symbol = _symbol;
totalSupply = _totalSupply;
balanceOf[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function approve(address to, uint amount) external returns (bool) {
allowance[msg.sender][to] = amount;
emit Approval(msg.sender, to, amount);
return true;
}
function transfer(address to, uint amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint amount) external returns (bool) {
if (allowance[from][msg.sender] != type(uint).max)
allowance[from][msg.sender] -= amount;
balanceOf[from] -= amount;
balanceOf[to] += amount;
emit Transfer(from, to, amount);
return true;
}
}
| 34,706 |
0 | // volume transactions // pending volume //Constructor/ | function initialize(IStatus _status, ITransfers _transfer, IDao _dao, ICandidate _candidate, ILimits _limits) public initializer
| function initialize(IStatus _status, ITransfers _transfer, IDao _dao, ICandidate _candidate, ILimits _limits) public initializer
| 16,029 |
29 | // Set prize royalty rate | function setPrizeRoyaltyDevRate(uint _royaltyRate) external onlyAdmin{
RoyaltyPrizeDev = _royaltyRate;
}
| function setPrizeRoyaltyDevRate(uint _royaltyRate) external onlyAdmin{
RoyaltyPrizeDev = _royaltyRate;
}
| 13,135 |
37 | // Sets the configuration bitmap of the reserve as a whole- Only callable by the LendingPoolConfigurator contract asset The address of the underlying asset of the reserve configuration The new configuration bitmap / | {
_reserves[asset].configuration.data = configuration;
}
| {
_reserves[asset].configuration.data = configuration;
}
| 6,927 |
2 | // address[] public authorizedAddress;who can enter datauint256[] public hospitalId;list of unique hospital ids |
mapping(uint256 => User) public users; //store user data against their Id
mapping(uint256 => bool) public userStatus; // check status whether data exist for an user
mapping(uint256 => bool) public hospitalIdStatus; // check status whether account exist for a hospital
mapping(address => bool) public authorizedAddress; // who can enter data
|
mapping(uint256 => User) public users; //store user data against their Id
mapping(uint256 => bool) public userStatus; // check status whether data exist for an user
mapping(uint256 => bool) public hospitalIdStatus; // check status whether account exist for a hospital
mapping(address => bool) public authorizedAddress; // who can enter data
| 10,025 |
45 | // Returns the value of onlyUserCanWithdraw for a given user user The address of the user / | function onlyUserCanWithdraw(address user) external view returns (bool);
| function onlyUserCanWithdraw(address user) external view returns (bool);
| 26,490 |
19 | // Set gas cost to mint GD rewards for keeper _gasAmount amount of gas it costs for minting gd reward / | function setGasCost(uint256 _gasAmount) public {
_onlyAvatar();
gdMintGasCost = _gasAmount;
emit GasCostSet(_gasAmount);
}
| function setGasCost(uint256 _gasAmount) public {
_onlyAvatar();
gdMintGasCost = _gasAmount;
emit GasCostSet(_gasAmount);
}
| 4,903 |
0 | // Adds the {permit} method, which can be used to change an account's ERC721 allowance (see {IERC721-allowance}) bypresenting a message signed by the account. By not relying on `{IERC721-approve}`, the token holder account doesn't solhint-disable-next-line var-name-mixedcase | bytes32 private immutable _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 tokenId,uint256 nonce,uint256 deadline)");
| bytes32 private immutable _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 tokenId,uint256 nonce,uint256 deadline)");
| 7,920 |
142 | // The number of tokens ever minted. This works as the serial number. | uint256 public numberOfTokenIds;
| uint256 public numberOfTokenIds;
| 9,328 |
88 | // Sets tax for buys. / | function setBuyTax(uint256 dev, uint256 marketing, uint256 liquidity, uint256 charity) public onlyOwner {
buyTaxes["dev"] = dev;
buyTaxes["marketing"] = marketing;
buyTaxes["liquidity"] = liquidity;
buyTaxes["charity"] = charity;
}
| function setBuyTax(uint256 dev, uint256 marketing, uint256 liquidity, uint256 charity) public onlyOwner {
buyTaxes["dev"] = dev;
buyTaxes["marketing"] = marketing;
buyTaxes["liquidity"] = liquidity;
buyTaxes["charity"] = charity;
}
| 19,843 |
189 | // >>> include other rewards | function _migrateRewards(address _newStrategy) internal override {
super._migrateRewards(_newStrategy);
IERC20(bor).safeTransfer(_newStrategy, IERC20(bor).balanceOf(address(this)));
}
| function _migrateRewards(address _newStrategy) internal override {
super._migrateRewards(_newStrategy);
IERC20(bor).safeTransfer(_newStrategy, IERC20(bor).balanceOf(address(this)));
}
| 79,650 |
241 | // If there's a final address, we're good. There's no loop. | if (!isNft) {
return;
}
| if (!isNft) {
return;
}
| 17,543 |
43 | // Helper function to setup deposit collateral actionsAssumeshas collateral in margin accountreturn actions array of collateral deposits for counterparty / | function _createDeposits(
address[] memory _collaterals,
uint256[] memory _amounts,
bool _isCashSettled,
IMarginEngine _marginEngine
| function _createDeposits(
address[] memory _collaterals,
uint256[] memory _amounts,
bool _isCashSettled,
IMarginEngine _marginEngine
| 6,061 |
57 | // Get number of frames available to be purchased | frames = ethAmount.div(_frameEth);
if (framesSold.add(frames) >= maxFrames) {
frames = maxFrames.sub(framesSold);
}
| frames = ethAmount.div(_frameEth);
if (framesSold.add(frames) >= maxFrames) {
frames = maxFrames.sub(framesSold);
}
| 8,756 |
2 | // IMPORTANT: Need to run {acceptOwnership} by the new owner. / | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_newOwner = newOwner;
}
| function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_newOwner = newOwner;
}
| 2,291 |
0 | // Define variable owner of the type address / | modifier onlyCreator() {
require(msg.sender == creator);
_;
}
| modifier onlyCreator() {
require(msg.sender == creator);
_;
}
| 48,476 |
1 | // Owner of the contract | address private _upgradeabilityOwner;
| address private _upgradeabilityOwner;
| 13,867 |
12 | // Handle non-overflow cases, 256 by 256 division. | if (prod1 == 0) {
return prod0 / denominator;
}
| if (prod1 == 0) {
return prod0 / denominator;
}
| 25,890 |
27 | // low as -2 digit | Ratio100x = calculateYourReward(entityA[i].position);
| Ratio100x = calculateYourReward(entityA[i].position);
| 53,085 |
299 | // Mint gun nft | uint256 newItemId = safeMint(msg.sender, gunType);
uint256 stakingFee = feesAmounts[gunType - 1].mul(stakingFeePercentage).div(10000);
uint256 platformFee = feesAmounts[gunType - 1].mul(platformFeePercentage).div(10000);
require(IERC20(feeToken).transferFrom(msg.sender, feesStaking, stakingFee), 'GunnerNFT: Not enough balance');
require(IERC20(feeToken).transferFrom(msg.sender, feesPlatform, platformFee), 'GunnerNFT: Not enough balance');
buysCount[msg.sender] += 1;
return newItemId;
| uint256 newItemId = safeMint(msg.sender, gunType);
uint256 stakingFee = feesAmounts[gunType - 1].mul(stakingFeePercentage).div(10000);
uint256 platformFee = feesAmounts[gunType - 1].mul(platformFeePercentage).div(10000);
require(IERC20(feeToken).transferFrom(msg.sender, feesStaking, stakingFee), 'GunnerNFT: Not enough balance');
require(IERC20(feeToken).transferFrom(msg.sender, feesPlatform, platformFee), 'GunnerNFT: Not enough balance');
buysCount[msg.sender] += 1;
return newItemId;
| 20,130 |
57 | // returns how many claims are there | function countClaims() external view returns (uint256);
| function countClaims() external view returns (uint256);
| 502 |
4 | // External Functions // / | function createSetting(
bytes32 name,
uint256 value,
uint256 min,
uint256 max
| function createSetting(
bytes32 name,
uint256 value,
uint256 min,
uint256 max
| 14,161 |
18 | // mint function for masterchef; | function mint(address to, uint256 amount) public onlyMasterChefAndBridge {
_mint(to, amount);
}
| function mint(address to, uint256 amount) public onlyMasterChefAndBridge {
_mint(to, amount);
}
| 73,804 |
2 | // TBA is deployed in ERC6551Registry | erc6551RegistryAddress = erc6551RegistryAddress_;
| erc6551RegistryAddress = erc6551RegistryAddress_;
| 24,619 |
33 | // function that is called when transaction target is an address | function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
| function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
| 54,691 |
4 | // Returns the number of NFTs in `owner`'s account./ |
function balanceOf(address owner) external view returns (uint256 balance);
function royaltyFee(uint256 tokenId) external view returns(uint256);
function getCreator(uint256 tokenId) external view returns(address);
|
function balanceOf(address owner) external view returns (uint256 balance);
function royaltyFee(uint256 tokenId) external view returns(uint256);
function getCreator(uint256 tokenId) external view returns(address);
| 18,050 |
48 | // Function to mint tokens to The address that will receive the minted tokens. value The amount of tokens to mint.return A boolean that indicates if the operation was successful. / | function mint(
address to,
uint256 value
)
public
onlyMinter
returns (bool)
| function mint(
address to,
uint256 value
)
public
onlyMinter
returns (bool)
| 29,148 |
23 | // Collection: Flying People - Dynamic NFT A Flying pleople is a regular ERC721 NFT (fp_nft) with some extra features. 1.- fp_nft owners can attach to it three other NFT's, called a Set of Wearables. 2.- fp_nft image is a representation of the fp_nft image itself and three other NFT's./ | contract FlyingPeopleDNFT is ERC721Drop, ChainlinkClient {
// Chainlink
using Chainlink for Chainlink.Request;
address private oracle;
bytes32 private jobId;
uint256 private fee;
// a simple pointer to an NFT that lives on another collection .
struct Wearable {
// collection contract address
address collection;
// collection nft token id
uint256 tokenId;
}
// 3 wearables, e.g hat, body, pants.
struct Set {
Wearable wearable1;
Wearable wearable2;
Wearable wearable3;
}
// map each NFT tokenId to a Set of Wearable(s) defined by the NFT(s) owner
mapping(uint256 => Set) public tokenIdToSet;
// event to emit new set
event NewSetEquiped(bytes32 _requestId, string _tokenId);
//
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _primarySaleRecipient
) ERC721Drop(_name, _symbol, _royaltyRecipient, _royaltyBps, _primarySaleRecipient) {
// Goerli LINK address
setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB);
// Ethereum Goerli Oracle Address 0xCC79157eb46F5624204f47AB42b3906cAA40eaB7
oracle = 0xCC79157eb46F5624204f47AB42b3906cAA40eaB7;
// Job Id to get > string 7d80a6386ef543a3abb52817f6707e3b
jobId = "7d80a6386ef543a3abb52817f6707e3b";
// 0,1 * 10**18 (Varies by network and job)
fee = (1 * LINK_DIVISIBILITY) / 10;
}
/**
* Attach a Set of Wearables to a fp_nft token (_tokenId).
* @dev _collections & _wearableTokenIds each array position compose a collection address and token id
*/
function setWearables(
address[3] memory _collections,
uint256[3] memory _wearableTokenIds,
uint256 _tokenId
) public {
require(ownerOf(_tokenId) == msg.sender, "caller not owner");
require(
_collections[0] != address(this) &&
_collections[1] != address(this) &&
_collections[2] != address(this),
"invalid nft"
);
// validate each external nft ownership
for (uint256 i = 0; i < _collections.length; i++) {
// instance collection
IERC721 collectionContract = IERC721(_collections[i]);
// check token ownership
address tokenOwner = collectionContract.ownerOf(_wearableTokenIds[i]);
// all good
if (msg.sender != tokenOwner) {
revert("caller not owner");
}
}
tokenIdToSet[_tokenId] = Set(
Wearable(_collections[0], _wearableTokenIds[0]),
Wearable(_collections[1], _wearableTokenIds[1]),
Wearable(_collections[2], _wearableTokenIds[2])
);
Chainlink.Request memory req = buildChainlinkRequest(
jobId,
address(this),
this.fulfill.selector
);
req.add(
"get",
string.concat(
"http://172.2.173.113:3000/update-wearables?tokenId=",
Strings.toString(_tokenId),
"&c1=",
Strings.toHexString(uint256(uint160(_collections[0])), 20),
"&c2=",
Strings.toHexString(uint256(uint160(_collections[1])), 20),
"&c3=",
Strings.toHexString(uint256(uint160(_collections[2])), 20),
"&w1=",
Strings.toString(_wearableTokenIds[0]),
"&w2=",
Strings.toString(_wearableTokenIds[1]),
"&w3=",
Strings.toString(_wearableTokenIds[2])
)
);
req.add("path", "tokenId");
sendChainlinkRequestTo(oracle, req, fee);
}
/**
* Receive the response in the form of string
*/
function fulfill(bytes32 _requestId, string memory _tokenId)
public
recordChainlinkFulfillment(_requestId)
{
emit NewSetEquiped(_requestId, _tokenId);
}
}
| contract FlyingPeopleDNFT is ERC721Drop, ChainlinkClient {
// Chainlink
using Chainlink for Chainlink.Request;
address private oracle;
bytes32 private jobId;
uint256 private fee;
// a simple pointer to an NFT that lives on another collection .
struct Wearable {
// collection contract address
address collection;
// collection nft token id
uint256 tokenId;
}
// 3 wearables, e.g hat, body, pants.
struct Set {
Wearable wearable1;
Wearable wearable2;
Wearable wearable3;
}
// map each NFT tokenId to a Set of Wearable(s) defined by the NFT(s) owner
mapping(uint256 => Set) public tokenIdToSet;
// event to emit new set
event NewSetEquiped(bytes32 _requestId, string _tokenId);
//
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _primarySaleRecipient
) ERC721Drop(_name, _symbol, _royaltyRecipient, _royaltyBps, _primarySaleRecipient) {
// Goerli LINK address
setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB);
// Ethereum Goerli Oracle Address 0xCC79157eb46F5624204f47AB42b3906cAA40eaB7
oracle = 0xCC79157eb46F5624204f47AB42b3906cAA40eaB7;
// Job Id to get > string 7d80a6386ef543a3abb52817f6707e3b
jobId = "7d80a6386ef543a3abb52817f6707e3b";
// 0,1 * 10**18 (Varies by network and job)
fee = (1 * LINK_DIVISIBILITY) / 10;
}
/**
* Attach a Set of Wearables to a fp_nft token (_tokenId).
* @dev _collections & _wearableTokenIds each array position compose a collection address and token id
*/
function setWearables(
address[3] memory _collections,
uint256[3] memory _wearableTokenIds,
uint256 _tokenId
) public {
require(ownerOf(_tokenId) == msg.sender, "caller not owner");
require(
_collections[0] != address(this) &&
_collections[1] != address(this) &&
_collections[2] != address(this),
"invalid nft"
);
// validate each external nft ownership
for (uint256 i = 0; i < _collections.length; i++) {
// instance collection
IERC721 collectionContract = IERC721(_collections[i]);
// check token ownership
address tokenOwner = collectionContract.ownerOf(_wearableTokenIds[i]);
// all good
if (msg.sender != tokenOwner) {
revert("caller not owner");
}
}
tokenIdToSet[_tokenId] = Set(
Wearable(_collections[0], _wearableTokenIds[0]),
Wearable(_collections[1], _wearableTokenIds[1]),
Wearable(_collections[2], _wearableTokenIds[2])
);
Chainlink.Request memory req = buildChainlinkRequest(
jobId,
address(this),
this.fulfill.selector
);
req.add(
"get",
string.concat(
"http://172.2.173.113:3000/update-wearables?tokenId=",
Strings.toString(_tokenId),
"&c1=",
Strings.toHexString(uint256(uint160(_collections[0])), 20),
"&c2=",
Strings.toHexString(uint256(uint160(_collections[1])), 20),
"&c3=",
Strings.toHexString(uint256(uint160(_collections[2])), 20),
"&w1=",
Strings.toString(_wearableTokenIds[0]),
"&w2=",
Strings.toString(_wearableTokenIds[1]),
"&w3=",
Strings.toString(_wearableTokenIds[2])
)
);
req.add("path", "tokenId");
sendChainlinkRequestTo(oracle, req, fee);
}
/**
* Receive the response in the form of string
*/
function fulfill(bytes32 _requestId, string memory _tokenId)
public
recordChainlinkFulfillment(_requestId)
{
emit NewSetEquiped(_requestId, _tokenId);
}
}
| 10,082 |
5 | // Constrctor function Initializes contract with initial supply tokens to the creator of the contract / | function BKEXComToken(
) public {
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
}
| function BKEXComToken(
) public {
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
}
| 2,726 |
53 | // for token to token dest address is network. and Ether / token already here... | if (dest == ETH_TOKEN_ADDRESS) {
destAddress.transfer(expectedDestAmount);
} else {
| if (dest == ETH_TOKEN_ADDRESS) {
destAddress.transfer(expectedDestAmount);
} else {
| 21,051 |
81 | // Returns normalized (to USD with 18 decimals) summary balanceof pool using all tokens in this protocol/ | function normalizedBalance() external returns(uint256);
| function normalizedBalance() external returns(uint256);
| 8,527 |
15 | // Resets fee for protocol `_protocol` to `baseClaimFee` / | function _resetProtocolClaimFee(address _protocol) internal {
protocolClaimFee[_protocol] = baseClaimFee;
}
| function _resetProtocolClaimFee(address _protocol) internal {
protocolClaimFee[_protocol] = baseClaimFee;
}
| 32,120 |
42 | // Add or remove a funded function actionType The type of action to execute functionPosition The position of the funded function in fundedFunctions adjusterType The adjuster contract to include for the funded function functionName The signature of the function that gets funded receiverContract The contract hosting the funded function / | function modifyParameters(bytes32 actionType, uint256 functionPosition, uint256 adjusterType, bytes4 functionName, address receiverContract)
| function modifyParameters(bytes32 actionType, uint256 functionPosition, uint256 adjusterType, bytes4 functionName, address receiverContract)
| 40,394 |
42 | // Emit event that proposal executed | emit ProposalExecuted(proposalId);
| emit ProposalExecuted(proposalId);
| 25,162 |
1 | // Math functions that do not check inputs or outputs/Contains methods that perform common math functions but do not do any overflow or underflow checks | library UnsafeMath {
/// @notice Returns ceil(x / y)
/// @dev division by 0 has unspecified behavior, and must be checked externally
/// @param x The dividend
/// @param y The divisor
/// @return z The quotient, ceil(x / y)
function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
assembly {
z := add(div(x, y), gt(mod(x, y), 0))
}
}
} | library UnsafeMath {
/// @notice Returns ceil(x / y)
/// @dev division by 0 has unspecified behavior, and must be checked externally
/// @param x The dividend
/// @param y The divisor
/// @return z The quotient, ceil(x / y)
function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
assembly {
z := add(div(x, y), gt(mod(x, y), 0))
}
}
} | 24,987 |
145 | // Get a snapshot of the account's balances, and the cached exchange rate This is used by controller to more efficiently perform liquidity checks. account Address of the account to snapshotreturn (possible error, token balance, borrow balance, exchange rate mantissa) / | function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {
uint aTokenBalance = accountTokens[account];
uint borrowBalance;
uint exchangeRateMantissa;
MathError mErr;
(mErr, borrowBalance) = borrowBalanceStoredInternal(account);
if (mErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0, 0, 0);
}
(mErr, exchangeRateMantissa) = exchangeRateStoredInternal();
if (mErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0, 0, 0);
}
return (uint(Error.NO_ERROR), aTokenBalance, borrowBalance, exchangeRateMantissa);
}
| function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {
uint aTokenBalance = accountTokens[account];
uint borrowBalance;
uint exchangeRateMantissa;
MathError mErr;
(mErr, borrowBalance) = borrowBalanceStoredInternal(account);
if (mErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0, 0, 0);
}
(mErr, exchangeRateMantissa) = exchangeRateStoredInternal();
if (mErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0, 0, 0);
}
return (uint(Error.NO_ERROR), aTokenBalance, borrowBalance, exchangeRateMantissa);
}
| 17,012 |
108 | // returns the 0 indexed position of the least significant bit of the input x s.t. (x & 2lsb) != 0 and (x & (2(lsb) - 1)) == 0) i.e. the bit at the index is set and the mask of all lower bits is 0 | function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::leastSignificantBit: zero');
r = 255;
if (x & uint128(-1) > 0) {
r -= 128;
} else {
x >>= 128;
}
if (x & uint64(-1) > 0) {
r -= 64;
} else {
x >>= 64;
}
if (x & uint32(-1) > 0) {
r -= 32;
} else {
x >>= 32;
}
if (x & uint16(-1) > 0) {
r -= 16;
} else {
x >>= 16;
}
if (x & uint8(-1) > 0) {
r -= 8;
} else {
x >>= 8;
}
if (x & 0xf > 0) {
r -= 4;
} else {
x >>= 4;
}
if (x & 0x3 > 0) {
r -= 2;
} else {
x >>= 2;
}
if (x & 0x1 > 0) r -= 1;
}
| function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::leastSignificantBit: zero');
r = 255;
if (x & uint128(-1) > 0) {
r -= 128;
} else {
x >>= 128;
}
if (x & uint64(-1) > 0) {
r -= 64;
} else {
x >>= 64;
}
if (x & uint32(-1) > 0) {
r -= 32;
} else {
x >>= 32;
}
if (x & uint16(-1) > 0) {
r -= 16;
} else {
x >>= 16;
}
if (x & uint8(-1) > 0) {
r -= 8;
} else {
x >>= 8;
}
if (x & 0xf > 0) {
r -= 4;
} else {
x >>= 4;
}
if (x & 0x3 > 0) {
r -= 2;
} else {
x >>= 2;
}
if (x & 0x1 > 0) r -= 1;
}
| 128 |
6 | // Contract module of the ERC165 standard, as defined in the This module is used through inheritance. It will make available thefunction `supportsInterface`. Derived contracts need only to registersupport for their own interfaces. / | contract ERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev a mapping of interface id to whether or not it is supported
*/
mapping(bytes4 => bool) private _supportedInterfaces;
/**
* @dev Initializes the contract registering ERC165 interface ID.
*/
constructor() internal {
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section].
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId)
external
view
returns (bool)
{
return _supportedInterfaces[interfaceId];
}
/**
* @dev registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface ID is not required.
*/
function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface ID");
_supportedInterfaces[interfaceId] = true;
}
}
| contract ERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev a mapping of interface id to whether or not it is supported
*/
mapping(bytes4 => bool) private _supportedInterfaces;
/**
* @dev Initializes the contract registering ERC165 interface ID.
*/
constructor() internal {
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section].
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId)
external
view
returns (bool)
{
return _supportedInterfaces[interfaceId];
}
/**
* @dev registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface ID is not required.
*/
function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface ID");
_supportedInterfaces[interfaceId] = true;
}
}
| 10,868 |
276 | // Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 4,397 |
74 | // salt from CREATE2 specification | bytes32 salt = keccak256(abi.encodePacked(saltArg, _changePk.pubKeyHash));
| bytes32 salt = keccak256(abi.encodePacked(saltArg, _changePk.pubKeyHash));
| 28,628 |
26 | // Set the token for sale. The owner of the token must be the sender and have the marketplace approved. _tokenId uint256 ID of the token _amount uint256 wei value that the item is for sale / | function setSalePrice(
uint256 _tokenId,
uint256 _amount,
address _owner
) external;
| function setSalePrice(
uint256 _tokenId,
uint256 _amount,
address _owner
) external;
| 55,116 |
28 | // Check the adjustment satisfies all conditions for the current system mode | _requireValidAdjustmentInCurrentMode(isRecoveryMode, _collWithdrawal, _isDebtIncrease, vars);
| _requireValidAdjustmentInCurrentMode(isRecoveryMode, _collWithdrawal, _isDebtIncrease, vars);
| 14,276 |
14 | // Creates a new pool if it does not exist, then unlocks if it has not been unlocked/token0 the token0 of the pool/token1 the token1 of the pool/fee the fee for the pool/currentSqrtP the initial price of the pool/ return pool returns the pool address | function createAndUnlockPoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 currentSqrtP
) external payable returns (address pool);
function mint(MintParams calldata params)
external
payable
| function createAndUnlockPoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 currentSqrtP
) external payable returns (address pool);
function mint(MintParams calldata params)
external
payable
| 14,219 |
143 | // Delegate tax/fee handling to a separate function | _handleTaxes(); // Tax liquidation frontruns this sell. THAT'S WHAT YOU GET
| _handleTaxes(); // Tax liquidation frontruns this sell. THAT'S WHAT YOU GET
| 14,321 |
3 | // add by Joe~ | bytes32 _transferRole = keccak256("TRANSFER_ROLE");
bytes32 _minterRole = keccak256("MINTER_ROLE");
address defaultAdmin = msg.sender;
_setupRole(DEFAULT_ADMIN_ROLE, defaultAdmin);
_setupRole(_minterRole, defaultAdmin);
_setupRole(_transferRole, defaultAdmin);
_setupRole(_transferRole, address(0));
_setupRole(COVER_ROLE, defaultAdmin);
| bytes32 _transferRole = keccak256("TRANSFER_ROLE");
bytes32 _minterRole = keccak256("MINTER_ROLE");
address defaultAdmin = msg.sender;
_setupRole(DEFAULT_ADMIN_ROLE, defaultAdmin);
_setupRole(_minterRole, defaultAdmin);
_setupRole(_transferRole, defaultAdmin);
_setupRole(_transferRole, address(0));
_setupRole(COVER_ROLE, defaultAdmin);
| 24,295 |
128 | // cancel exchangeuint256 _id exchangeId you want to cancel | function cancelExchange(uint256 _id) external onlyEOA {
require(exchange.ownerOf(_id) == msg.sender);
uint256 _tokenId = exchange.getTokenId(_id);
CrystalWrapper memory _cw = getCrystalWrapper(msg.sender, _tokenId);
// withdraw crystal from exchange contract
crystal._transferFrom(exchange, _cw.owner, _cw.tokenId);
exchange.remove(_id);
emit CancelExchange(_id, _cw.owner, _cw.tokenId, _cw.kind, _cw.weight, now);
}
| function cancelExchange(uint256 _id) external onlyEOA {
require(exchange.ownerOf(_id) == msg.sender);
uint256 _tokenId = exchange.getTokenId(_id);
CrystalWrapper memory _cw = getCrystalWrapper(msg.sender, _tokenId);
// withdraw crystal from exchange contract
crystal._transferFrom(exchange, _cw.owner, _cw.tokenId);
exchange.remove(_id);
emit CancelExchange(_id, _cw.owner, _cw.tokenId, _cw.kind, _cw.weight, now);
}
| 27,147 |
3 | // Returns if an execution strategy is in the system strategy address of the strategy / | function isStrategyWhitelisted(address strategy) external view override returns (bool) {
return _whitelistedStrategies.contains(strategy);
}
| function isStrategyWhitelisted(address strategy) external view override returns (bool) {
return _whitelistedStrategies.contains(strategy);
}
| 34,557 |
83 | // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. | if (low > 0 && array[low - 1] == element) {
return low - 1;
} else {
| if (low > 0 && array[low - 1] == element) {
return low - 1;
} else {
| 29,312 |
16 | // Emits a {Transfer} event./Function has a number of checks and conditions - see:/{_transfer} & {_spendAllowance} internal function. | function transferFrom(
address _from,
address _to,
uint256 _amount
) public ifTokenNotPaused returns (bool) {
address spender = _msgSender();
_spendAllowance(_from, spender, _amount);
_transfer(_from, _to, _amount);
return true;
}
| function transferFrom(
address _from,
address _to,
uint256 _amount
) public ifTokenNotPaused returns (bool) {
address spender = _msgSender();
_spendAllowance(_from, spender, _amount);
_transfer(_from, _to, _amount);
return true;
}
| 24,219 |
43 | // Returns whether an auction is active. | function isAuctionExpired(uint256 _auctionId) external view returns (bool);
| function isAuctionExpired(uint256 _auctionId) external view returns (bool);
| 26,784 |
46 | // Populate return array | uint256 moduleCount = 0;
address currentModule = modules[start];
while(currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {
array[moduleCount] = currentModule;
currentModule = modules[currentModule];
moduleCount++;
}
| uint256 moduleCount = 0;
address currentModule = modules[start];
while(currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {
array[moduleCount] = currentModule;
currentModule = modules[currentModule];
moduleCount++;
}
| 16,209 |
26 | // Execute the script with ID `_delayedScriptId`_delayedScriptId The ID of the script to execute/ | function execute(uint256 _delayedScriptId) external returns(bool success, bytes memory returnValue) {
require(canExecute(_delayedScriptId), ERROR_CAN_NOT_EXECUTE);
DelayedScript memory delayedScript = delayedScripts[_delayedScriptId];
delete delayedScripts[_delayedScriptId];
(success, returnValue) = delayedScript.on.call(delayedScript.data);
emit ExecutedScript(_delayedScriptId, delayedScript.on, delayedScript.data, 0, success);
}
| function execute(uint256 _delayedScriptId) external returns(bool success, bytes memory returnValue) {
require(canExecute(_delayedScriptId), ERROR_CAN_NOT_EXECUTE);
DelayedScript memory delayedScript = delayedScripts[_delayedScriptId];
delete delayedScripts[_delayedScriptId];
(success, returnValue) = delayedScript.on.call(delayedScript.data);
emit ExecutedScript(_delayedScriptId, delayedScript.on, delayedScript.data, 0, success);
}
| 32,225 |
17 | // Getter for the total amount of `token` already released. `token` should be the address of an IERC20contract. / | function totalReleased(IERC20 token) public view returns (uint256) {
return _erc20TotalReleased[token];
}
| function totalReleased(IERC20 token) public view returns (uint256) {
return _erc20TotalReleased[token];
}
| 3,651 |
14 | // Sets the address of the Seen.Haus items-based escrow ticketer contract. Emits a EscrowTicketerAddressChanged event._itemsTicketer - the address of the items-based escrow ticketer contract / | function setItemsTicketer(address _itemsTicketer)
external
override
onlyRole(MULTISIG)
| function setItemsTicketer(address _itemsTicketer)
external
override
onlyRole(MULTISIG)
| 34,604 |
6 | // A common scaling factor to maintain precision | uint public constant expScale = 1e18;
| uint public constant expScale = 1e18;
| 31,810 |
10 | // Returns the current implementation.return Address of the current implementation / | function _implementation() internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| function _implementation() internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| 18,550 |
93 | // Internal function that burns an amount of the token of a givenaccount. account The account whose tokens will be burnt. value The amount that will be burnt. / | function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
| function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
| 25,627 |
274 | // Check that create pair pubdata from request and block matches | function createPairPubdataMatch(bytes memory _lhs, bytes memory _rhs) internal pure returns (bool) {
// We must ignore `accountId` because it is present in block pubdata but not in priority queue
bytes memory lhs_trimmed = Bytes.slice(_lhs, ACCOUNT_ID_BYTES, PACKED_CREATE_PAIR_PUBDATA_BYTES - ACCOUNT_ID_BYTES);
bytes memory rhs_trimmed = Bytes.slice(_rhs, ACCOUNT_ID_BYTES, PACKED_CREATE_PAIR_PUBDATA_BYTES - ACCOUNT_ID_BYTES);
return keccak256(lhs_trimmed) == keccak256(rhs_trimmed);
}
| function createPairPubdataMatch(bytes memory _lhs, bytes memory _rhs) internal pure returns (bool) {
// We must ignore `accountId` because it is present in block pubdata but not in priority queue
bytes memory lhs_trimmed = Bytes.slice(_lhs, ACCOUNT_ID_BYTES, PACKED_CREATE_PAIR_PUBDATA_BYTES - ACCOUNT_ID_BYTES);
bytes memory rhs_trimmed = Bytes.slice(_rhs, ACCOUNT_ID_BYTES, PACKED_CREATE_PAIR_PUBDATA_BYTES - ACCOUNT_ID_BYTES);
return keccak256(lhs_trimmed) == keccak256(rhs_trimmed);
}
| 29,817 |
25 | // returns the minimum amount of tokens that can be transferred in one transaction / | function minLimit() external view returns (uint256) {
return _minLimit;
}
| function minLimit() external view returns (uint256) {
return _minLimit;
}
| 46,193 |
461 | // Unpacks a sample into its components. / | function unpack(bytes32 sample)
internal
pure
returns (
int256 logPairPrice,
int256 accLogPairPrice,
int256 logBptPrice,
int256 accLogBptPrice,
int256 logInvariant,
int256 accLogInvariant,
| function unpack(bytes32 sample)
internal
pure
returns (
int256 logPairPrice,
int256 accLogPairPrice,
int256 logBptPrice,
int256 accLogBptPrice,
int256 logInvariant,
int256 accLogInvariant,
| 24,246 |
2 | // It deposits ETH into the contract and increases the caller's internal balance of WETH. / | function deposit() external payable virtual;
| function deposit() external payable virtual;
| 44,725 |
30 | // Mark as claimed, write the hash and send the token. | data.count++;
data.claimed[msg.sender] = true;
addOwnership(msg.sender, claimed);
emit Transfer(address(0), msg.sender, claimed);
totalSupply = claimed + 1;
| data.count++;
data.claimed[msg.sender] = true;
addOwnership(msg.sender, claimed);
emit Transfer(address(0), msg.sender, claimed);
totalSupply = claimed + 1;
| 59,141 |
23 | // Fulfill auction and disperse winning bid / auctioned NFT. Anyone can call this function auctionId ID of auction to fulfill / | function fulfillAuction(bytes32 auctionId) external;
| function fulfillAuction(bytes32 auctionId) external;
| 14,223 |
15 | // list starts from 0 | potentialCandidateListForCurrentGA.list[candidateAssitant.numberOfCandidate].candidate = _adr;
potentialCandidateListForCurrentGA.list[candidateAssitant.numberOfCandidate].supportingVoteNum = 0;
| potentialCandidateListForCurrentGA.list[candidateAssitant.numberOfCandidate].candidate = _adr;
potentialCandidateListForCurrentGA.list[candidateAssitant.numberOfCandidate].supportingVoteNum = 0;
| 50,164 |
0 | // IVault Interface for the BaseVault / | interface IVault {
/**
* @notice Enables/Disables a module.
* @param _module The target module.
* @param _value Set to `true` to authorise the module.
*/
function authoriseModule(address _module, bool _value, bytes memory _initData) external;
/**
* @notice Enables a static method by specifying the target module to which the call must be delegated.
* @param _module The target module.
*/
function enableStaticCall(address _module) external;
/**
* @notice Inits the vault by setting the owner and authorising a list of modules.
* @param _owner The owner.
* @param _initData bytes32 initilization data specific to the module.
* @param _modules The modules to authorise.
*/
function init(address _owner, address[] calldata _modules, bytes[] calldata _initData) external;
/**
* @notice Sets a new owner for the vault.
* @param _newOwner The new owner.
*/
function setOwner(address _newOwner) external;
/**
* @notice Returns the vault owner.
* @return The vault owner address.
*/
function owner() external view returns (address);
/**
* @notice Returns the number of authorised modules.
* @return The number of authorised modules.
*/
function modules() external view returns (uint256);
/**
* @notice Checks if a module is authorised on the vault.
* @param _module The module address to check.
* @return `true` if the module is authorised, otherwise `false`.
*/
function authorised(address _module) external view returns (bool);
/**
* @notice Returns the module responsible, if static call is enabled for `_sig`, otherwise return zero address.
* @param _sig The signature of the static call.
* @return the module doing the redirection or zero address
*/
function enabled(bytes4 _sig) external view returns (address);
} | interface IVault {
/**
* @notice Enables/Disables a module.
* @param _module The target module.
* @param _value Set to `true` to authorise the module.
*/
function authoriseModule(address _module, bool _value, bytes memory _initData) external;
/**
* @notice Enables a static method by specifying the target module to which the call must be delegated.
* @param _module The target module.
*/
function enableStaticCall(address _module) external;
/**
* @notice Inits the vault by setting the owner and authorising a list of modules.
* @param _owner The owner.
* @param _initData bytes32 initilization data specific to the module.
* @param _modules The modules to authorise.
*/
function init(address _owner, address[] calldata _modules, bytes[] calldata _initData) external;
/**
* @notice Sets a new owner for the vault.
* @param _newOwner The new owner.
*/
function setOwner(address _newOwner) external;
/**
* @notice Returns the vault owner.
* @return The vault owner address.
*/
function owner() external view returns (address);
/**
* @notice Returns the number of authorised modules.
* @return The number of authorised modules.
*/
function modules() external view returns (uint256);
/**
* @notice Checks if a module is authorised on the vault.
* @param _module The module address to check.
* @return `true` if the module is authorised, otherwise `false`.
*/
function authorised(address _module) external view returns (bool);
/**
* @notice Returns the module responsible, if static call is enabled for `_sig`, otherwise return zero address.
* @param _sig The signature of the static call.
* @return the module doing the redirection or zero address
*/
function enabled(bytes4 _sig) external view returns (address);
} | 27,178 |
172 | // Decrease the allowance by a given decrement spender Spender's address decrement Amount of decrease in allowancereturn True if successful / | function decreaseAllowance(address spender, uint256 decrement)
external
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(spender)
returns (bool)
| function decreaseAllowance(address spender, uint256 decrement)
external
whenNotPaused
notBlacklisted(msg.sender)
notBlacklisted(spender)
returns (bool)
| 39,862 |
0 | // ============ Events ============ // ============ State Variables ============ / Instance of the controller smart contract | IController public controller;
| IController public controller;
| 36,027 |
229 | // _owner should not be an avatar address | require(ownerOf[_owner] == address(0), "Registry: cannot-create-an-avatar-of-avatar");
| require(ownerOf[_owner] == address(0), "Registry: cannot-create-an-avatar-of-avatar");
| 18,768 |
5 | // taxBps to 0% | _taxBps = 0;
| _taxBps = 0;
| 20,353 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.