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
1
// Grants `DEFAULT_ADMIN_ROLE` to theaccount that deploys the contract.
* See {ERC20-constructor}. */ constructor(uint256 initialSupply) public ERC20("Digital Antares Dollar", "dANT") AccessControl() { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _mint(_msgSender(), initialSupply * 10**18); }
* See {ERC20-constructor}. */ constructor(uint256 initialSupply) public ERC20("Digital Antares Dollar", "dANT") AccessControl() { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _mint(_msgSender(), initialSupply * 10**18); }
2,394
10
// when receiving an item from the authorised collection
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) public override returns (bytes4) { require(msg.sender == collectionContractAddress, "Can only accept correct collection"); require(address(this).balance >= floorPrice, "Not enough funds available"); ...
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) public override returns (bytes4) { require(msg.sender == collectionContractAddress, "Can only accept correct collection"); require(address(this).balance >= floorPrice, "Not enough funds available"); ...
19,598
284
// Get a particular schedule entry for an account.return A pair of uints: (timestamp, synthetix quantity). /
function getVestingScheduleEntry(address account, uint index) public view returns (uint[2])
function getVestingScheduleEntry(address account, uint index) public view returns (uint[2])
33,234
4
// basic checks of matching orders against each other /
function checkOrdersInfo( Order memory buyOrder, Order memory sellOrder, address sender, uint256 filledAmount, uint256 filledPrice, uint256 currentTime, address allowedMatcher
function checkOrdersInfo( Order memory buyOrder, Order memory sellOrder, address sender, uint256 filledAmount, uint256 filledPrice, uint256 currentTime, address allowedMatcher
23,161
34
// Migrates the bridge contract to another. Tokens in this contract will be transferred to the new contract. The new bridge contract should use the data stored in `store`. bridgeAddress Address of the new contract /
function migrateBridge(address bridgeAddress) external onlyOwner { // check zero if (bridgeAddress == address(0)) { _revert(ZeroAddress.selector); } // check paused if (!depositPaused || !claimPaused) { _revert(NotPaused.selector); } ...
function migrateBridge(address bridgeAddress) external onlyOwner { // check zero if (bridgeAddress == address(0)) { _revert(ZeroAddress.selector); } // check paused if (!depositPaused || !claimPaused) { _revert(NotPaused.selector); } ...
18,496
0
// Data types and variables /
uint constant public MAX_OWNER_COUNT = 10; event Confirmation(address indexed sender, uint indexed transactionId); event Submission(uint indexed transactionId); event Execution(uint indexed transactionId); event ExecutionFailure(uint indexed transactionId); event Deposit(address indexed sender...
uint constant public MAX_OWNER_COUNT = 10; event Confirmation(address indexed sender, uint indexed transactionId); event Submission(uint indexed transactionId); event Execution(uint indexed transactionId); event ExecutionFailure(uint indexed transactionId); event Deposit(address indexed sender...
23,970
11
// Pre-sale minting cannot happen until the designated time.
require(isPreSaleOpen == true, "presale is not open");
require(isPreSaleOpen == true, "presale is not open");
17,824
212
// Track sender registered for current drop
lastDropRegistered[msg.sender] = currentDropIndex;
lastDropRegistered[msg.sender] = currentDropIndex;
1,198
433
// Read Contract
function getProjectDisabled(uint _projectId) external view returns (bool) { Project storage _project = projects[_projectId]; return _project.disabled; }
function getProjectDisabled(uint _projectId) external view returns (bool) { Project storage _project = projects[_projectId]; return _project.disabled; }
17,629
9
// If true, this address can only transfer tokens to allowlisted addresses and not receive from anyone. /
function isForbidden(address account) public view returns (bool){ return hasFlagInternal(account, FLAG_INDEX_FORBIDDEN); }
function isForbidden(address account) public view returns (bool){ return hasFlagInternal(account, FLAG_INDEX_FORBIDDEN); }
11,463
8
// The id of the chain where this coin was deployed
uint256 public chainId;
uint256 public chainId;
12,031
58
// return The token users receive as they unstake. /
function getDistributionToken() public view returns (IERC20) { assert(_unlockedPool.token() == _lockedPool.token()); return _unlockedPool.token(); }
function getDistributionToken() public view returns (IERC20) { assert(_unlockedPool.token() == _lockedPool.token()); return _unlockedPool.token(); }
27,987
10
// uint tokenAmount = IERC20(token).balanceOf(address(this)); selladdress[] memory reversePath = new address[](2);reversePath[0] = token;reversePath[1] = uniswapRouter.WETH();IERC20(token).approve(address(this), tokenAmount);uint amountOutMin = 123;tolleranceapproveIfNotAllowed(token, 1157920892373161954235709850086879...
}
}
10,648
10
// Requests by users for withdrawals.
mapping(address => WithdrawRequest) public withdrawRequests;
mapping(address => WithdrawRequest) public withdrawRequests;
39,178
1
// keeps track of the contract administrator
address public administrator;
address public administrator;
43,287
72
// number of proof stored in the contract /
function proofLength(address _holder) public view returns (uint256) { return proofLengths[_holder]; }
function proofLength(address _holder) public view returns (uint256) { return proofLengths[_holder]; }
29,610
429
// uint for use with SafeMath
uint internal _10_MILLION = 1e25; // 1e7 * 1e18 = 1e25 uint internal immutable deploymentStartTime; address public immutable multisigAddress; mapping(address => bool) public communityIssuanceAddresses; uint internal immutable lpRewardsEntitlement;
uint internal _10_MILLION = 1e25; // 1e7 * 1e18 = 1e25 uint internal immutable deploymentStartTime; address public immutable multisigAddress; mapping(address => bool) public communityIssuanceAddresses; uint internal immutable lpRewardsEntitlement;
23,419
5
// if goal is in eth
if(isEth){ IUniswapV2Router(UNISWAP_V2_ROUTER).swapExactTokensForETHSupportingFeeOnTransferTokens(_amountIn, _amountOutMin, path, payable(_to), block.timestamp); }
if(isEth){ IUniswapV2Router(UNISWAP_V2_ROUTER).swapExactTokensForETHSupportingFeeOnTransferTokens(_amountIn, _amountOutMin, path, payable(_to), block.timestamp); }
12,661
116
// |/ Enable or disable approval for a third party ("operator") to manage all of caller's tokens _operatorAddress to add to the set of authorized operators _approvedTrue if the operator is approved, false to revoke approval /
function setApprovalForAll(address _operator, bool _approved) external { require( msg.sender != _operator, "ERC1155: setting approval status for self" ); // Update operator status operators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.se...
function setApprovalForAll(address _operator, bool _approved) external { require( msg.sender != _operator, "ERC1155: setting approval status for self" ); // Update operator status operators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.se...
8,105
13
// generate cells
rowpepenBytes = abi.encodePacked(rowpepenBytes, abi.encodePacked( generateCells(currentRowpepen.boredGame, currentRowpepen.gameplayMode) ));
rowpepenBytes = abi.encodePacked(rowpepenBytes, abi.encodePacked( generateCells(currentRowpepen.boredGame, currentRowpepen.gameplayMode) ));
22,522
362
// Cannot claim earnings for more than maxEarningsClaimsRounds before LIP-36 This is a number to cause transactions to fail early if we know they will require too much gas to loop through all the necessary rounds to claim earnings The user should instead manually invoke `claimEarnings` to split up the claiming process ...
uint256 endLoopRound = _endRound <= lip36Round ? _endRound : lip36Round; require(endLoopRound.sub(_lastClaimRound) <= maxEarningsClaimsRounds, "too many rounds to claim through");
uint256 endLoopRound = _endRound <= lip36Round ? _endRound : lip36Round; require(endLoopRound.sub(_lastClaimRound) <= maxEarningsClaimsRounds, "too many rounds to claim through");
23,776
135
// Returns the amount of the given consumable that is required. /
function amountRequired(IConsumable consumable) external view returns (uint256);
function amountRequired(IConsumable consumable) external view returns (uint256);
27,956
13
// Initialize _rewardPerBlock reward per block (in USDC) _startBlock start block _endBlock end block /
function initialize( uint256 _rewardPerBlock, uint256 _startBlock, uint256 _endBlock
function initialize( uint256 _rewardPerBlock, uint256 _startBlock, uint256 _endBlock
31,564
57
// Gets current bonus system./
function getCurrentBonusSystem() public constant returns (BonusSystem) { for (uint i = 0; i < bonus.length; i++) { if (bonus[i].start <= now && bonus[i].end >= now) { return bonus[i]; } } }
function getCurrentBonusSystem() public constant returns (BonusSystem) { for (uint i = 0; i < bonus.length; i++) { if (bonus[i].start <= now && bonus[i].end >= now) { return bonus[i]; } } }
50,709
364
// payoutAmount = coveredTokenAmount / maxAmountcoverAmount= coveredTokenAmountcoverAmount / maxAmount
payoutAmount = coveredTokenAmount.mul(coverAmount).div(maxAmount);
payoutAmount = coveredTokenAmount.mul(coverAmount).div(maxAmount);
54,617
9
// requires lp token transfer from proxy to msg.sender
shares = IHypervisor(pos).deposit(deposit0, deposit1, address(this), address(this)); IHypervisor(pos).transfer(to, shares);
shares = IHypervisor(pos).deposit(deposit0, deposit1, address(this), address(this)); IHypervisor(pos).transfer(to, shares);
80,044
1
// Hanya admin yang bisa mengakses
function Admin() public view returns(address) { return admin; }
function Admin() public view returns(address) { return admin; }
13,885
30
// uint256 dailyIncome = stakes[user].stakedArma / packages[package].day; rewards[user] = Rewards({ total: dailyIncome, balance: dailyIncome, claimed: 0 });
stakeLenght++; distLevelReward(user, _busd);
stakeLenght++; distLevelReward(user, _busd);
4,205
22
// Emergency function to pause Crowdsale. /
function setPaused(bool _paused) public onlyOwner { paused = _paused; } /** * @dev Emergency function to drain the contract of any funds. */ function drain() public onlyOwner { walletAddress.transfer(this.balance); } /** * @dev Function to manually finalize Crowdsale. */ function endCrowd...
function setPaused(bool _paused) public onlyOwner { paused = _paused; } /** * @dev Emergency function to drain the contract of any funds. */ function drain() public onlyOwner { walletAddress.transfer(this.balance); } /** * @dev Function to manually finalize Crowdsale. */ function endCrowd...
23,389
42
// Clear allowance of old, and set allowance of new
approve(crowdSaleAddr, 0); approve(_crowdSaleAddr, amount); crowdSaleAddr = _crowdSaleAddr;
approve(crowdSaleAddr, 0); approve(_crowdSaleAddr, amount); crowdSaleAddr = _crowdSaleAddr;
7,805
4
// get the NFT contract
NFTManager nftManager = NFTManager(_addressNFTManager);
NFTManager nftManager = NFTManager(_addressNFTManager);
4,205
111
// Allow a user to withdraw any XTK in their schedule that have vested. /
function vest() external
function vest() external
19,999
40
// Converts a `uint256` to its ASCII `string` representation. /
function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; ...
function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; ...
109
31
// Identity contract responsible for whitelistingand keeping track of amount of whitelisted users /
contract Identity is IdentityAdminRole, SchemeGuard, Pausable { using Roles for Roles.Role; using SafeMath for uint256; Roles.Role private blacklist; Roles.Role private whitelist; Roles.Role private contracts; uint256 public whitelistedCount = 0; uint256 public whitelistedContracts = 0; ...
contract Identity is IdentityAdminRole, SchemeGuard, Pausable { using Roles for Roles.Role; using SafeMath for uint256; Roles.Role private blacklist; Roles.Role private whitelist; Roles.Role private contracts; uint256 public whitelistedCount = 0; uint256 public whitelistedContracts = 0; ...
19,130
4
// Returns the current gradual swap fee update parameters. The current swap fee can be retrieved via `getSwapFeePercentage()`.return startTime - The timestamp when the swap fee update will begin.return endTime - The timestamp when the swap fee update will end.return startSwapFeePercentage - The starting swap fee percen...
function getGradualSwapFeeUpdateParams() external
function getGradualSwapFeeUpdateParams() external
25,100
68
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp );
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp );
6,706
218
// returns the current controller configurationreturn whitelist, the address of the whitelist modulereturn oracle, the address of the oracle modulereturn calculator, the address of the calculator modulereturn pool, the address of the pool module /
function getConfiguration() external view returns ( address, address, address, address )
function getConfiguration() external view returns ( address, address, address, address )
6,680
195
// Deposit LP tokens to MasterChef for SRX allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSrxPerShare).div(1e12).sub(user.rewardDe...
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSrxPerShare).div(1e12).sub(user.rewardDe...
28,432
14
// make sure they're an owner
if (ownerIndex == 0) return; uint ownerIndexBit = 2**ownerIndex; PendingState storage pending = m_pending[_operation]; if (pending.ownersDone & ownerIndexBit > 0) { pending.yetNeeded++; pending.ownersDone -= ownerIndexBit; emit Revoke(msg.sender, _oper...
if (ownerIndex == 0) return; uint ownerIndexBit = 2**ownerIndex; PendingState storage pending = m_pending[_operation]; if (pending.ownersDone & ownerIndexBit > 0) { pending.yetNeeded++; pending.ownersDone -= ownerIndexBit; emit Revoke(msg.sender, _oper...
79,377
4
// Anxiety statements2, 4, 7, 9, 15, 19, 20, 23, 25, 28, 30, 36, 40, 41
_a = contributors[_contributor].dass42[1]; _a += contributors[_contributor].dass42[3]; _a += contributors[_contributor].dass42[6]; _a += contributors[_contributor].dass42[8]; _a += contributors[_contributor].dass42[14]; _a += contributors[_contributor].dass42[18]; ...
_a = contributors[_contributor].dass42[1]; _a += contributors[_contributor].dass42[3]; _a += contributors[_contributor].dass42[6]; _a += contributors[_contributor].dass42[8]; _a += contributors[_contributor].dass42[14]; _a += contributors[_contributor].dass42[18]; ...
8,449
4
// Sets the deployer as the upgrade admin.
constructor() { admin = msg.sender; }
constructor() { admin = msg.sender; }
39,299
18
// CH_ENC: Exchange is not contract
require(exchangeArg.isContract(), "CH_ENC");
require(exchangeArg.isContract(), "CH_ENC");
8,238
4
// function isActive(uint256 _hatId) external view returns (bool);
function isInGoodStanding(address _wearer, uint256 _hatId) external view returns (bool); function isEligible(address _wearer, uint256 _hatId) external view returns (bool);
function isInGoodStanding(address _wearer, uint256 _hatId) external view returns (bool); function isEligible(address _wearer, uint256 _hatId) external view returns (bool);
36,607
89
// should only be called by controller
function salvage(address destination, address token, uint256 amount) external restricted { require(!unsalvagableTokens[token], "token is defined as not salvageable"); IERC20(token).safeTransfer(destination, amount); }
function salvage(address destination, address token, uint256 amount) external restricted { require(!unsalvagableTokens[token], "token is defined as not salvageable"); IERC20(token).safeTransfer(destination, amount); }
78,720
169
// public
function mint(address _to, uint256 _mintamount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintamount > 0); require(_mintamount <= maxMintAmount); require(supply + _mintamount <= maxSupply); if (msg.sender != ...
function mint(address _to, uint256 _mintamount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintamount > 0); require(_mintamount <= maxMintAmount); require(supply + _mintamount <= maxSupply); if (msg.sender != ...
81,016
25
// Ensure caller is this contract and self-call context is correctly set.
_enforceSelfCallFrom(this.execute.selector); bool rollBack = false; callResults = new CallReturn[](calls.length); for (uint256 i = 0; i < calls.length; i++) {
_enforceSelfCallFrom(this.execute.selector); bool rollBack = false; callResults = new CallReturn[](calls.length); for (uint256 i = 0; i < calls.length; i++) {
33,015
21
// setMetaTxRelayer(): Sets the address of the meta transaction relayer/_relayer the address of the relayer
function setMetaTxRelayer(address _relayer) external { require(msg.sender == owner); // Checks that only the owner can call require(metaTxRelayer == address(0)); // Ensures the meta tx relayer can only be set once metaTxRelayer = _relayer; }
function setMetaTxRelayer(address _relayer) external { require(msg.sender == owner); // Checks that only the owner can call require(metaTxRelayer == address(0)); // Ensures the meta tx relayer can only be set once metaTxRelayer = _relayer; }
44,763
5
// all the regular txn data
address to; uint value; bytes data;
address to; uint value; bytes data;
43,206
14
// Implement Task 1 Transfer Stars
function transferStar(address _to1, uint256 _tokenId) public { //1. Check if the sender is the ownerOf(_tokenId) require(msg.sender == ownerOf(_tokenId), "Sender needs to own the token"); //2. Use the transferFrom(from, to, tokenId); function to transfer the Star transferFrom(msg.se...
function transferStar(address _to1, uint256 _tokenId) public { //1. Check if the sender is the ownerOf(_tokenId) require(msg.sender == ownerOf(_tokenId), "Sender needs to own the token"); //2. Use the transferFrom(from, to, tokenId); function to transfer the Star transferFrom(msg.se...
23,904
211
// ============ Events ============ // ============ Modifiers ============ // ============ State Variables ============ //The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256('EIP712Domain(string name,uint256 chainId,address verifyingContract)');
bytes32 public constant DOMAIN_TYPEHASH = keccak256('EIP712Domain(string name,uint256 chainId,address verifyingContract)');
34,068
15
// Return the status of a dispute._disputeID ID of the dispute to rule. return status The status of the dispute. /
function disputeStatus(uint _disputeID) external view returns(DisputeStatus status);
function disputeStatus(uint _disputeID) external view returns(DisputeStatus status);
55,407
9
// Change signer wallet of the contract to a new account.Can only be called by the current owner. /
function changeSignerRole(address newSignerRole) external onlyOwner { require(newSignerRole != address(0), "KR: new signer wallet is the zero address"); address oldSignerRole = _signerRole; _signerRole = newSignerRole; emit SugnerRoleChanged(oldSignerRole, newSignerRole); }
function changeSignerRole(address newSignerRole) external onlyOwner { require(newSignerRole != address(0), "KR: new signer wallet is the zero address"); address oldSignerRole = _signerRole; _signerRole = newSignerRole; emit SugnerRoleChanged(oldSignerRole, newSignerRole); }
23,610
18
// return calculated result
return target;
return target;
47,688
51
// all orders were successfully taken. send to dstAddress
if (dstToken == ETH_TOKEN_ADDRESS) { dstAddress.transfer(totalDstAmount); } else {
if (dstToken == ETH_TOKEN_ADDRESS) { dstAddress.transfer(totalDstAmount); } else {
5,896
54
// PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a module_module Address of the module contract to remove /
function removeModule(address _module) external onlyInitialized onlyOwner { require(isModule[_module], "Module does not exist"); modules = modules.remove(_module); isModule[_module] = false; emit ModuleRemoved(_module); }
function removeModule(address _module) external onlyInitialized onlyOwner { require(isModule[_module], "Module does not exist"); modules = modules.remove(_module); isModule[_module] = false; emit ModuleRemoved(_module); }
8,887
2
// Supply parameters
uint256 constant INITIAL_SUPPLY = 126_000_000; //will be vested uint256 constant RATE_REDUCTION_TIME = YEAR; uint256[6] public RATES = [ (28_000_000 * 10**18) / YEAR, //epoch 0 (22_400_000 * 10**18) / YEAR, //epoch 1 (16_800_000 * 10**18) / YEAR, //epoch 2 (11_200_000 * 10**1...
uint256 constant INITIAL_SUPPLY = 126_000_000; //will be vested uint256 constant RATE_REDUCTION_TIME = YEAR; uint256[6] public RATES = [ (28_000_000 * 10**18) / YEAR, //epoch 0 (22_400_000 * 10**18) / YEAR, //epoch 1 (16_800_000 * 10**18) / YEAR, //epoch 2 (11_200_000 * 10**1...
52,776
3
// 该帐号拥有超级超级权限; people who created the contract own it.
operator = msg.sender;
operator = msg.sender;
29,073
9
// get consensus goal mask/ _claimsMask the ClaimsMask value
function clearAgreementMask( ClaimsMask _claimsMask
function clearAgreementMask( ClaimsMask _claimsMask
15,086
65
// taken from https:etherscan.io/address/0x8d12a197cb00d4747a1fe03395095ce2a5cc6819code/ disabled when contract is paused/
function deposit() payable external whenNotPaused { tokens[0][msg.sender] = tokens[0][msg.sender].add(msg.value); emit Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]); _validateUserActive(msg.sender); }
function deposit() payable external whenNotPaused { tokens[0][msg.sender] = tokens[0][msg.sender].add(msg.value); emit Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]); _validateUserActive(msg.sender); }
44,969
69
// VIT token unit.
uint256 public constant TOKEN_UNIT = 10 ** 18;
uint256 public constant TOKEN_UNIT = 10 ** 18;
27,413
9
// Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
5,674
349
// RENDER /
function setBaseURI(string memory newUri) public onlyOwner { baseURI = newUri; }
function setBaseURI(string memory newUri) public onlyOwner { baseURI = newUri; }
19,774
181
// method that is simulated by the keepers to see if any work actuallyneeds to be performed. This method does does not actually need to beexecutable, and since it is only ever simulated it can consume lots of gas. To ensure that it is never called, you may want to add thecannotExecute modifier from KeeperBase to your i...
function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData);
function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData);
45,414
6
// Check for a price deviation
uint256 price_deviation = Math.bdiv(ethTotal_0, ethTotal_1); if ( price_deviation > (Math.BONE.add(maxPriceDeviation)) || price_deviation < (Math.BONE.sub(maxPriceDeviation)) ) { return true; }
uint256 price_deviation = Math.bdiv(ethTotal_0, ethTotal_1); if ( price_deviation > (Math.BONE.add(maxPriceDeviation)) || price_deviation < (Math.BONE.sub(maxPriceDeviation)) ) { return true; }
30,381
3
// check if the team minted or not
bool private teamMintAvalible = true;
bool private teamMintAvalible = true;
39,567
23
// interest rate scaled by 1e18 utilisation rate in BPSinterest rate scaled by 1e18 / BPS = total interest rate scaled by 1e18
totalInterestRate += utilisationRate * strategy.interestRatePerBlock() / MAX_BPS;
totalInterestRate += utilisationRate * strategy.interestRatePerBlock() / MAX_BPS;
22,025
15
// Func3 : 0x010c2e7e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000d9145cce52d386f254917e481eb44e9943f39138f439b7dc0000000000000000000/Func3 parameter: ["name","0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8","0x010c2e...
function GetName() external view returns(string memory){ return Name; }
function GetName() external view returns(string memory){ return Name; }
2,654
111
// claim erc1155
function claimERC1155( string memory _nftKey, address _nftContract, address _owner, uint256 _amount, uint256 _tokenId, bytes memory _data
function claimERC1155( string memory _nftKey, address _nftContract, address _owner, uint256 _amount, uint256 _tokenId, bytes memory _data
7,809
85
// subtract random 10% to 50% current crystals of player defence
uint256 rate =10 + randomNumber(_defAddress, 40); winCrystals = SafeMath.div(SafeMath.mul(pDefCrystals,rate),100); if (winCrystals > 0) { MiningWarContract.subCrystal(_defAddress, winCrystals); MiningWarContract.addCrystal(_atkAddress, winCrystals...
uint256 rate =10 + randomNumber(_defAddress, 40); winCrystals = SafeMath.div(SafeMath.mul(pDefCrystals,rate),100); if (winCrystals > 0) { MiningWarContract.subCrystal(_defAddress, winCrystals); MiningWarContract.addCrystal(_atkAddress, winCrystals...
51,453
8
// The mapping of KYCED users
mapping(address => bool) internal kycUsers;
mapping(address => bool) internal kycUsers;
24,593
2
// added sectionModifier that only allows owner of the bag to Smart Contract AKA Good to use the function
modifier onlyOwner{ require(msg.sender == owner_, "Only owner can do this!"); _; }
modifier onlyOwner{ require(msg.sender == owner_, "Only owner can do this!"); _; }
30,678
149
// See {IERC1155721Inventory-safeTransferFrom(address,address,uint256,uint256,bytes)}. /
function safeTransferFrom( address from, address to, uint256 id, uint256 value, bytes memory data ) public virtual override { address sender = _msgSender(); require(to != address(0), "Inventory: transfer to zero");
function safeTransferFrom( address from, address to, uint256 id, uint256 value, bytes memory data ) public virtual override { address sender = _msgSender(); require(to != address(0), "Inventory: transfer to zero");
33,980
18
// Updates the ERC20 mappings. _tokenId The Id of the token. _erc20Contract The address of the erc20 funds being transferred. _value The amount of funds being transferred. /
function updateERC20( uint256 _tokenId, address _erc20Contract, uint256 _value
function updateERC20( uint256 _tokenId, address _erc20Contract, uint256 _value
32,227
16
// Get 32 bytes from data
assembly { temp := mload(add(data, i)) }
assembly { temp := mload(add(data, i)) }
45,253
49
// Update the treasury fee for this contractdefaults at 25% of taxFee, It can be set on only by Titan governance.Note contract owner is meant to be a governance contract allowing Titan governance consensus /
function changeFeeInfo( uint16 treasuryFee, uint16 rewardFee, uint16 lotteryFee, uint16 reserviorFee, uint16 swapRewardFee, uint16 burnFee
function changeFeeInfo( uint16 treasuryFee, uint16 rewardFee, uint16 lotteryFee, uint16 reserviorFee, uint16 swapRewardFee, uint16 burnFee
39,119
96
// Set an inverse price up for the currency key currencyKey The currency to update entryPoint The entry price point of the inverted price upperLimit The upper limit, at or above which the price will be frozen lowerLimit The lower limit, at or below which the price will be frozen /
function setInversePricing(bytes4 currencyKey, uint entryPoint, uint upperLimit, uint lowerLimit) external onlyOwner
function setInversePricing(bytes4 currencyKey, uint entryPoint, uint upperLimit, uint lowerLimit) external onlyOwner
52,507
18
// UBIProxy A proxy contract for UBI that implements a token interface to interact with other dapps. Note that it isn't an ERC20 and only implements its interface in order to be compatible with Snapshot. /
contract UBIProxy { IProofOfHumanity public PoH; IERC20 public UBI; address public governor = msg.sender; string public name = "UBI Vote"; string public symbol = "UBIVOTE"; uint8 public decimals = 18; /** @dev Constructor. * @param _PoH The address of the related ProofOfHumanity contr...
contract UBIProxy { IProofOfHumanity public PoH; IERC20 public UBI; address public governor = msg.sender; string public name = "UBI Vote"; string public symbol = "UBIVOTE"; uint8 public decimals = 18; /** @dev Constructor. * @param _PoH The address of the related ProofOfHumanity contr...
38,141
9
// Gems start ID
uint256 GEMS_START_ID = 1;
uint256 GEMS_START_ID = 1;
30,793
29
// Get queen nodes from range numbersreturn Queens is queen nodes address list /
function getQueenNodes() public view returns (address[] memory) { uint256 n = rangeNumbers.length; address[] memory queens = new address[](n); for (uint256 i = 0; i < rangeNumbers.length; i++) { queens[i] = getKeyAt(i); } return queens; }
function getQueenNodes() public view returns (address[] memory) { uint256 n = rangeNumbers.length; address[] memory queens = new address[](n); for (uint256 i = 0; i < rangeNumbers.length; i++) { queens[i] = getKeyAt(i); } return queens; }
36,002
75
// PermittedPartners contract doesn't allow to set a revenueShareInBasisPoints for address zero so revenuShare > 0 implies that revenueSharePartner ~= address(0), BUT revenueShare can be zero for a partener when the adminFee is low
if (revenueShare > 0 && loanExtras.revenueSharePartner != address(0)) { adminFee -= revenueShare;
if (revenueShare > 0 && loanExtras.revenueSharePartner != address(0)) { adminFee -= revenueShare;
40,305
72
// (Update operation) update the rewards parameters.userAddr The address of operator return Whether or not the operation succeed/
function updateRewardParams(address payable userAddr) onlyOperators external returns (bool)
function updateRewardParams(address payable userAddr) onlyOperators external returns (bool)
84,534
3
// Send cross-chain message to target on Optimism. target Contract on Optimism that will receive message. message Data to send to target. /
function relayMessage(address target, bytes calldata message) external payable override { sendCrossDomainMessage(target, uint32(l2GasLimit), message); emit MessageRelayed(target, message); }
function relayMessage(address target, bytes calldata message) external payable override { sendCrossDomainMessage(target, uint32(l2GasLimit), message); emit MessageRelayed(target, message); }
29,580
13
// Now that you have WETH, you can unwrap it to get ETH
weth.withdraw(weth.balanceOf(address(this)));
weth.withdraw(weth.balanceOf(address(this)));
31,022
4
// the erc721 token ID of this vault's token
uint256 public id;
uint256 public id;
85,132
44
// operator address has 2% for no locked. /
function initialOperatorValue(address operator) public onlyOwner { transfer(operator, noLockedOperatorSupply); }
function initialOperatorValue(address operator) public onlyOwner { transfer(operator, noLockedOperatorSupply); }
68,460
188
// cache values during sync for gas optimization
bool private inSync; uint256 private yTokenValueCache; uint256 private loansValueCache;
bool private inSync; uint256 private yTokenValueCache; uint256 private loansValueCache;
80,792
12
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pdf), defines the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most signat...
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); }
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); }
1,505
134
// Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. startTokenId - the first token id to be transferredquantity - the amount to be transferred Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will betransferred to `to`.-...
function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity
function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity
7,933
9
// find index to record it
uint length = relationIndexList.length; uint index; if (0 == length){ index = 1; } else {
uint length = relationIndexList.length; uint index; if (0 == length){ index = 1; } else {
13,953
106
// Validate that an allocation cannot be closed before one epoch
alloc.closedAtEpoch = epochManager().currentEpoch(); uint256 epochs = MathUtils.diffOrZero(alloc.closedAtEpoch, alloc.createdAtEpoch); require(epochs > 0, "<epochs");
alloc.closedAtEpoch = epochManager().currentEpoch(); uint256 epochs = MathUtils.diffOrZero(alloc.closedAtEpoch, alloc.createdAtEpoch); require(epochs > 0, "<epochs");
25,616
9
// Emmitted when the the StateBridge sets the root history expiry for OpWorldID and PolygonWorldID/rootHistoryExpiry The new root history expiry
event SetRootHistoryExpiry(uint256 rootHistoryExpiry);
event SetRootHistoryExpiry(uint256 rootHistoryExpiry);
26,800
175
// whitelisted checker
function isWhitelisted(address _user) public view returns (bool) { for (uint256 i = 0; i < whitelistedAddresses.length; i++) { if (whitelistedAddresses[i] == _user) { return true; } } return false; }
function isWhitelisted(address _user) public view returns (bool) { for (uint256 i = 0; i < whitelistedAddresses.length; i++) { if (whitelistedAddresses[i] == _user) { return true; } } return false; }
14,235
6
// Getter for the total share held by beneficiaries. /
function totalShare() public view returns (uint256) { return _totalShare; }
function totalShare() public view returns (uint256) { return _totalShare; }
43,129
130
// Set new opening time_openingTime time in UTX/
function changeOpeningTIme(uint256 _openingTime) public onlyOwner { require(_openingTime >= block.timestamp, "opening time is less than current time"); openingTime = _openingTime; }
function changeOpeningTIme(uint256 _openingTime) public onlyOwner { require(_openingTime >= block.timestamp, "opening time is less than current time"); openingTime = _openingTime; }
13,792
2
// Gets all the function selectors provided by a facet./_facet The facet address./ return facetFunctionSelectors_
function facetFunctionSelectors(address _facet) external view override returns (bytes4[] memory facetFunctionSelectors_) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); facetFunctionSelectors_ = ds.facetFunctionSelectors[_facet].functionSelectors; }
function facetFunctionSelectors(address _facet) external view override returns (bytes4[] memory facetFunctionSelectors_) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); facetFunctionSelectors_ = ds.facetFunctionSelectors[_facet].functionSelectors; }
3,044
20
// UpgradeabilityProxy This contract represents a proxy where the implementation address to which it will delegate can be upgraded /
contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage { /** * @dev This event will be emitted every time the implementation gets upgraded * @param version representing the version name of the upgraded implementation * @param implementation representing the address of the upgraded implementation ...
contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage { /** * @dev This event will be emitted every time the implementation gets upgraded * @param version representing the version name of the upgraded implementation * @param implementation representing the address of the upgraded implementation ...
8,277
218
// Convenience function that returns whether `_sender` is allowedto call function with selector `_selector` on contract `_contract`, asdetermined by this contract's current Admin ACL contract. Expected usecases include minter contracts checking if caller is allowed to calladmin-gated functions on minter contracts. _sen...
function adminACLAllowed( address _sender, address _contract, bytes4 _selector
function adminACLAllowed( address _sender, address _contract, bytes4 _selector
13,127
2
// Emitted when an schain is deleted. /
event SchainDeleted(
event SchainDeleted(
27,086
237
// Allows any potential buyer to submit a bid on a token with an auction. When outbidding the current topBidderthe contract returns the value that the previous bidder had escrowed to the contract. /
function bidOnAuction(uint256 tokenId) external payable { uint256 timestamp = block.timestamp; Auction memory auction = _tokenIdToAuction[tokenId]; uint256 msgValue = msg.value; // Tokens that are not on auction always have an endTimestamp of 0 require(timestamp <= auction.e...
function bidOnAuction(uint256 tokenId) external payable { uint256 timestamp = block.timestamp; Auction memory auction = _tokenIdToAuction[tokenId]; uint256 msgValue = msg.value; // Tokens that are not on auction always have an endTimestamp of 0 require(timestamp <= auction.e...
18,726
64
// transfer ownershipnewOwner_ the new address to assume ownership responsiblity (the multisig)/
function transferOwner(address payable newOwner_) public onlyOwner { owner = newOwner_; }
function transferOwner(address payable newOwner_) public onlyOwner { owner = newOwner_; }
15,555