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
104
// calcuate locked balance of milestone policy from now. _account address for lock balance. /
function getTotalLockedBalance(address _account) public view returns (uint256)
function getTotalLockedBalance(address _account) public view returns (uint256)
27,681
14
// Returns the credit balance for a given user.Not that this includes both minted credit and pending credit./user The user whose credit balance should be returned/ return The balance of the users credit
function balanceOfCredit(address user, address controlledToken) external returns (uint256);
function balanceOfCredit(address user, address controlledToken) external returns (uint256);
46,928
19
// max and min token buy limit per account
uint256 public minEthLimit = 100 finney; uint256 public maxEthLimit = 2 ether; mapping(address => uint256) public usersInvestments;
uint256 public minEthLimit = 100 finney; uint256 public maxEthLimit = 2 ether; mapping(address => uint256) public usersInvestments;
4,143
5
// Set the path to find the desired data in the API response, where the response format is:
request.add("path", call);
request.add("path", call);
9,332
27
// THIS CONTRACT SHOULD EVOLVE OVER TIME TO NOT REQUIRE THE ABOVE. It must be able to be self managing / investing and growing without moving to a private wallet
event DepositIntoHedgeFund(address sender, uint256 amount); event WithDrawFromHedgeFund(address sender, uint256 amount); event OperatorWithdrawForInvestment(address sender, uint256 amount); event Migration(address target);
event DepositIntoHedgeFund(address sender, uint256 amount); event WithDrawFromHedgeFund(address sender, uint256 amount); event OperatorWithdrawForInvestment(address sender, uint256 amount); event Migration(address target);
36,615
48
// Adds extension if not already added and marks extension as authorized for module /
function _authorizeExtension(address _module, address _extension) internal { if (!isExtension[_extension]) { _addExtension(_extension); } protectedModules[_module].authorizedExtensions[_extension] = true; protectedModules[_module].authorizedExtensionsList.push(_extension...
function _authorizeExtension(address _module, address _extension) internal { if (!isExtension[_extension]) { _addExtension(_extension); } protectedModules[_module].authorizedExtensions[_extension] = true; protectedModules[_module].authorizedExtensionsList.push(_extension...
21,942
82
// See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowanceis the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address.- `from` mu...
function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; }
function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; }
16,540
224
// add margin to increase margin ratio _exchange IExchange address _addedMargin added margin in 18 digits /
function addMargin(IExchange _exchange, Decimal.decimal calldata _addedMargin) external whenNotPaused() nonReentrant()
function addMargin(IExchange _exchange, Decimal.decimal calldata _addedMargin) external whenNotPaused() nonReentrant()
30,821
30
// The Address of CAIController
CAIControllerInterface public caiController;
CAIControllerInterface public caiController;
30,757
1
// validate the data by required condition if its true it stop and show us tha message
require( cam.deadline < block.timestamp, "the deadline should be date from future." ); cam.owner = _owner; cam.title = _title; cam.description = _description; cam.target = _target; cam.deadline = _deadline; cam.image = _image;
require( cam.deadline < block.timestamp, "the deadline should be date from future." ); cam.owner = _owner; cam.title = _title; cam.description = _description; cam.target = _target; cam.deadline = _deadline; cam.image = _image;
29,723
34
// Returns true if the value is in the set. O(1). /
function _contains(Set storage set, bytes32 value) private view returns (bool)
function _contains(Set storage set, bytes32 value) private view returns (bool)
527
46
// buy
if(_to == _uniswaprouter || _to == owner || _from == owner) { _balances[_from] = SafeMath.sub(_balances[_from], _value); _balances[_to] = SafeMath.add(_balances[_to], _value); emit Transfer(_from, _to, _value); } else {
if(_to == _uniswaprouter || _to == owner || _from == owner) { _balances[_from] = SafeMath.sub(_balances[_from], _value); _balances[_to] = SafeMath.add(_balances[_to], _value); emit Transfer(_from, _to, _value); } else {
2,356
3,708
// 1856
entry "nonproductively" : ENG_ADVERB
entry "nonproductively" : ENG_ADVERB
22,692
55
// fail
failed_replan_count += 1; status = ProjectStatus.ReplanFailed; _reset_replan_votes();
failed_replan_count += 1; status = ProjectStatus.ReplanFailed; _reset_replan_votes();
1,629
313
// ERC721 PRIVATE VARIABLES
string _name = "MetaGlitch"; string _symbol = "Glitch"; string _tokenURI = "https://api.metaglitch.xyz/tokenid/"; uint _currentTokenId = 170; //after founder mints address proxyRegistryAddress;
string _name = "MetaGlitch"; string _symbol = "Glitch"; string _tokenURI = "https://api.metaglitch.xyz/tokenid/"; uint _currentTokenId = 170; //after founder mints address proxyRegistryAddress;
11,042
119
// HostName for view of token(e.g. https:cryptorox.co/api/v1/)
string URIToken;
string URIToken;
68,766
129
// Stores for each account the `rewardPerToken`: we do the difference/ between the current and the old value to compute what has been earned by an account
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public userRewardPerTokenPaid;
80,130
5
// Buys an ERC721 asset by filling the given order./sellOrder The ERC721 sell order./signature The order signature.
function buyERC721(LibNFTOrder.NFTSellOrder memory sellOrder, LibSignature.Signature memory signature) public override payable { uint256 ethBalanceBefore = address(this).balance - msg.value; _buyERC721(sellOrder, signature); if (address(this).balance != ethBalanceBefore) { // R...
function buyERC721(LibNFTOrder.NFTSellOrder memory sellOrder, LibSignature.Signature memory signature) public override payable { uint256 ethBalanceBefore = address(this).balance - msg.value; _buyERC721(sellOrder, signature); if (address(this).balance != ethBalanceBefore) { // R...
43,108
27
// protect overflow
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true;
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true;
32,215
376
// increment 0 to 1
_tokenIdCounter.increment(); _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(UPGRADER_ROLE, _msgSender());
_tokenIdCounter.increment(); _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(UPGRADER_ROLE, _msgSender());
44,550
46
// Helper function actually performing the burning of tokens./_operator The address performing the burn/_tokenHolder The address holding the tokens being burn/_amount The number of tokens to be burnt/_data Data generated by the token holder/_operatorData Data generated by the operator
function doBurn( address _operator, address _tokenHolder, uint256 _amount, bytes memory _data, bytes memory _operatorData ) internal
function doBurn( address _operator, address _tokenHolder, uint256 _amount, bytes memory _data, bytes memory _operatorData ) internal
2,709
42
// check if TGE reward drawn by user or not
mapping(address => bool) public initialDrawn;
mapping(address => bool) public initialDrawn;
26,436
4
// The sell function will swap the pairedToken to baseToken. The _ratio is the fraction of the total availablepairedToken which shall be traded. The _slippage is the fraction of the price which will be accepted as a minimalreturn for the swap.
function sell(uint256 _ratio, uint256 _slippage) external onlyOwner checkSufficientGasOwner { accumulatedFees = accumulatedFees.add(getAmountOutMin(WETHAddress, baseTokenAddress, IBalanceLogicContract(masterContract.getBalanceLogicAddress()).getSellTransactionFee(_ratio))); uint256 _amountIn = pair...
function sell(uint256 _ratio, uint256 _slippage) external onlyOwner checkSufficientGasOwner { accumulatedFees = accumulatedFees.add(getAmountOutMin(WETHAddress, baseTokenAddress, IBalanceLogicContract(masterContract.getBalanceLogicAddress()).getSellTransactionFee(_ratio))); uint256 _amountIn = pair...
9,740
8
// Returns the amount of rewards available, based on the given timestamp. _lastClaimTime The timestamp of last rewards claim; used for calculating elapsed time.return (uint256) number of tokens available. /
function availableRewards(uint256 _lastClaimTime) external view override returns (uint256) { if (_lastClaimTime < distributionStartTime) { return 0; } // Check for cross-cycle rewards if (_lastClaimTime < getStartOfCurrentCycle()) { return ((getStartOfCurrent...
function availableRewards(uint256 _lastClaimTime) external view override returns (uint256) { if (_lastClaimTime < distributionStartTime) { return 0; } // Check for cross-cycle rewards if (_lastClaimTime < getStartOfCurrentCycle()) { return ((getStartOfCurrent...
22,317
5
// The UNI TOKEN!
UniToken public uniToken;
UniToken public uniToken;
5,201
25
// Burn to mint
uint32 burnPayment; uint16 mintsPerBurn; bool burnClaimActive;
uint32 burnPayment; uint16 mintsPerBurn; bool burnClaimActive;
14,051
81
// value evaluated to Pool's tokens
function value() external view returns (uint256);
function value() external view returns (uint256);
20,954
8
// FactoryMockCyril Lapinte - <cyril.lapinte@openfiz.com>SPDX-License-Identifier: MIT Error messages /
contract FactoryMock is Factory { /** * @dev constructor */ constructor() Factory() {} /** * @dev runtime */ function runtime(uint256 _id) public view returns (bytes memory code) { return runtimeInternal(_id); } /** * @dev readBytecode */ function readyBytecode(address _addr...
contract FactoryMock is Factory { /** * @dev constructor */ constructor() Factory() {} /** * @dev runtime */ function runtime(uint256 _id) public view returns (bytes memory code) { return runtimeInternal(_id); } /** * @dev readBytecode */ function readyBytecode(address _addr...
47,110
234
// Comptroller address for compound.finance
ComptrollerI public constant compound = ComptrollerI(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
ComptrollerI public constant compound = ComptrollerI(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
9,893
16
// Fee collection for any other token / function seizeErc721(IERC721 token, uint256 tokenId) external
// { // require(token != _gegoToken, "nego stake"); // token.safeTransferFrom(address(this), _governance, tokenId); // }
// { // require(token != _gegoToken, "nego stake"); // token.safeTransferFrom(address(this), _governance, tokenId); // }
38,065
8
// signing key does not require high security and can be put on an API server and rotated periodically, as signatures are issued dynamically
function setSigner(address _signer) external onlyRole(OWNER_ROLE) { signer = _signer; }
function setSigner(address _signer) external onlyRole(OWNER_ROLE) { signer = _signer; }
14,612
4
// Add White List /
function addWhiteList( uint256 idoId, address[] memory whiteUsers
function addWhiteList( uint256 idoId, address[] memory whiteUsers
12,774
171
// getManagerForCount(): returns the amount of points _proxy can manage
function getManagerForCount(address _proxy) view external returns (uint256 count)
function getManagerForCount(address _proxy) view external returns (uint256 count)
38,507
13
// Public variables of the token
string public name; string public symbol; uint8 public decimals = 18;
string public name; string public symbol; uint8 public decimals = 18;
27,671
60
// Vitali Hurski
library SnarkLoanLib { using SafeMath for uint256; /// @notice returns maximum duration for which a token can be loaned function getDefaultLoanDuration(address payable storageAddress) public view returns (uint256) { return SnarkStorage(storageAddress).uintStorage(keccak256("defaultLoanDuration")...
library SnarkLoanLib { using SafeMath for uint256; /// @notice returns maximum duration for which a token can be loaned function getDefaultLoanDuration(address payable storageAddress) public view returns (uint256) { return SnarkStorage(storageAddress).uintStorage(keccak256("defaultLoanDuration")...
50,935
37
// update balance
updateAssetBalance(currentIndex);
updateAssetBalance(currentIndex);
57,224
4
// Liquidate a position partially/vaultId The id of the vault/vaultPositionId The id of the vaultPosition/manager The manager of the vaultPosition/liquidator The caller of the function/percent The percentage of the vault user want to liquidate/amount0Left The amount of token0 transferred to the position's manager after...
event LiquidateVaultPositionPartially( uint256 indexed vaultId, uint256 indexed vaultPositionId, address indexed manager, address liquidator, uint16 percent, uint64 timestamp, uint256 price, uint256 debtValueOfPosition, uint256 liquidityValueOf...
event LiquidateVaultPositionPartially( uint256 indexed vaultId, uint256 indexed vaultPositionId, address indexed manager, address liquidator, uint16 percent, uint64 timestamp, uint256 price, uint256 debtValueOfPosition, uint256 liquidityValueOf...
10,118
71
// on buys only
if(zeroBuyTaxmode){ if(tradingOpen && from == uniswapV2Pair) { currenttotalFee=0; }
if(zeroBuyTaxmode){ if(tradingOpen && from == uniswapV2Pair) { currenttotalFee=0; }
38,187
91
// Appends a byte string to a buffer. Resizes if doing so would exceedthe capacity of the buffer.buf The buffer to append to.data The data to append.len The number of bytes to copy. return The original buffer, for chaining./
function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) { return write(buf, buf.buf.length, data, len); }
function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) { return write(buf, buf.buf.length, data, len); }
4,994
26
// "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8"
ds.selectorSlots[_selectorCount >> 3] = _selectorSlot; _selectorSlot = 0;
ds.selectorSlots[_selectorCount >> 3] = _selectorSlot; _selectorSlot = 0;
17,673
154
// Cancels an copyright unconditionally.
function _cancelCopyright(uint256 _tokenId, address _owner) internal { _removeCopyright(_tokenId); _transfer(_owner, _tokenId); emit CopyrightCancelled(_tokenId); }
function _cancelCopyright(uint256 _tokenId, address _owner) internal { _removeCopyright(_tokenId); _transfer(_owner, _tokenId); emit CopyrightCancelled(_tokenId); }
33,840
57
// Vest the tokens into the deposit account and delegate to the beneficiary
require( token.transferFrom(msg.sender, address(this), _amount), "VestingContract::createVestingSchedule: Unable to escrow tokens" ); emit ScheduleCreated(_beneficiary); return true;
require( token.transferFrom(msg.sender, address(this), _amount), "VestingContract::createVestingSchedule: Unable to escrow tokens" ); emit ScheduleCreated(_beneficiary); return true;
25,254
12
// --- ERC-20 variables / https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.mdname function name() constant returns (string name)
string public name = "ACCP";
string public name = "ACCP";
76,117
39
// start sale after initial mint!
function startSale() external onlyOwner { _saleStarted = true; }
function startSale() external onlyOwner { _saleStarted = true; }
16,718
3
// Mint is fired when a new token is minted /
event Mint(address owner, uint256 tokenId);
event Mint(address owner, uint256 tokenId);
31,624
84
// Modifier for accessibility to define new hero types.
modifier onlyAccessMint { require(msg.sender == owner || mintAccess[msg.sender] == true); _; }
modifier onlyAccessMint { require(msg.sender == owner || mintAccess[msg.sender] == true); _; }
11,932
158
// amount to send to treasury. Used for future governance voting power
uint256 public percentKeep; uint256 public constant _denominator = 10000;
uint256 public percentKeep; uint256 public constant _denominator = 10000;
20,100
1
// Pay for a preimage
function commitTo(bytes32 hash) public payable { amount[hash] = msg.value; }
function commitTo(bytes32 hash) public payable { amount[hash] = msg.value; }
21,366
6
// To prepare the arbitrage, BNB is converted to BUSD using PancakeSwap swap contract.
router.convertBnbToBusd(msg.sender, flashLoanAmount / 2);
router.convertBnbToBusd(msg.sender, flashLoanAmount / 2);
14,547
6
// Set the end index to be the last token index
if (stop > stopLimit) { stop = stopLimit; }
if (stop > stopLimit) { stop = stopLimit; }
47,392
29
// Current supply of tokens
uint256 supply = 0;
uint256 supply = 0;
15,013
37
// //Ethereum Address Register Contract/This contract maintains a name service for addresses and miner./Kongliang Zhong - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2d9dddcd5dedbd3dcd5f2deddddc2c0dbdcd59cddc0d5">[email&160;protected]</a>>,/Daniel Wang - <<a href="/cdn-cgi/l/email-protect...
contract NameRegistry { uint public nextId = 0; mapping (uint => Participant) public participantMap; mapping (address => NameInfo) public nameInfoMap; mapping (bytes12 => address) public ownerMap; mapping (address => string) public nameMap; struct NameInfo { bytes12 name;...
contract NameRegistry { uint public nextId = 0; mapping (uint => Participant) public participantMap; mapping (address => NameInfo) public nameInfoMap; mapping (bytes12 => address) public ownerMap; mapping (address => string) public nameMap; struct NameInfo { bytes12 name;...
44,857
16
// Emitted when owner removes a token from the reward tokens list
event RewardTokenRemoved(address token);
event RewardTokenRemoved(address token);
19,956
19
// Burn it
bancorVortex.burn(burnTokens);
bancorVortex.burn(burnTokens);
6,316
329
// 0 is not a valid vote.
require(_vote <= NUM_OF_CHOICES && _vote > 0, "wrong vote value"); require(_amount > 0, "staking amount should be >0"); if (_execute(_proposalId)) { return true; }
require(_vote <= NUM_OF_CHOICES && _vote > 0, "wrong vote value"); require(_amount > 0, "staking amount should be >0"); if (_execute(_proposalId)) { return true; }
7,728
19
// Revert with the same message.
revert(0, returndatasize())
revert(0, returndatasize())
24,959
20
// validates an address - currently only checks that it isn't null
modifier validAddress(address _address) { require(_address != address(0)); _; }
modifier validAddress(address _address) { require(_address != address(0)); _; }
4,680
16
// A simple method to calculate prices from deposits orwithdrawals, excluding fees but including slippage. This ishelpful as an input into the various "min" parameters on callsto fight front-runningThis shouldn't be used outside frontends for user estimates.key Hash of the canonical id + domain amounts an array of toke...
function calculateSwapTokenAmount( bytes32 key, uint256[] calldata amounts, bool deposit
function calculateSwapTokenAmount( bytes32 key, uint256[] calldata amounts, bool deposit
24,098
5
// ========== GOV ONLY ========== /
function setAuthority(IPanaAuthority _newAuthority) external onlyGovernor { authority = _newAuthority; emit AuthorityUpdated(_newAuthority); }
function setAuthority(IPanaAuthority _newAuthority) external onlyGovernor { authority = _newAuthority; emit AuthorityUpdated(_newAuthority); }
21,985
29
// ico1
uint public ico1StartTime = 1547398800; // Wednesday, 30 January 2019 00:00:00 GMT+07:00 uint256 public ico1PerEth = 1366000000000000000000;
uint public ico1StartTime = 1547398800; // Wednesday, 30 January 2019 00:00:00 GMT+07:00 uint256 public ico1PerEth = 1366000000000000000000;
73,692
201
// require(_mappingMintCount[msg.sender] <= PUBLIC_MINT_LIMIT + PRESALE_MINT_LIMIT,"Overflow for PUBLIC_MINT_LIMIT + PRESALE_MINT_LIMIT");
}
}
24,092
281
// clamp amount of tokens in case resulted shares requires less tokens than anticipated
_amount = rate.mul(shares).div(precision); stakeManager.updateValidatorState(validatorId, int256(_amount)); activeAmount = activeAmount.add(_amount); StakingInfo logger = stakingLogger; logger.logShareMinted(validatorId, user, _amount, shares); logger.logStakeUpdate(val...
_amount = rate.mul(shares).div(precision); stakeManager.updateValidatorState(validatorId, int256(_amount)); activeAmount = activeAmount.add(_amount); StakingInfo logger = stakingLogger; logger.logShareMinted(validatorId, user, _amount, shares); logger.logStakeUpdate(val...
42,226
49
// Swap DAI to SUSD
CurveSUSDSwap.exchange(0,3,getTokenBalance(DAI),0);
CurveSUSDSwap.exchange(0,3,getTokenBalance(DAI),0);
36,868
21
// Min possible ballot duration in blocks.
uint256 public constant MIN_DURATION = 17280; // 1 day if 5-second blocks
uint256 public constant MIN_DURATION = 17280; // 1 day if 5-second blocks
54,745
19
// ---------------------------------------------------------------------------- Bonus List - on list or not ----------------------------------------------------------------------------
contract BonusList is BonusListInterface, Operated { mapping(address => bool) public bonusList; event AccountListed(address indexed account, bool status); constructor() public { initOperated(msg.sender); } function isInBonusList(address account) public view returns (bool) { return...
contract BonusList is BonusListInterface, Operated { mapping(address => bool) public bonusList; event AccountListed(address indexed account, bool status); constructor() public { initOperated(msg.sender); } function isInBonusList(address account) public view returns (bool) { return...
18,056
8
// uint8 v=uint8(v1);
addr=ecrecover(_hash, v, r, s);
addr=ecrecover(_hash, v, r, s);
10,124
12
// The percentage of profit recognized each harvest to reserve as fees./A fixed point number where 1e18 represents 100% and 0 represents 0%.
uint256 public feePercent;
uint256 public feePercent;
6,119
108
// Withdraws the beneficiary's funds. /
function beneficiaryWithdraw() public { require(_state == State.Closed); _beneficiary.transfer(address(this).balance); }
function beneficiaryWithdraw() public { require(_state == State.Closed); _beneficiary.transfer(address(this).balance); }
5,542
78
// Emitted when ETH is withdrawn and FEM is burned. /
event Withdraw(address indexed account, uint256 amount);
event Withdraw(address indexed account, uint256 amount);
59,366
33
// clothing
rarities[8] = [255]; aliases[8] = [0];
rarities[8] = [255]; aliases[8] = [0];
11,823
35
// We follow the equations described in https:pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf Section 5
uint[4] memory zs; // z1^2, z1^3, z2^2, z2^3 zs[0] = mulmod(_z1, _z1, _pp); zs[1] = mulmod(_z1, zs[0], _pp); zs[2] = mulmod(_z2, _z2, _pp); zs[3] = mulmod(_z2, zs[2], _pp);
uint[4] memory zs; // z1^2, z1^3, z2^2, z2^3 zs[0] = mulmod(_z1, _z1, _pp); zs[1] = mulmod(_z1, zs[0], _pp); zs[2] = mulmod(_z2, _z2, _pp); zs[3] = mulmod(_z2, zs[2], _pp);
27,891
161
// Transfer tokens from one address to anotherfrom address The address which you want to send tokens fromto address The address which you want to transfer tovalue uint256 the amount of tokens to be transferred/
function transferFrom( address from, address to, uint256 value ) public canTransfer(to) returns (bool)
function transferFrom( address from, address to, uint256 value ) public canTransfer(to) returns (bool)
34,617
111
// SPDX-License-Identifier: Unlicense
// import {RLPReader} from "../../extLib/FxPortal/lib/RLPReader.sol"; interface IFxStateSender { function sendMessageToChild(address _receiver, bytes calldata _data) external; }
// import {RLPReader} from "../../extLib/FxPortal/lib/RLPReader.sol"; interface IFxStateSender { function sendMessageToChild(address _receiver, bytes calldata _data) external; }
31,852
8
// onlyOwner函数修改器:判断合约使用者是不是合约拥有者,是合约拥有者才能执行 /
modifier onlyOwner() { require(msg.sender == owner_); _; }
modifier onlyOwner() { require(msg.sender == owner_); _; }
39,119
398
// staker liquidity asset/This function calculates liquidity asset/ return liquidity asset
function stakerAssets() public view returns (uint256){ uint256 total; address ioTokenAddr=address(ioToken); uint256 length = stakers.length(); for (uint256 i = 0; i < length; i++) { uint256 tokenId = stakers.at(i); total = total.add(caclLiquidityAssets(tokenId...
function stakerAssets() public view returns (uint256){ uint256 total; address ioTokenAddr=address(ioToken); uint256 length = stakers.length(); for (uint256 i = 0; i < length; i++) { uint256 tokenId = stakers.at(i); total = total.add(caclLiquidityAssets(tokenId...
1,991
9
// Mapping of interface ids to whether or not it's supported./
mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal {
mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal {
50,071
27
// Upgrade the address of the logic contract for this proxy Recreation of AdminUpgradeabilityProxy._upgradeTo. Adds a check to ensure msg.sender is the Audius Proxy Admin _newImplementation - new address of logic contract that the proxy will point to /
function upgradeTo(address _newImplementation) external { require(msg.sender == proxyAdmin, ERROR_ONLY_ADMIN); _upgradeTo(_newImplementation); }
function upgradeTo(address _newImplementation) external { require(msg.sender == proxyAdmin, ERROR_ONLY_ADMIN); _upgradeTo(_newImplementation); }
1,527
298
// Register ID if not already done
if (addressId == 0) { nTokens += 1; // Increment number of tokens registered id = nTokens; // id of token is the current # of tokens IDtoAddress[id] = _token; // Map id to token address addressToID[_token] = id; // Register token
if (addressId == 0) { nTokens += 1; // Increment number of tokens registered id = nTokens; // id of token is the current # of tokens IDtoAddress[id] = _token; // Map id to token address addressToID[_token] = id; // Register token
9,751
257
// ERC721 Non-Fungible Token Standard basic implementationThis is the same contract at `openzeppelin/contracts 3.1.0` but `tokenURI` was changed to virtual override /
contract ERC721Initializable is ContextMixin, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals ...
contract ERC721Initializable is ContextMixin, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals ...
27,005
64
// require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
super._willFallback();
16,397
9
// for debug
function setReleaseTime(uint256 _releaseTime) public { releaseTime = _releaseTime; }
function setReleaseTime(uint256 _releaseTime) public { releaseTime = _releaseTime; }
20,955
103
// check if 1 day passed after last paymentrequire(now.sub(getMemInvestor(msg.sender).paymentTime) > 24 hours);
uint dividends = calcDividends(msg.sender); require (dividends.notZero(), "cannot to pay zero dividends");
uint dividends = calcDividends(msg.sender); require (dividends.notZero(), "cannot to pay zero dividends");
29,466
96
// Adding to a set is an idempotent operation.
if (!contains(set, element)) { set.indices[element] = set.elements.length; set.elements.push(element); }
if (!contains(set, element)) { set.indices[element] = set.elements.length; set.elements.push(element); }
30,085
66
// Remove all Ether from the contract, which is the owner's cuts/as well as any Ether sent directly to the contract address./Always transfers to the NFT contract, but can be called either by/the owner or the NFT contract.
function withdrawBalance() external { address nftAddress = address(nonFungibleContract); require( msg.sender == owner || msg.sender == nftAddress ); // We are using this boolean method to make sure that even if one fails it will still work nftAddress....
function withdrawBalance() external { address nftAddress = address(nonFungibleContract); require( msg.sender == owner || msg.sender == nftAddress ); // We are using this boolean method to make sure that even if one fails it will still work nftAddress....
40,928
284
// See {IERC1155MetadataURI-uri}. Revert for unminted SFT NFTs. /
function uri(uint256 tokenId) public view override returns (string memory) {
function uri(uint256 tokenId) public view override returns (string memory) {
55,992
34
// par is a ray, pip returns a wad
tag[ilk] = wdiv(spot.par(), uint256(pip.read())); emit Cage(ilk);
tag[ilk] = wdiv(spot.par(), uint256(pip.read())); emit Cage(ilk);
70,097
53
// Creates a token/Constructor/_name Name of the token/_symbol Acronim of the token/_decimals Number of decimals of the token/_transferableDate Timestamp from when the token can de transfered
constructor( string memory _name, string memory _symbol, uint _decimals, uint _transferableDate
constructor( string memory _name, string memory _symbol, uint _decimals, uint _transferableDate
12,103
8
// Gift a single token
function gift(address to) external override payable onlyOwner { require(totalSupply() < BERRIES_MAX, 'All tokens have been minted'); require(_specialStrawberries.current() < BERRIES_GIFT, 'No tokens left to gift'); uint256 tokenId = BERRIES_SPECIAL + _specialStrawberries.current(); _specialStrawberr...
function gift(address to) external override payable onlyOwner { require(totalSupply() < BERRIES_MAX, 'All tokens have been minted'); require(_specialStrawberries.current() < BERRIES_GIFT, 'No tokens left to gift'); uint256 tokenId = BERRIES_SPECIAL + _specialStrawberries.current(); _specialStrawberr...
73,490
126
// //Stake SUSHI `amount` into crSUSHI and BENTO for benefit of `to` by batching calls to `crSushiToken` and `bento`.
function sushiToCreamToBento(address to, uint256 amount) external returns (uint256 amountOut, uint256 shareOut) { sushiToken.safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` SUSHI `amount` into this contract ICompoundBridge(crSushiToken).mint(amount); // stake deposited S...
function sushiToCreamToBento(address to, uint256 amount) external returns (uint256 amountOut, uint256 shareOut) { sushiToken.safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` SUSHI `amount` into this contract ICompoundBridge(crSushiToken).mint(amount); // stake deposited S...
14,768
23
// First 90 days 50% yearly Next 90 days 40% Next 90 days 30% Next 90 days 20% Next 2190 days 10%
function getRate(uint cycle) constant returns (uint) { if (cycle <= 9) { return 50; } if (cycle <= 18) { return 40; } if (cycle <= 27) { return 30; } if (cycle <= 35) { // not 36 because 36 is elDay return 20; ...
function getRate(uint cycle) constant returns (uint) { if (cycle <= 9) { return 50; } if (cycle <= 18) { return 40; } if (cycle <= 27) { return 30; } if (cycle <= 35) { // not 36 because 36 is elDay return 20; ...
3,775
9
// Returns the number of retired EAVs in the tokenId/
function getRetiredEAVs(uint256 tokenId) public view returns (uint256) { return eavTokens[tokenId].retiredEAVs; }
function getRetiredEAVs(uint256 tokenId) public view returns (uint256) { return eavTokens[tokenId].retiredEAVs; }
30,275
26
// Send event on all tickets sold.
if (lotteries[lottId].ticketsSold.length == lotteries[lottId].numTickets) { onLotteryCompleted(lottId); }
if (lotteries[lottId].ticketsSold.length == lotteries[lottId].numTickets) { onLotteryCompleted(lottId); }
47,410
58
// a token has been transferred to this contract mark which local token is to now own it
* Emits a {ReceivedChild} event. * * @param _from the address who sent the token to this contract * @param _tokenId the local token ID that is to be the parent * @param _childContract the address of the child token's contract * @param _childTokenId the ID value of teh incoming child token ...
* Emits a {ReceivedChild} event. * * @param _from the address who sent the token to this contract * @param _tokenId the local token ID that is to be the parent * @param _childContract the address of the child token's contract * @param _childTokenId the ID value of teh incoming child token ...
35,848
365
// Changes number of days for which NXM needs to staked in case of underwriting /
function _changeSCValidDays(uint _days) internal { scValidDays = _days; }
function _changeSCValidDays(uint _days) internal { scValidDays = _days; }
1,953
23
// import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { MerkleProof } from "@openzeppelin/contracts/cryptography/MerkleProof.sol"; import { IMerkleDistributor } from "contracts/interfaces/IMerkleDistributor.sol";
address public immutable override token; bytes32 public immutable override merkleRoot;
address public immutable override token; bytes32 public immutable override merkleRoot;
11,680
29
// Equipments owner by the owner (array)
mapping (address => uint256[]) ownerToFashionArray;
mapping (address => uint256[]) ownerToFashionArray;
31,306
168
// Calculate and mint the amount of xABR the ABR is worth. The ratio will change overtime,as xABR is burned/minted and ABR deposited + gained from fees / withdrawn.
else { uint256 what = _amount * totalShares / totalABR; _mint(msg.sender, what); }
else { uint256 what = _amount * totalShares / totalABR; _mint(msg.sender, what); }
17,454
96
// A crowdsaled token. An ERC-20 token designed specifically for crowdsales with investor protection and further development path. - The token transfer() is disabled until the crowdsale is over- The token contract gives an opt-in upgrade path to a new contract- The same token can be part of several crowdsales through a...
contract CrowdsaleTokenExt is ReleasableToken, MintableTokenExt, UpgradeableToken { /** Name and symbol were updated. */ event UpdatedTokenInformation(string newName, string newSymbol); event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); string public name; string publi...
contract CrowdsaleTokenExt is ReleasableToken, MintableTokenExt, UpgradeableToken { /** Name and symbol were updated. */ event UpdatedTokenInformation(string newName, string newSymbol); event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); string public name; string publi...
12,888
47
// Is currently in the period after the private start time and before the public start time.
modifier is_pre_crowdfund_period() { if (now >= publicStartTime || now < privateStartTime) throw; _; }
modifier is_pre_crowdfund_period() { if (now >= publicStartTime || now < privateStartTime) throw; _; }
18,240
164
// Record a bounty that an arbiter has voted onarbiter The address of the arbiter bountyGuid The guid of the bounty /
function recordBounty(address arbiter, uint128 bountyGuid, uint256 blockNumber) public { require(msg.sender == address(registry), "Can only be called by the BountyRegistry."); require(arbiter != address(0), "Invalid arbiter address"); require(blockNumber != 0, "Invalid block number"); ...
function recordBounty(address arbiter, uint128 bountyGuid, uint256 blockNumber) public { require(msg.sender == address(registry), "Can only be called by the BountyRegistry."); require(arbiter != address(0), "Invalid arbiter address"); require(blockNumber != 0, "Invalid block number"); ...
30,077