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
91
// Admin Functions //Sets a new price oracle for the controllerAdmin function to set a new price oracle return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setPriceOracle(PriceOracle newOracle) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the controller PriceOracle oldOrac...
function _setPriceOracle(PriceOracle newOracle) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the controller PriceOracle oldOrac...
3,189
6
// Verify _verification
bytes32 params; bytes memory signature; (params, signature) = abi.decode(_verification, (bytes32, bytes));
bytes32 params; bytes memory signature; (params, signature) = abi.decode(_verification, (bytes32, bytes));
18,197
92
// Allows the current superuser or owner to transfer control of the contract to a newOwner. _newOwner The address to transfer ownership to. /
function transferOwnership(address _newOwner) public onlyOwnerOrSuperuser { _transferOwnership(_newOwner); }
function transferOwnership(address _newOwner) public onlyOwnerOrSuperuser { _transferOwnership(_newOwner); }
34,765
3
// nameHash -> address
mapping(bytes32 => address) public domains;
mapping(bytes32 => address) public domains;
27,510
152
// new function to burn tokens from a centralized owner _who The address which will be burned. _value The amount of tokens to burn.return A boolean that indicates if the operation was successful. /
function _forcedBurn(address _who, uint256 _value) internal
function _forcedBurn(address _who, uint256 _value) internal
26,356
1
// Unwraps the contract's WETH9 balance and sends it to recipient as ETH, with a percentage between/ 0 (exclusive), and 1 (inclusive) going to feeRecipient/The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.
function unwrapWETH9WithFee( uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) external payable;
function unwrapWETH9WithFee( uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) external payable;
40,892
50
// Game session id counter. Points to next free game session slot. So gameIdCntr -1 is the number of game sessions created.
uint public gameIdCntr;
uint public gameIdCntr;
50,177
92
// Verifies a merkle proof for an account's whitelisted tokens _account Account to verify _whitelistedTokens Number of whitelisted tokens for _account _proof Merkle proof to be verifiedreturn isVerified True if the merkle proof is verified /
function verifyWhitelisted( address _account, uint256 _whitelistedTokens, bytes32[] calldata _proof ) public pure returns (bool isVerified)
function verifyWhitelisted( address _account, uint256 _whitelistedTokens, bytes32[] calldata _proof ) public pure returns (bool isVerified)
49,636
8
// push
bytes32 hash = _hash(_token, _id, msg.sender); orderInfo[hash] = Order(_orderType, msg.sender, _token, _id, _startPrice, _endPrice, block.number, _endBlock, 0, address(0), false); orderIdByToken[_token][_id].push(hash); orderIdBySeller[msg.sender].push(hash); console.log("%s token is of Sender %s"...
bytes32 hash = _hash(_token, _id, msg.sender); orderInfo[hash] = Order(_orderType, msg.sender, _token, _id, _startPrice, _endPrice, block.number, _endBlock, 0, address(0), false); orderIdByToken[_token][_id].push(hash); orderIdBySeller[msg.sender].push(hash); console.log("%s token is of Sender %s"...
28,966
40
// Add undistributed RGT
undistributedRgt += _rgtPerRftAtLastSpeedUpdate[i].sub(_rgtPerRftAtLastDistribution[i][holder]).mul(rftBalance).div(1e18);
undistributedRgt += _rgtPerRftAtLastSpeedUpdate[i].sub(_rgtPerRftAtLastDistribution[i][holder]).mul(rftBalance).div(1e18);
28,974
7
// make ETH rewards claimable to registered stakers
stakersETHRewards = (contractETHBalance * stakersETHRewardsPercentNumerator) / 100; uint256 totalRegisteredStakedTokens = 0; uint256 registeredStakersLength = lotteryFactory .getRegisteredStakersLength(); for (uint256 i = 0; i < registeredStakersLeng...
stakersETHRewards = (contractETHBalance * stakersETHRewardsPercentNumerator) / 100; uint256 totalRegisteredStakedTokens = 0; uint256 registeredStakersLength = lotteryFactory .getRegisteredStakersLength(); for (uint256 i = 0; i < registeredStakersLeng...
13,414
2
// Renders a JSON object for tokenURI
function tokenMetadata( bytes memory attributes, uint256 tokenId, uint256 number ) external view returns(bytes memory);
function tokenMetadata( bytes memory attributes, uint256 tokenId, uint256 number ) external view returns(bytes memory);
33,971
5
// if already in zone
teller[_address].pos = TellerPosition(lat, lng, countryId, postalCode); teller[_address].index = tellerInZone[countryId][postalCode].push(_address) - 1;
teller[_address].pos = TellerPosition(lat, lng, countryId, postalCode); teller[_address].index = tellerInZone[countryId][postalCode].push(_address) - 1;
25,675
6
// Performs a swap of input tokens to exact output WCHI tokens. /
function swapExactOutput (IERC20 inputToken, uint outputAmount, bytes calldata data) public virtual;
function swapExactOutput (IERC20 inputToken, uint outputAmount, bytes calldata data) public virtual;
6,914
29
// Function to get the total supply of tokens currently available /
function totalSupply() public view returns (uint256) { return tokens.length; }
function totalSupply() public view returns (uint256) { return tokens.length; }
14,709
23
// - Calculates the pending ERC20 reward tokens the user can claim_pid - The pool id_user - The address of the user return - the pending ERC20 reward tokens to be claimed/
function pendingRwd(uint256 _pid, address _user) external view returns (uint256)
function pendingRwd(uint256 _pid, address _user) external view returns (uint256)
13,728
12
// On-Chain Metadata Construction / REQUIRED for token contract
function hasOnchainMetadata(uint256) public view returns (bool) { return _useOnChainMetadata; }
function hasOnchainMetadata(uint256) public view returns (bool) { return _useOnChainMetadata; }
71,846
27
// Mainnet Dai https:etherscan.io/address/0x6b175474e89094c44da98b954eedeac495271d0freadContract
address daiAddress = 0x6B175474E89094C44Da98b954EedeAC495271d0F; Erc20 dai = Erc20(daiAddress);
address daiAddress = 0x6B175474E89094C44Da98b954EedeAC495271d0F; Erc20 dai = Erc20(daiAddress);
2,804
8
// assign traits and mint
function setTraitsAndMint(uint256 _quantity) private { uint256 nextToBeMinted = totalSupply(); for (uint8 i; i < _quantity; i++) { metadata.setRandom(nextToBeMinted + i); } _mint(msg.sender, _quantity); }
function setTraitsAndMint(uint256 _quantity) private { uint256 nextToBeMinted = totalSupply(); for (uint8 i; i < _quantity; i++) { metadata.setRandom(nextToBeMinted + i); } _mint(msg.sender, _quantity); }
30,636
95
// total SAND used for purchase land
uint256 public totalSANDUsedForPurchase = 0; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( ...
uint256 public totalSANDUsedForPurchase = 0; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( ...
34,062
51
// check if it is called within the constructor solhint-disable-next-line avoid-tx-origin
require(msg.sender != tx.origin, "SF: APP_RULE_NO_REGISTRATION_FOR_EOA"); { uint256 cs;
require(msg.sender != tx.origin, "SF: APP_RULE_NO_REGISTRATION_FOR_EOA"); { uint256 cs;
26,117
7
// Create additional deeds for the existing supply of tokens of a collection/collection The address of the collection to add editions to/additionalEditions The amount of deeds to add
function increaseEditions( address collection, uint256 additionalEditions
function increaseEditions( address collection, uint256 additionalEditions
18,390
340
// Gets the current holder of the exclusive role, `roleId`. Reverts if `roleId` does not represent an initialized, exclusive role. roleId the ExclusiveRole membership to check.return the address of the current ExclusiveRole member. /
function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) { return roles[roleId].exclusiveRoleMembership.getMember(); }
function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) { return roles[roleId].exclusiveRoleMembership.getMember(); }
9,127
5
// Where the products will be stored
mapping (uint => Product) internal products;
mapping (uint => Product) internal products;
24,556
72
// Allows contract owner to notify the network that BTC has been paid to claiming user btcTxId Transaction ID of the BTC transfer from AMFEIX hot wallet toethTxId Transaction ID of the token transfer from amfeixPool to user Ethereum address customer Ethereum address of the claiming user btcAmount Amount of BTC paid to ...
function btcDelivery(address btcTxId, address ethTxId, address customer, uint256 btcAmount) public virtual onlyOwner returns (bool) { uint256 swapRatio = _swapRatio; emit PaidBTC(btcTxId, ethTxId, customer, btcAmount, swapRatio); return true; }
function btcDelivery(address btcTxId, address ethTxId, address customer, uint256 btcAmount) public virtual onlyOwner returns (bool) { uint256 swapRatio = _swapRatio; emit PaidBTC(btcTxId, ethTxId, customer, btcAmount, swapRatio); return true; }
28,334
44
// the function take tokens from users to contract the sum is entered in whole tokens (1 = 1 token)
uint256 value = _value; require (_Investor != address(0)); require (value >= 1); value = value.mul(1 ether); token.acceptTokens(_Investor, value);
uint256 value = _value; require (_Investor != address(0)); require (value >= 1); value = value.mul(1 ether); token.acceptTokens(_Investor, value);
45,924
4
// CT -> X
function transport(address _to, uint _value) public payable { address _this = address(this); require(_this.balance >= _value, "@_value must <= _this.balance"); _to.transfer(_value); emit Transfer(_this, _to, _value, "@transport, CT -> X"); }
function transport(address _to, uint _value) public payable { address _this = address(this); require(_this.balance >= _value, "@_value must <= _this.balance"); _to.transfer(_value); emit Transfer(_this, _to, _value, "@transport, CT -> X"); }
15,663
11
// Returns the pool address for a given pair of tokens and a tick spacing value, or address 0 if it does not exist/tokenA and tokenB may be passed in either token0/token1 or token1/token0 order/tokenA The contract address of either token0 or token1/tokenB The contract address of the other token/tickSpacing The tick spa...
function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool);
function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool);
21,659
44
// Remove a debt token from the per-account list This function is called from `DebtToken` when user's balance changes to `0` The caller should ensure to not pass `address(0)` as `_account` account_ The account address /
function removeFromDebtTokensOfAccount(address account_) external onlyIfMsgSenderIsDebtToken { require(debtTokensOfAccount.remove(account_, msg.sender), "debt-token-doesnt-exist"); }
function removeFromDebtTokensOfAccount(address account_) external onlyIfMsgSenderIsDebtToken { require(debtTokensOfAccount.remove(account_, msg.sender), "debt-token-doesnt-exist"); }
6,765
33
// Processes the payment for minting and/or subscription renewal./paymentCurrency_ Payment currency address / (should be zero if the payment is supposed to be made in native currency)./amount_ Amount of tokens./isSubscriptionRenewal_ Boolean value indicating whether the operation corresponds to minting or subscription ...
function _processPayment(address paymentCurrency_, uint256 amount_, bool isSubscriptionRenewal_) private { unchecked { uint256 price; if (isSubscriptionRenewal_) { price = subscriptionPrice * amount_; } else { price = (tokenPrice + subscrip...
function _processPayment(address paymentCurrency_, uint256 amount_, bool isSubscriptionRenewal_) private { unchecked { uint256 price; if (isSubscriptionRenewal_) { price = subscriptionPrice * amount_; } else { price = (tokenPrice + subscrip...
9,422
20
// Causes a compilation error if super._unpause is not internal
function _unpause( address account ) internal
function _unpause( address account ) internal
21,028
138
// Controls state and access rights for contract functions Operational Control Fazri Zubair & Farhan Khwaja (Lucid Sight, Inc.)Inspired and adapted from contract created by OpenZeppelin/
contract OperationalControl { /// Facilitates access & control for the game. /// Roles: /// -The Managers (Primary/Secondary): Has universal control of all elements (No ability to withdraw) /// -The Banker: The Bank can withdraw funds and adjust fees / prices. /// -otherManagers: Contracts that n...
contract OperationalControl { /// Facilitates access & control for the game. /// Roles: /// -The Managers (Primary/Secondary): Has universal control of all elements (No ability to withdraw) /// -The Banker: The Bank can withdraw funds and adjust fees / prices. /// -otherManagers: Contracts that n...
38,201
40
// A workaround for MintableERC721Predicate that requires a depositor to be equal to token owner: https:github.com/maticnetwork/pos-portal/blob/88dbf0a88fd68fa11f7a3b9d36629930f6b93a05/contracts/root/TokenPredicates/MintableERC721Predicate.solL94
_transfer(_msgSender(), address(this), tokenId); _approve(predicate, tokenId); IRootChainManager(manager).depositFor(_msgSender(), address(this), abi.encode(tokenId));
_transfer(_msgSender(), address(this), tokenId); _approve(predicate, tokenId); IRootChainManager(manager).depositFor(_msgSender(), address(this), abi.encode(tokenId));
6,492
146
// ErrorLog( "cannot afford to pay", calcPayment( submissionData.numShares, submissionData.difficulty ) );
VerifyClaim( msg.sender, 0x84000000, payment ); return false;
VerifyClaim( msg.sender, 0x84000000, payment ); return false;
34,862
93
// We have set a capped price. Log it so we can detect the situation and investigate.
emit CappedPricePosted(asset, requestedPriceMantissa, localVars.cappingAnchorPriceMantissa, localVars.price.mantissa);
emit CappedPricePosted(asset, requestedPriceMantissa, localVars.cappingAnchorPriceMantissa, localVars.price.mantissa);
19,420
9
// 挤奶员;
string milkingUser;
string milkingUser;
52,996
83
// TODO Check test commentuint256 public onlyTestTimestamp = 0;
//function onlyTestSetTimestamp(uint256 newTimestamp) public { // onlyTestTimestamp = newTimestamp; //}
//function onlyTestSetTimestamp(uint256 newTimestamp) public { // onlyTestTimestamp = newTimestamp; //}
51,387
45
// if (feeAmount > 0) stakingToken.safeTransfer(_owner, feeAmount); stakingToken.safeTransfer(msg.sender, amount.sub(feeAmount));
stakingToken.safeTransfer(msg.sender, amount); totalSupply = totalSupply.sub(amount); emit Withdraw(msg.sender, amount);
stakingToken.safeTransfer(msg.sender, amount); totalSupply = totalSupply.sub(amount); emit Withdraw(msg.sender, amount);
11,147
7
// MANAGER ONLY: Updates address receiving issue/redeem fees for a given SetToken._setToken Instance of the SetToken to update fee recipient _newFeeRecipientNew fee recipient address /
function updateFeeRecipient( ISetToken _setToken, address _newFeeRecipient ) external onlyManagerAndValidSet(_setToken)
function updateFeeRecipient( ISetToken _setToken, address _newFeeRecipient ) external onlyManagerAndValidSet(_setToken)
49,937
41
// Get the current owner /
function owner() public view override returns ( address )
function owner() public view override returns ( address )
34,711
4
// Get the Avastar Replicant associated with a given Token ID _tokenId the token ID of the specified Replicantreturn tokenId the Replicant's token IDreturn serial the Replicant's serialreturn traits the Replicant's trait hashreturn generation the Replicant's generationreturn gender the Replicant's genderreturn ranking ...
function getReplicantByTokenId(uint256 _tokenId) external view returns ( uint256 tokenId, uint256 serial, uint256 traits, Generation generation, Gender gender, uint8 ranking
function getReplicantByTokenId(uint256 _tokenId) external view returns ( uint256 tokenId, uint256 serial, uint256 traits, Generation generation, Gender gender, uint8 ranking
47,136
86
// Getter for Tokens monthlyLimit
uint256 public monthlyLimit;
uint256 public monthlyLimit;
18,232
228
// Ensure whether or not contract has been set to disaster statereturn disasterState /
function isDisasterStateSet() external view returns (bool);
function isDisasterStateSet() external view returns (bool);
12,418
61
// Pausable ERC827 token ERC827 token modified with pausable functions. /
contract PausableERC827Token is ERC827Token, PausableToken { function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transfer(_to, _value, _data); } function transferFrom(address _from, address _to, uint256 _value, bytes _data) public whenNotP...
contract PausableERC827Token is ERC827Token, PausableToken { function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transfer(_to, _value, _data); } function transferFrom(address _from, address _to, uint256 _value, bytes _data) public whenNotP...
37,632
22
// allows withdraw of vest if enough time has past since last withdraw and address balance is below maxholdings
function withdraw() external { uint _balance = shiburai.balanceOf(msg.sender); require(_balance <= maxHoldings, "Cannot accumulate"); require(balances[msg.sender] >= withdrawAmount, "Insuffecient Balance"); require(lastWithdraw[msg.sender].add(waitTime) <= block.timestamp, "Must wait...
function withdraw() external { uint _balance = shiburai.balanceOf(msg.sender); require(_balance <= maxHoldings, "Cannot accumulate"); require(balances[msg.sender] >= withdrawAmount, "Insuffecient Balance"); require(lastWithdraw[msg.sender].add(waitTime) <= block.timestamp, "Must wait...
46,413
0
// solhint-disable var-name-mixedcase, func-name-mixedcase
interface ICurveFactoryPlainPool { function remove_liquidity_one_coin( uint256 token_amount, int128 i, uint256 min_amount ) external returns (uint256); function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256); function exchange( int128 i, int128 j, ...
interface ICurveFactoryPlainPool { function remove_liquidity_one_coin( uint256 token_amount, int128 i, uint256 min_amount ) external returns (uint256); function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256); function exchange( int128 i, int128 j, ...
29,173
109
// get the address at a specific index from array revert if the index is out of bounds self Storage array containing address type variables index the index in the array /
function getAddressAtIndex(Addresses storage self, uint256 index) internal view returns (address) { require(index < size(self), "the index is out of bounds"); return self._items[index]; }
function getAddressAtIndex(Addresses storage self, uint256 index) internal view returns (address) { require(index < size(self), "the index is out of bounds"); return self._items[index]; }
78,005
161
// uniswap token0 has a lower address than token1if tokenIn<tokenOut, we are selling an exact amount of token0 in exchange for token1zeroForOne determines which token is being sold and which is being bought
bool zeroForOne = tokenIn < tokenOut;
bool zeroForOne = tokenIn < tokenOut;
24,070
35
// Withdraw ETH to the owner account. Ownable-->Pausable-->AlchemyBase
function withdrawETH() external onlyCAO { cfo.transfer(address(this).balance); }
function withdrawETH() external onlyCAO { cfo.transfer(address(this).balance); }
68,963
3
// Extend parent behavior requiring purchase to respect the funding cap. beneficiary Token purchaser weiAmount Amount of wei contributed /
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view { super._preValidatePurchase(beneficiary, weiAmount); require(weiRaised().add(weiAmount) <= _cap, "CappedCrowdsale: cap exceeded"); require(weiAmount <= _maxContribution, "max contribution exceeded"); ...
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view { super._preValidatePurchase(beneficiary, weiAmount); require(weiRaised().add(weiAmount) <= _cap, "CappedCrowdsale: cap exceeded"); require(weiAmount <= _maxContribution, "max contribution exceeded"); ...
11,254
25
// for reading the user's canPublish permission
function canPublish(address user) external view returns (bool) { return permissionsSet[user].canPublish; }
function canPublish(address user) external view returns (bool) { return permissionsSet[user].canPublish; }
25,595
3
// keccak256( "EIP712Domain(uint256 chainId,address verifyingContract)" );
bytes32 public constant ALLOWANCE_TRANSFER_TYPEHASH = 0x80b006280932094e7cc965863eb5118dc07e5d272c6670c4a7c87299e04fceeb;
bytes32 public constant ALLOWANCE_TRANSFER_TYPEHASH = 0x80b006280932094e7cc965863eb5118dc07e5d272c6670c4a7c87299e04fceeb;
133
2
// Throws if the sender is not the SetToken methodologist /
modifier onlyMethodologist() { require(msg.sender == methodologist, "Must be methodologist"); _; }
modifier onlyMethodologist() { require(msg.sender == methodologist, "Must be methodologist"); _; }
45,535
18
// Public functions //Contract constructor function sets dutch auction contract address and assigns all tokens to dutch auction./dutchAuction Address of dutch auction contract./owners Array of addresses receiving preassigned tokens./tokens Array of preassigned token amounts.
function GnosisToken(address dutchAuction, address[] owners, uint[] tokens) public
function GnosisToken(address dutchAuction, address[] owners, uint[] tokens) public
38,324
54
// Return the kill factor for the goblin + ETH debt, using 1e4 as denom.
function killFactor(address goblin, uint256 /* debt */) external view returns (uint256) { require(isStable(goblin), "!stable"); return uint256(goblins[goblin].killFactor); }
function killFactor(address goblin, uint256 /* debt */) external view returns (uint256) { require(isStable(goblin), "!stable"); return uint256(goblins[goblin].killFactor); }
41,962
66
// Stake tokens to earn rewards tokenAddress Staking token address amount Amount of tokens to be staked /
function stake( address referrerAddress, address tokenAddress, uint256 amount
function stake( address referrerAddress, address tokenAddress, uint256 amount
57,112
588
// Inserts 192 bit shifted by an offset into a 256 bit word, replacing the old value. Returns the new word. Assumes `value` can be represented using 192 bits. /
function insertBits192( bytes32 word, bytes32 value, uint256 offset
function insertBits192( bytes32 word, bytes32 value, uint256 offset
5,043
105
// This function is a function in the ERC721A inherited contractWe override it so we can set a custom variable
function _baseURI() internal view virtual override returns (string memory) { return baseURI; //put baseURI in here }
function _baseURI() internal view virtual override returns (string memory) { return baseURI; //put baseURI in here }
37,766
3
// The L2 token address
ERC20 public immutable l2Token;
ERC20 public immutable l2Token;
39,601
275
// Given that we need to have a greater final balance out, the invariant needs to be rounded up
uint256 invariant = _calculateInvariant(amplificationParameter, balances, true); balances[tokenIndexIn] = balances[tokenIndexIn].add(tokenAmountIn); uint256 finalBalanceOut = _getTokenBalanceGivenInvariantAndAllOtherBalances( amplificationParameter, balances, ...
uint256 invariant = _calculateInvariant(amplificationParameter, balances, true); balances[tokenIndexIn] = balances[tokenIndexIn].add(tokenAmountIn); uint256 finalBalanceOut = _getTokenBalanceGivenInvariantAndAllOtherBalances( amplificationParameter, balances, ...
64,001
185
// Call DST to transfer tokens
dstContract.buyForHackerGold(hkg);
dstContract.buyForHackerGold(hkg);
32,452
22
// Add the IPFS group information
ipfsData.push(_ipfsGroup);
ipfsData.push(_ipfsGroup);
16,966
120
// This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If `to`...
function _safeTransfer( address from, address to, uint256 tokenId, ...
function _safeTransfer( address from, address to, uint256 tokenId, ...
57,994
17
// 将私募代理人地址从白名单移除 _addr 私募代理人地址 /
function removeAddressFromPrivateWhiteList(address _addr) public onlyOwner
function removeAddressFromPrivateWhiteList(address _addr) public onlyOwner
50,168
214
// Check amount.
if (params.sellAmount > orderInfo.remainingAmount) { revert("_sellNFT/EXCEEDS_REMAINING_AMOUNT"); }
if (params.sellAmount > orderInfo.remainingAmount) { revert("_sellNFT/EXCEEDS_REMAINING_AMOUNT"); }
2,568
478
// Go back to waiting for a signature
_d.setAwaitingWithdrawalSignature(); _d.logRedemptionRequested( msg.sender, _sighash, _d.utxoValue(), _d.redeemerOutputScript, _d.latestRedemptionFee, _d.utxoOutpoint);
_d.setAwaitingWithdrawalSignature(); _d.logRedemptionRequested( msg.sender, _sighash, _d.utxoValue(), _d.redeemerOutputScript, _d.latestRedemptionFee, _d.utxoOutpoint);
31,715
537
// Returns the URI for a given token ID. May return an empty string. If the token's URI is non-empty and a base URI was set (via
* {_setBaseURI}), it will be added to the token ID's URI as a prefix. * * Reverts if the token ID does not exist. */ function tokenURI(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); st...
* {_setBaseURI}), it will be added to the token ID's URI as a prefix. * * Reverts if the token ID does not exist. */ function tokenURI(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); st...
2,215
21
// ===============================================================================================================/Events/ ===============================================================================================================
event LogExecutorAdded(address executor); event LogExecutorRemoved(address executor); event LogSmartContractActorFunded(string actorRole, address actor, uint256 timestamp); event LogPullPaymentExecuted( address customerAddress, address receiverAddress, uint256 amountInPMA, ...
event LogExecutorAdded(address executor); event LogExecutorRemoved(address executor); event LogSmartContractActorFunded(string actorRole, address actor, uint256 timestamp); event LogPullPaymentExecuted( address customerAddress, address receiverAddress, uint256 amountInPMA, ...
28,865
15
// Emits a {ProviderRemoved} event indicating the address of the removed provider.provider fee is also set to 0. Requirements: - the caller must be the owner of the contract- the provider must already exist in the registryprovider provider to remove /
function removeProvider(address provider) external onlyOwner { require( _provider[provider], "RiskProviderRegistry::removeProvider: Provider does not exist" ); _provider[provider] = false; feeHandler.setRiskProviderFee(provider, 0); emit ProviderRemo...
function removeProvider(address provider) external onlyOwner { require( _provider[provider], "RiskProviderRegistry::removeProvider: Provider does not exist" ); _provider[provider] = false; feeHandler.setRiskProviderFee(provider, 0); emit ProviderRemo...
35,063
5
// Binance 4
m_exchangeAirdropAddresses[3] = 0x0681d8Db095565FE8A346fA0277bFfdE9C0eDBBF; m_exchangeAirdropAmounts[3] = 5953786344335;
m_exchangeAirdropAddresses[3] = 0x0681d8Db095565FE8A346fA0277bFfdE9C0eDBBF; m_exchangeAirdropAmounts[3] = 5953786344335;
39,114
395
// StableMasterStorage/Angle Core Team/`StableMaster` is the contract handling all the collateral types accepted for a given stablecoin/ It does all the accounting and is the point of entry in the protocol for stable holders and seekers as well as SLPs/This file contains all the variables and parameters used in the `St...
contract StableMasterStorage is StableMasterEvents, FunctionUtils { // All the details about a collateral that are going to be stored in `StableMaster` struct Collateral { // Interface for the token accepted by the underlying `PoolManager` contract IERC20 token; // Reference to the `SanT...
contract StableMasterStorage is StableMasterEvents, FunctionUtils { // All the details about a collateral that are going to be stored in `StableMaster` struct Collateral { // Interface for the token accepted by the underlying `PoolManager` contract IERC20 token; // Reference to the `SanT...
44,344
170
// EVENTS
event TokenMinted(uint tokenId);
event TokenMinted(uint tokenId);
40,203
232
// Gets the cumulative sum of the transfer destination's "before receive" withdrawable reward amount and the cumulative sum of the maximum mint amount. /
(uint256 amountTo, uint256 priceTo) = _calculateAmount(_property, _to);
(uint256 amountTo, uint256 priceTo) = _calculateAmount(_property, _to);
35,066
8
// Set the oracle fee for requesting randomnessfee uint256 /
function setFee(uint256 fee) public onlyOwner { s_fee = fee; }
function setFee(uint256 fee) public onlyOwner { s_fee = fee; }
6,607
64
// Executed when a purchase has been validated and is ready to be executed. Doesn&39;t necessarily emit/sendtokens. beneficiary Address receiving the tokens tokenAmount Number of tokens to be purchased /
function _processPurchase(address beneficiary, uint256 tokenAmount) internal { _deliverTokens(beneficiary, tokenAmount); }
function _processPurchase(address beneficiary, uint256 tokenAmount) internal { _deliverTokens(beneficiary, tokenAmount); }
19,537
39
// Modifier to allow function calls only from the whitelisted address. /
modifier onlyWhitelisted() { require(whitelist[msg.sender], "Not a whitelisted address"); _; }
modifier onlyWhitelisted() { require(whitelist[msg.sender], "Not a whitelisted address"); _; }
50,655
5
// Enforce owners only
modifier onlyOwners() { require(isOwner(msg.sender), "MREQ2: Not an Owner."); _; }
modifier onlyOwners() { require(isOwner(msg.sender), "MREQ2: Not an Owner."); _; }
30,130
123
// File: contracts\ERC721.sol/the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address...
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address...
3,314
9
// Selling Southparkcoins
function sell_southparkcoins(address investor, uint southparkcoins_sold) external { equity_southparkcoins[investor] -= southparkcoins_sold; equity_usd[investor] = equity_southparkcoins[investor] / 1; total_southparkcoins_bought -= southparkcoins_sold; }
function sell_southparkcoins(address investor, uint southparkcoins_sold) external { equity_southparkcoins[investor] -= southparkcoins_sold; equity_usd[investor] = equity_southparkcoins[investor] / 1; total_southparkcoins_bought -= southparkcoins_sold; }
52,653
47
// Deposit to the `SeniorPool` and stake your shares with a lock-up in the same transaction./usdcAmount The amount of USDC to deposit into the senior pool. All shares from deposit/ will be staked./lockupPeriod The period over which to lock staked tokens
function depositAndStakeWithLockup(uint256 usdcAmount, LockupPeriod lockupPeriod) public nonReentrant whenNotPaused updateReward(0)
function depositAndStakeWithLockup(uint256 usdcAmount, LockupPeriod lockupPeriod) public nonReentrant whenNotPaused updateReward(0)
27,295
448
// if credit balance exists, if amount owed > creidt credit zero add amount else reduce credit by certain amount. else if credit balance doesn't exist add amount to balance TODO: this function should have an event
function _updateBenefactorBalance(address benefactor) public { uint256 patronageDueForBenefactor = patronageDueBenefactor(benefactor); if (patronageDueForBenefactor > 0) { _increaseBenefactorBalance(benefactor, patronageDueForBenefactor); } timeLastCollectedBenefactor[b...
function _updateBenefactorBalance(address benefactor) public { uint256 patronageDueForBenefactor = patronageDueBenefactor(benefactor); if (patronageDueForBenefactor > 0) { _increaseBenefactorBalance(benefactor, patronageDueForBenefactor); } timeLastCollectedBenefactor[b...
27,141
53
// freezing account list
mapping(address => FreezingNode[]) internal c_freezing_list;
mapping(address => FreezingNode[]) internal c_freezing_list;
36,831
276
// Return list of keepers
function keepers() external view returns (address[] memory) { return _keepers.values(); }
function keepers() external view returns (address[] memory) { return _keepers.values(); }
5,440
441
// Remove compound approval to be extra safe
success = config.getUSDC().approve(address(cUSDC), 0); require(success, "Failed to approve USDC for compound");
success = config.getUSDC().approve(address(cUSDC), 0); require(success, "Failed to approve USDC for compound");
61,914
23
// Allows a whitelister to enable assiciate wrappers to a token/_token Address of the token/_wrapper Address of the exchange/_isWhitelisted Bool whitelisted
function whitelistTokenOnWrapper(address _token, address _wrapper, bool _isWhitelisted) external onlyAdmin
function whitelistTokenOnWrapper(address _token, address _wrapper, bool _isWhitelisted) external onlyAdmin
50,454
135
// Get flashloan fee for flashloan amount before make product(BiFi-X)handlerID The ID of handler with accumulated flashloan feeamount The amount of flashloan amountbifiAmount The amount of Bifi amount return The amount of fee for flashloan amount/
function getFeeFromArguments( uint256 handlerID, uint256 amount, uint256 bifiAmount
function getFeeFromArguments( uint256 handlerID, uint256 amount, uint256 bifiAmount
12,577
10
// When minting
_addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId);
_addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId);
10,958
15
// Custom functions
function setBaseURI(string memory uri_) external onlyRole(DEFAULT_ADMIN_ROLE)
function setBaseURI(string memory uri_) external onlyRole(DEFAULT_ADMIN_ROLE)
24,443
13
// Estimate staking reward for a user. user Address of the user.return Estimated staking reward. /
function calculateStakingReward(address user) public view returns (uint256) { uint256 staked = stakedRewards[user]; if (staked == 0) return 0; uint256 timeStaked = block.timestamp - stakedStartTime[user]; if (timeStaked >= AUTO_STAKE_DURATION) return staked; uint256 reward ...
function calculateStakingReward(address user) public view returns (uint256) { uint256 staked = stakedRewards[user]; if (staked == 0) return 0; uint256 timeStaked = block.timestamp - stakedStartTime[user]; if (timeStaked >= AUTO_STAKE_DURATION) return staked; uint256 reward ...
14,017
2
// constructor() { assert(isContract(this) == false) }
function isContract(address addr) private view returns (bool) { uint32 size; assembly { size := extcodesize(addr) }
function isContract(address addr) private view returns (bool) { uint32 size; assembly { size := extcodesize(addr) }
2,991
129
// add report
fundManagerCashedOut = fundManagerCashedOut.add(fundManagerCut);
fundManagerCashedOut = fundManagerCashedOut.add(fundManagerCut);
45,856
100
// Get the initial tokens and balances for the pool.
(address[] memory tokens, uint256[] memory balances) = getInitialTokensAndBalances( listID, indexSize, uint144(initialWethValue) ); initializer.initialize(address(this), poolAddress, tokens, balances); emit NewPoolInitializer( poolAddress,
(address[] memory tokens, uint256[] memory balances) = getInitialTokensAndBalances( listID, indexSize, uint144(initialWethValue) ); initializer.initialize(address(this), poolAddress, tokens, balances); emit NewPoolInitializer( poolAddress,
75,758
62
// Notifies the managed contracts on a change in a contract address/invokes the refreshContracts() function in each contract that queries the relevant contract addresses
function notifyOnContractsChange() private { for (uint i = 0; i < managedContractAddresses.length; i++) { IManagedContract(managedContractAddresses[i]).refreshContracts(); } }
function notifyOnContractsChange() private { for (uint i = 0; i < managedContractAddresses.length; i++) { IManagedContract(managedContractAddresses[i]).refreshContracts(); } }
69,029
16
// Function to set pre-sale slot3 window w.r.t sale start time _daysPrior number of days prior to sale start time _durationInSecs duration of presale in seconds or epoch from slot3 start time /
function setPreSaleSlot3Window(uint _daysPrior, uint _durationInSecs) external onlyOwner { presaleSlot3StartTime = saleStartTime - (_daysPrior * 24 * 60 * 60); presaleSlot3EndTime = presaleSlot3StartTime + _durationInSecs; require(presaleSlot3EndTime <= saleStartTime, 'Presale Slot3 end time...
function setPreSaleSlot3Window(uint _daysPrior, uint _durationInSecs) external onlyOwner { presaleSlot3StartTime = saleStartTime - (_daysPrior * 24 * 60 * 60); presaleSlot3EndTime = presaleSlot3StartTime + _durationInSecs; require(presaleSlot3EndTime <= saleStartTime, 'Presale Slot3 end time...
32,469
77
// We need to convert
if (routes[_token][targetToken].length > 1) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 balanceToSwap = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeApprove(router, 0); IERC20(_token).safeApprove(router, balanceToSwap); IU...
if (routes[_token][targetToken].length > 1) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 balanceToSwap = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeApprove(router, 0); IERC20(_token).safeApprove(router, balanceToSwap); IU...
11,256
20
// Check allowance if owner if not sender
if (msg.sender != _owner) { uint256 currentAllowance = allowance(_owner, msg.sender); require(currentAllowance >= _shares, "ERC4626: redeem exceeds allowance"); _approve(_owner, msg.sender, currentAllowance - _shares); }
if (msg.sender != _owner) { uint256 currentAllowance = allowance(_owner, msg.sender); require(currentAllowance >= _shares, "ERC4626: redeem exceeds allowance"); _approve(_owner, msg.sender, currentAllowance - _shares); }
37,152
3
// Check if already called for the current epoch
require(!isCurrentEpochRun(), "Current epoch already run"); lastRunEpoch = currentEpoch();
require(!isCurrentEpochRun(), "Current epoch already run"); lastRunEpoch = currentEpoch();
22,324
3
// Invests the underlying asset./amount The amount of tokens to invest./Assume the contract's balance is greater than the amount
function _skim(uint256 amount) internal virtual;
function _skim(uint256 amount) internal virtual;
24,674
83
// Builds a prefixed hash to mimic the behavior of eth_sign.
function prefixed(bytes32 hash) internal view returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", DOMAIN_SEPARATOR, hash)); }
function prefixed(bytes32 hash) internal view returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", DOMAIN_SEPARATOR, hash)); }
10,721
488
// transfer to the core contract
core.transferToReserve.value(msg.value)(_reserve, msg.sender, _amount);
core.transferToReserve.value(msg.value)(_reserve, msg.sender, _amount);
12,228