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 |
|---|---|---|---|---|
8 | // initiate final payout from PayoutEscrow to payee | ClaimablePayout memory payout = ClaimablePayout(payee, totalUsdcAmount, tokensToExchange);
payoutEscrow.claimPayout(payout);
| ClaimablePayout memory payout = ClaimablePayout(payee, totalUsdcAmount, tokensToExchange);
payoutEscrow.claimPayout(payout);
| 49,596 |
5 | // MintableToken public token; |
function test01CrowdsaleInit(){
uint256 startTime = now + 5 seconds;
uint256 endTime = now + 20 minutes;
|
function test01CrowdsaleInit(){
uint256 startTime = now + 5 seconds;
uint256 endTime = now + 20 minutes;
| 18,708 |
0 | // The basis one which the sold are made.Here everithing is in Ether | uint base = 1 ether;
| uint base = 1 ether;
| 9,333 |
36 | // uint _now = now; interest = maxMintProofOfStake; if ((_now.sub(stakeStartTime)).div(1 years) == 0) { interest = (770maxMintProofOfStake).div(100); } else if ((_now.sub(stakeStartTime)).div(1 years) == 1) { interest = (435maxMintProofOfStake).div(100); } |
return REWARDS_PER_AGE;
|
return REWARDS_PER_AGE;
| 35,950 |
300 | // One possible code of zero length | left = 1;
for (len = 1; len <= MAXBITS; len++) {
| left = 1;
for (len = 1; len <= MAXBITS; len++) {
| 47,305 |
12 | // initialize the maturity with also the 1st bit on the 33th position set | if (encoded == 0) return maturity | (1 << 32);
uint256 baseMaturity = encoded & ((1 << 32) - 1);
if (maturity < baseMaturity) {
| if (encoded == 0) return maturity | (1 << 32);
uint256 baseMaturity = encoded & ((1 << 32) - 1);
if (maturity < baseMaturity) {
| 24,471 |
46 | // Bypass for a `--via-ir` bug (https:github.com/chiru-labs/ERC721A/pull/364). | struct TokenApprovalRef {
address value;
}
| struct TokenApprovalRef {
address value;
}
| 5,137 |
104 | // A mapping from product ids to Products | mapping (uint256 => Product) public products;
| mapping (uint256 => Product) public products;
| 42,756 |
262 | // Storage Properties // Container for salary information@member company The address of the company which funded this salary@member isEntity bool true=object exists, otherwise false@member streamId The id of the stream in the Sablier contract / | struct Salary {
address company;
bool isEntity;
uint256 streamId;
}
| struct Salary {
address company;
bool isEntity;
uint256 streamId;
}
| 8,223 |
357 | // Utility function that converts the address in the L1 that submitted a tx to/ the inbox to the msg.sender viewed in the L2/l1Address the address in the L1 that triggered the tx to L2/ return l2Address L2 address as viewed in msg.sender | function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {
unchecked {
l2Address = address(uint160(l1Address) + offset);
}
}
| function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {
unchecked {
l2Address = address(uint160(l1Address) + offset);
}
}
| 71,702 |
2 | // === Event Setup === // This function transfers source tokens if needed, swaps to the Mosspool token, and then retires via their CarbonChain interface. Needed sourcetoken amount is expected to be held by the caller to use._sourceToken The contract address of the token being supplied. _poolToken The contract address o... | function retireMoss(
address _sourceToken,
address _poolToken,
| function retireMoss(
address _sourceToken,
address _poolToken,
| 48,979 |
178 | // Retreive value from oracle based on timestamp_requestId being requested_timestamp to retreive data/value from return value for timestamp submitted/ | function retrieveData(uint256 _requestId, uint256 _timestamp) external view returns (uint256) {
return berry.retrieveData(_requestId, _timestamp);
}
| function retrieveData(uint256 _requestId, uint256 _timestamp) external view returns (uint256) {
return berry.retrieveData(_requestId, _timestamp);
}
| 11,640 |
47 | // Checks if base can be migrated | require(currentState != State.Migrated);
_;
| require(currentState != State.Migrated);
_;
| 40,153 |
16 | // indicator showing if proposal was cancelled | bool wasCancelled;
| bool wasCancelled;
| 73,644 |
20 | // Client buys insurance for a flight; AppContract should send the ether first before insuring the passenger / | function buyInsurance(bytes32 flightKey, address _insuree, uint256 amount) external isAuthorized isOperational {
bytes32 insuranceKey = generateKey(_insuree, flightKey, 0);
insurances[insuranceKey] = Insurance(_insuree, amount, false);
flightInsurances[flightKey].push(insuranceKey);
... | function buyInsurance(bytes32 flightKey, address _insuree, uint256 amount) external isAuthorized isOperational {
bytes32 insuranceKey = generateKey(_insuree, flightKey, 0);
insurances[insuranceKey] = Insurance(_insuree, amount, false);
flightInsurances[flightKey].push(insuranceKey);
... | 20,378 |
87 | // Decodes message for transferring ERC20 with token info. Returns structure `TransferErc20AndTokenInfoMessage`. / | function decodeTransferErc20AndTokenInfoMessage(
bytes calldata data
| function decodeTransferErc20AndTokenInfoMessage(
bytes calldata data
| 13,755 |
156 | // Transfer to system fee wallet fee amount | safeTransfer(_contract.terms.collateralAsset, address(this), feeWallet, _systemFeeAmount);
| safeTransfer(_contract.terms.collateralAsset, address(this), feeWallet, _systemFeeAmount);
| 7,789 |
27 | // Base date to calculate team, marketing and platform tokens lock | uint256 lockStartDate = 1613494800;
| uint256 lockStartDate = 1613494800;
| 17,259 |
29 | // Locker contract constructor. It will only be called once when deployingcontract. / | constructor(address _uniswapV3Pool, address _uniswapV3PositionManager) {
// Set the locker contract owner to the creator of the contract (msg.sender)
owner = msg.sender;
// Set Uniswap V3 Pool address
uniswapV3Pool = _uniswapV3Pool;
// Set Uniswap V3: Position NFT contract ... | constructor(address _uniswapV3Pool, address _uniswapV3PositionManager) {
// Set the locker contract owner to the creator of the contract (msg.sender)
owner = msg.sender;
// Set Uniswap V3 Pool address
uniswapV3Pool = _uniswapV3Pool;
// Set Uniswap V3: Position NFT contract ... | 9,367 |
36 | // Lock tokens to activate TradeGPTPass | function setTradeGPTPassLockedTokens(address user, uint amount) external onlyTradeGPTPass {
tradeGPTPassLockedTokens[user] = amount;
emit TradeGPTPassLockedTokens(user,amount);
}
| function setTradeGPTPassLockedTokens(address user, uint amount) external onlyTradeGPTPass {
tradeGPTPassLockedTokens[user] = amount;
emit TradeGPTPassLockedTokens(user,amount);
}
| 12,768 |
108 | // Treasury module ID - keccak256(abi.encodePacked("TREASURY")) | bytes32 internal constant MODULE_ID_TREASURY = 0x06aa03964db1f7257357ef09714a5f0ca3633723df419e97015e0c7a3e83edb7;
| bytes32 internal constant MODULE_ID_TREASURY = 0x06aa03964db1f7257357ef09714a5f0ca3633723df419e97015e0c7a3e83edb7;
| 12,764 |
20 | // Settle an auction, finalizing the bid and paying out to the owner. If there are no bids, the Noun is burned. / | function _settleAuction() internal {
INounsAuctionHouse.Auction memory _auction = auction;
require(_auction.startTime != 0, "Auction hasn't begun");
require(!_auction.settled, 'Auction has already been settled');
require(block.timestamp >= _auction.endTime, "Auction hasn't completed... | function _settleAuction() internal {
INounsAuctionHouse.Auction memory _auction = auction;
require(_auction.startTime != 0, "Auction hasn't begun");
require(!_auction.settled, 'Auction has already been settled');
require(block.timestamp >= _auction.endTime, "Auction hasn't completed... | 14,834 |
17 | // This is a hot address with a current record - include the balance held natively by this address and the cold: | balance_ += queryAddress_.balance;
balance_ += hotToRecord[queryAddress_].cold.balance;
| balance_ += queryAddress_.balance;
balance_ += hotToRecord[queryAddress_].cold.balance;
| 8,128 |
58 | // saving sip details to blockchain storage | sips[msg.sender].push(SIP({
planId: _planId,
stakingTimestamp: now,
monthlyCommitmentAmount: _monthlyCommitmentAmount,
totalDeposited: _monthlyCommitmentAmount,
lastWithdrawlMonthId: 0, /// @dev withdrawl monthId starts from 1
powerBoosterWithdrawls: 0,
numberOfAppointees: ... | sips[msg.sender].push(SIP({
planId: _planId,
stakingTimestamp: now,
monthlyCommitmentAmount: _monthlyCommitmentAmount,
totalDeposited: _monthlyCommitmentAmount,
lastWithdrawlMonthId: 0, /// @dev withdrawl monthId starts from 1
powerBoosterWithdrawls: 0,
numberOfAppointees: ... | 24,118 |
723 | // zapIn Exchanges a number of tokens which are used in a specific/ curve pool(s) for a principal token./_info See ZapInInfo struct/_zap See ZapCurveLpIn struct - This is the "main" or parent zap/ which produces the lp token necessary to swap for the principal token/_childZap See ZapCurveLpIn - This is used only in cas... | function zapIn(
ZapInInfo memory _info,
ZapCurveLpIn memory _zap,
ZapCurveLpIn memory _childZap,
PermitData[] memory _permitData
)
external
payable
nonReentrant
notFrozen
| function zapIn(
ZapInInfo memory _info,
ZapCurveLpIn memory _zap,
ZapCurveLpIn memory _childZap,
PermitData[] memory _permitData
)
external
payable
nonReentrant
notFrozen
| 33,056 |
99 | // Copy elements from the second array. | for (uint256 i = 0; i < _bLength; i++) {
ret[i + _aLength] = _b[i];
}
| for (uint256 i = 0; i < _bLength; i++) {
ret[i + _aLength] = _b[i];
}
| 34,000 |
6 | // Burns `tokenId`. See {ERC721-_burn}.- The caller must own `tokenId` or be an approved operator. / | function burn(uint256 tokenId) external;
| function burn(uint256 tokenId) external;
| 27,846 |
329 | // Helper function to return the `asset` amount returned using the `share` amount share is the number of shares used to withdraw currentAssetBalance is the value returned by totalBalance(). This is passed in to save gas. / | function _withdrawAmountWithShares(
uint256 share,
uint256 currentAssetBalance
)
private
view
returns (
uint256 withdrawAmount,
uint256 newAssetBalance,
uint256 newShareSupply
| function _withdrawAmountWithShares(
uint256 share,
uint256 currentAssetBalance
)
private
view
returns (
uint256 withdrawAmount,
uint256 newAssetBalance,
uint256 newShareSupply
| 48,951 |
23 | // 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);
... | 38,622 |
201 | // Decrease delegator&39;s bonded amount | del.bondedAmount = del.bondedAmount.sub(_amount);
| del.bondedAmount = del.bondedAmount.sub(_amount);
| 40,780 |
4 | // Mappings | mapping(address => mapping(string => uint256)) private OI; // open interest. market => asset => amount
mapping(address => mapping(string => uint256)) private OILong; // open interest. market => asset => amount
mapping(address => mapping(string => uint256)) private OIShort; // open interest. market => asset ... | mapping(address => mapping(string => uint256)) private OI; // open interest. market => asset => amount
mapping(address => mapping(string => uint256)) private OILong; // open interest. market => asset => amount
mapping(address => mapping(string => uint256)) private OIShort; // open interest. market => asset ... | 6,990 |
161 | // received amount | uint256 amountReceived = address(this).balance;
| uint256 amountReceived = address(this).balance;
| 14,311 |
71 | // allow only if whitelist expiration hasn't yet been set, or if the whitelist expiration hasn't passed yet | require(
whitelistExpiration == 0 || whitelistActive(),
"an expired whitelist cannot be extended"
);
| require(
whitelistExpiration == 0 || whitelistActive(),
"an expired whitelist cannot be extended"
);
| 46,556 |
73 | // Forked from the original yearn Controller (https:github.com/yearn/yearn-protocol/blob/develop/contracts/controllers/Controller.sol) with the following changes: - change mapping of vault and strategy from token -> vault, token -> strategy to vault <-> strategy | contract Controller is IController {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
/* ========== STATE VARIABLES ========== */
address public governance;
// Strategy to vault mapping
mapping(address => address) public vaults;
// Vault to strategy m... | contract Controller is IController {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
/* ========== STATE VARIABLES ========== */
address public governance;
// Strategy to vault mapping
mapping(address => address) public vaults;
// Vault to strategy m... | 50,852 |
69 | // Contracts allowed to call those proxies. | mapping(address => bool) public contracts;
uint public DELAY_PERIOD = 2 weeks;
| mapping(address => bool) public contracts;
uint public DELAY_PERIOD = 2 weeks;
| 52,226 |
42 | // rewardIsEligible checks if the account is eligible to receive any reward. | function rewardIsEligible(address _account) public view returns (bool) {
return addressProvider.getFantomMint().rewardIsEligible(_account);
}
| function rewardIsEligible(address _account) public view returns (bool) {
return addressProvider.getFantomMint().rewardIsEligible(_account);
}
| 4,277 |
1 | // implementation of metadata methods/ | function updateMetaData(string ipfsHash) public {
super.updateMetaData(ipfsHash);
}
| function updateMetaData(string ipfsHash) public {
super.updateMetaData(ipfsHash);
}
| 35,504 |
1 | // address of deplyer contract | GitRepositoryDeployer private deployer;
| GitRepositoryDeployer private deployer;
| 44,448 |
3 | // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners | mapping(address => mapping(bytes32 => uint256)) public approvedHashes;
| mapping(address => mapping(bytes32 => uint256)) public approvedHashes;
| 7,641 |
14 | // The offset of a single token address and pool fee | uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE;
| uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE;
| 14,438 |
98 | // A count of how many new key purchases there have been | uint public numberOfKeysSold;
| uint public numberOfKeysSold;
| 45,430 |
138 | // Liquidity Lockthe timestamp when Liquidity unlocks | uint256 private _liquidityUnlockTime;
| uint256 private _liquidityUnlockTime;
| 33,023 |
37 | // A contract to track a whitelist of addresses. / | contract AddressWhitelist is Ownable, Lockable {
enum Status { None, In, Out }
mapping(address => Status) public whitelist;
address[] public whitelistIndices;
event AddedToWhitelist(address indexed addedAddress);
event RemovedFromWhitelist(address indexed removedAddress);
/**
* @notice A... | contract AddressWhitelist is Ownable, Lockable {
enum Status { None, In, Out }
mapping(address => Status) public whitelist;
address[] public whitelistIndices;
event AddedToWhitelist(address indexed addedAddress);
event RemovedFromWhitelist(address indexed removedAddress);
/**
* @notice A... | 15,849 |
0 | // Number of decimal places in the representations. // The number representing 1.0. // The number representing 1.0 for higher fidelity numbers. //return Provides an interface to UNIT. / | function unit() external pure returns (uint) {
return UNIT;
}
| function unit() external pure returns (uint) {
return UNIT;
}
| 16,307 |
8 | // Mapping Discord server ID to its associated PaymentOptions | mapping(string => PaymentOption[]) private discordIdToPaymentOptions;
| mapping(string => PaymentOption[]) private discordIdToPaymentOptions;
| 28,005 |
66 | // Try to sort group in active groups based on new value. group The group address. newValue The new value of group. valueIncreased Whether value increased/decreased compared to original value. / | function trySort(
address group,
uint256 newValue,
bool valueIncreased
| function trySort(
address group,
uint256 newValue,
bool valueIncreased
| 19,185 |
120 | // If there are any undistributed or unclaimed tokens left in contract after this time Admin can claim them | uint public constant adminCanClaimAfter = 395 days;
| uint public constant adminCanClaimAfter = 395 days;
| 30,087 |
17 | // Ejects any remaining tokens from the pool. Callable only after the pool has started and the pools reward distribution period has finished. | function eject() external onlyOwner {
require(
startTime < block.timestamp && block.timestamp >= periodFinish,
"Cannot eject before period finishes or pool has started"
);
uint256 currBalance = rewardToken.balanceOf(address(this));
rewardToken.safeTransfer(msg... | function eject() external onlyOwner {
require(
startTime < block.timestamp && block.timestamp >= periodFinish,
"Cannot eject before period finishes or pool has started"
);
uint256 currBalance = rewardToken.balanceOf(address(this));
rewardToken.safeTransfer(msg... | 29,332 |
53 | // Benign percent penalty | mapping(uint256 => uint256) public benignPercent;
| mapping(uint256 => uint256) public benignPercent;
| 24,260 |
153 | // Represent price as this way, may lose precision, the error less than 1/10^14 price = priceFraction16 ^ priceExponent | uint56 priceFloat;
| uint56 priceFloat;
| 30,468 |
75 | // See {BEP20-allowance}. / | function allowance(address owner, address spender) virtual public override view returns (uint256) {
return _allowances[owner][spender];
}
| function allowance(address owner, address spender) virtual public override view returns (uint256) {
return _allowances[owner][spender];
}
| 9,784 |
22 | // The proposal's SetToken to rebalance into | ISetToken public nextSet;
| ISetToken public nextSet;
| 12,344 |
34 | // Transfers a specific NFT (`tokenId`) from one account (`from`) toanother (`to`). Requirements:- `from`, `to` cannot be zero.- `tokenId` must be owned by `from`.- If the caller is not `from`, it must be have been allowed to move this | * NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, i... | * NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, i... | 826 |
110 | // start of ClaimStakingReward typeHash: 0x56d7b9415a7ab01a4e256d5e8a8a100fcf839c82096289e6a835115c704aee67 function: onClaimStakingReward(address,uint256,address,uint256) | case 9 {
let headSize := 128
let typeLen := 0
let txPtr := 320
let endOfSlot := add(txPtr, 128)
txPtr := 352
| case 9 {
let headSize := 128
let typeLen := 0
let txPtr := 320
let endOfSlot := add(txPtr, 128)
txPtr := 352
| 44,301 |
68 | // Changes the Pricer contract, after a certain delaynewAddress Allows coins to be created and sent to other people return transaction ID which can be viewed in the pending mapping/ | releaseTime = now + PRICER_DELAY;
future = newAddress;
EventAddressChange(pricer, future, releaseTime);
| releaseTime = now + PRICER_DELAY;
future = newAddress;
EventAddressChange(pricer, future, releaseTime);
| 35,187 |
138 | // Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it waspresent. / | function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To dele... | function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To dele... | 546 |
14 | // Check if ERC20 token symbol exists | function hasSymbol(string _symbol) public constant returns (bool) {
if(numTokens == 0) {
return false;
}
for(uint i=0; i<numTokens; i++) {
if(keccak256(tokens[i].symbol) == keccak256(_symbol)) {
return true;
}
}
return false;
}
| function hasSymbol(string _symbol) public constant returns (bool) {
if(numTokens == 0) {
return false;
}
for(uint i=0; i<numTokens; i++) {
if(keccak256(tokens[i].symbol) == keccak256(_symbol)) {
return true;
}
}
return false;
}
| 4,179 |
191 | // Allow the stakeAdmin to update the 'mint' fee. | function updateMinimumStakeBalance(uint256 _nextMinimumStakeBalance) public onlyOwner {
_updateMinimumStakeBalance(_nextMinimumStakeBalance);
}
| function updateMinimumStakeBalance(uint256 _nextMinimumStakeBalance) public onlyOwner {
_updateMinimumStakeBalance(_nextMinimumStakeBalance);
}
| 9,959 |
99 | // Array to store the addresses of token holders | address[] private _holders;
| address[] private _holders;
| 34,894 |
144 | // Allows to withdraw the Ether in the contract to the address of the owner. / | function withdraw() external onlyOwner {
uint256 totalBalance = address(this).balance;
payable(msg.sender).transfer(totalBalance);
}
| function withdraw() external onlyOwner {
uint256 totalBalance = address(this).balance;
payable(msg.sender).transfer(totalBalance);
}
| 39,790 |
75 | // Transfer and transferFrom antiwhale | function _transfer(address sender, address recipient, uint256 amount) internal override(ERC20) antiWhale(sender, recipient, amount) {
uint256 feeAmount = calculateCommission(amount);
uint256 recieverAmount = amount - feeAmount;
if(taxStatus) {
amount = handleTax(sender, reci... | function _transfer(address sender, address recipient, uint256 amount) internal override(ERC20) antiWhale(sender, recipient, amount) {
uint256 feeAmount = calculateCommission(amount);
uint256 recieverAmount = amount - feeAmount;
if(taxStatus) {
amount = handleTax(sender, reci... | 28,769 |
115 | // send ETH to treasury address | uint256 treasuryETHBalance = ethBalanceUpdate.mul(treasuryFee).div(
_liquidityFeeTotal
);
if (treasuryETHBalance > 0) {
_sendETHToTreasury(treasuryETHBalance);
}
| uint256 treasuryETHBalance = ethBalanceUpdate.mul(treasuryFee).div(
_liquidityFeeTotal
);
if (treasuryETHBalance > 0) {
_sendETHToTreasury(treasuryETHBalance);
}
| 24,012 |
33 | // returns the max level currently available for this NFT or 0 for unknown NFTs reminder: "level" starts counting at 1 | function _getAvailableLevel(uint256 nftId) public view returns(uint8) {
if (_nftProps[nftId].creationTimestamp == 0) {
return 0;
}
uint256 age = block.timestamp - _nftProps[nftId].creationTimestamp;
// rewardSchedule[0][0] MUST be 0 for this loop to work as expected!
... | function _getAvailableLevel(uint256 nftId) public view returns(uint8) {
if (_nftProps[nftId].creationTimestamp == 0) {
return 0;
}
uint256 age = block.timestamp - _nftProps[nftId].creationTimestamp;
// rewardSchedule[0][0] MUST be 0 for this loop to work as expected!
... | 21,686 |
19 | // To bet for a number by sending Ether/numberSelected The number that the player wants to bet for. Must be between 1 and 10 both inclusive | function bet(uint256 numberSelected) public payable {
// Check that the player doesn't exists
require(!checkPlayerExists(msg.sender));
// Check that the number to bet is within the range
require(numberSelected <= 10 && numberSelected >= 1);
// Check that the amount paid is bigger or equal the mini... | function bet(uint256 numberSelected) public payable {
// Check that the player doesn't exists
require(!checkPlayerExists(msg.sender));
// Check that the number to bet is within the range
require(numberSelected <= 10 && numberSelected >= 1);
// Check that the amount paid is bigger or equal the mini... | 18,836 |
83 | // Sets the flash loan fee for multiple tokens. params token, feePPM, receiverLocation. / | function setFlashLoanFeesForTokens(SetFlashLoanFeeForTokenParam[] calldata params) external override onlyOwner {
uint256 len = params.length;
for(uint256 i = 0; i < len; i++) {
address token = params[i].token;
uint256 feePPM = params[i].feePPM;
bytes32 receiverLoc... | function setFlashLoanFeesForTokens(SetFlashLoanFeeForTokenParam[] calldata params) external override onlyOwner {
uint256 len = params.length;
for(uint256 i = 0; i < len; i++) {
address token = params[i].token;
uint256 feePPM = params[i].feePPM;
bytes32 receiverLoc... | 17,384 |
42 | // whitelist collection to be traded on marketplace _collection address of collection ERC721 / | function whitelistERC721(address _collection) onlyRole(DEFAULT_ADMIN_ROLE) external {
ERC721Whitelist[_collection] = true;
}
| function whitelistERC721(address _collection) onlyRole(DEFAULT_ADMIN_ROLE) external {
ERC721Whitelist[_collection] = true;
}
| 41,994 |
222 | // The address of the person who placed this order. | address who;
| address who;
| 51,225 |
86 | // So indexers can keep track of this | event Harvested(uint256 profit, uint256 loss, uint256 debtPayment, uint256 debtOutstanding);
event UpdatedStrategist(address newStrategist);
event UpdatedKeeper(address newKeeper);
event UpdatedRewards(address rewards);
event UpdatedReportDelay(uint256 delay);
| event Harvested(uint256 profit, uint256 loss, uint256 debtPayment, uint256 debtOutstanding);
event UpdatedStrategist(address newStrategist);
event UpdatedKeeper(address newKeeper);
event UpdatedRewards(address rewards);
event UpdatedReportDelay(uint256 delay);
| 2,238 |
12 | // Chainlink vrf v2 setup/ | uint64 private immutable i_subscriptionId;
uint32 private immutable i_callbackGasLimit;
uint32 private constant NUM_WORDS = 1;
uint16 private constant REQUEST_CONFIRMATIONS = 3;
VRFCoordinatorV2Interface private immutable i_vrfCoordinator;
bytes32 private immutable i_keyHash;
| uint64 private immutable i_subscriptionId;
uint32 private immutable i_callbackGasLimit;
uint32 private constant NUM_WORDS = 1;
uint16 private constant REQUEST_CONFIRMATIONS = 3;
VRFCoordinatorV2Interface private immutable i_vrfCoordinator;
bytes32 private immutable i_keyHash;
| 25,195 |
8 | // L1 USDC -> polyUSDC Polygon Bridge | bridgeable_token_address = collateral_address;
| bridgeable_token_address = collateral_address;
| 2,184 |
2 | // Overrides ERC20 transfer to add checkfor allowed partiesand make calls from FundsModule work without approval / | function transferFrom(address from, address to, uint256 value) public returns (bool) {
address funds = getModuleAddress(MODULE_FUNDS);
if (_msgSender() == funds) {
_transfer(from, to, value);
return true;
} else {
requireAllowedParties(from, to, funds);
... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
address funds = getModuleAddress(MODULE_FUNDS);
if (_msgSender() == funds) {
_transfer(from, to, value);
return true;
} else {
requireAllowedParties(from, to, funds);
... | 15,508 |
272 | // We call doTransferIn for the caller and the addAmount Note: The slToken must handle variations between ERC-20 and ETH underlying. On success, the slToken holds an additional addAmount of cash. doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred. it returns the amount actually... |
actualAddAmount = doTransferIn(msg.sender, addAmount);
totalReservesNew = totalReserves + actualAddAmount;
|
actualAddAmount = doTransferIn(msg.sender, addAmount);
totalReservesNew = totalReserves + actualAddAmount;
| 3,497 |
147 | // Writes an address into a specific position in a byte array./b Byte array to insert address into./index Index in byte array of address./input Address to put into byte array. | function writeAddress(
bytes memory b,
uint256 index,
address input
)
internal
pure
| function writeAddress(
bytes memory b,
uint256 index,
address input
)
internal
pure
| 36,979 |
132 | // Apply the Dampening factor. | supplyDelta = supplyDelta.div(rebaseLag.toInt256Safe());
if (supplyDelta > 0 && fragments.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY) {
supplyDelta = (MAX_SUPPLY.sub(fragments.totalSupply())).toInt256Safe();
}
| supplyDelta = supplyDelta.div(rebaseLag.toInt256Safe());
if (supplyDelta > 0 && fragments.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY) {
supplyDelta = (MAX_SUPPLY.sub(fragments.totalSupply())).toInt256Safe();
}
| 54,865 |
17 | // Number of blocks an escrow account must be marked for destruction before it is destroyed | uint256 public destructionDelay;
| uint256 public destructionDelay;
| 15,798 |
79 | // Returns the amount of tokens of token type `id` owned by `account`. Requirements: - `account` cannot be the zero address. / | function balanceOf(address account, uint256 id) external view returns (uint256);
| function balanceOf(address account, uint256 id) external view returns (uint256);
| 44,761 |
12 | // Execute the obliteration of cacaos/Abstract Method/_amount The amount of obliterated cacaos. | function onObliterateRescued(uint256 _amount) internal;
| function onObliterateRescued(uint256 _amount) internal;
| 32,162 |
175 | // forward all generated credit by applying rate | (, uint256 rate, , ) = codex.vaults(vault);
exitMoneta(creditor, wmul(uint256(deltaNormalDebt), rate));
| (, uint256 rate, , ) = codex.vaults(vault);
exitMoneta(creditor, wmul(uint256(deltaNormalDebt), rate));
| 7,552 |
151 | // Maximum swap or exit fee. | uint256 internal constant MAX_FEE = BONE / 10;
| uint256 internal constant MAX_FEE = BONE / 10;
| 56,516 |
7 | // uint toBurn = getEstimatedTOKENforETH(Amount)[1]; | uint toBurn = 100;
Token(NUSTOKEN).tokensBurner(uint96(toBurn));
return true;
| uint toBurn = 100;
Token(NUSTOKEN).tokensBurner(uint96(toBurn));
return true;
| 14,076 |
63 | // Return true if a particular address is approved as a global operator. Such an address canact on any account as if it were the operator's own. operatorThe address to queryreturn True if operator is a global operator / | function getIsGlobalOperator(
address operator
)
public
view
returns (bool)
| function getIsGlobalOperator(
address operator
)
public
view
returns (bool)
| 20,385 |
183 | // Emitted when calcaultor is changed | event CalculatorChanged(IRewardCalculator oldCalculator, IRewardCalculator newCalculator);
| event CalculatorChanged(IRewardCalculator oldCalculator, IRewardCalculator newCalculator);
| 47,782 |
5 | // [ERC1400Raw INTERFACE (4/13)]INFO replaced by ERC20 Get the balance of the account with address 'tokenHolder'. tokenHolder Address for which the balance is returned.return Amount of token held by 'tokenHolder' in the token contract. / | /* function balanceOf(address tokenHolder) public override view returns (uint256) {
return _balances[tokenHolder];
} */
| /* function balanceOf(address tokenHolder) public override view returns (uint256) {
return _balances[tokenHolder];
} */
| 35,795 |
8 | // -- Configuration -- |
function setMinimumIndexerStake(uint256 _minimumIndexerStake) external;
function setThawingPeriod(uint32 _thawingPeriod) external;
function setCurationPercentage(uint32 _percentage) external;
function setProtocolPercentage(uint32 _percentage) external;
function setChannelDisputeEpochs(uint32 _c... |
function setMinimumIndexerStake(uint256 _minimumIndexerStake) external;
function setThawingPeriod(uint32 _thawingPeriod) external;
function setCurationPercentage(uint32 _percentage) external;
function setProtocolPercentage(uint32 _percentage) external;
function setChannelDisputeEpochs(uint32 _c... | 35,910 |
71 | // ! Since time bonuses is changable we should take latest first | lastSlice = timeSlices[timeSlicesCount - 1];
lastBonus = timeBonuses[lastSlice];
| lastSlice = timeSlices[timeSlicesCount - 1];
lastBonus = timeBonuses[lastSlice];
| 71,140 |
1 | // Holds parameters passed through flash loancontrol flow that dictate terms of the new loan.Contains a signature by lender for same terms.isLegacy determines which loanCore to look for theold loan in. / | struct OperationData {
RolloverContractParams contracts;
uint256 loanId;
LoanLibrary.LoanTerms newLoanTerms;
uint8 v;
bytes32 r;
bytes32 s;
}
| struct OperationData {
RolloverContractParams contracts;
uint256 loanId;
LoanLibrary.LoanTerms newLoanTerms;
uint8 v;
bytes32 r;
bytes32 s;
}
| 46,652 |
20 | // ) = incentivesController.getAssetData(reserveData.aTokenAddress); TODO: temp fix | ) = incentivesController.assets(reserveData.aTokenAddress);
(
reserveData.sTokenIncentivesIndex,
reserveData.sEmissionPerSecond,
reserveData.sIncentivesLastUpdateTimestamp
| ) = incentivesController.assets(reserveData.aTokenAddress);
(
reserveData.sTokenIncentivesIndex,
reserveData.sEmissionPerSecond,
reserveData.sIncentivesLastUpdateTimestamp
| 21,070 |
72 | // View function for total reward the farm has yet to pay out. | function totalPending() external view returns (uint256) {
if (block.number <= startBlock) {
return 0;
}
uint256 lastBlock = block.number < endBlock ? block.number : endBlock;
return rewardPerBlock.mul(lastBlock - startBlock).sub(paidOut);
}
| function totalPending() external view returns (uint256) {
if (block.number <= startBlock) {
return 0;
}
uint256 lastBlock = block.number < endBlock ? block.number : endBlock;
return rewardPerBlock.mul(lastBlock - startBlock).sub(paidOut);
}
| 3,922 |
29 | // THESE ARE TEST CONTRACTS FOR FRONTENED! | contract BuybackProtocol is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
// The SwapRouter. Will only be set to pangolin Router
IUniswapV2Router02 public pangolinRouter;
event BuybackAndBurn(uint256 singleBuybackAmount, uint256 totalBuybackAmount, uint256 tot... | contract BuybackProtocol is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
// The SwapRouter. Will only be set to pangolin Router
IUniswapV2Router02 public pangolinRouter;
event BuybackAndBurn(uint256 singleBuybackAmount, uint256 totalBuybackAmount, uint256 tot... | 9,038 |
221 | // -------------------------------------------------------- [external] 発行者の確認-------------------------------------------------------- | function getMinter( uint256 tokenId ) external view returns (address) {
require( _exists( tokenId ), "token not exist" );
return( _minters[tokenId-TOKEN_ID_OFS] );
}
| function getMinter( uint256 tokenId ) external view returns (address) {
require( _exists( tokenId ), "token not exist" );
return( _minters[tokenId-TOKEN_ID_OFS] );
}
| 20,313 |
68 | // Return amount after calculating slippage | return _amount.sub(rate);
| return _amount.sub(rate);
| 37,613 |
70 | // ========== STATE VARIABLES ========== //Addresses selected by owner which are allowed to call `transferFrom` to manage debt shares / | mapping(address => bool) public authorizedBrokers;
| mapping(address => bool) public authorizedBrokers;
| 24,756 |
44 | // wallet changed | event WalletChange(address _wallet, uint256 _timestamp);
| event WalletChange(address _wallet, uint256 _timestamp);
| 42,432 |
244 | // Calculate the effective value by going from source -> USD -> destination | value = sourceAmount.multiplyDecimalRound(sourceRate).divideDecimalRound(destinationRate);
| value = sourceAmount.multiplyDecimalRound(sourceRate).divideDecimalRound(destinationRate);
| 6,102 |
114 | // Gets whether the contract is still in the intial grace period where we give extra features to color setters | function isInGracePeriod() public view returns(bool) {
return now <= GRACE_PERIOD_END_TIMESTAMP;
}
| function isInGracePeriod() public view returns(bool) {
return now <= GRACE_PERIOD_END_TIMESTAMP;
}
| 17,350 |
303 | // PAYOUT / | function withdraw() public nonReentrant onlyOwner {
uint256 balance = address(this).balance;
Address.sendValue(payable(_owner()), balance);
}
| function withdraw() public nonReentrant onlyOwner {
uint256 balance = address(this).balance;
Address.sendValue(payable(_owner()), balance);
}
| 7,388 |
46 | // Emit the AdminLoanRepaid event | emit AdminLoanRepaid(loanID, msg.value, _adminLoanBalances[loanID]);
| emit AdminLoanRepaid(loanID, msg.value, _adminLoanBalances[loanID]);
| 25,295 |
353 | // Note: If we reach this point, we must update _GLOBAL_INDEX_TIMESTAMP_. |
uint256 emissionPerSecond = _REWARDS_PER_SECOND_;
if (emissionPerSecond == 0 || totalStaked == 0) {
|
uint256 emissionPerSecond = _REWARDS_PER_SECOND_;
if (emissionPerSecond == 0 || totalStaked == 0) {
| 43,936 |
48 | // Atomically increases the allowance granted to 'spender' by the caller. | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function increaseAllowanc... | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function increaseAllowanc... | 29,874 |
6 | // Emitted when the default tickspacing is changed/newDefaultTickspacing The new default tickspacing value | event DefaultTickspacing(int24 newDefaultTickspacing);
| event DefaultTickspacing(int24 newDefaultTickspacing);
| 23,168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.