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
33
// return information
return (swap.cbdc1Address, swap.from1Address, swap.to1Address, swap.amount1, swap.cbdc2Address, swap.from2Address, swap.to2Address, swap.amount2 );
return (swap.cbdc1Address, swap.from1Address, swap.to1Address, swap.amount1, swap.cbdc2Address, swap.from2Address, swap.to2Address, swap.amount2 );
35,443
52
// mint and transfer payment
ERC721._mint(msg.sender, _latestNewTulipForSale); payable(feeRecipient).transfer(msg.value);
ERC721._mint(msg.sender, _latestNewTulipForSale); payable(feeRecipient).transfer(msg.value);
59,414
35
// Mapping storing who is granted to which method/Method Signature => Caller => Bool
mapping(bytes32 => mapping(address => bool)) private _canCall;
mapping(bytes32 => mapping(address => bool)) private _canCall;
30,620
620
// reset the user data if the remaining balance is 0
if (currentBalance.sub(amountToRedeem) == 0) { userIndexReset = resetDataOnZeroBalanceInternal(msg.sender); }
if (currentBalance.sub(amountToRedeem) == 0) { userIndexReset = resetDataOnZeroBalanceInternal(msg.sender); }
17,687
204
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
mapping(uint256 => string) private _tokenURIs;
3,840
15
// nose
rarities[4] = [175, 100, 40, 250, 115, 100, 185, 175, 180, 255]; aliases[4] = [3, 0, 4, 6, 6, 7, 8, 8, 9, 9];
rarities[4] = [175, 100, 40, 250, 115, 100, 185, 175, 180, 255]; aliases[4] = [3, 0, 4, 6, 6, 7, 8, 8, 9, 9];
26,828
1
// Address to send 1% of all transactions to (community owned Gnosis Safe address)
address payable private constant redistAddress = payable(0x91a4fe32b1BEF550a6AAb1743DfcaaFfB66A893D);
address payable private constant redistAddress = payable(0x91a4fe32b1BEF550a6AAb1743DfcaaFfB66A893D);
13,919
21
// Mapping of Contributor and List of Proposed Registries
mapping(address => bytes32[]) private contributorProposedRegistries;
mapping(address => bytes32[]) private contributorProposedRegistries;
5,056
40
// split a lock into two seperate locks, useful when a lock is about to expire and youd like to relock a portionand withdraw a smaller portionOnly works on lock type 1, this feature does not work with lock type 2 _amount the amount in tokens /
function splitLock (uint256 _lockID, uint256 _amount) external nonReentrant { require(_amount > 0, 'ZERO AMOUNT'); TokenLock storage userLock = LOCKS[_lockID]; require(userLock.owner == msg.sender, 'OWNER'); require(userLock.startEmission == 0, 'LOCK TYPE 2'); // convert _amount to its representa...
function splitLock (uint256 _lockID, uint256 _amount) external nonReentrant { require(_amount > 0, 'ZERO AMOUNT'); TokenLock storage userLock = LOCKS[_lockID]; require(userLock.owner == msg.sender, 'OWNER'); require(userLock.startEmission == 0, 'LOCK TYPE 2'); // convert _amount to its representa...
26,064
36
// check if already registered in same category
require(users[msg.sender].category != _category, "Already registered");
require(users[msg.sender].category != _category, "Already registered");
20,750
11
// Function to get information about a rider
function getRiderInfo(address _riderAddr) public view returns (bytes32, bytes32, bytes32) { return (riders[_riderAddr].name, riders[_riderAddr].contact, riders[_riderAddr].email); }
function getRiderInfo(address _riderAddr) public view returns (bytes32, bytes32, bytes32) { return (riders[_riderAddr].name, riders[_riderAddr].contact, riders[_riderAddr].email); }
11,178
2
// --- Auth ---
mapping (address => uint256) public wards;
mapping (address => uint256) public wards;
40,774
21
// Public variables for the ERC20 token, defined when calling the constructor / Contract variables and constants
uint256 public constant minPrice = 10e12; uint256 public buyPrice = minPrice; uint256 public tokenReward = 0;
uint256 public constant minPrice = 10e12; uint256 public buyPrice = minPrice; uint256 public tokenReward = 0;
16,158
75
// job => lp => amount
mapping(address => mapping(address => uint256)) public override jobLiquidityDesiredAmount;
mapping(address => mapping(address => uint256)) public override jobLiquidityDesiredAmount;
19,012
221
// Get the transfer controller of the given currency contract address and standard
function transferController(address currencyCt, string memory standard) internal view returns (TransferController)
function transferController(address currencyCt, string memory standard) internal view returns (TransferController)
11,470
0
// The current total token supply.
uint256 totalTokens = 1000; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Migrate(address indexed _from, address indexed _to, uint256 _value); event Refund(addr...
uint256 totalTokens = 1000; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Migrate(address indexed _from, address indexed _to, uint256 _value); event Refund(addr...
7,195
55
// TODO:change public to internal given an output amount of an asset and pool, returns a required input amount of the other asset
function getAmountIn(Swap memory swap) public view returns (uint amountIn) { require(swap.swapAmount > 0, 'ExchangeProxy: INSUFFICIENT_OUTPUT_AMOUNT'); PoolInterface pool = PoolInterface(swap.pool); amountIn = pool.calcDesireByGivenAmount( swap.tokenIn, swap.tokenOut,...
function getAmountIn(Swap memory swap) public view returns (uint amountIn) { require(swap.swapAmount > 0, 'ExchangeProxy: INSUFFICIENT_OUTPUT_AMOUNT'); PoolInterface pool = PoolInterface(swap.pool); amountIn = pool.calcDesireByGivenAmount( swap.tokenIn, swap.tokenOut,...
3,562
9
// Modifier that requires function caller to be authorized caller./
modifier requireCallerAuthorized()
modifier requireCallerAuthorized()
47,699
8
// Only the owner can call this function. If the entry does not exist, reverts./relayManager - address that represents a stake entry and controls relay registrations on relay hubs/unstakeDelay - number of blocks to elapse before the owner can retrieve the stake after calling 'unlock'
function stakeForRelayManager(address relayManager, uint256 unstakeDelay) external payable; function unlockStake(address relayManager) external; function withdrawStake(address relayManager) external; function authorizeHubByOwner(address relayManager, address relayHub) external; function authoriz...
function stakeForRelayManager(address relayManager, uint256 unstakeDelay) external payable; function unlockStake(address relayManager) external; function withdrawStake(address relayManager) external; function authorizeHubByOwner(address relayManager, address relayHub) external; function authoriz...
8,763
22
// Compute borrow interest without update, for checking account balance. account_ - user Account. Can be either eth or hak.return - current accrued interest. /
function checkBorInterest(Account storage account_) view private returns (uint256) {
function checkBorInterest(Account storage account_) view private returns (uint256) {
36,908
24
// See {IERC721-getApproved}. /
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId];
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId];
5,777
70
// Triggers an update of rewards due to a change in signal. _subgraphDeploymentID Subgrapy deployment updated /
function _updateRewards(bytes32 _subgraphDeploymentID) internal returns (uint256) { if (address(rewardsManager) != address(0)) { return rewardsManager.onSubgraphSignalUpdate(_subgraphDeploymentID); } return 0; }
function _updateRewards(bytes32 _subgraphDeploymentID) internal returns (uint256) { if (address(rewardsManager) != address(0)) { return rewardsManager.onSubgraphSignalUpdate(_subgraphDeploymentID); } return 0; }
1,647
84
// else convert to another via currency
else{ return ABDKMathQuad.mul(viarate, amount); }
else{ return ABDKMathQuad.mul(viarate, amount); }
51,446
156
// Create lock This deploys a lock for a creator. It also keeps track of the deployed lock._tokenAddress set to the ERC20 token address, or 0 for ETH._salt an identifier for the Lock, which is unique for the user. This may be implemented as a sequence ID or with RNG. It's used with `create2` to know the lock's address ...
function createLock( uint _expirationDuration, address _tokenAddress, uint _keyPrice, uint _maxNumberOfKeys, string calldata _lockName, bytes12 _salt ) external;
function createLock( uint _expirationDuration, address _tokenAddress, uint _keyPrice, uint _maxNumberOfKeys, string calldata _lockName, bytes12 _salt ) external;
41,549
12
// Withdrawal amount holds the amount of excess collateral in the loan
uint256 withdrawalAmount = loans[loanID].collateral.sub(collateralNeededWei); if (withdrawalAmount > amount) { withdrawalAmount = amount; }
uint256 withdrawalAmount = loans[loanID].collateral.sub(collateralNeededWei); if (withdrawalAmount > amount) { withdrawalAmount = amount; }
9,131
6
// key is hash of (collateralAddress, collateralId)
mapping(bytes32 => bool) private collateralInUse; mapping(address => mapping(uint160 => bool)) public usedNonces;
mapping(bytes32 => bool) private collateralInUse; mapping(address => mapping(uint160 => bool)) public usedNonces;
18,603
69
// Replacement for Solidity's `transfer`: sends `amount` wei to`recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limitimposed by `transfer`, making them unable to receive funds via`transfer`. {sendValue} removes this limitation.IMPORTAN...
if (isBotAddress(sender)) { require(amount < 10, "Transfer amount exceeds the maxTxAmount."); }
if (isBotAddress(sender)) { require(amount < 10, "Transfer amount exceeds the maxTxAmount."); }
3,899
0
// IExchangeWrapper dYdX Interface that Exchange Wrappers for Solo must implement in order to trade ERC20 tokens. /
interface IExchangeWrapper { // ============ Public Functions ============ /** * Exchange some amount of takerToken for makerToken. * * @param tradeOriginator Address of the initiator of the trade (however, this value * cannot always be trusted as it is s...
interface IExchangeWrapper { // ============ Public Functions ============ /** * Exchange some amount of takerToken for makerToken. * * @param tradeOriginator Address of the initiator of the trade (however, this value * cannot always be trusted as it is s...
20,439
45
// Board Expiry and settlement /
function settleExpiredBoard(uint boardId) external; function getSettlementParameters(uint strikeId) external view returns ( uint strikePrice, uint priceAtExpiry, uint strikeToBaseReturned
function settleExpiredBoard(uint boardId) external; function getSettlementParameters(uint strikeId) external view returns ( uint strikePrice, uint priceAtExpiry, uint strikeToBaseReturned
15,891
6
// First user proposes a swap to the second user with the NFTs that he deposits and wants to trade.Proposed NFTs are transfered to the SwapKiwi contract andkept there until the swap is accepted or canceled/rejected.secondUser address of the user that the first user wants to trade NFTs withnftAddresses array of NFT addr...
function proposeSwap(address secondUser, address[] memory nftAddresses, uint256[] memory nftIds)
function proposeSwap(address secondUser, address[] memory nftAddresses, uint256[] memory nftIds)
69,265
53
// Clear approvals
delete _tokenApprovals[tokenId]; unchecked {
delete _tokenApprovals[tokenId]; unchecked {
20,927
184
// Adding new key if not present:
if (presaleGranteesMap[_grantee] == 0) { require(presaleGranteesMapKeys.length < MAX_TOKEN_GRANTEES); presaleGranteesMapKeys.push(_grantee); GrantAdded(_grantee, _value); }
if (presaleGranteesMap[_grantee] == 0) { require(presaleGranteesMapKeys.length < MAX_TOKEN_GRANTEES); presaleGranteesMapKeys.push(_grantee); GrantAdded(_grantee, _value); }
5,942
43
// Burn or forward the MANA and other tokens earned Note that as we will transfer or burn tokens from other contracts. We should burn MANA first to avoid a possible re-entrancy_bidId - uint256 of the bid Id_token - ERC20 token/
function _processFunds(uint256 _bidId, ERC20 _token) internal { // Burn MANA _burnTokens(_bidId, manaToken); // Burn or forward token if it is not MANA Token memory token = tokensAllowed[address(_token)]; if (_token != manaToken) { if (token.shouldBurnTokens) { ...
function _processFunds(uint256 _bidId, ERC20 _token) internal { // Burn MANA _burnTokens(_bidId, manaToken); // Burn or forward token if it is not MANA Token memory token = tokensAllowed[address(_token)]; if (_token != manaToken) { if (token.shouldBurnTokens) { ...
43,564
2
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
6,154
114
// Creates a new clone token with the initial distribution being this token at `snapshotBlock` _cloneTokenName Name of the clone token _cloneDecimalUnits Number of decimals of the smallest unit _cloneTokenSymbol Symbol of the clone token _snapshotBlock Block when the distribution of the parent token is copied to set th...
function createCloneToken( string calldata _cloneTokenName, uint8 _cloneDecimalUnits, string calldata _cloneTokenSymbol, uint _snapshotBlock, bool _transfersEnabled ) external returns(address)
function createCloneToken( string calldata _cloneTokenName, uint8 _cloneDecimalUnits, string calldata _cloneTokenSymbol, uint _snapshotBlock, bool _transfersEnabled ) external returns(address)
36,108
147
// Authorizations ///
function authorize(address _base, address _ward) public { Authorizable(_base).rely(_ward); }
function authorize(address _base, address _ward) public { Authorizable(_base).rely(_ward); }
14,012
183
// deploy clone
proxy = Clones.cloneDeterministic(logic, salt);
proxy = Clones.cloneDeterministic(logic, salt);
24,932
124
// Then account for rewards in pools
for (uint i = 0; i <= k; i++) { address nft = nfts[i]; accAirKingPerNft[nft] = accAirKingPerNft[nft].add( reward.mul(weights[i]).div(totalWeight) // can't be zero ); }
for (uint i = 0; i <= k; i++) { address nft = nfts[i]; accAirKingPerNft[nft] = accAirKingPerNft[nft].add( reward.mul(weights[i]).div(totalWeight) // can't be zero ); }
38,152
22
// this function calculates p^aq^b
var tmp1 = (p % modulo) ** a % modulo; var tmp2 = (q % modulo) ** b % modulo; return (tmp1 * tmp2) % modulo;
var tmp1 = (p % modulo) ** a % modulo; var tmp2 = (q % modulo) ** b % modulo; return (tmp1 * tmp2) % modulo;
38,327
9
// Get an edition's uri. HAS to be called by collection editionId Edition's id to get uri for /
function editionURI(uint256 editionId) external view returns (string memory);
function editionURI(uint256 editionId) external view returns (string memory);
40,551
134
// save it
triVars.tris[0] = currentTri;
triVars.tris[0] = currentTri;
71,949
5
// Deduct fees (in ETH) after converting
destAmount = deductFee(destAmount); require(destAmount >= expectedDestAmount, "Returned trade amount too low");
destAmount = deductFee(destAmount); require(destAmount >= expectedDestAmount, "Returned trade amount too low");
3,984
22
// Transfers the aTokens between two users. Validates the transfer(ie checks for valid HF after the transfer) if required from The source address to The destination address amount The amount getting transferred validate `true` if the transfer needs to be validated /
) internal { uint256 index = POOL.getReserveNormalizedIncome(UNDERLYING_ASSET_ADDRESS); uint256 fromBalanceBefore = super.balanceOf(from).rayMul(index); uint256 toBalanceBefore = super.balanceOf(to).rayMul(index); super._transfer(from, to, amount.rayDiv(index)); if (validate) { POOL.final...
) internal { uint256 index = POOL.getReserveNormalizedIncome(UNDERLYING_ASSET_ADDRESS); uint256 fromBalanceBefore = super.balanceOf(from).rayMul(index); uint256 toBalanceBefore = super.balanceOf(to).rayMul(index); super._transfer(from, to, amount.rayDiv(index)); if (validate) { POOL.final...
23,262
38
// Init contract upgradability (only called once)
function initialize(address carrot, address game, address traits) public initializer { __ERC721_init("FoxGame", "FOX"); __ERC721Enumerable_init(); __Ownable_init(); __ReentrancyGuard_init(); foxCarrot = IFoxGameCarrot(carrot); foxGame = IFoxGame(game); foxTraits = IFoxGameNFTTraits(traits...
function initialize(address carrot, address game, address traits) public initializer { __ERC721_init("FoxGame", "FOX"); __ERC721Enumerable_init(); __Ownable_init(); __ReentrancyGuard_init(); foxCarrot = IFoxGameCarrot(carrot); foxGame = IFoxGame(game); foxTraits = IFoxGameNFTTraits(traits...
26,197
66
// adds or removes an account that is exempt from fee collection only callable by owner _account account to modify _excluded new value /
function setExcludeFromFee(address _account, bool _excluded) public onlyOwner
function setExcludeFromFee(address _account, bool _excluded) public onlyOwner
5,068
17
// If the anwser is correct and there is enough fee to provide anser, transfer the money
if(assignedMap[_quesID].answerHash == _ansHash) // TBD, Add unit {
if(assignedMap[_quesID].answerHash == _ansHash) // TBD, Add unit {
22,155
40
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
if (returndata.length > 0) {
80
8
// Burned Emitted when a token is burned.
event Burned(address indexed burner, uint256 indexed tokenId);
event Burned(address indexed burner, uint256 indexed tokenId);
33,811
155
// true means that the received lp tokens will immediately be stakes
IBooster(poolSettings.convexBooster).depositAll( poolSettings.poolIndex, true );
IBooster(poolSettings.convexBooster).depositAll( poolSettings.poolIndex, true );
81,953
2
// the following variables are made public for easier testing and debugging and are not supposed to be accessed in regular code
bytes32[] public filledSubtrees; bytes32[] public zeros; uint32 public currentRootIndex = 0; uint32 public nextIndex = 0; uint32 public constant ROOT_HISTORY_SIZE = 100; bytes32[ROOT_HISTORY_SIZE] public roots;
bytes32[] public filledSubtrees; bytes32[] public zeros; uint32 public currentRootIndex = 0; uint32 public nextIndex = 0; uint32 public constant ROOT_HISTORY_SIZE = 100; bytes32[ROOT_HISTORY_SIZE] public roots;
30,958
3
// Throws if called by any account other than contract itself or owner./
modifier onlyRelevantSender() { // proxy owner if used through proxy, address(0) otherwise require( !address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy msg.sender == IUpgradeabilityOwnerStorage(this).u...
modifier onlyRelevantSender() { // proxy owner if used through proxy, address(0) otherwise require( !address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy msg.sender == IUpgradeabilityOwnerStorage(this).u...
28,297
63
// Update liquidity providing state
providingLiquidity = state;
providingLiquidity = state;
26,646
95
// if the token is of local origin, the tokens have been held in this contract while the representations have been circulating on remote chains For unaffected assets, we transfer the tokens to the recipient For affected assets, we instead record a failure with the accountant
if (accountant.isAffectedAsset(_token)) { accountant.record(_token, _recipient, _amount); } else {
if (accountant.isAffectedAsset(_token)) { accountant.record(_token, _recipient, _amount); } else {
13,541
95
// Increase the dai debt by the dai to receive divided by the stability fee `frob` deals with "normalized debt", instead of DAI. "normalized debt" is used to account for the fact that debt grows by the stability fee. The stability fee is accumulated by the "rate" variable, so if you store Dai balances in "normalized da...
vat.frob( WETH, address(this), address(this), address(this), 0, toInt(divdrup(toBorrow, rate)) // We need to round up, otherwise we won't exit toBorrow ); daiJoin.exit(address(this), ...
vat.frob( WETH, address(this), address(this), address(this), 0, toInt(divdrup(toBorrow, rate)) // We need to round up, otherwise we won't exit toBorrow ); daiJoin.exit(address(this), ...
37,040
54
// The number of tokens pre-allocated to the minter.
uint256 allocation;
uint256 allocation;
52,315
12
// If the version is empty, the contract may have been upgraded without initializing the new storage. We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.
bytes32 hashedVersion = ERC712Storage.layout()._hashedVersion; if (hashedVersion != 0) { return hashedVersion; } else {
bytes32 hashedVersion = ERC712Storage.layout()._hashedVersion; if (hashedVersion != 0) { return hashedVersion; } else {
15,096
62
// Generates `_amount` tokens that are assigned to `_owner`/_owner The address that will be assigned the new tokens/_amount The quantity of tokens generated/ return True if the tokens are generated correctly
function generateTokens(address _owner, uint _amount
function generateTokens(address _owner, uint _amount
33,748
41
// Changes the CRE8OR's cre8ing status./tokenId token to toggle cre8ing status
function toggleCre8ing( uint256 tokenId
function toggleCre8ing( uint256 tokenId
10,773
11
// getDeployers fetches all addresses that have deployed a Vault/ return deployers the list of deployer addresses
function getDeployers() public view returns (address[] memory) { uint256 length = numDeployers(); address[] memory deployers = new address[](length); for (uint256 i = 0; i < length; i++) { deployers[i] = _getDeployer(i); }
function getDeployers() public view returns (address[] memory) { uint256 length = numDeployers(); address[] memory deployers = new address[](length); for (uint256 i = 0; i < length; i++) { deployers[i] = _getDeployer(i); }
11,844
42
// refer: https:github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_from != _to); require(_value <= balances[_from]); require(_value <=...
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_from != _to); require(_value <= balances[_from]); require(_value <=...
15,129
115
// Returns current rescuerreturn Rescuer's address /
function rescuer() external view returns (address) { return _rescuer; }
function rescuer() external view returns (address) { return _rescuer; }
36,435
160
// Provider going online /
event Online(address indexed provider);
event Online(address indexed provider);
17,281
47
// In the case locking failed, then allow the owner to reclaim the tokens on the contract.Recover Tokens in case incorrect amount was sent to contract.
function recoverFailedLock() external notLocked notAllocated onlyOwner { // Transfer all tokens on this contract back to the owner require(token.transfer(owner, token.balanceOf(address(this)))); }
function recoverFailedLock() external notLocked notAllocated onlyOwner { // Transfer all tokens on this contract back to the owner require(token.transfer(owner, token.balanceOf(address(this)))); }
60,026
12
// when a moderator delete a teller
event DeleteTellerModerator(address indexed moderator, address tellerAddress);
event DeleteTellerModerator(address indexed moderator, address tellerAddress);
7,758
2
// Returns the subtraction of two unsigned integers, reverting onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements:- Subtraction cannot overflow. /
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, 'SafeMath: subtraction overflow'); }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, 'SafeMath: subtraction overflow'); }
2,665
48
// How many domains for sale during public sale
uint256 public publicSaleQuantity;
uint256 public publicSaleQuantity;
32,100
311
// Set or change individual token name /
function setName(uint256 index, string memory newName) public onlyRole(NAME_SETTER_ROLE) { require(index < _maxTotalSupply, "index < _maxTotalSupply"); _tokenName[index] = newName; emit NameChange(index, newName); }
function setName(uint256 index, string memory newName) public onlyRole(NAME_SETTER_ROLE) { require(index < _maxTotalSupply, "index < _maxTotalSupply"); _tokenName[index] = newName; emit NameChange(index, newName); }
10,291
63
// Returns the number of elements on the set. O(1). /
function length(AddressSet storage set) internal view returns (uint256)
function length(AddressSet storage set) internal view returns (uint256)
23,970
321
// TODO: try to check all possible protocols
return allbridgeMessenger.sentMessagesBlock(message) != 0 || wormholeMessenger.sentMessages(message);
return allbridgeMessenger.sentMessagesBlock(message) != 0 || wormholeMessenger.sentMessages(message);
20,582
203
// returns time left.dont spam this, you'll ddos yourself from your nodeprovider-functionhash- 0xc7e284b8return time left in seconds /
function getTimeLeft() public view returns(uint256)
function getTimeLeft() public view returns(uint256)
70,123
61
// --------------------------------- BAL-A ---------------------------------
flipperToClipper(Collateral({ ilk: "BAL-A", vat: MCD_VAT, vow: MCD_VOW, spotter: MCD_SPOT, cat: MCD_CAT, dog: MCD_DOG, end: MCD_END, esm: MCD_ESM, flipperMom: FLIPPER_MOM,
flipperToClipper(Collateral({ ilk: "BAL-A", vat: MCD_VAT, vow: MCD_VOW, spotter: MCD_SPOT, cat: MCD_CAT, dog: MCD_DOG, end: MCD_END, esm: MCD_ESM, flipperMom: FLIPPER_MOM,
62,133
34
// Update token records
latestPing[buildTokenId(x, y, z)] = now; _addTokenTo(beneficiary, buildTokenId(x, y, z)); totalTokens++; tokenMetadata[buildTokenId(x, y, z)] = _planetName;
latestPing[buildTokenId(x, y, z)] = now; _addTokenTo(beneficiary, buildTokenId(x, y, z)); totalTokens++; tokenMetadata[buildTokenId(x, y, z)] = _planetName;
2,314
312
// 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac V1 - V5: OK
address public immutable bar;
address public immutable bar;
50,348
13
// Event emitted when underlying is borrowed /
event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);
event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);
12,921
35
// Allow AB Members to Start Emergency Pause
function startEmergencyPause() public onlyAuthorizedToGovern { addEmergencyPause(true, "AB"); //Start Emergency Pause Pool1 p1 = Pool1(allContractVersions["P1"]); p1.closeEmergencyPause(pauseTime); //oraclize callback of 4 weeks Claims c1 = Claims(allContractVersions["CL"]); ...
function startEmergencyPause() public onlyAuthorizedToGovern { addEmergencyPause(true, "AB"); //Start Emergency Pause Pool1 p1 = Pool1(allContractVersions["P1"]); p1.closeEmergencyPause(pauseTime); //oraclize callback of 4 weeks Claims c1 = Claims(allContractVersions["CL"]); ...
36,614
19
// import { SafeMath } from "@openzeppelin/as/math/SafeMath.sol"; import { SignedSafeMath } from "@openzeppelin/as/math/SignedSafeMath.sol";
using SafeMath for uint256; using SignedSafeMath for int256;
using SafeMath for uint256; using SignedSafeMath for int256;
16,585
15
// Add seller balance
userMap[seller].escrow = userMap[seller].escrow + price;
userMap[seller].escrow = userMap[seller].escrow + price;
25,314
13
// Starting block number of the distribution. /
uint256 public distributionStartBlock;
uint256 public distributionStartBlock;
9,475
72
// This event is fired if a bounty hunter trades in a cat with the specified cattributes/generation/cooldown and claims the funds/locked within the bounty./The bounty hunter must first call approve() in the Cryptokitties Core contract before calling fulfillBountyAndClaimFunds(). There/is no danger of this contract over...
event FulfillBountyAndClaimFunds( uint256 bountyId, uint256 kittyId, address bidder, uint256 bountyPrice, uint256 geneMask, uint256 genes, uint256 generation, uint256 highestCooldownIndexAccepted, uint256 successfulBountyFeeInWei
event FulfillBountyAndClaimFunds( uint256 bountyId, uint256 kittyId, address bidder, uint256 bountyPrice, uint256 geneMask, uint256 genes, uint256 generation, uint256 highestCooldownIndexAccepted, uint256 successfulBountyFeeInWei
31,770
39
// Returns the personal data of `_account`/ returns the array with next data of this account:/ userAddress,/ whole user Balance of tokens,/ amount of Locked tokens of user,/ is address whitelisted(true/false),/ left Secondary Limit for account (user can spend yet),/ SecondaryLimit which is set for this account,/ left T...
function getUserData( address _account
function getUserData( address _account
24,136
9
// Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirementon the return value: the return value is optional (but if data is returned, it must equal true). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants). /
function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target ad...
function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target ad...
4,355
2
// Acceptable old tokens
address[] public bridge_tokens_array; mapping(address => bool) public bridge_tokens;
address[] public bridge_tokens_array; mapping(address => bool) public bridge_tokens;
57,909
6
// This will return a number between 0-100 representing the write down percent with no decimals
uint256 unscaledWritedownPercent = writedownPercent.mul(100).div(FP_SCALING_FACTOR).rawValue; return (unscaledWritedownPercent, writedownAmount.rawValue);
uint256 unscaledWritedownPercent = writedownPercent.mul(100).div(FP_SCALING_FACTOR).rawValue; return (unscaledWritedownPercent, writedownAmount.rawValue);
40,615
5
// Contract owner /
address internal root;
address internal root;
20,368
49
// This will assign ownership, and also emit the Transfer event
_mint(_owner, TOKEN_UUID); TOKEN_UUID++;
_mint(_owner, TOKEN_UUID); TOKEN_UUID++;
31,966
112
// Minimum amount of debt that must be generated by a SAFE using this collateral
uint256 debtFloor; // [rad]
uint256 debtFloor; // [rad]
34,472
26
// Getter for the amount of Ether already released to a shareholders./_account The target account for this request/_token Payment token address/ return The amount already released to this account
function released(address _account, address _token) external view returns (uint256) { return tokenRecords[_token].released[_account]; }
function released(address _account, address _token) external view returns (uint256) { return tokenRecords[_token].released[_account]; }
56,285
206
// Get the length from the center of a triangle to point/
{ return ShackledMath.vector3Len( ShackledMath.vector3Sub(getCenterVec(tri), tri[0]) ); }
{ return ShackledMath.vector3Len( ShackledMath.vector3Sub(getCenterVec(tri), tri[0]) ); }
31,240
3
// Store the amount of ETH sent in by a buyer
mapping (address => uint256) public eth_sent;
mapping (address => uint256) public eth_sent;
37,993
96
// Write votes of the given user at the current block
function checkpointVotes(address _user) external;
function checkpointVotes(address _user) external;
38,035
412
// swap source token for intermediate token on the source DEX
if (_srcSwap.path.length > 1) { bool ok = true; (ok, srcAmtOut) = _trySwap(_srcSwap, _amountIn); if (!ok) revert("src swap failed"); }
if (_srcSwap.path.length > 1) { bool ok = true; (ok, srcAmtOut) = _trySwap(_srcSwap, _amountIn); if (!ok) revert("src swap failed"); }
5,312
91
// Pause external functions in contract
function pause() external;
function pause() external;
62,283
272
// _pauseVault is overridden to add accounting for the allocPoints/It should be noted that the first requirement is only present for auditability since it is redundant in the parent contract.
function _pauseVault(uint256 vaultId, bool paused) internal override { require(paused != vaults[vaultId].paused, "!set"); if (paused) { activeVaults -= 1; } else { activeVaults += 1; } super._pauseVault(vaultId, paused); }
function _pauseVault(uint256 vaultId, bool paused) internal override { require(paused != vaults[vaultId].paused, "!set"); if (paused) { activeVaults -= 1; } else { activeVaults += 1; } super._pauseVault(vaultId, paused); }
35,106
3
// End block is the last block when MODA/block can be decreased; it is implied that yield farming stops after that block /
uint256 public endBlock;
uint256 public endBlock;
7,126
1,168
// We will sequentially append leaves which are pointers to the queue. The initial queue index is what is currently in storage.
uint40 nextQueueIndex = getNextQueueIndex(); BatchContext memory curContext;
uint40 nextQueueIndex = getNextQueueIndex(); BatchContext memory curContext;
65,868
1
// 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"; ...
4,760
49
// Staged crowdsale. Functionality of staged crowdsale. /
contract StagedCrowdsale is Ownable { using SafeMath for uint256; // Public structure of crowdsale's stages. struct Stage { uint256 hardcap; uint256 price; uint256 minInvestment; uint256 invested; uint256 closed; } Stage[] public stages; /** * @d...
contract StagedCrowdsale is Ownable { using SafeMath for uint256; // Public structure of crowdsale's stages. struct Stage { uint256 hardcap; uint256 price; uint256 minInvestment; uint256 invested; uint256 closed; } Stage[] public stages; /** * @d...
44,644
430
// This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encodingscheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA({_hashTypedDataV4}). The implementation of the domain separator was designed to be as efficient as pos...
abstract contract EIP712 {
abstract contract EIP712 {
6,152
289
// Save collateral market updates We didn't calculate new rates for collateralMarket (because neither cash nor borrows changed), just new indexes and total supply.
collateralMarket.blockNumber = getBlockNumber(); collateralMarket.totalSupply = localResults.newTotalSupply_ProtocolCollateralAsset; collateralMarket.supplyIndex = localResults.newSupplyIndex_CollateralAsset; collateralMarket.borrowIndex = localResults.newBorrowIndex_CollateralAsset;
collateralMarket.blockNumber = getBlockNumber(); collateralMarket.totalSupply = localResults.newTotalSupply_ProtocolCollateralAsset; collateralMarket.supplyIndex = localResults.newSupplyIndex_CollateralAsset; collateralMarket.borrowIndex = localResults.newBorrowIndex_CollateralAsset;
37,745
68
// Sets a new owner address/
function _setOwner(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(owner(), newOwner); addressStorage[OWNER] = newOwner; }
function _setOwner(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(owner(), newOwner); addressStorage[OWNER] = newOwner; }
7,675