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
45
// This percent of a transaction will be redistribute to all holders.
uint32 private _taxReward;
uint32 private _taxReward;
55,845
0
// Storage for Community For future upgrades, do not change CommunityStorageV2. Create a newcontract which implements CommunityStorageV2 and following the naming conventionCommunityStorageVX. /
abstract contract CommunityStorageV2 is CommunityStorageV1 { IERC20 public _token; uint256 public override maxBeneficiaries; }
abstract contract CommunityStorageV2 is CommunityStorageV1 { IERC20 public _token; uint256 public override maxBeneficiaries; }
23,540
23
// Remove minter minter minter /
function removeMinter(address minter) external returns (bool)
function removeMinter(address minter) external returns (bool)
19,815
18
// swap fromToken to endToken
address[] memory path = new address[](2); path[0] = address(startToken); path[1] = address(endToken);
address[] memory path = new address[](2); path[0] = address(startToken); path[1] = address(endToken);
46,326
60
// exlcusions
mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTx; event ExcludeFromFees(address indexed account, bool isExcluded); event hostileBankUpdated(address indexed newWallet, address indexed oldWallet); event liqOwnerUpdated(address indexed newWallet,...
mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTx; event ExcludeFromFees(address indexed account, bool isExcluded); event hostileBankUpdated(address indexed newWallet, address indexed oldWallet); event liqOwnerUpdated(address indexed newWallet,...
38,159
14
// contract states
uint256 private constant divider = 100; uint256 private interestPercentage = 25; uint256 private withDrawalTimes = 12; uint256 private monthlyPercentage = 8; uint256 private minimumDays = 28 days; uint256 private lockTime = 30 days; uint256 public _totalStakedTokens; uint256 public _tota...
uint256 private constant divider = 100; uint256 private interestPercentage = 25; uint256 private withDrawalTimes = 12; uint256 private monthlyPercentage = 8; uint256 private minimumDays = 28 days; uint256 private lockTime = 30 days; uint256 public _totalStakedTokens; uint256 public _tota...
30,755
12
// ERCSFTMockThis mock just provides a public burn functions for testing purposes /
contract ERCSFTMock is SFT { constructor(string memory name, string memory symbol) SFT(name, symbol) {} function setSemiBaseURI(string memory baseUri) public { _setSemiBaseURI(baseUri); } function SemiBaseURI() public view returns (string memory) { return _semiBaseURI(); } fun...
contract ERCSFTMock is SFT { constructor(string memory name, string memory symbol) SFT(name, symbol) {} function setSemiBaseURI(string memory baseUri) public { _setSemiBaseURI(baseUri); } function SemiBaseURI() public view returns (string memory) { return _semiBaseURI(); } fun...
21,972
42
// return i-th tranche data /
function getTrancheData(uint256) external view returns (TrancheData memory);
function getTrancheData(uint256) external view returns (TrancheData memory);
5,647
23
// Make a fee contribution._moderation The moderation to contribute to._side The side to contribute to._contributor The contributor._amount The amount contributed._totalRequired The total amount required for this side. return The amount of fees contributed. /
function contribute( Moderation storage _moderation, Party _side, address payable _contributor, uint256 _amount, uint256 _totalRequired
function contribute( Moderation storage _moderation, Party _side, address payable _contributor, uint256 _amount, uint256 _totalRequired
16,463
105
// % bound away from TWAP price
uint256 internal constant TWAP_BOUNDS = 5 * 10**15; function quote(uint256 purchaseAmount, uint256 saleAmount) internal view returns (uint256)
uint256 internal constant TWAP_BOUNDS = 5 * 10**15; function quote(uint256 purchaseAmount, uint256 saleAmount) internal view returns (uint256)
4,887
302
// Checks whether an identifier is on the whitelist. identifier bytes32 encoding of the string identifier. Eg: BTC/USD.return bool if the identifier is supported (or not). /
function isIdentifierSupported(bytes32 identifier) external view returns (bool);
function isIdentifierSupported(bytes32 identifier) external view returns (bool);
12,047
269
// The faster the rise and the larger the negative rebase, the more that is bought
uint256 sellPercent = changedDiggPercent.mul(wbtcSupplyChangeFactor.add(uint256(percentChange).mul(wbtcSellAmplificationFactor))).div( DIVISION_FACTOR ); if (sellPercent > maxWBTCSellPercent) { ...
uint256 sellPercent = changedDiggPercent.mul(wbtcSupplyChangeFactor.add(uint256(percentChange).mul(wbtcSellAmplificationFactor))).div( DIVISION_FACTOR ); if (sellPercent > maxWBTCSellPercent) { ...
78,515
0
// statera.solSTA V3 deflationary index token smart contract2020-05-29/
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve...
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve...
29,253
65
// Restricts each bet to a maximum profit of 20% contractBalance
require(newMaxProfitAsPercent <= 200000); maxProfitAsPercentOfHouse = newMaxProfitAsPercent; setMaxProfit();
require(newMaxProfitAsPercent <= 200000); maxProfitAsPercentOfHouse = newMaxProfitAsPercent; setMaxProfit();
28,396
305
// Increase totalAmountStaked
totalAmountStaked += (amount + pendingRewards); emit Deposit(msg.sender, amount, pendingRewards);
totalAmountStaked += (amount + pendingRewards); emit Deposit(msg.sender, amount, pendingRewards);
68,501
19
// Blacklist an extension /
function _blacklistExtension(address extension) internal { require(extension != address(0) && extension != address(this), "Cannot blacklist yourself"); if (_extensions.contains(extension)) { emit ExtensionUnregistered(extension, msg.sender); _extensions.remove(extension); ...
function _blacklistExtension(address extension) internal { require(extension != address(0) && extension != address(this), "Cannot blacklist yourself"); if (_extensions.contains(extension)) { emit ExtensionUnregistered(extension, msg.sender); _extensions.remove(extension); ...
22,352
8
// TODO: Implement
// function replaceAdapter(address oldAddress, address newAddress) public {} function removeAdapter(address adapterAddress) external onlyManagers { bool adapterExists = adapterIdxByAddress[adapterAddress] != 0; if (adapterExists) { uint256 adapterIndex = adapterIdxByAddress[adapterA...
// function replaceAdapter(address oldAddress, address newAddress) public {} function removeAdapter(address adapterAddress) external onlyManagers { bool adapterExists = adapterIdxByAddress[adapterAddress] != 0; if (adapterExists) { uint256 adapterIndex = adapterIdxByAddress[adapterA...
50,724
179
// Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is neverdirectly accessed. /
library Counters { using SafeMath for uint256; struct Counter {
library Counters { using SafeMath for uint256; struct Counter {
31,180
5
// constructor( address _registryAddress, address _oracleAddress,
// ) Adapter(_registryAddress, _oracleAddress) {} // /** // * Common code shared by v1 vaults, v2 vaults and earn // */ // function positionsOf( // address accountAddress, // address[] memory _assetsAddresses // ) public view returns (Position[] memory) { // uint256 nu...
// ) Adapter(_registryAddress, _oracleAddress) {} // /** // * Common code shared by v1 vaults, v2 vaults and earn // */ // function positionsOf( // address accountAddress, // address[] memory _assetsAddresses // ) public view returns (Position[] memory) { // uint256 nu...
52,251
14
// Initializes contract to be a Filtered Minter for`_minterFilter`, integrated with Art Blocks core contractat address `_genArt721Address`. _genArt721Address Art Blocks core contract for which thiscontract will be a minter. _minterFilter Minter filter for whichthis will a filtered minter. _delegationRegistryAddress Del...
constructor( address _genArt721Address, address _minterFilter, address _delegationRegistryAddress
constructor( address _genArt721Address, address _minterFilter, address _delegationRegistryAddress
8,742
126
// swap tokens for ETH
swapTokensForEth(half);
swapTokensForEth(half);
55,969
6
// Forwards a batch commit to Voting. commits struct to encapsulate an `identifier`, `time`, `hash` and optional `encryptedVote`. /
function batchCommit(VotingAncillaryInterface.CommitmentAncillary[] calldata commits) external onlyRoleHolder(uint256(Roles.Voter))
function batchCommit(VotingAncillaryInterface.CommitmentAncillary[] calldata commits) external onlyRoleHolder(uint256(Roles.Voter))
16,866
1,118
// 561
entry "praisingly" : ENG_ADVERB
entry "praisingly" : ENG_ADVERB
21,397
122
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
computedHash = _efficientHash(computedHash, proofElement);
11,004
26
// Action Functions /
function swap(uint256 _amount) external payable whenNotPaused isFunded isSaleOpen onlyWhitelisted blockReentrancy { /* Confirm Amount is positive */ require(_amount > 0, "Amount has to be positive"); /* Confirm Amount is less than tokens available */ require(_amount <= tokensLeft(),...
function swap(uint256 _amount) external payable whenNotPaused isFunded isSaleOpen onlyWhitelisted blockReentrancy { /* Confirm Amount is positive */ require(_amount > 0, "Amount has to be positive"); /* Confirm Amount is less than tokens available */ require(_amount <= tokensLeft(),...
24,708
8
// This function will issue the certificate for the multiple courses on nextgen technologies/_userId is the unique ID of student/_name inputs the name of student/_course inputs the course for which the certificate is issued/_belt inputs the belt level of each course in integer/_percentile inputs the percentage which st...
function issueCertificate( uint256 _userId, string memory _name, string memory _course, uint256 _belt, uint256 _percentile
function issueCertificate( uint256 _userId, string memory _name, string memory _course, uint256 _belt, uint256 _percentile
14,030
172
// _payoutDistributionHash the payout distribution hash being checkedreturn uint256 indicating the REP stake in a single outcome for a particular payout hash /
function getStakeInOutcome(bytes32 _payoutDistributionHash) public view returns (uint256) { uint256 _sum; // Participants is implicitly bounded by the floor of the initial report REP cost to be no more than 21 for (uint256 i = 0; i < participants.length; ++i) { IReportingParticip...
function getStakeInOutcome(bytes32 _payoutDistributionHash) public view returns (uint256) { uint256 _sum; // Participants is implicitly bounded by the floor of the initial report REP cost to be no more than 21 for (uint256 i = 0; i < participants.length; ++i) { IReportingParticip...
4,347
1
// strategy
function register(address _cashMachine, address _token, uint256 _amount) external {}
function register(address _cashMachine, address _token, uint256 _amount) external {}
13,233
30
// Implementation of the standard transferFrom method that takes into account the finalize flag
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
51,645
11
// 2. 取得用戶想要存入的以太幣數量
uint256 depositAmount = msg.value;
uint256 depositAmount = msg.value;
12,379
5
// We want to refund everything except the specified cost.
if (_cost < gasUsed) { transactionRecord.ovmGasRefund += gasUsed - _cost; }
if (_cost < gasUsed) { transactionRecord.ovmGasRefund += gasUsed - _cost; }
45,455
147
// Add the new guardian
Data.Guardian memory g = Data.Guardian( guardianAddr, group.toUint16(), validSince.toUint40(), uint40(0) ); w.guardians.push(g); w.guardianIdx[guardianAddr] = w.guardians.length;
Data.Guardian memory g = Data.Guardian( guardianAddr, group.toUint16(), validSince.toUint40(), uint40(0) ); w.guardians.push(g); w.guardianIdx[guardianAddr] = w.guardians.length;
52,592
10
// recoveredAddress verified
validatorIndexVisited[validatorIndex] = true; verifiedNum++; if (verifiedNum >= threshold) { return; }
validatorIndexVisited[validatorIndex] = true; verifiedNum++; if (verifiedNum >= threshold) { return; }
37,699
25
// Returns the discounted price in paymentTokens for a given amount of options tokens/_amount The amount of options tokens to exercise/ return The amount of payment tokens to pay to purchase the underlying tokens
function getDiscountedPrice(uint256 _amount) public view returns (uint256) { return (getTimeWeightedAveragePrice(_amount) * discount) / 100; }
function getDiscountedPrice(uint256 _amount) public view returns (uint256) { return (getTimeWeightedAveragePrice(_amount) * discount) / 100; }
14,430
20
// Check if there are any existing tokens.
if (tokenAddresses.length == 0) {
if (tokenAddresses.length == 0) {
38,750
36
// Stop re-initialization.
if (address(store) != address(0)) revert();
if (address(store) != address(0)) revert();
30,532
26
// normal quote
toTokenFee = idealToAmount.wmul(haircutRate); actualToAmount = idealToAmount - toTokenFee;
toTokenFee = idealToAmount.wmul(haircutRate); actualToAmount = idealToAmount - toTokenFee;
30,237
58
// Function to get available and claimed rewards for an address
function getAvailableAndClaimedReward(address _address) public view returns (uint256, uint256) { uint256 totalRewardPossible = 0; uint256 effectiveBalancePossible; uint256 effectiveBalanceCurrent; // Iterate over periods starting from the last claimed snapshot for (...
function getAvailableAndClaimedReward(address _address) public view returns (uint256, uint256) { uint256 totalRewardPossible = 0; uint256 effectiveBalancePossible; uint256 effectiveBalanceCurrent; // Iterate over periods starting from the last claimed snapshot for (...
5,729
306
// Creates an asset with its parameters owner, initial owner of asset mainId, unique identifier of asset price, asset price to sell dueDate, end date for calculating rewards apr, annual percentage rate for calculating rewards Needs marketplace access to create an asset /
function createAsset(
function createAsset(
12,239
43
// Ensure that exactly one 721 item is being transferred.
if (item.amount != 1) { revert InvalidERC721TransferAmount(item.amount); }
if (item.amount != 1) { revert InvalidERC721TransferAmount(item.amount); }
14,319
57
// 修改token兑换比率,1eth兑换多少代币 /
function changeTokensPerEther(uint256 _newRate) onlyController public { tokensPerEther = _newRate; }
function changeTokensPerEther(uint256 _newRate) onlyController public { tokensPerEther = _newRate; }
47,553
3
// Add this to a function that might reequire involved actors to be whitelisted in the future /
modifier mayNeedWhitelisting(address sender, address recipient) { if (needWhitelisting) { require(_whitelisted[sender], "A5"); //Transfer Blocked - Sender not eligible require(_whitelisted[recipient], "A6"); //Transfer Blocked - Receiver not eligible } _; }
modifier mayNeedWhitelisting(address sender, address recipient) { if (needWhitelisting) { require(_whitelisted[sender], "A5"); //Transfer Blocked - Sender not eligible require(_whitelisted[recipient], "A6"); //Transfer Blocked - Receiver not eligible } _; }
48,828
2
// transactor is a smart contract address able to only add transactions/ to retrieve a transaction id and able to revoke all confirmations too./ The transactor is not an owner and cannot confirm transactions./ An example for this existing is when the minting admin role contract/ needs to add a multisig transaction to r...
address public transactor;
address public transactor;
7,394
95
// AtivoToken with Governance.
contract AtivoToken is ERC20("Ativo Finance", "ATIVO"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount);...
contract AtivoToken is ERC20("Ativo Finance", "ATIVO"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount);...
15,379
1
// Constructor function of XDISCO Token set name, symbol and decimal of token mint hardcap to deployer /
constructor() public ERC20("XDISCO", "XDISCO")
constructor() public ERC20("XDISCO", "XDISCO")
20,767
168
// A reward pool that does not mint/The rewards are transferred to the pool by calling `notifyRewardAmount`./Only the reward distributor can notify.
contract RewardPool is IRewardDistributor, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; using SafeERC20 for DraculaToken; DraculaToken public dracula; IERC20 public rewardToken; uint256 public rewardsDuration; uint256 public periodFinish; uint256 public rew...
contract RewardPool is IRewardDistributor, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; using SafeERC20 for DraculaToken; DraculaToken public dracula; IERC20 public rewardToken; uint256 public rewardsDuration; uint256 public periodFinish; uint256 public rew...
32,451
160
// Retrieve the current exchange rate palToken:underlying
uint _exchRate = _exchangeRate();
uint _exchRate = _exchangeRate();
74,979
50
// Reentrancy appears
string public constant REENTRANCY = "IPOR_016";
string public constant REENTRANCY = "IPOR_016";
42,953
33
// Approves the token to the spender address with allowance amount. Approves the token to the spender address with allowance amount. token_ token for which allowance is to be given. spender_ the address to which the allowance is to be given. amount_ amount of token. /
function approve( address token_, address spender_, uint256 amount_
function approve( address token_, address spender_, uint256 amount_
77,812
64
// Do the callback after everything is done to avoid reentrancy attack
uint256 codeSize;
uint256 codeSize;
6,881
27
// [DIRECT-TX] revokeInvitationtransaction function to directly revoke an invitationtransaction is submitted directly by msg.sender; not a meta-tx_groupId group id the invitation belongs to_secretHash hash generated by backend return bool upon successful transaction /
function revokeInvitation( uint256 _groupId, bytes32 _secretHash ) external returns (bool)
function revokeInvitation( uint256 _groupId, bytes32 _secretHash ) external returns (bool)
40,657
47
// update new variables based on the number of farmers paid
if (totalWinnersPerTX <= pool.minerCutoff) { if (pool.maxWinnersPerBlock > 2) pool.maxWinnersPerBlock = pool.maxWinnersPerBlock.sub(1); if (pool.maxWinnersPerBlock > 20) pool.maxTransactionLoop = pool.maxTransactionLoop.sub(1); pool.ichiPerLoop = pool.ichiPerLoop.sub(pool.ich...
if (totalWinnersPerTX <= pool.minerCutoff) { if (pool.maxWinnersPerBlock > 2) pool.maxWinnersPerBlock = pool.maxWinnersPerBlock.sub(1); if (pool.maxWinnersPerBlock > 20) pool.maxTransactionLoop = pool.maxTransactionLoop.sub(1); pool.ichiPerLoop = pool.ichiPerLoop.sub(pool.ich...
33,656
16
// Requires a fresh price and then returns the current value.
function read() external view returns (bytes32);
function read() external view returns (bytes32);
43,476
17
// Returns boolean whether an address is ambassador of a given community._ambassador Address of the ambassador _community Address of the communityreturn Boolean whether an address is ambassador of a given community or not /
function isAmbassadorOf(address _ambassador, address _community) public view override returns (bool)
function isAmbassadorOf(address _ambassador, address _community) public view override returns (bool)
29,252
11
// Determine which deposits we will modifiy
for (uint256 end = 0; end < ds.length; end++) { if (ds[end].blockNumber <= latest_block) { if (ds[end].value >= remaining) { ds[end].value = ds[end].value.sub(remaining); if (ds[end].value == 0) { end++; ...
for (uint256 end = 0; end < ds.length; end++) { if (ds[end].blockNumber <= latest_block) { if (ds[end].value >= remaining) { ds[end].value = ds[end].value.sub(remaining); if (ds[end].value == 0) { end++; ...
3,067
4
// Mints 1 ORBITAL to contract creator for initial pool setup
_mint(msg.sender, 1e18);
_mint(msg.sender, 1e18);
33,255
63
// General function to update the implementation of a proxy registered withcertain `id`. If there is no proxy registered, it will instantiate one andset as implementation the `implementationAddress`IMPORTANT Use this function carefully, only for ids that don't have an explicitsetter function, in order to avoid unexpect...
function setAddressAsProxy(bytes32 id, address implementationAddress) external override onlyOwner
function setAddressAsProxy(bytes32 id, address implementationAddress) external override onlyOwner
5,966
32
// send the specified amount to the treasury
transferUSDCs(revenueWallet, totalFeeSum); emit FeeTransfer(msg.sender, revenueWallet, totalFeeSum, _batchId);
transferUSDCs(revenueWallet, totalFeeSum); emit FeeTransfer(msg.sender, revenueWallet, totalFeeSum, _batchId);
31,652
73
// define midtoken address, ETH -> WETH address
uint256 curTotalAmount = IERC20(midToken[i]).tokenBalanceOf(assetFrom[i-1]); uint256 curTotalWeight = totalWeight[i-1]; for(uint256 j = splitNumber[i-1]; j < splitNumber[i]; j++) { PoolInfo memory curPoolInfo; { (addres...
uint256 curTotalAmount = IERC20(midToken[i]).tokenBalanceOf(assetFrom[i-1]); uint256 curTotalWeight = totalWeight[i-1]; for(uint256 j = splitNumber[i-1]; j < splitNumber[i]; j++) { PoolInfo memory curPoolInfo; { (addres...
47,394
148
// Check that no mint has been made in the same block from the same EOA
require(keccak256(abi.encodePacked(tx.origin, block.number)) != _minterBlock, "REENTR MINT-BURN"); _output_amount = (balance().mul(_shares)).div(totalSupply()); _burn(msg.sender, _shares); uint _withdrawalProtectionFee = vaultMaster.withdrawalProtectionFee(); if (_withdrawalPro...
require(keccak256(abi.encodePacked(tx.origin, block.number)) != _minterBlock, "REENTR MINT-BURN"); _output_amount = (balance().mul(_shares)).div(totalSupply()); _burn(msg.sender, _shares); uint _withdrawalProtectionFee = vaultMaster.withdrawalProtectionFee(); if (_withdrawalPro...
17,555
74
// Finalizes the sale. /
function finalize() external onlyOwner { require(weiTotalReceived >= softCap); require(now > startTime.add(period) || weiTotalReceived >= hardCap); if (state == State.PRESALE) { require(this.balance > 0); walletEtherPresale.transfer(this.balance); pause()...
function finalize() external onlyOwner { require(weiTotalReceived >= softCap); require(now > startTime.add(period) || weiTotalReceived >= hardCap); if (state == State.PRESALE) { require(this.balance > 0); walletEtherPresale.transfer(this.balance); pause()...
40,652
8
// - Creates a deterministic hash id for a credit line provided by a single Lender for a given token on a Line of Credit facility line - The Line of Credit facility concerned lender - The address managing the credit line concerned token- The token being lent out on the credit line concernedreturn id /
function computeId(address line, address lender, address token) external pure returns (bytes32) {
function computeId(address line, address lender, address token) external pure returns (bytes32) {
37,746
34
// The time test in the standard contract around line 154 needs to be commentedout to test this function, this tests denying more than one bid from an account/
function testDepositFunctionDenyBid(){ //Test multiple bid denial mechanisim in standard contract address testDeploy = new StandardICOAuction(10000000000000000000000, 1000000000000000000000, 10000000000000000000, 10000000000000000, 1000000000000000, 1000000000000000, 90, t); testConstruct = Standa...
function testDepositFunctionDenyBid(){ //Test multiple bid denial mechanisim in standard contract address testDeploy = new StandardICOAuction(10000000000000000000000, 1000000000000000000000, 10000000000000000000, 10000000000000000, 1000000000000000, 1000000000000000, 90, t); testConstruct = Standa...
49,693
106
// - `index` must be strictly less than {length}./
function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); }
function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); }
33,653
29
// Wraps ERC20 tokens as ERC1155 reward tokens.
function wrapERC20( address _tokenContract, uint256 _tokenAmount, uint256 _numOfRewardsToMint, string calldata _rewardURI
function wrapERC20( address _tokenContract, uint256 _tokenAmount, uint256 _numOfRewardsToMint, string calldata _rewardURI
18,110
13
// sender => _allowed
mapping(address => bool) public callers;
mapping(address => bool) public callers;
27,499
7
// only owner can able to see balance
require(msg.sender == owner, "Only owner can able to see the balance."); return address(this).balance;
require(msg.sender == owner, "Only owner can able to see the balance."); return address(this).balance;
42,295
1
// the unit is Szabo = 0.001 finney
function setCompensationFee(uint _compensationFee) public
function setCompensationFee(uint _compensationFee) public
40,577
213
// Remove an address from the whitelist_addressAddress to remove from the whitelist /
function removeAddress( address _address ) external onlyOwner
function removeAddress( address _address ) external onlyOwner
44,736
0
// This is the reward token per second Which will be multiplied by the tokens the user staked divided by the total This ensures a steady reward rate of the platform So the more users stake, the less for everyone who is staking.
uint256 public constant REWARD_RATE = 100; uint256 public s_lastUpdateTime; uint256 public s_rewardPerTokenStored; mapping(address => uint256) public s_userRewardPerTokenPaid; mapping(address => uint256) public s_rewards; uint256 private s_totalSupply; mapping(address => uint256) public s_...
uint256 public constant REWARD_RATE = 100; uint256 public s_lastUpdateTime; uint256 public s_rewardPerTokenStored; mapping(address => uint256) public s_userRewardPerTokenPaid; mapping(address => uint256) public s_rewards; uint256 private s_totalSupply; mapping(address => uint256) public s_...
16,964
7
// The current stable borrow rate. Expressed in ray.
uint128 currentStableBorrowRate;
uint128 currentStableBorrowRate;
40,639
158
// register distribution
registeredDistributions[receiver] = distribution; registrations.push(receiver);
registeredDistributions[receiver] = distribution; registrations.push(receiver);
42,310
50
// Since transfer throws an exception on failure and cannot call back here, there should be no way for us to still have half of the money.
assert(this.balance == balanceBeforeTransfer - msg.value / 2); return this.balance;
assert(this.balance == balanceBeforeTransfer - msg.value / 2); return this.balance;
19,512
13
// burns L2 tokens in order to release escrowed L1 tokens
IArbToken(_l2Token).bridgeBurn(_from, _amount);
IArbToken(_l2Token).bridgeBurn(_from, _amount);
9,437
8
// mark token name as taken, avoid same line minted twice
myTokenName[_line] = 1;
myTokenName[_line] = 1;
9,539
0
// LIBRARIES /
using FlagHelper for uint256; using SafeMath for uint256;
using FlagHelper for uint256; using SafeMath for uint256;
40,817
99
// See {ERC20-_beforeTokenTransfer}. Requirements: - the sender or the receiver must not be freezed. /
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!freezed(from), "ERC20Freezable: sender freezed"); require(!freezed(to), "ERC20Freezable: receiver freezed"); }
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!freezed(from), "ERC20Freezable: sender freezed"); require(!freezed(to), "ERC20Freezable: receiver freezed"); }
56,260
7
// Pay the Royalty
currency.transfer(root, royalty);
currency.transfer(root, royalty);
22,981
1
// solium-disable-next-line security/no-inline-assembly
assembly { if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) }
assembly { if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) }
41,409
93
// Removes a darknode from the store and transfers its bond to the/ owner of this contract.
function removeDarknode(address darknodeID) external onlyOwner { uint256 bond = darknodeRegistry[darknodeID].bond; delete darknodeRegistry[darknodeID]; LinkedList.remove(darknodes, darknodeID); require(ren.transfer(owner, bond), "bond transfer failed"); }
function removeDarknode(address darknodeID) external onlyOwner { uint256 bond = darknodeRegistry[darknodeID].bond; delete darknodeRegistry[darknodeID]; LinkedList.remove(darknodes, darknodeID); require(ren.transfer(owner, bond), "bond transfer failed"); }
3,944
8
// Updates a token to a new TokenURI. _blockNumber block number of the block _blockHash bytes32 of the blockHash _ipfsHash ipfsHash of the token URI /
function updateToken( uint256 _blockNumber, bytes32 _blockHash, string memory _ipfsHash
function updateToken( uint256 _blockNumber, bytes32 _blockHash, string memory _ipfsHash
24,186
155
// todo if there's more than one mint request in one block the quoted fee might be lowerthan what the artist expects, (when using a bonded price strategy)return fee the fee required to mint splices of that style /
function quoteFee( uint32 styleTokenId, IERC721[] memory originCollections, uint256[] memory originTokenIds
function quoteFee( uint32 styleTokenId, IERC721[] memory originCollections, uint256[] memory originTokenIds
76,591
58
// Emit {LogCancelVouch} eventstaker Staker addressborrower borrower address /
function cancelVouch(address staker, address borrower) external override onlyMember(msg.sender) whenNotPaused { if (msg.sender != staker && msg.sender != borrower) revert AuthFailed(); if (getLockedStake(staker, borrower) != 0) revert LockedStakeNonZero(); uint256 stakerCount = members[borro...
function cancelVouch(address staker, address borrower) external override onlyMember(msg.sender) whenNotPaused { if (msg.sender != staker && msg.sender != borrower) revert AuthFailed(); if (getLockedStake(staker, borrower) != 0) revert LockedStakeNonZero(); uint256 stakerCount = members[borro...
21,695
45
// if target is newer than last timepoint
if (target == currentTime || _lteConsideringOverflow(lastTimepointTimestamp, target, currentTime)) { return (lastTimepoint, lastTimepoint, true, lastIndex); }
if (target == currentTime || _lteConsideringOverflow(lastTimepointTimestamp, target, currentTime)) { return (lastTimepoint, lastTimepoint, true, lastIndex); }
27,166
17
// Contract authorization functuons!!!
function authorizeCaller(address dataContract) external requireContractOwner{ authorizedContracts[dataContract] = 1; }
function authorizeCaller(address dataContract) external requireContractOwner{ authorizedContracts[dataContract] = 1; }
44,615
46
// Swap tokenA into tokenB using univ3_router.ExactInputSingle() Uni V3 only
function swap(address _tokenA, address _tokenB, uint24 _fee_tier, uint256 _amountAtoB, uint256 _amountOutMinimum, uint160 _sqrtPriceLimitX96) public onlyByOwnGov returns (uint256) { // Make sure the collateral is allowed require(allowed_collaterals[_tokenA] || _tokenA == address(FRAX), "TokenA not a...
function swap(address _tokenA, address _tokenB, uint24 _fee_tier, uint256 _amountAtoB, uint256 _amountOutMinimum, uint160 _sqrtPriceLimitX96) public onlyByOwnGov returns (uint256) { // Make sure the collateral is allowed require(allowed_collaterals[_tokenA] || _tokenA == address(FRAX), "TokenA not a...
74,980
27
// Gov Functions //Begins transfer of gov rights. The newPendingGov must call `_acceptGov` to finalize the transfer.Gov function to begin change of gov. The newPendingGov must call `_acceptGov` to finalize the transfer.newPendingGov New pending gov./
function _setPendingGov(address newPendingGov) external
function _setPendingGov(address newPendingGov) external
16,659
24
// update an Issue with transaction tokens owned2nd step(optional) /
function updateIssue(uint256 _issueId, uint256 _newTokenAmount) public whenNotPaused { require(issues[_issueId].tokensStaked != 0, "Issue has to exist"); require(issues[_issueId].issueGenerator == msg.sender, "Has to be the issue creator"); require(isIssueInDraft(_issueId), "Draft Issue Time...
function updateIssue(uint256 _issueId, uint256 _newTokenAmount) public whenNotPaused { require(issues[_issueId].tokensStaked != 0, "Issue has to exist"); require(issues[_issueId].issueGenerator == msg.sender, "Has to be the issue creator"); require(isIssueInDraft(_issueId), "Draft Issue Time...
45,505
24
// write sourceChainId
mstore(chainIds, and(mload(add(_data, srcdataptr)), mask))
mstore(chainIds, and(mload(add(_data, srcdataptr)), mask))
18,625
59
// Propose a new cold wallet address/_newColdWallet The address of the new cold wallet
function proposeColdWallet(address _newColdWallet) external onlyOwner { _tempWallet = _newColdWallet; adminFeelsOK = true; }
function proposeColdWallet(address _newColdWallet) external onlyOwner { _tempWallet = _newColdWallet; adminFeelsOK = true; }
13,082
64
// if a taker has been specified (peer-to-peer offer - i.e. direct trade between two users)
else{ if(checkIds){
else{ if(checkIds){
26,783
8
// Set up variables for checking the contract's membership status.
bool private isMember_; uint8 private memberId_;
bool private isMember_; uint8 private memberId_;
10,694
247
// Revokes `role` from the calling account.
* Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked}...
* Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked}...
185
20
// collateralRatioDecimalsCorrection represents the value to be used to adjust result decimals after applying ratio to a value calculation.
function collateralRatioDecimalsCorrection() public pure returns (uint256) { return 10000; }
function collateralRatioDecimalsCorrection() public pure returns (uint256) { return 10000; }
6,267
102
// 0: Water, 1: Fire, 2: Nature, 3: Light, 4: Darkness.
uint8 aura;
uint8 aura;
57,791
8
// See {ERC721Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`. /
function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to unpause"); _unpause(); }
function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to unpause"); _unpause(); }
6,258
165
// Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint ID of the token to be added to the tokens list of the given address /
function _addTokenToOwnerEnumeration(address to, uint tokenId) private { uint length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; }
function _addTokenToOwnerEnumeration(address to, uint tokenId) private { uint length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; }
40,318
115
// Handles Minting Logic To Create New Tokens/
) private returns (bool) { // fee exempt bool takeFee = !isFeeExempt[msg.sender]; // find the number of tokens we should mint to keep up with the current price uint256 tokensToMintNoTax = _totalSupply.mul(received).div( prevTokenAmount ); // apply fee to...
) private returns (bool) { // fee exempt bool takeFee = !isFeeExempt[msg.sender]; // find the number of tokens we should mint to keep up with the current price uint256 tokensToMintNoTax = _totalSupply.mul(received).div( prevTokenAmount ); // apply fee to...
29,656
26
// assert(a == bc + a % b);There is no case in which this doesn't hold
return c;
return c;
17,113
80
// is a is less than b a FixedPointInt b FixedPointIntreturn True if a < b, False if not /
function isLessThan(FixedPointInt memory a, FixedPointInt memory b) internal pure returns (bool) { return a.value < b.value; }
function isLessThan(FixedPointInt memory a, FixedPointInt memory b) internal pure returns (bool) { return a.value < b.value; }
48,520