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
0
// 建構子
function AuctionWithdraw() payable { highestBidder = msg.sender; highestBid = 0; }
function AuctionWithdraw() payable { highestBidder = msg.sender; highestBid = 0; }
24,936
12
// Update the user's amount of claimed PAY first to prevent recursive call.
pay_claimed[msg.sender] = 0;
pay_claimed[msg.sender] = 0;
39,647
18
// Returns the price a pool from its id/poolId Id of the pool/ return poolPrice Price of the pool in wei/ return totalTokens Number of tokens of a pool (totalSupply)
function getPoolPrice(uint256 poolId) internal view returns ( uint256 poolPrice, uint256 totalTokens )
function getPoolPrice(uint256 poolId) internal view returns ( uint256 poolPrice, uint256 totalTokens )
15,750
12
// transferable
require(amount >= c.minAmount, "token amount must be greater than configured minAmount"); require(IERC20(tokenContract).allowance(msg.sender, address(this)) >= amount, "token allowance must be equal or greater than amount");
require(amount >= c.minAmount, "token amount must be greater than configured minAmount"); require(IERC20(tokenContract).allowance(msg.sender, address(this)) >= amount, "token allowance must be equal or greater than amount");
38,432
30
// Royalties formats required for use on the Rarible platform/https:docs.rarible.com/asset/royalties-schema
interface IHasSecondarySaleFees is IERC165 { event SecondarySaleFees(uint256 tokenId, address[] recipients, uint[] bps); function getFeeRecipients(uint256 id) external returns (address payable[] memory); function getFeeBps(uint256 id) external returns (uint[] memory); }
interface IHasSecondarySaleFees is IERC165 { event SecondarySaleFees(uint256 tokenId, address[] recipients, uint[] bps); function getFeeRecipients(uint256 id) external returns (address payable[] memory); function getFeeBps(uint256 id) external returns (uint[] memory); }
3,066
404
// Returns whether the given account is entered in the given asset account The address of the account to check aToken The aToken to checkreturn True if the account is in the asset, otherwise false. /
function checkMembership(address account, AToken aToken) external view returns (bool) { return markets[address(aToken)].accountMembership[account]; }
function checkMembership(address account, AToken aToken) external view returns (bool) { return markets[address(aToken)].accountMembership[account]; }
17,053
60
// calculate duration
uint256 duration = end.sub(start);
uint256 duration = end.sub(start);
71,974
66
// get Xend Token contract and mint token for member
_xendTokenContract.mint(payable(member), reward);
_xendTokenContract.mint(payable(member), reward);
5,660
82
// check if taker has enough balance if (safeAdd(safeAdd(safeMul(safeSub(t.capPrice, t.makerPrice), tv.qty)/ t.capPrice, safeMul(tv.qty, takerFee) / (1 ether)), t.takerGasFee / 1e10)1e10 > safeSub(balances[1],tv.takerReserve))
if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) {
if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) {
1,179
27
// Contract that creates the Token
contract Token is SafeMath { // Contract balance mapping (address => uint256) public balanceOf; // Token name string public name = "MoralityAI"; // Token symbol string public symbol = "Mo"; // Decimals to use uint8 public decimal = 18; // Total initial suppy uint256 public totalSupply = 10000000000000000000...
contract Token is SafeMath { // Contract balance mapping (address => uint256) public balanceOf; // Token name string public name = "MoralityAI"; // Token symbol string public symbol = "Mo"; // Decimals to use uint8 public decimal = 18; // Total initial suppy uint256 public totalSupply = 10000000000000000000...
20,388
8
// Security: function should only be called by owner or tokenFactory
function addERC20(address _address) external override OnlyBy(_ProjectERC20FactoryAddress, owner()) { console.log("DEBUG sol: addERC20", _address); pERC20Registry[_address] = true; }
function addERC20(address _address) external override OnlyBy(_ProjectERC20FactoryAddress, owner()) { console.log("DEBUG sol: addERC20", _address); pERC20Registry[_address] = true; }
16,182
95
// Cradle A smart-contract based mechanism to distribute tokens over time, inspired loosely by Compound and Uniswap. More background and motivation available at: /
contract Cradle is IStaking, Ownable { using SafeMath for uint256; event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data); event TokensClaimed(address indexed user, uint256 amount); event TokensL...
contract Cradle is IStaking, Ownable { using SafeMath for uint256; event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data); event TokensClaimed(address indexed user, uint256 amount); event TokensL...
28,012
98
// The preparation time period where a new dungeon is created, before it can be challenged.
uint public dungeonPreparationTime = 60 minutes;
uint public dungeonPreparationTime = 60 minutes;
56,668
17
// This is only called when a new board or a new listing is added, so exposure values will be 0
OptionListingCache storage listingCache = listingCaches[listing.id]; listingCache.id = listing.id; listingCache.strike = listing.strike; listingCache.boardId = listing.boardId; listingCache.skew = listing.skew; boardCache.listings.push(listingId);
OptionListingCache storage listingCache = listingCaches[listing.id]; listingCache.id = listing.id; listingCache.strike = listing.strike; listingCache.boardId = listing.boardId; listingCache.skew = listing.skew; boardCache.listings.push(listingId);
9,713
5
// mapping description of different registries
mapping (string => string) internal registryDescriptions;
mapping (string => string) internal registryDescriptions;
10,788
11
// Using Math.min() since we might free more than needed
_debtPayment = Math.min(_amountFreed, _debtOutstanding);
_debtPayment = Math.min(_amountFreed, _debtOutstanding);
12,258
44
// The scale factor is a crude way to turn everything into integer calcs. Actually do (n10 ^ 4) ^ (1/2)
uint256 _n = n * 10**6; uint256 c = _n; res = _n; uint256 xi; while (true) { xi = (res + c / res) / 2;
uint256 _n = n * 10**6; uint256 c = _n; res = _n; uint256 xi; while (true) { xi = (res + c / res) / 2;
12,028
19
// Agreement account state updated event agreementClass Contract address of the agreement account Account updated slotId slot id of the agreement state /
event AgreementStateUpdated(
event AgreementStateUpdated(
5,039
18
// VNET Token Amount to be transfer
uint256 vnetAmount = weiAmount.mul(ratioNext).div(10 ** 18);
uint256 vnetAmount = weiAmount.mul(ratioNext).div(10 ** 18);
63,000
5
// Choose a member to be the winner
function getWinner() { /** * Block Info Dependency */ uint winnerID = uint(block.blockhash(block.number)) % participants.length; participants[winnerID].send(8 ether); participatorID = 0; }
function getWinner() { /** * Block Info Dependency */ uint winnerID = uint(block.blockhash(block.number)) % participants.length; participants[winnerID].send(8 ether); participatorID = 0; }
17,400
3
// How many decimals does the strike token have? E.g.: 18 /
uint8 public strikeAssetDecimals;
uint8 public strikeAssetDecimals;
8,948
7
// array of all the token tickers
string[] public tokenBridges; bool public isBridgeActive; uint256[100] private __gap;
string[] public tokenBridges; bool public isBridgeActive; uint256[100] private __gap;
10,311
197
// PAYOUT /
function withdraw() public nonReentrant { uint256 balance = address(this).balance; Address.sendValue(payable(owner()), balance); }
function withdraw() public nonReentrant { uint256 balance = address(this).balance; Address.sendValue(payable(owner()), balance); }
51,338
42
// Encode the first byte, followed by the `len` in binary form if `length` is more than 55. len The length of the string or the payload. offset 128 if item is string, 192 if item is list.return RLP encoded bytes. /
function encodeLength(uint len, uint offset) private pure returns (bytes memory) { bytes memory encoded; if (len < 56) { encoded = new bytes(1); encoded[0] = bytes32(len + offset)[31]; } else { uint lenLen; uint i = 1; while (len >=...
function encodeLength(uint len, uint offset) private pure returns (bytes memory) { bytes memory encoded; if (len < 56) { encoded = new bytes(1); encoded[0] = bytes32(len + offset)[31]; } else { uint lenLen; uint i = 1; while (len >=...
48,072
6
// events
35,070
263
// If over vesting duration, all tokens vested
if (elapsedTime >= _durationInSeconds) { return token.balanceOf(address(this)); } else {
if (elapsedTime >= _durationInSeconds) { return token.balanceOf(address(this)); } else {
23,413
18
// Disabling fairsale protection
function fairsaleProtectionOFF() onlyOwner { if ( block.number - start_block < 2000) throw; // fairsale window is strictly enforced for the first 2000 blocks fairsaleProtection = false; }
function fairsaleProtectionOFF() onlyOwner { if ( block.number - start_block < 2000) throw; // fairsale window is strictly enforced for the first 2000 blocks fairsaleProtection = false; }
21,935
88
// count of user wallet to check investor should be enlisted /
mapping(address => uint) public userActiveWalletCount;
mapping(address => uint) public userActiveWalletCount;
41,723
39
// Check supply cap
uint supplyCap = supplyCaps[cToken];
uint supplyCap = supplyCaps[cToken];
7,544
6
// Returns the v1 traits associated with a given token ID./Throws if the token ID is not valid./tokenId The ID of the token that represents the Cub/ return traits memory
function traitsV1(uint256 tokenId) external view returns (ICubTraits.TraitsV1 memory traits);
function traitsV1(uint256 tokenId) external view returns (ICubTraits.TraitsV1 memory traits);
57,469
45
// actually retrieve the code, this needs assembly
extcodecopy(who, add(o_code, 0x20), 0, size)
extcodecopy(who, add(o_code, 0x20), 0, size)
28,102
8
// return the total vesting count. /
function vestingCount() public view returns (uint256) { return _vestingCount; }
function vestingCount() public view returns (uint256) { return _vestingCount; }
21,332
96
// Use block UINT256_MAX (which should be never) as the initializable date
uint256 internal constant PETRIFIED_BLOCK = uint256(-1);
uint256 internal constant PETRIFIED_BLOCK = uint256(-1);
16,403
33
// Transfer ERC20 tokens
try this.safeTransferExternal( IERC20Upgradeable(tokenAddress[i]), to[i], amount[i] ) { packPayoutNonce(payoutNonce[i]); ...
try this.safeTransferExternal( IERC20Upgradeable(tokenAddress[i]), to[i], amount[i] ) { packPayoutNonce(payoutNonce[i]); ...
20,078
199
// Cache the end of the memory to calculate the length later.
let end := str
let end := str
9,050
44
// Mirror governance contract.
address public override governor;
address public override governor;
46,078
299
// if the earlyBallot was created more than 30 days in the past we should count the new ballot
if (earlyBallotTs < now - 30 days) { return (true, false); }
if (earlyBallotTs < now - 30 days) { return (true, false); }
4,135
15
// The underlying queue data structure stores 2 elements per insertion, so to get the actual desired queue index we need to multiply by 2.
uint40 trueIndex = uint40(_index * 2); bytes32 transactionHash = _queueRef.get(trueIndex); bytes32 timestampAndBlockNumber = _queueRef.get(trueIndex + 1); uint40 elementTimestamp; uint40 elementBlockNumber;
uint40 trueIndex = uint40(_index * 2); bytes32 transactionHash = _queueRef.get(trueIndex); bytes32 timestampAndBlockNumber = _queueRef.get(trueIndex + 1); uint40 elementTimestamp; uint40 elementBlockNumber;
27,900
73
// Minting of new tokens. to The address to mint to. value The amount to be minted. /
function mint(address to, uint256 value) public onlyMinter canMint(value) returns (bool) { _mint(to, value); return true; }
function mint(address to, uint256 value) public onlyMinter canMint(value) returns (bool) { _mint(to, value); return true; }
29,745
214
// returns the day number of the current day, in days since the UNIX epoch. /
function today() public view virtual returns (uint256 dayNumber) { return uint256(block.timestamp / SECONDS_PER_DAY); }
function today() public view virtual returns (uint256 dayNumber) { return uint256(block.timestamp / SECONDS_PER_DAY); }
25,186
6
// Then, compute cost of new memory allocation.
if gt(returnDataWords, msizeWords) { cost := add( cost, add( mul(sub(returnDataWords, msizeWords), CostPerWord), shr( ...
if gt(returnDataWords, msizeWords) { cost := add( cost, add( mul(sub(returnDataWords, msizeWords), CostPerWord), shr( ...
16,444
16
// Получение количества голосваний. /
function getBallotsLengh() public view returns(uint) { return ballots.length; }
function getBallotsLengh() public view returns(uint) { return ballots.length; }
41,150
39
// Allows the current owner to transfer control of the contract to a newOwner.changes the pending owner to newOwner. But doesn't actually transfer newOwner The address to transfer ownership to. /
function transferProxyOwnership(address newOwner) external onlyProxyOwner { require(newOwner != address(0)); _setPendingUpgradeabilityOwner(newOwner); emit NewPendingOwner(proxyOwner(), newOwner); }
function transferProxyOwnership(address newOwner) external onlyProxyOwner { require(newOwner != address(0)); _setPendingUpgradeabilityOwner(newOwner); emit NewPendingOwner(proxyOwner(), newOwner); }
27,426
8
// amount of $HOUSE due for each alpha point staked
uint256 public housePerDagger = 0;
uint256 public housePerDagger = 0;
14,008
125
// 4. GROUP FUNCTIONS/ Function to return group info for an EIN _ein the EIN of the user _groupIndex the index of the groupreturn index is the index of the groupreturn name is the name associated with the group /
function getGroup(uint _ein, uint _groupIndex) external view
function getGroup(uint _ein, uint _groupIndex) external view
36,916
31
// the car registration contract
contract RegisterCar{ // information of car owner string public ownerFirstname; string public ownerLastname; string public ownerBirthdate; string public ownerStreet; string public ownerStreetNumber; string public ownerZipcode; string public ownerCity; //information of car strin...
contract RegisterCar{ // information of car owner string public ownerFirstname; string public ownerLastname; string public ownerBirthdate; string public ownerStreet; string public ownerStreetNumber; string public ownerZipcode; string public ownerCity; //information of car strin...
5,295
2
// Emits a {Transfer} event. /
function transfer(address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
2,035
46
// Send the ETH to where admins agree upon.
_safe.transfer(this.balance);
_safe.transfer(this.balance);
20,083
19
// Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming...
function div( uint256 a, uint256 b, string memory errorMessage
function div( uint256 a, uint256 b, string memory errorMessage
13,863
10
// Info of each user that stakes Staking tokens.
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
31,829
15
// claim from main curve LP pools
for(uint256 i = 0; i < rewardContracts.length; i++){ IBasicRewards(rewardContracts[i]).getReward(msg.sender,true); }
for(uint256 i = 0; i < rewardContracts.length; i++){ IBasicRewards(rewardContracts[i]).getReward(msg.sender,true); }
1,901
98
// the Metadata extension. Built to optimize for lower gas during batch mints and non serialized minting such as for migration/non sequence minting. Assumes that an owner cannot have more than 264 - 1 (max value of uint64) of supply. Assumes that the maximum token id cannot exceed 2256 - 1 (max value of uint256). /
contract ERC721SW is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; //used to figure out gaps with non sequ...
contract ERC721SW is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; //used to figure out gaps with non sequ...
39,733
2
// emitted when a representation token contract is deployed domain the domain of the chain where the canonical asset is deployed id the bytes32 address of the canonical token contract representation the address of the newly locally deployed representation contract /
event TokenDeployed(uint32 indexed domain, bytes32 indexed id, address indexed representation);
event TokenDeployed(uint32 indexed domain, bytes32 indexed id, address indexed representation);
19,206
50
// Bulk function for updating pools - loops throughall pools saved inside the poolTokenAddresses array. /
function syncAllPools() external
function syncAllPools() external
1,365
47
// Run mass transfers with pre-ico 2 bonus /
function proceedPreIcoTransactions(address[] toArray, uint[] valueArray) onlyOwner() { uint tokens = 0; address to = 0x0; uint value = 0; for (uint i = 0; i < toArray.length; i++) { to = toArray[i]; value = valueArray[i]; tokens = value / price();...
function proceedPreIcoTransactions(address[] toArray, uint[] valueArray) onlyOwner() { uint tokens = 0; address to = 0x0; uint value = 0; for (uint i = 0; i < toArray.length; i++) { to = toArray[i]; value = valueArray[i]; tokens = value / price();...
37,391
159
// divide the `asset` sellAmount by the target premium per oToken to get the number of oTokens to buy (8 decimals)
buyAmount = sellAmount .mul(10**(bidDetails.assetDecimals.add(Vault.OTOKEN_DECIMALS))) .div(bidDetails.optionPremium) .div(10**bidDetails.assetDecimals); require( sellAmount <= type(uint96).max, "sellAmount > type(uint96) max value!" )...
buyAmount = sellAmount .mul(10**(bidDetails.assetDecimals.add(Vault.OTOKEN_DECIMALS))) .div(bidDetails.optionPremium) .div(10**bidDetails.assetDecimals); require( sellAmount <= type(uint96).max, "sellAmount > type(uint96) max value!" )...
13,644
46
// unstake function for layer1 stakes
// @param sessionID {uint256} - id of the layer 1 stake function unstakeV1(uint256 sessionId) external pausable { //lastSessionIdv1 is the last stake ID from v1 layer require(sessionId <= lastSessionIdV1, 'Staking: Invalid sessionId'); Session storage session = sessionDataOf[msg.sender]...
// @param sessionID {uint256} - id of the layer 1 stake function unstakeV1(uint256 sessionId) external pausable { //lastSessionIdv1 is the last stake ID from v1 layer require(sessionId <= lastSessionIdV1, 'Staking: Invalid sessionId'); Session storage session = sessionDataOf[msg.sender]...
51,020
35
// Burn function used to burn the securityToken _value No. of token that get burned /
function burn(uint256 _value) public; event Minted(address indexed to, uint256 amount); event Burnt(address indexed _burner, uint256 _value);
function burn(uint256 _value) public; event Minted(address indexed to, uint256 amount); event Burnt(address indexed _burner, uint256 _value);
50,093
159
// uint256 royaltyPayment
payments[1] = calcRoyaltyPayment( _isPrimarySale, _amount, _royaltyPercentage );
payments[1] = calcRoyaltyPayment( _isPrimarySale, _amount, _royaltyPercentage );
57,510
24
// require(_value <= balances[msg.sender]);
require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
15,491
34
// Set reduce token amount on total reward tokens
function setReduceTokenAmount(uint256 _amount) external onlyOwner { require(_amount <= (totalRewardTokens - soldAmount), "Wrong amount"); reduceTokenAmount = _amount; }
function setReduceTokenAmount(uint256 _amount) external onlyOwner { require(_amount <= (totalRewardTokens - soldAmount), "Wrong amount"); reduceTokenAmount = _amount; }
18,335
204
// Swap using a swapper freely chosen by the caller Open (flash) liquidation: get proceeds first and provide the borrow after
vase.transfer(cloneInfo.collateral, address(this), to, allCollateralShare); if (swapper != address(0)) { ISwapper(swapper).swap(IERC20(cloneInfo.collateral), roseUsd, msg.sender, allBorrowShare, allCollateralShare); }
vase.transfer(cloneInfo.collateral, address(this), to, allCollateralShare); if (swapper != address(0)) { ISwapper(swapper).swap(IERC20(cloneInfo.collateral), roseUsd, msg.sender, allBorrowShare, allCollateralShare); }
32,908
29
// Internal function that mints an amount of the token and assigns it toan account. This encapsulates the modification of balances such that theproper events are emitted. account The account that will receive the created tokens. value The amount that will be created. /
function _mint(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); }
function _mint(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); }
448
20
// Change address that collects payments for listing tokens./Can be called only by zkSync governor
function setTreasury(address _newTreasury) external { governance.requireGovernor(msg.sender); treasury = _newTreasury; emit TreasuryUpdate(_newTreasury); }
function setTreasury(address _newTreasury) external { governance.requireGovernor(msg.sender); treasury = _newTreasury; emit TreasuryUpdate(_newTreasury); }
54,566
181
// send some amount of arbitrary ERC20 Tokens_externalToken the address of the Token Contract_to address of the beneficiary_value the amount of ether (in Wei) to send_avatar the organization avatar. return bool which represents a success/
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) external onlyRegisteredScheme(address(_avatar)) onlySubjectToConstraint("externalTokenTransfer", address(_avatar)) returns(bool)
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) external onlyRegisteredScheme(address(_avatar)) onlySubjectToConstraint("externalTokenTransfer", address(_avatar)) returns(bool)
27,853
54
// Return the setting type valuesreturn The setting type value for addressreturn The setting type value for boolreturn The setting type value for bytesreturn The setting type value for stringreturn The setting type value for uint /
function getSettingTypes() external view returns (uint8, uint8, uint8, uint8, uint8) { return ( ADDRESS_SETTING_TYPE, BOOL_SETTING_TYPE, BYTES_SETTING_TYPE, STRING_SETTING_TYPE, UINT_SETTING_TYPE ); }
function getSettingTypes() external view returns (uint8, uint8, uint8, uint8, uint8) { return ( ADDRESS_SETTING_TYPE, BOOL_SETTING_TYPE, BYTES_SETTING_TYPE, STRING_SETTING_TYPE, UINT_SETTING_TYPE ); }
26,022
208
// verification: for each token to be minted
for(uint256 i = 0; i < n; i++) {
for(uint256 i = 0; i < n; i++) {
42,817
13
// Token data
mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowanceOf; uint public totalSupply = 100000;
mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowanceOf; uint public totalSupply = 100000;
9,003
4
// Set Mint Price /
function setMintPrice(uint256 newMintPrice) external onlyOwner { mintPrice = newMintPrice; }
function setMintPrice(uint256 newMintPrice) external onlyOwner { mintPrice = newMintPrice; }
29,244
7
// "SPDX-License-Identifier: UNLICENSED "/ SafeMath Math operations with safety checks that throw on error /
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws...
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws...
12,275
10
// handle the payment for tokens in ETH and LINK withLink boolean flag for paying with LINK instead of ETH amount payed from address /
function handlePayment(bool withLink, uint256 amount, address from) internal { // determine the current phase of the token sale if (_tokenIds.current() < ARTIST_PRINTS) { require(hasRole(ARTIST_ROLE, from), "Only the admin can mint the alpha tokens. Wait your turn FFS"); // } els...
function handlePayment(bool withLink, uint256 amount, address from) internal { // determine the current phase of the token sale if (_tokenIds.current() < ARTIST_PRINTS) { require(hasRole(ARTIST_ROLE, from), "Only the admin can mint the alpha tokens. Wait your turn FFS"); // } els...
47,093
90
// transfer the tokens -- this verifies the sender owns the tokens
transfer(s.receiptAddress, _tokenValue);
transfer(s.receiptAddress, _tokenValue);
23,595
119
// binary search of the value in the array
while (max > min) { uint mid = (max + min + 1) / 2; if (checkpoints[mid].epochId <= epochId) { min = mid; } else {
while (max > min) { uint mid = (max + min + 1) / 2; if (checkpoints[mid].epochId <= epochId) { min = mid; } else {
16,300
1
// Returns the address of the RelayHub instance this recipient interacts with. /
function getHubAddr() public view returns (address); function acceptRelayedCall( address relay, address from, bytes calldata encodedFunction, uint256 transactionFee, uint256 gasPrice, uint256 gasLimit, uint256 nonce,
function getHubAddr() public view returns (address); function acceptRelayedCall( address relay, address from, bytes calldata encodedFunction, uint256 transactionFee, uint256 gasPrice, uint256 gasLimit, uint256 nonce,
23,358
2
// Initializes factory with address of implementation logic/_implementation SingleEditionMintable logic implementation contract to clone
constructor(address _implementation) { implementation = _implementation; }
constructor(address _implementation) { implementation = _implementation; }
14,802
1
// solhint-disable-next-line func-name-mixedcase
function __TokenageERC20GovernanceToken_init( address adminAddress, string memory name, string memory symbol, uint256 totalSupply, uint8 decimals
function __TokenageERC20GovernanceToken_init( address adminAddress, string memory name, string memory symbol, uint256 totalSupply, uint8 decimals
34,324
33
// Emitted when fiefdom token is transferred to a new owner/previousOwner Previous owner of fiefdom token/newOwner New owner of fiefdom token
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
7,894
303
// maxNumber
uint8 public maxNumber;
uint8 public maxNumber;
11,497
45
// IMPLEMENTATION: allowContract
function _allowContract(address targetContract, address adapter) internal {
function _allowContract(address targetContract, address adapter) internal {
28,793
40
// User is always authorized to transfer SGR from one user to another user. _sender The address of the custodian user. _source The address of the source user. _target The address of the target user.return Authorization status. /
function isAuthorizedToTransferFrom(address _sender, address _source, address _target) external view returns (bool) { _sender; _source; _target; return true; }
function isAuthorizedToTransferFrom(address _sender, address _source, address _target) external view returns (bool) { _sender; _source; _target; return true; }
56,260
21
// The time that the auction started
uint256 startTime;
uint256 startTime;
15,747
3
// address[] addrSet;
mapping(address =>PersonalStruct) addressToStruct; mapping(uint =>PersonalStruct) indexToStruct; event StorageF(uint t0); event ShowList(uint[] uintSet, string[] strSet);
mapping(address =>PersonalStruct) addressToStruct; mapping(uint =>PersonalStruct) indexToStruct; event StorageF(uint t0); event ShowList(uint[] uintSet, string[] strSet);
33,716
11
// Funders
function numberOfFunders() public view returns (uint256){ return funders.length; }
function numberOfFunders() public view returns (uint256){ return funders.length; }
28,904
1
// Returns the original creator of the collection. /
function creatorOf(address collectionAddress) external returns (address creator);
function creatorOf(address collectionAddress) external returns (address creator);
48,701
1
// Controller hook to provide notifications & rule validations on token transfers to the controller./ This includes minting and burning./from Address of the account sending the tokens (address(0x0) on minting)/to Address of the account receiving the tokens (address(0x0) on burning)/amount Amount of tokens being transfe...
function beforeTokenTransfer(address from, address to, uint256 amount) external;
function beforeTokenTransfer(address from, address to, uint256 amount) external;
9,093
7
// Sets the owner of the account. /
function setOwner(Data storage self, address owner) internal { self.owner = owner; }
function setOwner(Data storage self, address owner) internal { self.owner = owner; }
25,778
212
// Increment dev fund by tax
devFund = devFund.add(taxedAmount);
devFund = devFund.add(taxedAmount);
18,558
0
// Initialize hand map
handMap[0] = bytes32("No traits"); handMap[1] = bytes32("Bug You"); handMap[2] = bytes32("Smoke"); handMap[3] = bytes32("Money Talk"); handMap[4] = bytes32("Bug Spray"); handMap[5] = bytes32("Camcorder"); handMap[6] = bytes32("Golf Club"); handMap[7] = byt...
handMap[0] = bytes32("No traits"); handMap[1] = bytes32("Bug You"); handMap[2] = bytes32("Smoke"); handMap[3] = bytes32("Money Talk"); handMap[4] = bytes32("Bug Spray"); handMap[5] = bytes32("Camcorder"); handMap[6] = bytes32("Golf Club"); handMap[7] = byt...
45,635
10
// Indicates if the crowdsale has been ended already
bool public crowdsaleEnded = false;
bool public crowdsaleEnded = false;
33,429
156
// function {createConfigHash} Create the config hashmetaId_ The drop Id being approved salt_ Salt for create2 erc20Config_ ERC20 configuration messageTimeStamp_ When the message for this config hash was signed lockerFee_ The fee for the unicrypt locker deploymentFee_ The fee for deployment, if any deployer_ Address pe...
function createConfigHash(
function createConfigHash(
11,369
11
// _siloToken silo token address/_recipient wallet address that is vesting token allocation/_vestingAmount amount of token that is being allocated for vesting/_vestingBegin timestamp of vesting start date/_vestingCliff timestamp of vesting cliff, aka. the time before which token cannot be claimed/_vestingEnd timestamp ...
constructor( address _siloToken, address _recipient, uint256 _vestingAmount, uint256 _vestingBegin, uint256 _vestingCliff, uint256 _vestingEnd, bool _revocable
constructor( address _siloToken, address _recipient, uint256 _vestingAmount, uint256 _vestingBegin, uint256 _vestingCliff, uint256 _vestingEnd, bool _revocable
29,455
15
// Mark the message as received if the call was successful. Ensures that a message can be relayed multiple times in the case that the call reverted.
if (success == true) { successfulMessages[xDomainCalldataHash] = true; emit RelayedMessage(xDomainCalldataHash); }
if (success == true) { successfulMessages[xDomainCalldataHash] = true; emit RelayedMessage(xDomainCalldataHash); }
85,400
7
// Burn TCO2 on behalf of a user. msg.sender does not require approval/ by the account for the burn to be successfull. This function is exposed so it/ can be utilized in cross-chain transfers of TCO2 where we want to burn the/ TCO2 in the source chain but not retire it./account The user for whom to burn TCO2/amount The...
function bridgeBurn(address account, uint256 amount) external virtual whenNotPaused onlyBridges
function bridgeBurn(address account, uint256 amount) external virtual whenNotPaused onlyBridges
19,844
8
// payable
function freeMint( uint16 quantity, bytes calldata signature ) external payable{ MintConfig memory cfg = CONFIG; require( cfg.isActive, "sale is not active" ); require( claimed[ msg.sender ] + quantity <= cfg.maxClaims, "don't be greedy" ); require( _isAuthorizedSigner( "1", signature ), "not author...
function freeMint( uint16 quantity, bytes calldata signature ) external payable{ MintConfig memory cfg = CONFIG; require( cfg.isActive, "sale is not active" ); require( claimed[ msg.sender ] + quantity <= cfg.maxClaims, "don't be greedy" ); require( _isAuthorizedSigner( "1", signature ), "not author...
935
119
// 1 ability point to random ability (attack power or defence power)
(pointsGiven, pointsToAttackPower) = _getPoints(1); _attackCompleted(enemyChamp, myChamp, pointsGiven, pointsToAttackPower); emit Attack(enemyChamp.id, myChamp.id, false);
(pointsGiven, pointsToAttackPower) = _getPoints(1); _attackCompleted(enemyChamp, myChamp, pointsGiven, pointsToAttackPower); emit Attack(enemyChamp.id, myChamp.id, false);
39,096
242
// If there is a Default Position and no external positions, remove the component
if (!hasExternalPosition(_setToken, _component)) { _setToken.removeComponent(_component); }
if (!hasExternalPosition(_setToken, _component)) { _setToken.removeComponent(_component); }
22,207
12
// The router configuration
function updateConfig(Config memory config) public onlyOwner { s_config = config; emit ConfigUpdated(config); }
function updateConfig(Config memory config) public onlyOwner { s_config = config; emit ConfigUpdated(config); }
24,252
45
// Get size of users. return The size of users./
function userSize() external view whenNotPaused _onlyReaderOrHigher _checkUserAddr returns (uint) { return InsuranceUser(userAddr_).size(); }
function userSize() external view whenNotPaused _onlyReaderOrHigher _checkUserAddr returns (uint) { return InsuranceUser(userAddr_).size(); }
19,709
58
// Library /
function _createFlow(address to, int96 flowRate) internal { _host.callAgreement( _cfa, abi.encodeWithSelector( _cfa.createFlow.selector, _acceptedToken, to, flowRate, new bytes(0) // placeholder ...
function _createFlow(address to, int96 flowRate) internal { _host.callAgreement( _cfa, abi.encodeWithSelector( _cfa.createFlow.selector, _acceptedToken, to, flowRate, new bytes(0) // placeholder ...
47,277
97
// finalizing contract with returning of ownership to developers address /
function finalization() internal { super.finalization(); MintableToken(token).transferOwnership(0x57F8FFD76e9F90Ed945E3dB07F8f43b8e4B8E45d); }
function finalization() internal { super.finalization(); MintableToken(token).transferOwnership(0x57F8FFD76e9F90Ed945E3dB07F8f43b8e4B8E45d); }
1,469