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 |
|---|---|---|---|---|
19 | // Assigns a new address to act as the CEO. Only available to the current CEO./_newCEO The address of the new CEO | function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| 23,609 |
35 | // Allow owner to transfer token from contract | * @param {address} contract address of corresponding token
* @param {uint256} amount of token to be transferred
*
* This is a generalized function which can be used to transfer any accidentally
* sent (including DCB) out of the contract to wowner
*
*/
function transferToken(address _addr, uint256... | * @param {address} contract address of corresponding token
* @param {uint256} amount of token to be transferred
*
* This is a generalized function which can be used to transfer any accidentally
* sent (including DCB) out of the contract to wowner
*
*/
function transferToken(address _addr, uint256... | 39,882 |
162 | // If the collateral type is any ERC20, anyone can call this function any time beforeexpiry to increase the amount of collateral in a Vault. Can only transfer in the collateral asset.Will fail if ETH is the collateral asset.The user has to allow the contract to handle their ERC20 tokens on his behalf before thesefuncti... | function addERC20Collateral(address payable vaultOwner, uint256 amt)
public
notExpired
returns (uint256)
| function addERC20Collateral(address payable vaultOwner, uint256 amt)
public
notExpired
returns (uint256)
| 43,442 |
30 | // Get the address of a network contract by name | function getContractAddress(string memory _contractName)
internal
view
returns (address)
| function getContractAddress(string memory _contractName)
internal
view
returns (address)
| 7,942 |
109 | // accounts for first epoch being longer lockStart + firstEpochDelay + (epochsPassedepochDuration) | return
LOCK_START.add(FIRST_EPOCH_DELAY).add(passed.mul(EPOCH_DURATION));
| return
LOCK_START.add(FIRST_EPOCH_DELAY).add(passed.mul(EPOCH_DURATION));
| 20,191 |
62 | // Emit event WorkApproved | emit WorkApproved(_workId, _bountyId);
| emit WorkApproved(_workId, _bountyId);
| 1,419 |
24 | // wallet should have enough tokens to fund | require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet].sub(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
emit Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
| require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet].sub(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
emit Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
| 40,643 |
6 | // pass back same data as returned by 'implementation' contract: | return(ptr, size)
| return(ptr, size)
| 49,567 |
113 | // loseSponsor(): indicates that _point's sponsor is no longer providing it service | function loseSponsor(uint32 _point)
onlyOwner
external
| function loseSponsor(uint32 _point)
onlyOwner
external
| 2,963 |
15 | // Prevent voting if any Mario is Prez. | modifier isVotingOpen() {
require(!IsMarioPrez, "VREQ7: Voting has ended!");
_;
}
| modifier isVotingOpen() {
require(!IsMarioPrez, "VREQ7: Voting has ended!");
_;
}
| 36,504 |
8 | // ====================== internal ======================= |
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
|
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
| 39,304 |
26 | // Withdraw `amount` tokens and unwrap/_amount The amount of tokens that the user wants to withdraw/_claim Whether or not the user wants to claim their rewards | function withdrawAndUnwrap(uint256 _amount, bool _claim)
public
updateReward(msg.sender)
| function withdrawAndUnwrap(uint256 _amount, bool _claim)
public
updateReward(msg.sender)
| 30,508 |
66 | // burn token | _burn(tokenId);
| _burn(tokenId);
| 24,351 |
23 | // Transaction info | sender: _msgSender()
| sender: _msgSender()
| 10,128 |
1 | // Sets the ABI associated with an ENS node.Nodes may have one ABI of each content type. To remove an ABI, set it tothe empty string. node The node to update. contentType The content type of the ABI data The ABI data. / | function setABI(bytes32 node, uint256 contentType, bytes calldata data) virtual external authorised(node) {
// Content types must be powers of 2
require(((contentType - 1) & contentType) == 0);
abis[node][contentType] = data;
emit ABIChanged(node, contentType);
}
| function setABI(bytes32 node, uint256 contentType, bytes calldata data) virtual external authorised(node) {
// Content types must be powers of 2
require(((contentType - 1) & contentType) == 0);
abis[node][contentType] = data;
emit ABIChanged(node, contentType);
}
| 8,067 |
4 | // ISafeProtocolStaticFunctionHandler - An interface that a Safe functionhandler should implement in case when handling static calls | * @notice In Safe{Core} Protocol, a function handler can be used to add additional functionality to a Safe.
* User(s) should add SafeProtocolManager as a function handler (aka fallback handler in Safe v1.x) to the Safe
* and enable the contract implementing ISafeProtocolStaticFunctionHandler interfac... | * @notice In Safe{Core} Protocol, a function handler can be used to add additional functionality to a Safe.
* User(s) should add SafeProtocolManager as a function handler (aka fallback handler in Safe v1.x) to the Safe
* and enable the contract implementing ISafeProtocolStaticFunctionHandler interfac... | 30,548 |
1 | // Constructor function to set the rewards token and the NFT collection addresses. | constructor(IERC721 _therotybroiCollection, IERC20 _oioiToken) {
therotybroiCollection = _therotybroiCollection;
oioiToken = _oioiToken;
}
| constructor(IERC721 _therotybroiCollection, IERC20 _oioiToken) {
therotybroiCollection = _therotybroiCollection;
oioiToken = _oioiToken;
}
| 1,449 |
50 | // Interface for all security tokens / | contract ISecurityToken is IST20, Ownable {
uint8 public constant PERMISSIONMANAGER_KEY = 1;
uint8 public constant TRANSFERMANAGER_KEY = 2;
uint8 public constant STO_KEY = 3;
uint8 public constant CHECKPOINT_KEY = 4;
uint256 public granularity;
// Value of current checkpoint
uint256 public... | contract ISecurityToken is IST20, Ownable {
uint8 public constant PERMISSIONMANAGER_KEY = 1;
uint8 public constant TRANSFERMANAGER_KEY = 2;
uint8 public constant STO_KEY = 3;
uint8 public constant CHECKPOINT_KEY = 4;
uint256 public granularity;
// Value of current checkpoint
uint256 public... | 9,678 |
6 | // Standard ERC20 token / | contract StandardToken is ERC20Basic {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(... | contract StandardToken is ERC20Basic {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(... | 38,017 |
15 | // SharesSubject => Supply | mapping(uint256 => uint256) public sharesSupply;
mapping(address => address) public invite;
| mapping(uint256 => uint256) public sharesSupply;
mapping(address => address) public invite;
| 14,829 |
127 | // Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. / | function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| 9,594 |
110 | // what else? | // enum CampaignStages{
// campaignStarted,
// campaignFinished
// }
| // enum CampaignStages{
// campaignStarted,
// campaignFinished
// }
| 17,280 |
34 | // To remove users from blacklist which restricts blacklisted users from claiming _userToRemoveFromBlacklist addresses of the users / | function removeFromBlacklist(
address[] calldata _userToRemoveFromBlacklist
| function removeFromBlacklist(
address[] calldata _userToRemoveFromBlacklist
| 39,716 |
168 | // Mints a wrapped punk / | function mint(uint256 punkIndex) external;
| function mint(uint256 punkIndex) external;
| 34,081 |
12 | // Redeems an NFTVoucher for an actual NFT, creating it in the process./redeemer The address of the account which will receive the NFT upon success./voucher A signed NFTVoucher that describes the NFT to be redeemed. | function redeem(address redeemer, NFTVoucher calldata voucher) public payable returns (uint256) {
// make sure signature is valid and get the address of the signer
address signer = _verify(voucher);
// make sure that the signer is authorized to mint NFTs
require(hasRole(MINTER_ROLE, signer), "Signatu... | function redeem(address redeemer, NFTVoucher calldata voucher) public payable returns (uint256) {
// make sure signature is valid and get the address of the signer
address signer = _verify(voucher);
// make sure that the signer is authorized to mint NFTs
require(hasRole(MINTER_ROLE, signer), "Signatu... | 20,303 |
201 | // USDC | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,
| 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,
| 5,748 |
3 | // ============ Constructor ============ //Instantiate with ManagerCore address and WrapModuleV2 address._managerCoreAddress of ManagerCore contract _wrapModule Address of WrapModuleV2 contract / | constructor(
IManagerCore _managerCore,
IWrapModuleV2 _wrapModule,
ISignalSuscriptionModule _signalSuscriptionModule
| constructor(
IManagerCore _managerCore,
IWrapModuleV2 _wrapModule,
ISignalSuscriptionModule _signalSuscriptionModule
| 43,828 |
5,734 | // 2868 | entry "unostracized" : ENG_ADJECTIVE
| entry "unostracized" : ENG_ADJECTIVE
| 19,480 |
99 | // 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 onlyOwner {
require(_to != address(0), "to address cannot be zero");
totalSupply_ = totalSupply_.add(_value);
balances.addBalance(_to, _value);
emit Mint(_to, _value);
emit Transfer(address(0), _to, _value);
}
| function mint(address _to, uint256 _value) public onlyOwner {
require(_to != address(0), "to address cannot be zero");
totalSupply_ = totalSupply_.add(_value);
balances.addBalance(_to, _value);
emit Mint(_to, _value);
emit Transfer(address(0), _to, _value);
}
| 46,512 |
4 | // Anyone can pay the gas to create their very own Tester token | function create() public returns (uint256 _tokenId) {
bytes32 sudoRandomButTotallyPredictable = keccak256(abi.encodePacked(totalSupply(),blockhash(block.number - 1)));
uint8 body = (uint8(sudoRandomButTotallyPredictable[0])%5)+1;
uint8 feet = (uint8(sudoRandomButTotallyPredictable[1])%5)+1;
uint8 hea... | function create() public returns (uint256 _tokenId) {
bytes32 sudoRandomButTotallyPredictable = keccak256(abi.encodePacked(totalSupply(),blockhash(block.number - 1)));
uint8 body = (uint8(sudoRandomButTotallyPredictable[0])%5)+1;
uint8 feet = (uint8(sudoRandomButTotallyPredictable[1])%5)+1;
uint8 hea... | 40,783 |
163 | // Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which isforwarded in {IERC721Receiver-onERC721Received} to contract recipients. / | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| 2,316 |
56 | // Max Tax at launch to avoid snipers & bots. Changed when officially launch | feeRatesStruct public buyRates =
| feeRatesStruct public buyRates =
| 85,118 |
178 | // max gas price for buy/sell transactions | function getMaxGasPrice() public view returns(uint256) {
return _core.MAX_GAS_PRICE();
}
| function getMaxGasPrice() public view returns(uint256) {
return _core.MAX_GAS_PRICE();
}
| 18,467 |
92 | // Whether `a` is less than or equal to `b`. a a uint256. b a FixedPoint.return True if `a <= b`, or False. / | function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue <= b.rawValue;
}
| function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue <= b.rawValue;
}
| 15,023 |
438 | // load the table into memory | string memory table = TABLE_ENCODE;
| string memory table = TABLE_ENCODE;
| 4,000 |
9 | // owner contract owner address/newTradePercentage new maximum tradable percentage of the reserves | event NewMaxTradePercentage( address owner, uint16 newTradePercentage );
| event NewMaxTradePercentage( address owner, uint16 newTradePercentage );
| 20,652 |
6 | // log initialization params | emit Initialized(operator, multihash, metadata);
| emit Initialized(operator, multihash, metadata);
| 7,812 |
10 | // Getter function for the proposal information by the id_id is the proposal idreturn title of proposal return description of proposal return owner of proposal return minAmountUSD for proposal to pass return expirationDate of proposal return trbBalance of proposal return open- bool true if proposal is still open return... | function getProposalById(uint _id) external view returns(string memory,string memory,address,uint,uint,uint,bool,bool,uint){
Proposal memory t = idToProposal[_id];
return (t.title,t.description,t.owner,t.minAmountUSD,t.expirationDate,t.trbBalance,t.open,t.passed,100 * (t.trbBalance* viewTellorPrice()/1e20) / t.min... | function getProposalById(uint _id) external view returns(string memory,string memory,address,uint,uint,uint,bool,bool,uint){
Proposal memory t = idToProposal[_id];
return (t.title,t.description,t.owner,t.minAmountUSD,t.expirationDate,t.trbBalance,t.open,t.passed,100 * (t.trbBalance* viewTellorPrice()/1e20) / t.min... | 31,763 |
62 | // ========== UTILITY FUNCTIONS ========== / | function rebalance() external onlyWorker {
address iterAddress = farmHead;
while (iterAddress != address(0)) {
if (farms[iterAddress].active) {
IFarm(iterAddress).rebalance();
}
iterAddress = farms[iterAddress].nextFarm;
}
emit Rebalanced(iterAddress);
}
| function rebalance() external onlyWorker {
address iterAddress = farmHead;
while (iterAddress != address(0)) {
if (farms[iterAddress].active) {
IFarm(iterAddress).rebalance();
}
iterAddress = farms[iterAddress].nextFarm;
}
emit Rebalanced(iterAddress);
}
| 59,931 |
16 | // Bind the fractional token address to the newly minted NFT's tokenId. | tokenIdToERC20TokenAddress[_tokenId] = tokenAddress;
| tokenIdToERC20TokenAddress[_tokenId] = tokenAddress;
| 28,617 |
166 | // //Convert string to bytes32 / | function stringToBytes32(string memory source) public pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
| function stringToBytes32(string memory source) public pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
| 9,698 |
4 | // Fee | uint256 public adminWalletFee = 3000 * 10**18;
uint256 public stakingPoolFee = 0;
uint256 public burnFee = 100 * 10**18;
| uint256 public adminWalletFee = 3000 * 10**18;
uint256 public stakingPoolFee = 0;
uint256 public burnFee = 100 * 10**18;
| 5,914 |
1 | // Raised when trying create a WhiteList config that already exisit (mint amounts are the same) / | error WhiteListAlreadyExists();
error NotWhitelisted();
error InvalidMintDuration();
function whitelistMint(
uint256 editionId,
uint8 maxAmount,
uint24 mintPriceInFinney,
bytes32[] calldata merkleProof,
uint24 quantity,
| error WhiteListAlreadyExists();
error NotWhitelisted();
error InvalidMintDuration();
function whitelistMint(
uint256 editionId,
uint8 maxAmount,
uint24 mintPriceInFinney,
bytes32[] calldata merkleProof,
uint24 quantity,
| 40,187 |
9 | // return The address for COMP token | function getCompAddress() external view returns (address);
| function getCompAddress() external view returns (address);
| 31,298 |
16 | // The new observation for each symbolHash | mapping(bytes32 => Observation) public newObservations;
| mapping(bytes32 => Observation) public newObservations;
| 12,306 |
8 | // |
uint constant MAX_HOUSE_FEE_THOUSANDTHS = 20;
uint constant MAX_LOTTERY_FEE_THOUSANDTHS = 40;
address public lastPlayer;
uint public lastBlock;
uint public totalWinnings;
uint public jackpot;
uint public startedAt;
|
uint constant MAX_HOUSE_FEE_THOUSANDTHS = 20;
uint constant MAX_LOTTERY_FEE_THOUSANDTHS = 40;
address public lastPlayer;
uint public lastBlock;
uint public totalWinnings;
uint public jackpot;
uint public startedAt;
| 50,014 |
12 | // Emitted when graph account sets their default name / | event SetDefaultName(
address graphAccount,
uint256 nameSystem, // only ENS for now
bytes32 nameIdentifier,
string name
);
| event SetDefaultName(
address graphAccount,
uint256 nameSystem, // only ENS for now
bytes32 nameIdentifier,
string name
);
| 28,891 |
24 | // Standard TRC20 tokenImplementation of the basic standard token. This implementation emits additional Approval events, allowing applications to reconstruct the allowance status forall accounts just by listening to said events. Note that this isn't required by the specification, and othercompliant implementations may ... | contract TRC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender,... | contract TRC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender,... | 9,824 |
1 | // performance fee sent to treasury / FEE_BASIS of 10_000 | uint16 public fee = 1_000;
uint16 internal constant MAX_FEE = 1_000;
uint16 internal constant FEE_BASIS = 10_000;
| uint16 public fee = 1_000;
uint16 internal constant MAX_FEE = 1_000;
uint16 internal constant FEE_BASIS = 10_000;
| 6,261 |
3 | // Index operations // Create a new index for the publisher token Super token address indexId Id of the index ctx Context bytes (see ISuperfluid.sol for Context struct) @custom:callbacks None / | function createIndex(
ISuperfluidToken token,
uint32 indexId,
bytes calldata ctx)
external
virtual
returns(bytes memory newCtx);
| function createIndex(
ISuperfluidToken token,
uint32 indexId,
bytes calldata ctx)
external
virtual
returns(bytes memory newCtx);
| 21,929 |
124 | // The cfolioItem wrapper bridge | address private immutable _cfiBridge;
| address private immutable _cfiBridge;
| 68,550 |
165 | // Sets the active state of the reserve self The reserve configuration active The active state / | function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
self.data =
(self.data & ACTIVE_MASK) |
(uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
}
| function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
self.data =
(self.data & ACTIVE_MASK) |
(uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
}
| 53,279 |
1,759 | // A mock oracle used for testing. Exports the voting & oracle interfaces and events that contain ancillary data. | abstract contract VotingAncillaryInterfaceTesting is OracleAncillaryInterface, VotingAncillaryInterface, Testable {
using FixedPoint for FixedPoint.Unsigned;
// Events, data structures and functions not exported in the base interfaces, used for testing.
event VoteCommitted(
address indexed voter,
... | abstract contract VotingAncillaryInterfaceTesting is OracleAncillaryInterface, VotingAncillaryInterface, Testable {
using FixedPoint for FixedPoint.Unsigned;
// Events, data structures and functions not exported in the base interfaces, used for testing.
event VoteCommitted(
address indexed voter,
... | 17,966 |
204 | // Triggers an update of rewards due to a change in allocations. _subgraphDeploymentID Subgraph deployment updated / | function _updateRewards(bytes32 _subgraphDeploymentID) private returns (uint256) {
IRewardsManager rewardsManager = rewardsManager();
if (address(rewardsManager) == address(0)) {
return 0;
}
return rewardsManager.onSubgraphAllocationUpdate(_subgraphDeploymentID);
}
| function _updateRewards(bytes32 _subgraphDeploymentID) private returns (uint256) {
IRewardsManager rewardsManager = rewardsManager();
if (address(rewardsManager) == address(0)) {
return 0;
}
return rewardsManager.onSubgraphAllocationUpdate(_subgraphDeploymentID);
}
| 20,703 |
65 | // Function to convert {Set} Tokens into underlying components The ERC20 components do not need to be approved to call this functionquantity uint The quantity of Sets desired to redeem in Wei / | function redeem(uint quantity)
public
isMultipleOfNaturalUnit(quantity)
hasSufficientBalance(quantity)
isNonZero(quantity)
returns (bool success)
{
burn(quantity);
for (uint i = 0; i < components.length; i++) {
| function redeem(uint quantity)
public
isMultipleOfNaturalUnit(quantity)
hasSufficientBalance(quantity)
isNonZero(quantity)
returns (bool success)
{
burn(quantity);
for (uint i = 0; i < components.length; i++) {
| 3,418 |
11 | // Allow the fyToken to pull from the base join for redemption, and to push to mint with underlying | bytes4[] memory sigs = new bytes4[](2);
sigs[0] = JOIN;
sigs[1] = EXIT;
AccessControl(address(baseJoin)).grantRoles(sigs, address(fyToken));
| bytes4[] memory sigs = new bytes4[](2);
sigs[0] = JOIN;
sigs[1] = EXIT;
AccessControl(address(baseJoin)).grantRoles(sigs, address(fyToken));
| 10,656 |
46 | // Take service fee back. | function getServiceFeeBack() public onlyOwner
| function getServiceFeeBack() public onlyOwner
| 27,945 |
21 | // An order can only be filled if its status is FILLABLE. | if (orderInfo.orderStatus != LibOrder.OrderStatus.FILLABLE) {
revert('EXCHANGE: status not fillable');
}
| if (orderInfo.orderStatus != LibOrder.OrderStatus.FILLABLE) {
revert('EXCHANGE: status not fillable');
}
| 36,103 |
67 | // Info of each MCV2 pool./ `allocPoint` The amount of allocation points assigned to the pool./ Also known as the amount of SUSHI to distribute per block. | struct PoolInfo {
uint128 accSushiPerShare;
uint64 lastRewardBlock;
uint64 allocPoint;
}
| struct PoolInfo {
uint128 accSushiPerShare;
uint64 lastRewardBlock;
uint64 allocPoint;
}
| 34,512 |
158 | // oods_coefficients[134]/ mload(add(context, 0x6a80)), res += c_135(f_8(x) - f_8(g^34z)) / (x - g^34z). | res := add(
res,
mulmod(mulmod(/*(x - g^34 * z)^(-1)*/ mload(add(denominatorsPtr, 0x300)),
| res := add(
res,
mulmod(mulmod(/*(x - g^34 * z)^(-1)*/ mload(add(denominatorsPtr, 0x300)),
| 28,900 |
116 | // ========== MUTATIVE FUNCTIONS ========== // Fallback function (exchanges ETH to pUSD) / | function() external payable nonReentrant rateNotInvalid(ETH) notPaused {
_exchangeEtherForPynths();
}
| function() external payable nonReentrant rateNotInvalid(ETH) notPaused {
_exchangeEtherForPynths();
}
| 30,933 |
33 | // Get the address of a network contract by name | function getContractAddress(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check it
require(contractAddress != address(0x0), "C... | function getContractAddress(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check it
require(contractAddress != address(0x0), "C... | 20,866 |
12 | // Gets the owner of the specified token ID _tokenId uint256 ID of the token to query the owner ofreturn owner address currently marked as the owner of the given token ID / | function ownerOf(uint256 _tokenId) public override view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0), "Zero address not allowed");
return owner;
}
| function ownerOf(uint256 _tokenId) public override view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0), "Zero address not allowed");
return owner;
}
| 5,050 |
0 | // Paused on launch | _pause();
| _pause();
| 4,347 |
134 | // allows to burn only if burn is enabled / | function burn(uint256 amount) public virtual override {
require(_isBurnable, "burn option is deactivated");
super.burn(amount);
}
| function burn(uint256 amount) public virtual override {
require(_isBurnable, "burn option is deactivated");
super.burn(amount);
}
| 2,730 |
29 | // set refer reward rate / | function setReferRewardRate(uint256 referRate) public
onlyGovernance
| function setReferRewardRate(uint256 referRate) public
onlyGovernance
| 27,820 |
64 | // check if reward pool for given token exists | if (!rewardPools[address(token)].exists) {
| if (!rewardPools[address(token)].exists) {
| 18,513 |
7 | // Pauses system | function pause() external ifAdmin {
StorageSlot.getBooleanSlot(_PAUSE_SLOT).value = true;
emit Paused(msg.sender);
}
| function pause() external ifAdmin {
StorageSlot.getBooleanSlot(_PAUSE_SLOT).value = true;
emit Paused(msg.sender);
}
| 23,450 |
12 | // ============ External Getter Functions ============ //Return 0xAPI calldata which is already generated from 0xAPI _sourceTokenAddress of source token to be sold_destinationToken Address of destination token to buy_destinationAddress Address that assets should be transferred to_sourceQuantity Amount of source token t... | function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address _destinationAddress,
uint256 _sourceQuantity,
uint256 _minDestinationQuantity,
bytes calldata _data
)
external
view
| function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address _destinationAddress,
uint256 _sourceQuantity,
uint256 _minDestinationQuantity,
bytes calldata _data
)
external
view
| 59,137 |
1 | // Admin mints an NFT ticket with a specific metadata for this ticket. _to Mint to _to address _userId User ID of the NFT ticket Owner _eventId Event ID that the ticket belongs to _ticketTypeId ID of the ticket type _metadataFileName The name of metadata json file in the metadata folder.The metadata will be set at tick... | function safeMintWithMetadata(
| function safeMintWithMetadata(
| 36,292 |
51 | // Admin function to set the mint fee_mintFee The new mint fee specified in basis pointsThe maximum fee that can be set is 10_000 bps, or 100% / | function setMintFee(uint256 _mintFee) external onlyRole(MANAGER_ADMIN) {
if (_mintFee > BPS_DENOMINATOR) {
revert FeeTooLarge();
}
uint256 oldMintFee = mintFee;
mintFee = _mintFee;
emit MintFeeSet(oldMintFee, _mintFee);
}
| function setMintFee(uint256 _mintFee) external onlyRole(MANAGER_ADMIN) {
if (_mintFee > BPS_DENOMINATOR) {
revert FeeTooLarge();
}
uint256 oldMintFee = mintFee;
mintFee = _mintFee;
emit MintFeeSet(oldMintFee, _mintFee);
}
| 24,640 |
174 | // The constructor that is called when the contract is being deployed. | constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for ... | constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for ... | 26,897 |
164 | // Executions | function getOrderExecutionLength(address _token, bytes32 _orderId) constant public returns(uint) {
return my_executions[_token][_orderId].length;
}
| function getOrderExecutionLength(address _token, bytes32 _orderId) constant public returns(uint) {
return my_executions[_token][_orderId].length;
}
| 46,488 |
40 | // We need to unpack the signature, which is given as an array of 65 bytes (from eth.sign) | bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 32))
s := mload(add(signature, 64))
v := and(mload(add(signature, 65)), 255)
}
| bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 32))
s := mload(add(signature, 64))
v := and(mload(add(signature, 65)), 255)
}
| 40,763 |
15 | // Assset info for ETH assetType is only a selector, i.e. 4 bytes length. | require(assetInfo.length == 4, "INVALID_ASSET_STRING");
| require(assetInfo.length == 4, "INVALID_ASSET_STRING");
| 16,030 |
202 | // Check that the rental requires mediation | require(rental.depositStatus == DepositStatus.Pending);
require(depositDeductions[rentalId].status == DeductionStatus.Objected);
| require(rental.depositStatus == DepositStatus.Pending);
require(depositDeductions[rentalId].status == DeductionStatus.Objected);
| 43,488 |
20 | // copy un funded task for ith phase | uint256[] memory _nonFundedTaskList = new uint256[](
_nonFundedPhaseToTask.length - j
);
uint256 _taskID;
for (
uint256 k = j;
k < _nonFunde... | uint256[] memory _nonFundedTaskList = new uint256[](
_nonFundedPhaseToTask.length - j
);
uint256 _taskID;
for (
uint256 k = j;
k < _nonFunde... | 18,420 |
533 | // View function to see pending microCOREs on frontend. | function pendingmicroCORE(uint256 _pid, address _user)
external
view
returns (uint256)
| function pendingmicroCORE(uint256 _pid, address _user)
external
view
returns (uint256)
| 42,973 |
80 | // Sets {decimals} to a value other than the default one of 18./ | function _setupDecimals(uint8 decimals_) internal {
| function _setupDecimals(uint8 decimals_) internal {
| 3,276 |
48 | // An approximation of currently how many seconds are in between blocks. | uint256 public secondsPerBlock = 15;
| uint256 public secondsPerBlock = 15;
| 85,199 |
44 | // Initialize the data contarct. _strvalue of exmStr of Data contract._intvalue of exmInt of Data contract._arrayvalue of exmArray of Data contract. / | function initialize (string _str, uint256 _int, uint16 [] _array) public;
| function initialize (string _str, uint256 _int, uint16 [] _array) public;
| 28,744 |
17 | // equip the shard | tokenIdToDna[tokenId] = dnaType;
| tokenIdToDna[tokenId] = dnaType;
| 33,426 |
324 | // Yields the least unsigned 60.18 decimal fixed-point number greater than or equal to x.//Optimised for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts./ See https:en.wikipedia.org/wiki/Floor_and_ceiling_functions.// Requirements:/ - x must be less than or equal to M... | function ceil(uint256 x) internal pure returns (uint256 result) {
require(x <= MAX_WHOLE_UD60x18);
assembly {
// Equivalent to "x % SCALE" but faster.
let remainder := mod(x, SCALE)
// Equivalent to "SCALE - remainder" but faster.
let delta := sub(SCA... | function ceil(uint256 x) internal pure returns (uint256 result) {
require(x <= MAX_WHOLE_UD60x18);
assembly {
// Equivalent to "x % SCALE" but faster.
let remainder := mod(x, SCALE)
// Equivalent to "SCALE - remainder" but faster.
let delta := sub(SCA... | 69,495 |
61 | // Log the transfer event | Transfer(msg.sender, _to, _value, _data);
return true;
| Transfer(msg.sender, _to, _value, _data);
return true;
| 21,190 |
3 | // the collenction Name / | string private name_;
| string private name_;
| 11,414 |
432 | // allows the configurator to update the loan to value of a reserve_reserve the address of the reserve_ltv the new loan to value/ | {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| 56,056 |
172 | // returns the amount of underlying that this contract's cTokens can be redeemed for | function balanceOfCTokenUnderlying(address owner) internal view returns (uint256) {
uint256 exchangeRate = cToken.exchangeRateStored();
uint256 scaledMantissa = exchangeRate.mul(cToken.balanceOf(owner));
// Note: We are not using careful math here as we're performing a division that cannot fail
return... | function balanceOfCTokenUnderlying(address owner) internal view returns (uint256) {
uint256 exchangeRate = cToken.exchangeRateStored();
uint256 scaledMantissa = exchangeRate.mul(cToken.balanceOf(owner));
// Note: We are not using careful math here as we're performing a division that cannot fail
return... | 34,791 |
4 | // Multiply two uint256 values, throw in case of overflow.x first value to multiply y second value to multiplyreturn xy / | function safeMul (uint256 x, uint256 y)
pure internal
| function safeMul (uint256 x, uint256 y)
pure internal
| 50,110 |
27 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 291 |
33 | // Split user bet in some pieces:- 55% go to bank- 20% go to contract developer :)- 12% go to sponsor- 10% go to stock for future restores- 3%go to referral (if exists, if not - go into stock) / | function splitTheBet(address referral) private {
uint256 _partBank = Math.percent(msg.value, partBank);
uint256 _partOwner = Math.percent(msg.value, partOwner);
uint256 _partStock = Math.percent(msg.value, partStock);
uint256 _partSponsor = Math.percent(msg.value, partSpon... | function splitTheBet(address referral) private {
uint256 _partBank = Math.percent(msg.value, partBank);
uint256 _partOwner = Math.percent(msg.value, partOwner);
uint256 _partStock = Math.percent(msg.value, partStock);
uint256 _partSponsor = Math.percent(msg.value, partSpon... | 18,629 |
182 | // Require loanLiquidationOpen to be false or we are in liquidation phase | require(loanLiquidationOpen == false, "Loans are now being liquidated");
| require(loanLiquidationOpen == false, "Loans are now being liquidated");
| 3,812 |
1 | // lock time for passive liquidity | uint256 public override passiveLiquidityLocktime;
| uint256 public override passiveLiquidityLocktime;
| 27,223 |
7 | // mapping(address => uint256) funds; | mapping(bytes32 => uint256) flightSurety;
| mapping(bytes32 => uint256) flightSurety;
| 4,101 |
5 | // Calculates the change to base token reserves associated with a pricemove along an AMM curve of constant liquidity.Result is a tight lower-bound for fixed-point precision. Meaning if thethe returned limit is X, then X will be inside the limit price and (X+1)will be outside the limit price. / | internal pure returns (uint128) {
unchecked {
uint128 priceDelta = priceX > priceY ?
priceX - priceY : priceY - priceX; // Condition assures never underflows
return reserveAtPrice(liq, priceDelta, true);
}
}
| internal pure returns (uint128) {
unchecked {
uint128 priceDelta = priceX > priceY ?
priceX - priceY : priceY - priceX; // Condition assures never underflows
return reserveAtPrice(liq, priceDelta, true);
}
}
| 13,516 |
129 | // Optimize for when y equals 1.0, 2.0 or 4.0, as those are very simple to implement and occur often in 50/50 and 80/20 Weighted Pools | if (y == ONE) {
return x;
} else if (y == TWO) {
| if (y == ONE) {
return x;
} else if (y == TWO) {
| 25,006 |
39 | // sendReward( account, stakeEarned, stakeSubtract, yieldEarned, yieldSubtract ); |
if(yieldEarned > 0){
pendingEarnedYields[account] = yieldEarned;
totalExitRewardsYield += yieldSubtract;
}
|
if(yieldEarned > 0){
pendingEarnedYields[account] = yieldEarned;
totalExitRewardsYield += yieldSubtract;
}
| 10,599 |
62 | // send bonus token to broker | function requestBonus() external{
require(getState()==State.Success);
uint256 bonusAmount = bonus[msg.sender];
assert(bonusAmount>0);
require(bonusAmount<=safeSub(bonusAndBountyTokens,bonusAmount));
balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender],bonusAmount);
bonus[msg.sen... | function requestBonus() external{
require(getState()==State.Success);
uint256 bonusAmount = bonus[msg.sender];
assert(bonusAmount>0);
require(bonusAmount<=safeSub(bonusAndBountyTokens,bonusAmount));
balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender],bonusAmount);
bonus[msg.sen... | 46,447 |
38 | // on presale success, this is the final step to end the presale, lock liquidity and enable withdrawls of the sale token. This function does not use percentile distribution. Rebasing mechanisms, fee on transfers, or any deflationary logic are not taken into account at this stage to ensure stated liquidity is locked and... | function addLiquidity() external nonReentrant {
require(!STATUS.LP_GENERATION_COMPLETE, 'GENERATION COMPLETE');
require(presaleStatus() == 2, 'NOT SUCCESS'); // SUCCESS
// Fail the presale if the pair exists and contains presale token liquidity
if (PRESALE_LOCK_FORWARDER.uniswapPairIsInitialised(addre... | function addLiquidity() external nonReentrant {
require(!STATUS.LP_GENERATION_COMPLETE, 'GENERATION COMPLETE');
require(presaleStatus() == 2, 'NOT SUCCESS'); // SUCCESS
// Fail the presale if the pair exists and contains presale token liquidity
if (PRESALE_LOCK_FORWARDER.uniswapPairIsInitialised(addre... | 20,857 |
180 | // txHash -> eth address of tx mint |
mapping(string => bool) xeq_complete;
mapping(string => uint256) xeq_amounts;
mapping(string => address) eth_addresses;
|
mapping(string => bool) xeq_complete;
mapping(string => uint256) xeq_amounts;
mapping(string => address) eth_addresses;
| 32,225 |
6 | // decode a UQ6496 into a uint192 by truncating after the radix point | function decode(uq64x96 memory self) internal pure returns (uint192) {
return uint192(self._x >> _N);
}
| function decode(uq64x96 memory self) internal pure returns (uint192) {
return uint192(self._x >> _N);
}
| 13,186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.