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
24
// Sets the royalty addresses for the two artists and three developers. /
function setRoyaltyAddresses( address _a1, address _a2, address _d1, address _d2, address _d3
function setRoyaltyAddresses( address _a1, address _a2, address _d1, address _d2, address _d3
2,694
99
// amountOut = liquiditynavps_op.erc20Amount(K_BASE - _op.K)(THETA_BASE - _op.theta) / NAVPS_BASE / _op.ethAmount / K_BASE / THETA_BASE;/
uint256 navps = calcNAVPerShareForBurn(reserve0, reserve1, _op); uint256 liqMulMany = liquidity.mul(navps).mul(_op.erc20Amount).mul(K_BASE.sub(_op.K)).mul(THETA_BASE.sub(_op.theta)); amountOut = liqMulMany.div(NAVPS_BASE).div(_op.ethAmount).div(K_BASE).div(THETA_BASE); if (_op.theta != 0...
uint256 navps = calcNAVPerShareForBurn(reserve0, reserve1, _op); uint256 liqMulMany = liquidity.mul(navps).mul(_op.erc20Amount).mul(K_BASE.sub(_op.K)).mul(THETA_BASE.sub(_op.theta)); amountOut = liqMulMany.div(NAVPS_BASE).div(_op.ethAmount).div(K_BASE).div(THETA_BASE); if (_op.theta != 0...
48,334
6
// The amount for the presale AND for the whitelist
uint private constant MAX_PRESALE_AND_WHITELIST = MAX_PRESALE + MAX_WHITELIST;
uint private constant MAX_PRESALE_AND_WHITELIST = MAX_PRESALE + MAX_WHITELIST;
28,530
11
// Proposers must have previously staked at the BondManager
require( IBondManager(resolve("BondManager")).isCollateralized(msg.sender), "Proposer does not have enough collateral posted" ); require(_batch.length > 0, "Cannot submit an empty state batch."); require( getTotalElements() + _batch.length <= ...
require( IBondManager(resolve("BondManager")).isCollateralized(msg.sender), "Proposer does not have enough collateral posted" ); require(_batch.length > 0, "Cannot submit an empty state batch."); require( getTotalElements() + _batch.length <= ...
29,050
651
// getting whole pool's mine production weight ratio. Real mine production equals base mine production multiply weight ratio. /
function getMineWeightRatio() external view returns (uint256);
function getMineWeightRatio() external view returns (uint256);
77,735
185
// presale mint for whitelisted
function presalemint(uint256 tokens, bytes32[] calldata merkleProof) public payable nonReentrant { require(!paused, "SOFTEE: oops contract is paused"); require(MerkleProof.verify(merkleProof, merkleRoot, keccak256(abi.encodePacked(msg.sender))), "SOFTEE: You are not Whitelisted"); uint256 supply = total...
function presalemint(uint256 tokens, bytes32[] calldata merkleProof) public payable nonReentrant { require(!paused, "SOFTEE: oops contract is paused"); require(MerkleProof.verify(merkleProof, merkleRoot, keccak256(abi.encodePacked(msg.sender))), "SOFTEE: You are not Whitelisted"); uint256 supply = total...
72,202
0
// =================================== Chainlink Stuff===================================
using Chainlink for Chainlink.Request; bytes32 private jobId; uint256 private fee; mapping(bytes32 => address) public requestIdToAddress; mapping(bytes32 => bool) public requestIdFulfilled; event RequestFulfilled(bytes32 indexed requestId, uint256 indexed score);
using Chainlink for Chainlink.Request; bytes32 private jobId; uint256 private fee; mapping(bytes32 => address) public requestIdToAddress; mapping(bytes32 => bool) public requestIdFulfilled; event RequestFulfilled(bytes32 indexed requestId, uint256 indexed score);
52,503
180
// Advance the old oracle first to give the tax to the old oracle.
coin_.transferOwnership(address(old_oracle_)); burned = old_oracle_.advance(coin_); old_oracle_.revokeOwnership(coin_); coin_.transferOwnership(address(oracle_)); uint ret = oracle_.advance(coin_); require(ret == 0, "vo1"); oracle_.revokeOwnership(coin_);...
coin_.transferOwnership(address(old_oracle_)); burned = old_oracle_.advance(coin_); old_oracle_.revokeOwnership(coin_); coin_.transferOwnership(address(oracle_)); uint ret = oracle_.advance(coin_); require(ret == 0, "vo1"); oracle_.revokeOwnership(coin_);...
13,884
8
// if investor is now a top token holder
} else if (balanceOf[_investor] > balanceOf[lowestBenefactor]) {
} else if (balanceOf[_investor] > balanceOf[lowestBenefactor]) {
50,527
60
// returns the bid of the given bidder on the tokens. Signature for getYourBidBatch(uint256[],uint256[]) : `0x5928801c`tokenIds ids of the token. serialNosserial Numbers of the token. return bid of the given bidder on the tokens. /
function getYourBidsBatch(
function getYourBidsBatch(
17,216
66
// Returns the amount of burned tokens. /
function burnedSupply() public view returns (uint256) { return _burnedSupply; }
function burnedSupply() public view returns (uint256) { return _burnedSupply; }
3,791
21
// Zero issuance under a rate of 1.0
if (issuanceRate <= MIN_ISSUANCE_RATE) { return 0; }
if (issuanceRate <= MIN_ISSUANCE_RATE) { return 0; }
81,625
107
// address of the ERC20 token
IERC20 immutable private _token; bytes32[] private vestingSchedulesIds; mapping(bytes32 => VestingSchedule) private vestingSchedules; uint256 private vestingSchedulesTotalAmount; mapping(address => uint256) private holdersVestingCount; event Released(uint256 amount); event Revoked();
IERC20 immutable private _token; bytes32[] private vestingSchedulesIds; mapping(bytes32 => VestingSchedule) private vestingSchedules; uint256 private vestingSchedulesTotalAmount; mapping(address => uint256) private holdersVestingCount; event Released(uint256 amount); event Revoked();
76,238
778
// EVENTS / Emitted when a new proposal is created.
event NewProposal(uint256 indexed id, Transaction[] transactions);
event NewProposal(uint256 indexed id, Transaction[] transactions);
10,114
7
// returns the balance of a specific address
function balanceOf(address _addr) public view override returns (uint balance) { return __balanceOf[_addr]; }
function balanceOf(address _addr) public view override returns (uint balance) { return __balanceOf[_addr]; }
85,222
112
// Creates a new snapshot and returns its snapshot id. Emits a {Snapshot} event that contains the same id. {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to aset of accounts, for example using {AccessControl}, or it may be open to the public. [WARNING]====While...
function _snapshot() internal virtual returns (uint256) { _currentSnapshotId.increment(); uint256 currentId = _getCurrentSnapshotId(); emit Snapshot(currentId); return currentId;
function _snapshot() internal virtual returns (uint256) { _currentSnapshotId.increment(); uint256 currentId = _getCurrentSnapshotId(); emit Snapshot(currentId); return currentId;
12,474
43
// Emitted when platform fees is changed. oldPlatformFee value platform fee was changed from newPlatformFee value platform fee was changed to /
event PlatformFeeChanged(uint64 oldPlatformFee, uint64 newPlatformFee);
event PlatformFeeChanged(uint64 oldPlatformFee, uint64 newPlatformFee);
3,803
4
// It's being used or not.
bool isUsed;
bool isUsed;
47,954
57
// Payment Model/Interface for contracts that implement a payment model with which a/ payment of a certain amount may be sent to and received by another address.
contract PaymentModel is PaymentModelEventEmitter { /** * @dev Make a transfer or payment transfer safely. * @dev Used to make a payment of a certain amount to a certain address. * @dev A sender uses this to make payment, initiating the transaction * * @param amount {uint} Amount of t...
contract PaymentModel is PaymentModelEventEmitter { /** * @dev Make a transfer or payment transfer safely. * @dev Used to make a payment of a certain amount to a certain address. * @dev A sender uses this to make payment, initiating the transaction * * @param amount {uint} Amount of t...
27,403
32
// Get total number of versions for a service type _serviceType - type of service /
function getNumberOfVersions(bytes32 _serviceType) external view returns (uint256)
function getNumberOfVersions(bytes32 _serviceType) external view returns (uint256)
49,016
94
// stake for msg.sender
IBasicRewards(cvxCrvRewards).stakeFor(msg.sender, cvxCrvBalance);
IBasicRewards(cvxCrvRewards).stakeFor(msg.sender, cvxCrvBalance);
39,105
34
// Check thatHotfriescoin have not already been claimed this seasonfor a given tokenId
require( !seasonClaimedByTokenId[season][tokenId], "GOLD_CLAIMED_FOR_TOKEN_ID" );
require( !seasonClaimedByTokenId[season][tokenId], "GOLD_CLAIMED_FOR_TOKEN_ID" );
13,611
14
// This creates an array with all balances
mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance;
mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance;
53,245
5
// uint dateDiff = SafeMath.div(SafeMath.sub(currentDate, schedule[SafeMath.sub(schedule.length, 2)].day), 2592000);
uint dateDiff = SafeMath.div(SafeMath.sub(currentDate, schedule[SafeMath.sub(schedule.length, 2)].day), 1800); uint256 newUnlockToken = SafeMath.mul(schedule[SafeMath.sub(schedule.length, 2)].token, SafeMath.add(dateDiff, 1)); return SafeMath.add(schedule[SafeMath.sub(schedule.length, 3)].token, newUn...
uint dateDiff = SafeMath.div(SafeMath.sub(currentDate, schedule[SafeMath.sub(schedule.length, 2)].day), 1800); uint256 newUnlockToken = SafeMath.mul(schedule[SafeMath.sub(schedule.length, 2)].token, SafeMath.add(dateDiff, 1)); return SafeMath.add(schedule[SafeMath.sub(schedule.length, 3)].token, newUn...
13,467
7
// Set Dai contract address This function can only be carreid out by the owner of this contract. /
function setDaiAddress(address _dai) public onlyOwner { daiAddr = _dai; }
function setDaiAddress(address _dai) public onlyOwner { daiAddr = _dai; }
31,797
122
// solhint-disable
contract MetaCarToken is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; address payable public marketingAddress = payable(0x8F7ed9570285A27A592643E6024BE54FB4590352); address payable public devAddress = payable(0x3c4e7F6f679F713503216b7795f092d8DbEDA93...
contract MetaCarToken is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; address payable public marketingAddress = payable(0x8F7ed9570285A27A592643E6024BE54FB4590352); address payable public devAddress = payable(0x3c4e7F6f679F713503216b7795f092d8DbEDA93...
25,785
94
// Check for the possibility of buying tokens. Inside. Constant.
function validPurchase() internal view returns (bool) { // The round started and did not end bool withinPeriod = (now > startTime && now < endTime.add(renewal)); // Rate is greater than or equal to the minimum bool nonZeroPurchase = msg.value >= minPay; // hardCap is not r...
function validPurchase() internal view returns (bool) { // The round started and did not end bool withinPeriod = (now > startTime && now < endTime.add(renewal)); // Rate is greater than or equal to the minimum bool nonZeroPurchase = msg.value >= minPay; // hardCap is not r...
36,238
201
// Creates a new race and specifies the maximum number of racers /
function createRace(uint256 tokenId, uint256 maxLevel) external returns (uint256);
function createRace(uint256 tokenId, uint256 maxLevel) external returns (uint256);
17,208
26
// Short-circuit in case the hash was presigned. Optimization as performing calls and ecrecover is more expensive than an SLOAD.
if (isPresigned[_hash]) { return returnIsValidSignatureMagicNumber(true); }
if (isPresigned[_hash]) { return returnIsValidSignatureMagicNumber(true); }
18,849
20
// Just in case this function is called late (EVM only stores last 256 block hashes)
if ((block.number - startingIndexBlock) > 255) { startingIndex = uint(blockhash(block.number - 1)) % MAX_SUPPLY; }
if ((block.number - startingIndexBlock) > 255) { startingIndex = uint(blockhash(block.number - 1)) % MAX_SUPPLY; }
84,944
25
// address _certificateSigner, bool _certificateActivated,
bytes32[] calldata _defaultPartitions, uint256 _protocolVersion ) external returns(address securityTokenAddress);
bytes32[] calldata _defaultPartitions, uint256 _protocolVersion ) external returns(address securityTokenAddress);
12,488
771
// Gets CDP info (collateral, debt)/_cdpId Id of the CDP/_ilk Ilk of the CDP
function getCdpInfo(uint _cdpId, bytes32 _ilk) public view returns (uint, uint) { address urn = manager.urns(_cdpId); (uint collateral, uint debt) = vat.urns(_ilk, urn); (,uint rate,,,) = vat.ilks(_ilk); return (collateral, rmul(debt, rate)); }
function getCdpInfo(uint _cdpId, bytes32 _ilk) public view returns (uint, uint) { address urn = manager.urns(_cdpId); (uint collateral, uint debt) = vat.urns(_ilk, urn); (,uint rate,,,) = vat.ilks(_ilk); return (collateral, rmul(debt, rate)); }
55,105
53
// Update the observations array
updateObservations(elapsedTime, uint256(aggregatorResult));
updateObservations(elapsedTime, uint256(aggregatorResult));
8,876
93
// Emits events {DelegateChanged} and {DelegateVotesChanged}. /
function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates(delegator); uint256 delegatorBalance = balanceOf(delegator); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveVotingPo...
function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates(delegator); uint256 delegatorBalance = balanceOf(delegator); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveVotingPo...
3,780
18
// Has the next call (at this call depth only) create a transaction with the private key provided as the sender that can later be signed and sent onchain
function broadcast(uint256) external;
function broadcast(uint256) external;
26,058
8
// Emitted when `amount` tokens is approved by `owner` to be used by `spender`.
event Approval( address indexed owner, address indexed spender, uint256 amount );
event Approval( address indexed owner, address indexed spender, uint256 amount );
33,333
73
// Key data structure given to clients for high-level furball access (furballs.stats)
struct FurballStats { uint16 expRate; uint16 furRate; RewardModifiers modifiers; Furball definition; Snack[] snacks; }
struct FurballStats { uint16 expRate; uint16 furRate; RewardModifiers modifiers; Furball definition; Snack[] snacks; }
69,649
222
// Emit appropriate events.
emit LotteryRandomSeedCallbackCompleted( uint( _queryId ) );
emit LotteryRandomSeedCallbackCompleted( uint( _queryId ) );
5,924
10
// Operations Gnosis Safe multisig.
address public operations;
address public operations;
27,251
31
// ---------------------------------------- Internal functions ----------------------------------------
function _getNormalizedDataFromBatch(address cob, uint256 tokenId) internal view returns ( uint256, uint256, BatchStatus )
function _getNormalizedDataFromBatch(address cob, uint256 tokenId) internal view returns ( uint256, uint256, BatchStatus )
14,969
16
// Ensure that the target is not already authorized.
if (authorized[target]) { LibRichErrors.rrevert(LibAuthorizableRichErrors.TargetAlreadyAuthorizedError(target)); }
if (authorized[target]) { LibRichErrors.rrevert(LibAuthorizableRichErrors.TargetAlreadyAuthorizedError(target)); }
25,143
138
// Store latest result/error requestId The request ID, returned by sendRequest() response Aggregated response from the user code err Aggregated error from the user code or from the execution pipelineEither response or error parameter will be set, but never both /
function fulfillRequest( bytes32 requestId, bytes memory response, bytes memory err
function fulfillRequest( bytes32 requestId, bytes memory response, bytes memory err
12,712
135
// Returns the amount of liquidityAsset that can be recovered from BPT burning
uint256 tokenAmountOut = bPool.calcSingleOutGivenPoolIn( tokenBalanceOut, tokenWeightOut, poolSupply, totalWeight, poolAmountIn, swapFee );
uint256 tokenAmountOut = bPool.calcSingleOutGivenPoolIn( tokenBalanceOut, tokenWeightOut, poolSupply, totalWeight, poolAmountIn, swapFee );
6,010
4
// Address of the relayer (who is allowed to forward signed instructions from parties)
address public relayer; uint32 public requestCancellationMinimumTime;
address public relayer; uint32 public requestCancellationMinimumTime;
28,061
9
// Default function; Gets called when Ether is deposited, and forwards it to the parent address /
function() public payable { // throws on failure parentAddress.transfer(msg.value); // Fire off the deposited event if we can forward it emit ForwarderDeposited(msg.sender, msg.value, msg.data); }
function() public payable { // throws on failure parentAddress.transfer(msg.value); // Fire off the deposited event if we can forward it emit ForwarderDeposited(msg.sender, msg.value, msg.data); }
18,158
46
// Usual getter (inherited from IStrategy)/ return 'want' token (In this case EURxb)
function want() external view override returns (address) { return _want; }
function want() external view override returns (address) { return _want; }
27,790
144
// Returns a token ID at a given `index` of all the tokens stored by the contract.Use along with {totalSupply} to enumerate all tokens. /
function tokenByIndex(uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
336
2
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper::safeTransfer: transfer failed" );
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper::safeTransfer: transfer failed" );
2,180
1
// Indicator that this is a PriceOracle contract (for inspection)
bool public constant isPriceOracle = true;
bool public constant isPriceOracle = true;
12,990
6
// Percentage Helpers for Grant Contracts. Used to offer pro-rata refunds and proportionate payment splitting among grantees without loss of precision when handling tokens with large supply. @NoahMarconi /
library Percentages { /** * @dev Calculate quad point percentage from two uint256 values. * @param numerator division numerator. * @param denominator division denominator. */ function percentage(uint256 numerator, uint256 denominator) internal pure returns (bytes16) ...
library Percentages { /** * @dev Calculate quad point percentage from two uint256 values. * @param numerator division numerator. * @param denominator division denominator. */ function percentage(uint256 numerator, uint256 denominator) internal pure returns (bytes16) ...
24,653
11
// Update the allow list data for this nft contract on SeaDrop.Only the owner or administrator can use this function.seaDropImpl The allowed SeaDrop contract. allowListData The allow list data. /
function updateAllowList(
function updateAllowList(
6,831
105
// withdraws crvToken from convex, withdraws from lending pool, then deposits asset into treasurytoken addressamount uintminAmount uint /
function withdraw( address token, uint amount, uint minAmount ) public onlyPolicy() { rewardPool.withdrawAndUnwrap( amount, false ); // withdraw to curve token address curveToken = tokenInfo[ token ].curveToken; IERC20(curveToken).approve(address(curve3Pool), amount); // approve 3Pool to s...
function withdraw( address token, uint amount, uint minAmount ) public onlyPolicy() { rewardPool.withdrawAndUnwrap( amount, false ); // withdraw to curve token address curveToken = tokenInfo[ token ].curveToken; IERC20(curveToken).approve(address(curve3Pool), amount); // approve 3Pool to s...
22,157
156
// override and add any supply needed (interest based growth)
return totalSupply();
return totalSupply();
43,960
5
// Constructor
function initialize(address _SPA, string memory _version) public initializer
function initialize(address _SPA, string memory _version) public initializer
64,299
23
// Returns the total balance, locked balance, and unlocked balance for an account account address of the account to check balances forreturn totalBalance total balance of the accountreturn lockedBalance amount of tokens locked for the accountreturn unlockedBalance amount of tokens not locked for the account /
function checkBalances(address account) public view returns (uint256 totalBalance, uint256 lockedBalance, uint256 unlockedBalance) { totalBalance = balanceOf(account); lockedBalance = locked(account); // Get locked balance using the locked() function unlockedBalance = totalBalance - lockedBa...
function checkBalances(address account) public view returns (uint256 totalBalance, uint256 lockedBalance, uint256 unlockedBalance) { totalBalance = balanceOf(account); lockedBalance = locked(account); // Get locked balance using the locked() function unlockedBalance = totalBalance - lockedBa...
2,605
7
// Return total amount of DAI that is currently held by Syndicate
function getDaiBalance() external view returns (uint256 combinedDaiInVat);
function getDaiBalance() external view returns (uint256 combinedDaiInVat);
48,944
172
// payOracle pays out _transmitter's balance to the corresponding payee, and zeros it out
function payOracle(address _transmitter) internal
function payOracle(address _transmitter) internal
26,002
44
// Updates the supported interfaces _interfaceId The interface ID to update _supported Whether the interface is supported or not /
function updateSupportedInterfaces(
function updateSupportedInterfaces(
50,495
2
// for modified functions allows only self external call /
modifier onlySelf { require( msg.sender == address(this), "Only self call is possible" ); _; }
modifier onlySelf { require( msg.sender == address(this), "Only self call is possible" ); _; }
41,093
33
// Crowdsale parameters/
bool public isFinalized;
bool public isFinalized;
3,426
50
// One specific attribute of the equipment modified
function _changeAttrByIndex(Card storage _cd, uint16 _index, uint16 _val) internal { if (_index == 2) { _cd.quality = _val; } else if(_index == 3) { _cd.feature = _val; } else if(_index == 4) { _cd.level = _val; } else if(_index == 5) { ...
function _changeAttrByIndex(Card storage _cd, uint16 _index, uint16 _val) internal { if (_index == 2) { _cd.quality = _val; } else if(_index == 3) { _cd.feature = _val; } else if(_index == 4) { _cd.level = _val; } else if(_index == 5) { ...
7,638
20
// check condition to avoid Overflows
require(_value > 0); require(balances[msg.sender] >= _value); require(balances[_to] + _value > balances[_to]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
require(_value > 0); require(balances[msg.sender] >= _value); require(balances[_to] + _value > balances[_to]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
72,756
456
// Data structures for lockup during withdrawal
struct UndelegateStakeRequest { address serviceProvider; uint256 amount; uint256 lockupExpiryBlock; }
struct UndelegateStakeRequest { address serviceProvider; uint256 amount; uint256 lockupExpiryBlock; }
41,348
3
// sandwicher variables
address public sandwicherMasterAddress; mapping(address => bool) public sandwicherWhitelist; bool public antiSandwichEnabled; mapping(uint256 => mapping(address => bool)) public transactedCurrentBlock; // keeps track of the transactions of current block
address public sandwicherMasterAddress; mapping(address => bool) public sandwicherWhitelist; bool public antiSandwichEnabled; mapping(uint256 => mapping(address => bool)) public transactedCurrentBlock; // keeps track of the transactions of current block
27,535
125
// Checks if the crowdsale has closed.
function hasClosed() public view returns (bool) { return super.hasClosed() || super.capReached(); }
function hasClosed() public view returns (bool) { return super.hasClosed() || super.capReached(); }
850
9
// User-defined callback function handling newly generated secure random number.
function __callback__(uint requestId, uint generatedRandom) external auth(requestId)
function __callback__(uint requestId, uint generatedRandom) external auth(requestId)
30,272
52
// Returns the erc token owner. /
function getOwner() external view returns (address);
function getOwner() external view returns (address);
2,768
303
// if (_speakingPlayer != null)
{ _chatLog.EnableParticipant(_speakingPlayer); }
{ _chatLog.EnableParticipant(_speakingPlayer); }
2,326
46
// Setup contract with given params Used by Initializable contract (can be called only once) manager Address on which MANAGER_ROLE is granted allowedBorrowers List of addresses on which BORROWER_ROLE should be granted, [address(0)] if all borrowers are allowed asset Address of ERC20 token used by AssetVault protocolCon...
function initialize(
function initialize(
19,390
12
// Bubbles the element at some index down. /
function _percDown(uint256 _index) private { uint256 index = _index; uint256 j = index; uint256 newVal = heapList[index]; uint256 mc = _minChild(index); while (mc <= currentSize && newVal > heapList[mc]) { heapList[index] = heapList[mc]; index = mc; ...
function _percDown(uint256 _index) private { uint256 index = _index; uint256 j = index; uint256 newVal = heapList[index]; uint256 mc = _minChild(index); while (mc <= currentSize && newVal > heapList[mc]) { heapList[index] = heapList[mc]; index = mc; ...
38,296
29
// Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.Be aware that there is no check for duplicate recipients._from The address of the sender_toAddresses The addresses of the recipients (MAX 255)_amounts The amounts of tokens to be transferred/
function multiSendFrom(address _from, address[] _toAddresses, uint256[] _amounts) public { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.le...
function multiSendFrom(address _from, address[] _toAddresses, uint256[] _amounts) public { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses.le...
23,351
30
// CONSTANTS // IDs /
enum MaterialId { Pearl, Copper, Onyx, Quartz, Emerald, Ruby, Sapphire, Amber, Amethyst, Obsidian, Gold, Diamond }
enum MaterialId { Pearl, Copper, Onyx, Quartz, Emerald, Ruby, Sapphire, Amber, Amethyst, Obsidian, Gold, Diamond }
5,876
6
// --------------------------------------------
function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _a...
function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _a...
10,315
1
// backdoor function to activate Operator for testing
function activateOperator() public { Operated._activateOperator(); }
function activateOperator() public { Operated._activateOperator(); }
35,304
2
// Get a batch of human-readable addresses from the address list. The requested batch size can be greaterthan the actual address list size, in which the full address list will be returned. Due to limitations of gas usage in off-chain calls, we need to support fetching the addresses in batches.EVM addresses need to be c...
function getPoRAddressList(uint256 startIndex, uint256 endIndex) external view returns (string[] memory);
function getPoRAddressList(uint256 startIndex, uint256 endIndex) external view returns (string[] memory);
11,376
52
// Returns the sTOKEN index, which tracks rebase growth/ return index_Index of sTOKEN
function index() public view returns (uint256 index_) { return sTOKEN.index(); }
function index() public view returns (uint256 index_) { return sTOKEN.index(); }
18,410
1
// The prefix f01551220 only works with IPFS CID v1 as token ID
constructor() ERC1155("ipfs://f01551220") {} // in the future we may need to change the default function setURI(string memory newuri) public onlyOwner { _setURI(newuri); }
constructor() ERC1155("ipfs://f01551220") {} // in the future we may need to change the default function setURI(string memory newuri) public onlyOwner { _setURI(newuri); }
21,709
188
// Check order creator is the asset owner
address assetOwner = nftRegistry.ownerOf(_assetId); require( assetOwner == msg.sender, "Marketplace: Only the asset owner can create orders" ); require(_priceInWei > 0, "Marketplace: Price should be bigger than 0"); require(
address assetOwner = nftRegistry.ownerOf(_assetId); require( assetOwner == msg.sender, "Marketplace: Only the asset owner can create orders" ); require(_priceInWei > 0, "Marketplace: Price should be bigger than 0"); require(
11,597
350
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn( address factory, uint256 amountOut, address[] memory path
function getAmountsIn( address factory, uint256 amountOut, address[] memory path
3,923
10
// attributes combination => flag mapping ( bytes => bool) public blackList; boxId => boxOpener => array of combinations to be minted mapping ( uint256 => mapping ( address => bytes[] )) public nftToMint; boxId => owner
mapping ( uint256 => address ) public genBoxOwner;
mapping ( uint256 => address ) public genBoxOwner;
36,810
60
// add███ fee?
_id = ++nonce; creators[_id] = msg.sender; balances[_id][msg.sender] = _initialSupply; royalties[_id] = _royalties; emit TransferSingle(msg.sender, address(0x0), msg.sender, _id, _initialSupply); uri[_id] = _tokenUri; emit URI(_tokenUri,...
_id = ++nonce; creators[_id] = msg.sender; balances[_id][msg.sender] = _initialSupply; royalties[_id] = _royalties; emit TransferSingle(msg.sender, address(0x0), msg.sender, _id, _initialSupply); uri[_id] = _tokenUri; emit URI(_tokenUri,...
24,658
58
// Mint on a Series with a valid claim where one can choose the tokens to mint claim Series Claim claimSignature Signed + encoded claim mintRecipient Who to mint the NFT(s) to tokenIds IDs of NFTs to mint /
function gatedSeriesMintChooseToken( SeriesClaim calldata claim, bytes calldata claimSignature, address mintRecipient, uint256[] calldata tokenIds
function gatedSeriesMintChooseToken( SeriesClaim calldata claim, bytes calldata claimSignature, address mintRecipient, uint256[] calldata tokenIds
18,496
8
// If no delegate owner is provided, the deploying address is the owner.
if (delegateContractOwner != address(0)) { transferOwnership(delegateContractOwner); }
if (delegateContractOwner != address(0)) { transferOwnership(delegateContractOwner); }
35,130
44
// Emitted when a token is given a new priority order in the displayed price ratio/token The token being given priority order/priority Represents priority in ratio - higher integers get numerator priority
event UpdateTokenRatioPriority(address token, int256 priority);
event UpdateTokenRatioPriority(address token, int256 priority);
60,895
370
// Modifier to protect an initialization function so that it can only be invoked by functions with the{initializer} modifier, directly or indirectly. /
modifier onlyInitializing() {
modifier onlyInitializing() {
60,394
33
// ETH Vault
mapping(uint16 => uint256) public boatsWithdrawAmount;
mapping(uint16 => uint256) public boatsWithdrawAmount;
18,643
363
// Max adminFee is 100% of the swapFee adminFee does not add additional fee on top of swapFee Instead it takes a certain % of the swapFee. Therefore it has no impact on the users but only on the earnings of LPs
uint256 public constant MAX_ADMIN_FEE = 10**10;
uint256 public constant MAX_ADMIN_FEE = 10**10;
3,800
25
// Before contract start no funds are available
if (current < startTime) { return 0; }
if (current < startTime) { return 0; }
22,807
298
// ========== VIEWS ========== // Retrieve the length of the distributions array /
function distributionsLength() external view returns (uint) { return distributions.length; }
function distributionsLength() external view returns (uint) { return distributions.length; }
10,620
90
// let's just go with the safe option rather than using send(): probably fine but no loss
owed[auction.highestBidder] = owed[auction.highestBidder].add(auction.highestBid);
owed[auction.highestBidder] = owed[auction.highestBidder].add(auction.highestBid);
40,816
110
// Subtraction: uint256 - int256uint256(-b) will not overflow when b is IMIN /
function sub(uint256 a, int256 b) internal pure returns (uint256) { if (b >= 0) { return sub(a, uint256(b)); } else { return add(a, uint256(-b)); } }
function sub(uint256 a, int256 b) internal pure returns (uint256) { if (b >= 0) { return sub(a, uint256(b)); } else { return add(a, uint256(-b)); } }
59,726
70
// regular voting period
proposal.eta == 0 && block.number <= proposal.endBlock ) {
proposal.eta == 0 && block.number <= proposal.endBlock ) {
27,183
17
// ----------------------------------------------------------------------- EVENTS -----------------------------------------------------------------------
event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner,
event AuctionRegistered( address owner, uint256 indexed auctionID, string auctionName, address auctionContract ); event AuctionUpdated( address owner,
59,896
2
// Create a new vote to choose one of 'proposalNames'. proposalNames names of proposals /
constructor(string[] memory proposalNames) { for (uint i = 0; i < proposalNames.length; i++) { proposals.push(Proposal({ name: proposalNames[i], voteCount: 0 })); } }
constructor(string[] memory proposalNames) { for (uint i = 0; i < proposalNames.length; i++) { proposals.push(Proposal({ name: proposalNames[i], voteCount: 0 })); } }
56,914
36
// Set the amount for the liquidation c-ratio;
systemsettings_i.setLiquidationRatio(666666666666666666);
systemsettings_i.setLiquidationRatio(666666666666666666);
50,607
809
// Emitted when a deposit or withdrawal is made.Note that `amount` is not set for `WithdrawAll` actions. /
event PoolAllocation(PoolAllocationAction indexed action, LiquidityPool indexed pool, string indexed currencyCode, uint256 amount);
event PoolAllocation(PoolAllocationAction indexed action, LiquidityPool indexed pool, string indexed currencyCode, uint256 amount);
63,975
8
// Handles the request to update an agreement beacon which will connect a specific tokento a set of specific digital agreements that have been agreed to by counterparties.tokenContractAddress The token contract owning the token to be integrated via the beacon tokenId The ID of the token to be integrated via the beacon ...
function requestUpdateBeacon(
function requestUpdateBeacon(
1,717
103
// https:etherscan.io/address/0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f
address internal constant CRV_ORACLE = 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f;
address internal constant CRV_ORACLE = 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f;
15,797
42
// Wrappers over Solidity's arithmetic operations with added overflowchecks. Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises anerror, which is the standard behavior in high level programming languages.`SafeMath` restores this ...
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) {...
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) {...
16,647
0
// Once this is called Governance will be disabled forever! Due to community decision, ownership has been renounced. - No KP4R can be minted. - KP4R governance can never be transfered. - Theres no going back. You asked, we listened!
kp4r.acceptGovernance();
kp4r.acceptGovernance();
25,707