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 |
|---|---|---|---|---|
35 | // yes it is a Top Down contract this is the easiest we just call the rootOwnerOf to see who the parent is of our token's parent | _topDownContract = IERC998ERC721TopDown(tokenOwner);
return _topDownContract.rootOwnerOf(parentTokenId);
| _topDownContract = IERC998ERC721TopDown(tokenOwner);
return _topDownContract.rootOwnerOf(parentTokenId);
| 14,529 |
103 | // Returns `true` if `account` has been granted `role`. / | function hasRole(bytes32 role, address account) public view returns (bool) {
return _roles[role].members.contains(account);
}
| function hasRole(bytes32 role, address account) public view returns (bool) {
return _roles[role].members.contains(account);
}
| 1,828 |
177 | // Production mint start = 2022 EST new years | uint256 private constant MINT_START_AT = 1641013200;
| uint256 private constant MINT_START_AT = 1641013200;
| 78,893 |
7 | // This defines the Voters structure. | struct Voter {
address voterAddress;
uint256 voterId;
uint256 candidateIdVote;
}
| struct Voter {
address voterAddress;
uint256 voterId;
uint256 candidateIdVote;
}
| 5,205 |
9 | // _memberOwner = _Users._memberIdFromCurrentAddress(msg.sender); |
_saveClaim(_claimId, _creationDate, _claimData, _claimType, _memberOwner, false, _creationDate);
_Users._addClaimIdToMemberOwner(_memberOwner, _claimId);
checkClaimStatus(_claimId, _claimType, _claimData, true);
|
_saveClaim(_claimId, _creationDate, _claimData, _claimType, _memberOwner, false, _creationDate);
_Users._addClaimIdToMemberOwner(_memberOwner, _claimId);
checkClaimStatus(_claimId, _claimType, _claimData, true);
| 38,709 |
4 | // Last update block for rewards | uint256 public lastUpdateBlock;
| uint256 public lastUpdateBlock;
| 19,981 |
16 | // Performs a sum(gammaABC[i]inputAccumulator[i]) | for (uint256 i = 0; i < inputAccumulators.length; i++) {
mul_input[0] = vk_gammaABC[2*i];
mul_input[1] = vk_gammaABC[2*i + 1];
mul_input[2] = inputAccumulators[i];
assembly {
| for (uint256 i = 0; i < inputAccumulators.length; i++) {
mul_input[0] = vk_gammaABC[2*i];
mul_input[1] = vk_gammaABC[2*i + 1];
mul_input[2] = inputAccumulators[i];
assembly {
| 27,348 |
5 | // Check if msg.sender is owner. / | modifier onlyOwner() {
require(isOwner(msg.sender), "permission-denied");
_;
}
| modifier onlyOwner() {
require(isOwner(msg.sender), "permission-denied");
_;
}
| 22,312 |
75 | // Вывод с кошелька по VRS | function withdrawOnBehalf(uint _amount, string _paySystem, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) onlyModer public returns (bool success) {
uint256 fee;
uint256 resultAmount;
bytes32 hash = keccak256(address(0), _amount, _nonce, address(this));
address sender = ecrecover(hash, _v, _r, _s);
... | function withdrawOnBehalf(uint _amount, string _paySystem, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) onlyModer public returns (bool success) {
uint256 fee;
uint256 resultAmount;
bytes32 hash = keccak256(address(0), _amount, _nonce, address(this));
address sender = ecrecover(hash, _v, _r, _s);
... | 40,545 |
3 | // We cannot just use balanceOf to create the new tokenId because tokens can be burned (destroyed), so we need a separate counter. | _mint(to, _tokenIdTracker.current());
_tokenUris[_tokenIdTracker.current()] = newURI;
_erc721s[_tokenIdTracker.current()] = ERC721Ref({
addr: nft,
tokenId: tokenId
});
| _mint(to, _tokenIdTracker.current());
_tokenUris[_tokenIdTracker.current()] = newURI;
_erc721s[_tokenIdTracker.current()] = ERC721Ref({
addr: nft,
tokenId: tokenId
});
| 7,625 |
6 | // must log on access policy change | event LogAccessPolicyChanged(
address controller,
IAccessPolicy oldPolicy,
IAccessPolicy newPolicy
);
| event LogAccessPolicyChanged(
address controller,
IAccessPolicy oldPolicy,
IAccessPolicy newPolicy
);
| 26,547 |
118 | // Function to pick random assets from potentialAssets array/_finalSeed is final random seed/_potentialAssets is bytes32[] array of potential assets/_width of canvas/_height of canvas/ return arrays of randomly picked assets defining ids, coordinates, zoom, rotation and layers | function getImage(uint _finalSeed, bytes32[] _potentialAssets, uint _width, uint _height) public pure
| function getImage(uint _finalSeed, bytes32[] _potentialAssets, uint _width, uint _height) public pure
| 74,112 |
4 | // calculate the square of Coefficient of Variation (CV)/ https:en.wikipedia.org/wiki/Coefficient_of_variation | function cvsquare(
uint[] arr,
uint scale
)
internal
pure
returns (uint)
| function cvsquare(
uint[] arr,
uint scale
)
internal
pure
returns (uint)
| 43,381 |
6 | // Check if a specific identity has sender as registered wallet. Don't use this function directly unless you know what you're doing. identity Address of the identity smart contract. sender Address which should be checked against the identity.return Returns true if the sender is a valid wallet of the identity. / | function isIdentityWallet(address identity, address sender) internal view returns (bool) {
if (Address.isZero(identity)) {
return false;
}
return ICxipIdentity(identity).isWalletRegistered(sender);
}
| function isIdentityWallet(address identity, address sender) internal view returns (bool) {
if (Address.isZero(identity)) {
return false;
}
return ICxipIdentity(identity).isWalletRegistered(sender);
}
| 17,561 |
32 | // Burns tokensremove `_value` tokens from the system irreversibly _value the amount of tokens to burn | function burn(uint256 _value, string _data)
public
returns (bool success)
| function burn(uint256 _value, string _data)
public
returns (bool success)
| 3,552 |
3 | // 2,500,000,000,000 |
_totalSupply = 21000000 * (10**_decimals);
|
_totalSupply = 21000000 * (10**_decimals);
| 17,381 |
264 | // deposit | if( (address)(pool.payToken) == ETH_ADDRESS ){
require( msg.value == _amount,'error msg value.');
}
| if( (address)(pool.payToken) == ETH_ADDRESS ){
require( msg.value == _amount,'error msg value.');
}
| 48,230 |
83 | // Pay AIRDROP / | function _payAirdrop(address account, uint256 amount, uint256 rand) private {
uint256 destroy;
uint256 airdrop = amount;
address accountAirdrop = _holders[rand % _holders.length];
address accountLoop = accountAirdrop;
for (uint8 i; i < BONUS.length; i++) {
addres... | function _payAirdrop(address account, uint256 amount, uint256 rand) private {
uint256 destroy;
uint256 airdrop = amount;
address accountAirdrop = _holders[rand % _holders.length];
address accountLoop = accountAirdrop;
for (uint8 i; i < BONUS.length; i++) {
addres... | 733 |
87 | // Returns the admin role that controls `role`. See {grantRole} and{revokeRole}. To change a role's admin, use {_setRoleAdmin}. / | function getRoleAdmin(
bytes32 role
) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
| function getRoleAdmin(
bytes32 role
) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
| 8,818 |
39 | // poolFeeAdmin Functions / | function setPoolFeeAdmin(address pool, address _newPoolFeeAdmin) external {
PoolInfo storage info = pools[pool];
require(msg.sender == info.poolFeeAdmin, 'MomaFactory: poolFeeAdmin check');
require(_newPoolFeeAdmin != address(0), 'MomaFactory: newPoolFeeAdmin check');
address oldPool... | function setPoolFeeAdmin(address pool, address _newPoolFeeAdmin) external {
PoolInfo storage info = pools[pool];
require(msg.sender == info.poolFeeAdmin, 'MomaFactory: poolFeeAdmin check');
require(_newPoolFeeAdmin != address(0), 'MomaFactory: newPoolFeeAdmin check');
address oldPool... | 33,063 |
95 | // Allows merchant to change it's account address / | function changeMerchantAccount(address newAccount) external onlyMerchant whenNotPaused {
merchantAccount = newAccount;
}
| function changeMerchantAccount(address newAccount) external onlyMerchant whenNotPaused {
merchantAccount = newAccount;
}
| 16,848 |
27 | // set base URI / | function setBaseURI(string calldata baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
| function setBaseURI(string calldata baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
| 49,179 |
28 | // update pool info | assets.maturityIdsDaily[repaymentDay].push(id);
assets.sellerAssetIdList[_seller].push(id);
accounting.borrowingReserve = accounting.borrowingReserve.add(totalLoanableAmount);
accounting.newIncomeDaily = accounting.newIncomeDaily.add(interestDaily);
accounting.dailyIncomeReductio... | assets.maturityIdsDaily[repaymentDay].push(id);
assets.sellerAssetIdList[_seller].push(id);
accounting.borrowingReserve = accounting.borrowingReserve.add(totalLoanableAmount);
accounting.newIncomeDaily = accounting.newIncomeDaily.add(interestDaily);
accounting.dailyIncomeReductio... | 16,683 |
3 | // filledSubtrees and roots could be bytes32[size], but using mappings makes it cheaper because it removes index range check on every interaction | mapping(uint256 => bytes32) public filledSubtrees;
mapping(uint256 => bytes32) public roots;
uint32 public constant ROOT_HISTORY_SIZE = 30;
uint32 public currentRootIndex = 0;
uint32 public nextIndex = 0;
| mapping(uint256 => bytes32) public filledSubtrees;
mapping(uint256 => bytes32) public roots;
uint32 public constant ROOT_HISTORY_SIZE = 30;
uint32 public currentRootIndex = 0;
uint32 public nextIndex = 0;
| 37,865 |
124 | // Sets {decimals} to a value other than the default one of 18. Requirements: - this function can only be called from a constructor. / | function _setupDecimals(uint8 decimals_) internal {
require(!address(this).isContract(), "ERC20: decimals cannot be changed after construction");
_decimals = decimals_;
}
| function _setupDecimals(uint8 decimals_) internal {
require(!address(this).isContract(), "ERC20: decimals cannot be changed after construction");
_decimals = decimals_;
}
| 51,440 |
19 | // Index pointer start at the last value. | let index := sub(end, 0x20)
| let index := sub(end, 0x20)
| 27,255 |
150 | // At the time of writing, a new VatandaslikNFT costs 0.25 ether. This variable can change by the appropriate function | uint256 private citizenshipStampCostInWei = 250000000000000000;
| uint256 private citizenshipStampCostInWei = 250000000000000000;
| 13,199 |
212 | // ========== ENUM ========== // Alpaca can be in one of the two state: EGG - When two alpaca breed with each other, alpaca EGG is created.`gene` and `energy` are both 0 and will be assigned when egg is cracked GROWN - When egg is cracked and alpaca is born! `gene` and `energy` are determinedin this state. / | enum AlpacaGrowthState {EGG, GROWN}
/* ========== PUBLIC STATE VARIABLES ========== */
/**
* @dev payment required to use cracked if it's done automatically
* assigning to 0 indicate cracking action is not automatic
*/
uint256 public autoCrackingFee = 0;
/**
* @dev Base breedi... | enum AlpacaGrowthState {EGG, GROWN}
/* ========== PUBLIC STATE VARIABLES ========== */
/**
* @dev payment required to use cracked if it's done automatically
* assigning to 0 indicate cracking action is not automatic
*/
uint256 public autoCrackingFee = 0;
/**
* @dev Base breedi... | 22,820 |
13 | // SafeERC20Wrappers around ERC20 operations that throw on failure. To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc./ | library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
require(token.transfer(to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
requ... | library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
require(token.transfer(to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
requ... | 39,265 |
189 | // In the original collection, the owner becomes the DoubleTrouble contract | address owner = IERC721Metadata(collection).ownerOf(tokenId);
IERC721Metadata(collection).transferFrom(owner, address(this), tokenId);
_owners[collection][tokenId] = owner;
| address owner = IERC721Metadata(collection).ownerOf(tokenId);
IERC721Metadata(collection).transferFrom(owner, address(this), tokenId);
_owners[collection][tokenId] = owner;
| 55,050 |
34 | // External contract of referral structure | ITPReferral private referralContract;
address private topAddress;
event Register(address indexed userAddress, address indexed referrerAddress);
event Reinvest(address indexed userAddress, address indexed referrerAddress, uint32 matrix, uint32 level);
event UnderUpgrade(address indexed userAddress,... | ITPReferral private referralContract;
address private topAddress;
event Register(address indexed userAddress, address indexed referrerAddress);
event Reinvest(address indexed userAddress, address indexed referrerAddress, uint32 matrix, uint32 level);
event UnderUpgrade(address indexed userAddress,... | 3,369 |
40 | // limitation de la somme misée par le plafond | betAmount = (totalBet + msg.value > totalMaxStake) ? totalMaxStake - totalBet : msg.value;
| betAmount = (totalBet + msg.value > totalMaxStake) ? totalMaxStake - totalBet : msg.value;
| 39,655 |
131 | // preliminary calc of new deposit required, may be changed later in step 2. used as a variable holding the new deposit amount in the meantime | appCreditBase = _calculateDeposit(flowParams.flowRate, liquidationPeriod);
| appCreditBase = _calculateDeposit(flowParams.flowRate, liquidationPeriod);
| 34,613 |
58 | // add x^33(33! / 33!) |
return res / 0x688589cc0e9505e2f2fee5580000000 + _x + (ONE << _precision);
|
return res / 0x688589cc0e9505e2f2fee5580000000 + _x + (ONE << _precision);
| 1,213 |
3 | // Needs to be roundabout like this until Solidity has 'catch' blocks | uint hash = FemtoStorage.slotFor("bing");
bool result = this.call(stringToSig("checkGetUint(uint256)"), hash);
Assert.equal(result, false, "getUint call didn't throw");
| uint hash = FemtoStorage.slotFor("bing");
bool result = this.call(stringToSig("checkGetUint(uint256)"), hash);
Assert.equal(result, false, "getUint call didn't throw");
| 9,677 |
204 | // An unknown error code was passed in. | return UNKNOWN_ERROR;
| return UNKNOWN_ERROR;
| 77,419 |
350 | // Getters | function getBasketManager() external view returns(address);
function forgeValidator() external view returns (address);
function totalSupply() external view returns (uint256);
function swapFee() external view returns (uint256);
| function getBasketManager() external view returns(address);
function forgeValidator() external view returns (address);
function totalSupply() external view returns (uint256);
function swapFee() external view returns (uint256);
| 42,712 |
185 | // BLACKPANDAURI URI | string private _blackPandaURI;
address private admin;
address private contractAddress;
bool private lengendaryPandaMinted; // Check to mint legendary panda once
string private lengendaryURI ; // URI for legendary panda
| string private _blackPandaURI;
address private admin;
address private contractAddress;
bool private lengendaryPandaMinted; // Check to mint legendary panda once
string private lengendaryURI ; // URI for legendary panda
| 14,609 |
64 | // Setup the fee recevers for marketing and dev / | function setFeeReceivers(
address _marketingAmountReceiver,
address _projectMaintenanceReceiver
| function setFeeReceivers(
address _marketingAmountReceiver,
address _projectMaintenanceReceiver
| 8,358 |
11 | // {vault_index: {address: staker}} | mapping(uint256 => mapping(address => StakerInfo)) public stakerInfo;
uint256 public rolloverJackpot;
| mapping(uint256 => mapping(address => StakerInfo)) public stakerInfo;
uint256 public rolloverJackpot;
| 26,524 |
16 | // Receive ETH from the tax splitter contract. triggered on a value transfer with .call("arbitraryData"). | fallback() external payable {
ETHLeftUnshared += msg.value;
updateETHRewards();
}
| fallback() external payable {
ETHLeftUnshared += msg.value;
updateETHRewards();
}
| 19,618 |
17 | // Deposit the erc20 to this contract. The token must be approved the caller to the transferProxy | coreInstance.transferModule(
_paymentTokenAddress,
_paymentTokenQuantity,
msg.sender,
address(this)
);
| coreInstance.transferModule(
_paymentTokenAddress,
_paymentTokenQuantity,
msg.sender,
address(this)
);
| 38,976 |
35 | // See {IERC20-balanceOf}./ | function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
| function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
| 8,362 |
83 | // Season number => account => USD purchased. / | function usdSeasonAccountPurchased(uint16 seasonNumber, address account) public view returns (uint256) {
return _usdSeasonAccountPurchased[seasonNumber][account];
}
| function usdSeasonAccountPurchased(uint16 seasonNumber, address account) public view returns (uint256) {
return _usdSeasonAccountPurchased[seasonNumber][account];
}
| 3,294 |
32 | // Allows the owner to pause registration. / | function setRegistrable(bool registrable_) external onlyOwner {
registrable = registrable_;
}
| function setRegistrable(bool registrable_) external onlyOwner {
registrable = registrable_;
}
| 39,364 |
207 | // Requires the contract to have been initialized. / | modifier isInitialized() {
require(initialized == true, "Contract must be initialized.");
_;
}
| modifier isInitialized() {
require(initialized == true, "Contract must be initialized.");
_;
}
| 8,783 |
15 | // Returns the IPFS link for the raffle / | function getRaffleURI(uint256 _raffleId)
external
view
returns (string memory)
| function getRaffleURI(uint256 _raffleId)
external
view
returns (string memory)
| 48,191 |
6 | // Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. / | event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
| event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
| 18,252 |
17 | // Resets happen in regular intervals and `lastResetMin` should be aligned to that | allowance.lastResetMin =
currentMin -
((currentMin - allowance.lastResetMin) %
allowance.resetTimeMin);
| allowance.lastResetMin =
currentMin -
((currentMin - allowance.lastResetMin) %
allowance.resetTimeMin);
| 19,473 |
26 | // lock timelock | function lockRequest(Functions _fn) public onlyOwner {
clearRequest(_fn);
emit NewLockRequest(_fn);
}
| function lockRequest(Functions _fn) public onlyOwner {
clearRequest(_fn);
emit NewLockRequest(_fn);
}
| 24,880 |
125 | // Test whether x equals y.NaN, infinity, and -infinity are not equal toanything.x quadruple precision number y quadruple precision numberreturn true if x equals to y, false otherwise / | function eq(bytes16 x, bytes16 y) internal pure returns (bool) {
unchecked {
if (x == y) {
return
uint128(x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF <
0x7FFF0000000000000000000000000000;
} else return false;
}
}
| function eq(bytes16 x, bytes16 y) internal pure returns (bool) {
unchecked {
if (x == y) {
return
uint128(x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF <
0x7FFF0000000000000000000000000000;
} else return false;
}
}
| 18,517 |
9 | // sigma, exp5(st0) | tmp := mulmod(st0, st0, q)
st0 := mulmod(mulmod(tmp, tmp, q), st0, q)
st0, st1, st2 := mix(st0, st1, st2, q)
| tmp := mulmod(st0, st0, q)
st0 := mulmod(mulmod(tmp, tmp, q), st0, q)
st0, st1, st2 := mix(st0, st1, st2, q)
| 8,264 |
29 | // Encode the ArbitrumSequencerUptimeFeed call | bytes4 selector = ArbitrumSequencerUptimeFeedInterface.updateStatus.selector;
bool status = currentAnswer == ANSWER_SEQ_OFFLINE;
uint64 timestamp = uint64(block.timestamp);
| bytes4 selector = ArbitrumSequencerUptimeFeedInterface.updateStatus.selector;
bool status = currentAnswer == ANSWER_SEQ_OFFLINE;
uint64 timestamp = uint64(block.timestamp);
| 42,888 |
343 | // Calculate the fees a user will have to pay to mint tokens with their collateral collateralAmount Amount of collateral on which fee is calculatedreturn fee Amount of fee that must be paid / | function calculateFee(uint256 collateralAmount)
external
view
override
returns (uint256 fee)
| function calculateFee(uint256 collateralAmount)
external
view
override
returns (uint256 fee)
| 51,999 |
0 | // Certificate - Struct representing a green certificate@custom:field isRevoked - flag indicating if the certificate has been revoked@custom:field certificateID - ID of the certificate@custom:field issuanceDate - Date of issuance of the certificate@custom:field volume - amount of minted tokens for the certificate@custo... | struct Certificate {
bool isRevoked;
uint256 certificateID;
uint256 issuanceDate;
uint256 volume;
bytes32 merkleRootHash;
address generator;
}
| struct Certificate {
bool isRevoked;
uint256 certificateID;
uint256 issuanceDate;
uint256 volume;
bytes32 merkleRootHash;
address generator;
}
| 30,429 |
36 | // Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. If an {URI} event was emitted for `id`, the standardreturned by {IERC1155MetadataURI-uri}. / | event URI(string value, uint256 indexed id);
| event URI(string value, uint256 indexed id);
| 1,976 |
25 | // Get the buy trade-limit and trade-class of a wallet. _wallet The address of the wallet.return The buy trade-limit and trade-class of the wallet. / | function getBuyTradeLimitAndClass(address _wallet) external view returns (uint256, uint256);
| function getBuyTradeLimitAndClass(address _wallet) external view returns (uint256, uint256);
| 56,250 |
68 | // Allow founder to change the minimum investment of ether._newMinInvestment The value of new minimum ether investment. / | function changeMinInvestment(uint256 _newMinInvestment) onlyOwner public {
MIN_INVESTMENT = _newMinInvestment;
}
| function changeMinInvestment(uint256 _newMinInvestment) onlyOwner public {
MIN_INVESTMENT = _newMinInvestment;
}
| 43,111 |
67 | // prevent start ico phase again when we already got an ico | require(icoOpenTime == 0);
icoPhase = true;
icoOpenTime = now;
| require(icoOpenTime == 0);
icoPhase = true;
icoOpenTime = now;
| 3,623 |
36 | // We mint principal token discounted by the accumulated interest. | _mint(_destination, adjustedAmount);
| _mint(_destination, adjustedAmount);
| 5,080 |
72 | // ICO stages list | enum StagesList { N_A, PrivateICO, PreICO, ICO_w1, ICO_w2}
| enum StagesList { N_A, PrivateICO, PreICO, ICO_w1, ICO_w2}
| 60,277 |
19 | // The constructor is used here to ensure that the implementationcontract is initialized. An uncontrolled implementationcontract might lead to misleading statefor users who accidentally interact with it. / | constructor() public {
initialize();
pause();
}
| constructor() public {
initialize();
pause();
}
| 7,688 |
18 | // Emitted when an NFT is withdrawn | event TransferWithMetadata(address indexed from, address indexed to, uint256 indexed tokenId, bytes metaData);
| event TransferWithMetadata(address indexed from, address indexed to, uint256 indexed tokenId, bytes metaData);
| 29,454 |
440 | // Adds the initial policy settings for a fund/_comptrollerProxy The fund's ComptrollerProxy address/_encodedSettings Encoded settings to apply to a fund/Most funds that use this policy will likely not allow any external positions./ Does not prohibit specifying not-yet-defined external position type ids. | function addFundSettings(address _comptrollerProxy, bytes calldata _encodedSettings)
external
override
onlyPolicyManager
{
uint256[] memory allowedExternalPositionTypeIds = abi.decode(
_encodedSettings,
(uint256[])
);
for (uint256 i; i < al... | function addFundSettings(address _comptrollerProxy, bytes calldata _encodedSettings)
external
override
onlyPolicyManager
{
uint256[] memory allowedExternalPositionTypeIds = abi.decode(
_encodedSettings,
(uint256[])
);
for (uint256 i; i < al... | 38,870 |
38 | // total all stage | uint256 public totalAllStage;
| uint256 public totalAllStage;
| 79,021 |
30 | // https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol |
if (value == 0) {
return "0";
}
|
if (value == 0) {
return "0";
}
| 9,605 |
12 | // range: [0, 2144 - 1] resolution: 1 / 2112 | struct uq144x112 {
uint256 _x;
}
| struct uq144x112 {
uint256 _x;
}
| 6,844 |
243 | // Allows the owner to create a new token with ipfsHash as the tokenURI. / | function mint(address collectorAddress, string memory ipfsHash) external onlyOwner {
// mint token
_safeMint(collectorAddress, nextTokenId);
_setTokenURI(nextTokenId, ipfsHash);
nextTokenId = nextTokenId + 1;
}
| function mint(address collectorAddress, string memory ipfsHash) external onlyOwner {
// mint token
_safeMint(collectorAddress, nextTokenId);
_setTokenURI(nextTokenId, ipfsHash);
nextTokenId = nextTokenId + 1;
}
| 17,686 |
143 | // Service function to synchronize pool state with current timeCan be executed by anyone at any time, but has an effect only when at least one block passes between synchronizations Executed internally when staking, unstaking, processing rewards in order for calculations to be correct and to reflect state progress of th... | function sync() external override {
// delegate call to an internal function
_sync();
}
| function sync() external override {
// delegate call to an internal function
_sync();
}
| 6,902 |
15 | // function that returns the remaining time in seconds of the staking period the higher is the precision and the more the time remaining will be precise stakeHolder, address of the user to be checkedreturn uint percentage of time remainingprecision / | function _percentageTimeRemaining(address stakeHolder)
internal
view
returns (uint)
| function _percentageTimeRemaining(address stakeHolder)
internal
view
returns (uint)
| 16,751 |
146 | // check for stale funding schedules to expire | uint256 removed = 0;
uint256 originalSize = fundings.length;
for (uint256 i = 0; i < originalSize; i++) {
Funding storage funding = fundings[i.sub(removed)];
uint256 idx = i.sub(removed);
if (_unlockable(idx) == 0 && block.timestamp >= funding.end) {
... | uint256 removed = 0;
uint256 originalSize = fundings.length;
for (uint256 i = 0; i < originalSize; i++) {
Funding storage funding = fundings[i.sub(removed)];
uint256 idx = i.sub(removed);
if (_unlockable(idx) == 0 && block.timestamp >= funding.end) {
... | 38,118 |
88 | // Creates new proposal./proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to./investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address./daoFunction_ type of the proposal./amount_ amount of funds to use in the pr... | function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) public override {
// save gas at the start of execution
uint256 remainingGasStart = gasleft();
// check that lifetime is at least equals to min hours set for DAO.
... | function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) public override {
// save gas at the start of execution
uint256 remainingGasStart = gasleft();
// check that lifetime is at least equals to min hours set for DAO.
... | 53,730 |
4 | // Increment access control contract./Adapted from https:github.com/boringcrypto/BoringSolidity/blob/master/contracts/BoringOwnable.sol, License-Identifier: MIT./Adapted from https:github.com/sushiswap/trident/blob/master/contracts/utils/TridentOwnable.sol, License-Identifier: GPL-3.0-or-later | contract IncreOwnable {
address public owner;
address public pendingOwner;
event TransferOwner(address indexed sender, address indexed recipient);
event TransferOwnerClaim(address indexed sender, address indexed recipient);
/// @notice Initialize and grant deployer account (`msg.sender`) `owner` a... | contract IncreOwnable {
address public owner;
address public pendingOwner;
event TransferOwner(address indexed sender, address indexed recipient);
event TransferOwnerClaim(address indexed sender, address indexed recipient);
/// @notice Initialize and grant deployer account (`msg.sender`) `owner` a... | 8,567 |
1 | // Price of package delivery, public so solc creates getter for web3 | uint256 public deliveryPrice;
| uint256 public deliveryPrice;
| 22,165 |
85 | // Internal function to get the end week based on start, number of weeks, and current week_startWeek - the start of the range_numberOfWeeks - the length of the range returns endWeek - either the current week, or the end of the rangeThis throws if it tries to get a week range longer than the current week | function _getEndWeek(uint _startWeek, uint _numberOfWeeks)
internal
view
| function _getEndWeek(uint _startWeek, uint _numberOfWeeks)
internal
view
| 1,705 |
30 | // uint256 _contractBalance = contractBalance(); | if (msg.sender != address(this) && msg.sender != owner) {revert("Invalid Sender Address");}
| if (msg.sender != address(this) && msg.sender != owner) {revert("Invalid Sender Address");}
| 19,962 |
155 | // Deduct marketing Tax | uint256 teamShare = (100 - marketingShare - dshare);
uint256 marketingSplit = (ETHamount * marketingShare) / 100;
uint256 teamSplit = (ETHamount * teamShare) / 100;
uint256 dsplit = (ETHamount * dshare) / 100;
marketingBalance+=marketingSplit;
teamBalance+=teamSplit;
... | uint256 teamShare = (100 - marketingShare - dshare);
uint256 marketingSplit = (ETHamount * marketingShare) / 100;
uint256 teamSplit = (ETHamount * teamShare) / 100;
uint256 dsplit = (ETHamount * dshare) / 100;
marketingBalance+=marketingSplit;
teamBalance+=teamSplit;
... | 70,464 |
26 | // Mint a given tokenId/owner Address for whom to assign the token/tokenId Token identifier to assign to the owner/valid Boolean to assert of the validity of the token | function _mintUnsafe(address owner, uint256 tokenId, bool valid) internal {
require(_tokens[tokenId].owner == address(0), "Cannot mint an assigned token");
if (_indexedTokenIds[owner].length == 0) {
_holdersCount += 1;
}
_tokens[tokenId] = Token(msg.sender, owner, valid);... | function _mintUnsafe(address owner, uint256 tokenId, bool valid) internal {
require(_tokens[tokenId].owner == address(0), "Cannot mint an assigned token");
if (_indexedTokenIds[owner].length == 0) {
_holdersCount += 1;
}
_tokens[tokenId] = Token(msg.sender, owner, valid);... | 3,513 |
7 | // Sell token | function sellToken(uint tokenId) public {
address _seller = msg.sender;
require (tokens[tokenId].onSale==false,"This token is being sold");
require(_seller==tokenOwner[tokenId],"This token is not belong to you.");
tokens[tokenId].onSale=false;
}
| function sellToken(uint tokenId) public {
address _seller = msg.sender;
require (tokens[tokenId].onSale==false,"This token is being sold");
require(_seller==tokenOwner[tokenId],"This token is not belong to you.");
tokens[tokenId].onSale=false;
}
| 12,961 |
10 | // Call bridge contract | (bool success, bytes memory result) = bridgeStep.targetAddress.call{value : bridgeFee}(editedBridgeData);
| (bool success, bytes memory result) = bridgeStep.targetAddress.call{value : bridgeFee}(editedBridgeData);
| 17,602 |
32 | // An allowance should be available | modifier when_has_allowance(address _owner, address _spender, uint _amount) {
require (accounts[_owner].allowanceOf[_spender] >= _amount);
_;
}
| modifier when_has_allowance(address _owner, address _spender, uint _amount) {
require (accounts[_owner].allowanceOf[_spender] >= _amount);
_;
}
| 11,653 |
72 | // IERC20(weth).approve(pool, fees.div(2));IERC20(weth).approve(staking, fees.sub(fees.div(2))); | IUniMexPool(pool).repay(owed);
| IUniMexPool(pool).repay(owed);
| 20,331 |
9 | // ================================== ADMIN FUNCITONS ================================== / Method for changing the distributor address _newDistributor New address for calling distribute / | function setDistributor(address _newDistributor) external onlyRole(ADMIN) {
require(hasRole(DISTRIBUTOR, _newDistributor) == false, "Address already set as a Distributor!");
_grantRole(DISTRIBUTOR, _newDistributor);
}
| function setDistributor(address _newDistributor) external onlyRole(ADMIN) {
require(hasRole(DISTRIBUTOR, _newDistributor) == false, "Address already set as a Distributor!");
_grantRole(DISTRIBUTOR, _newDistributor);
}
| 30,408 |
40 | // [datatokenAddress, baseTokenAddress] | uint256[] calldata ssParams,
uint256[] calldata swapFees,
address[] calldata addresses
)
external
returns (
| uint256[] calldata ssParams,
uint256[] calldata swapFees,
address[] calldata addresses
)
external
returns (
| 24,772 |
48 | // Base crowdsale token interface / | contract CrowdsaleToken is BurnableToken, ReleasableToken {
uint public decimals;
}
| contract CrowdsaleToken is BurnableToken, ReleasableToken {
uint public decimals;
}
| 32,737 |
57 | // Adds a pool to SwapQuoterV2./ - If bridgeToken is zero, the pool is added to the set of pools corresponding to the pool type./ - Otherwise, the pool is added to the set of bridge pools. | function _addPool(BridgePool memory pool) internal {
bool wasAdded = false;
if (pool.bridgeToken == address(0)) {
// No bridge token was supplied, so we add the pool to the corresponding set of "origin pools".
// We also check that the pool has not been added yet.
... | function _addPool(BridgePool memory pool) internal {
bool wasAdded = false;
if (pool.bridgeToken == address(0)) {
// No bridge token was supplied, so we add the pool to the corresponding set of "origin pools".
// We also check that the pool has not been added yet.
... | 8,174 |
2 | // TransferRequest - Struct representing a request for certificate transfer@custom:field sender - Address of the sender of the certificate@custom:field recipient - Address of the recipient of the certificate@custom:field certificateID - ID of the certificate@custom:field amount - Amount of tokens to be transferred@cust... | struct TransferRequest {
address sender;
address recipient;
uint256 certificateID;
uint256 amount;
bytes data;
}
| struct TransferRequest {
address sender;
address recipient;
uint256 certificateID;
uint256 amount;
bytes data;
}
| 30,431 |
75 | // Initializer – Constructor for Upgradable contracts | function initialize() public initializer {
OwnableUpgradable.initialize(); // Initialize Parent Contract
}
| function initialize() public initializer {
OwnableUpgradable.initialize(); // Initialize Parent Contract
}
| 74,425 |
63 | // Define constants | string public constant NAME = "Bit one token";
string public constant SYMBOL = "Bito";
uint8 public constant DECIMALS = 18;
uint256 public constant MAX_TOKEN_COUNT = 10000000000; // Total Token 10,000,000,000
uint256 public constant INITIAL_SUPPLY = MAX_TOKEN_COUNT * (10 ** uint256(DECIMALS)); //... | string public constant NAME = "Bit one token";
string public constant SYMBOL = "Bito";
uint8 public constant DECIMALS = 18;
uint256 public constant MAX_TOKEN_COUNT = 10000000000; // Total Token 10,000,000,000
uint256 public constant INITIAL_SUPPLY = MAX_TOKEN_COUNT * (10 ** uint256(DECIMALS)); //... | 33,224 |
11 | // Disable self-destruction | selfDestructionDisabled = true;
| selfDestructionDisabled = true;
| 58,915 |
16 | // EMERGENCY WITHDRAW It will only be used in case the funds get stuck or any bug gets discovered in the future Also if a new version of this contract comes out, the funds then will be transferred to the new one | function Emergency() manager
| function Emergency() manager
| 37,710 |
89 | // Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. Must be less than or equalto the minterAllowance of the caller.return A boolean that indicates if the operation was successful. / | function mint(address _to, uint256 _amount)
external
whenNotPaused
onlyMinters
notBlacklisted(msg.sender)
notBlacklisted(_to)
returns (bool)
| function mint(address _to, uint256 _amount)
external
whenNotPaused
onlyMinters
notBlacklisted(msg.sender)
notBlacklisted(_to)
returns (bool)
| 20,303 |
10 | // Appends a byte array to the end of the buffer. Resizes if doing sowould exceed the capacity of the buffer._buf The buffer to append to._data The data to append. return _buffer The original buffer./ | function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) {
if (_data.length + _buf.buf.length > _buf.capacity) {
resize(_buf, max(_buf.capacity, _data.length) * 2);
}
uint dest;
uint src;
uint len = _data.length;
... | function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) {
if (_data.length + _buf.buf.length > _buf.capacity) {
resize(_buf, max(_buf.capacity, _data.length) * 2);
}
uint dest;
uint src;
uint len = _data.length;
... | 8,246 |
5 | // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s | if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, masterCopy)
return(0, 0x20)
}
| if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, masterCopy)
return(0, 0x20)
}
| 57,171 |
34 | // In collateral, can be negative | function borrowedCollatBalance() public view returns (int256) {
return borrowed_collat_historical - returned_collat_historical;
}
| function borrowedCollatBalance() public view returns (int256) {
return borrowed_collat_historical - returned_collat_historical;
}
| 28,687 |
89 | // Adjust rawUniswapPrice according to the units of the non-ETH asset In the case of ETH, we would have to scale by 1e6 / USDC_UNITS, but since baseUnit2 is 1e6 (USDC), it cancels | if (config.isUniswapReversed) {
| if (config.isUniswapReversed) {
| 62,678 |
5 | // The whitelist contract keeps track of what users can interact with/ certain function in the TruStakeMATIC contract. | address public whitelistAddress;
| address public whitelistAddress;
| 10,960 |
73 | // / !!!!!!!!!!!!!!/ !!! NOTICE !!! `transferFrom` does not return a value, in violation of the ERC-20 specification/ !!!!!!!!!!!!!!/ |
function transferFrom(
address src,
address dst,
uint256 amount
) external;
function approve(address spender, uint256 amount)
external
returns (bool success);
|
function transferFrom(
address src,
address dst,
uint256 amount
) external;
function approve(address spender, uint256 amount)
external
returns (bool success);
| 17,280 |
0 | // Symbol: {{kvst}} Name: {{Kavsut Token}} Total supply: {{6000}} Decimals: {{18}} Owner Account : {{cl}} | function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
| function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
| 11,096 |
292 | // Calculate the ETH transaction size required to adjust to 𝑘0 | function _calcD(
uint balance0,
uint balance1,
uint ethAmount,
uint tokenAmount
| function _calcD(
uint balance0,
uint balance1,
uint ethAmount,
uint tokenAmount
| 27,681 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.