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 |
|---|---|---|---|---|
15 | // Retire carbon credits using the lowest quality (oldest) TCO2tokens available from the specified Toucan token pool by sending MATIC.Use `calculateNeededETHAmount()` first in order to find out how muchMATIC is required to retire the specified quantity of TCO2. This function:1. Swaps the Matic sent to the contract for the specified pool token.2. Redeems the pool token for the poorest quality TCO2 tokens available.3. Retires the TCO2 tokens.If the user sends much MATIC, the leftover amount will be sent backto the user._poolToken The address of the Toucan pool token that theuser wants to use, for example, NCT or BCT. _amountToOffset The amount | // {
// // swap CELO for BCT / NCT
// swapExactOutETH(_poolToken, _amountToOffset);
// // redeem BCT / NCT for TCO2s
// (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);
// // retire the TCO2s to achieve offset
// autoRetire(tco2s, amounts);
// }
| // {
// // swap CELO for BCT / NCT
// swapExactOutETH(_poolToken, _amountToOffset);
// // redeem BCT / NCT for TCO2s
// (tco2s, amounts) = autoRedeem(_poolToken, _amountToOffset);
// // retire the TCO2s to achieve offset
// autoRetire(tco2s, amounts);
// }
| 23,298 |
471 | // Transfer `amount` tokens from `msg.sender` to `dst`dst The address of the destination accountamount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint256 amount) external returns (bool success);
| function transfer(address dst, uint256 amount) external returns (bool success);
| 7,628 |
0 | // Extension of ERC721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts/ See {ERC721-_afterTokenTransfer}. Adjusts votes when tokens are transferred. Emits a {IVotes-DelegateVotesChanged} event. / | function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override {
_transferVotingUnits(from, to, batchSize);
super._afterTokenTransfer(from, to, firstTokenId, batchSize);
}
| function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override {
_transferVotingUnits(from, to, batchSize);
super._afterTokenTransfer(from, to, firstTokenId, batchSize);
}
| 15,741 |
2 | // insurance | struct Insurance {
address passenger;
uint256 amount;
}
| struct Insurance {
address passenger;
uint256 amount;
}
| 36,670 |
8 | // MODIFIERS / Ensure the lock is public | modifier onlyPublic() {
require(keyReleaseMechanism == KeyReleaseMechanisms.Public, "Only allowed on public locks");
_;
}
| modifier onlyPublic() {
require(keyReleaseMechanism == KeyReleaseMechanisms.Public, "Only allowed on public locks");
_;
}
| 25,860 |
17 | // console.log(msg); | bool sent = theReceiver.send(msg.value); // transfer pledged amounts to owner
if (!sent) {
revert("Failed on dummy bid");
}
| bool sent = theReceiver.send(msg.value); // transfer pledged amounts to owner
if (!sent) {
revert("Failed on dummy bid");
}
| 30,864 |
0 | // Interface of the SWL token/ | interface ISWLToken {
/**
* @notice
* @dev
*/
function createStake(uint256 stake) external returns(bool);
/**
* @notice
* @dev
*/
function removeStake(uint256 stake) external returns(bool);
/**
* @notice
* @dev
*/
function addStakeHolder(address stakeholder) external returns(bool);
/**
* @notice
* @dev
*/
function removeStakeHolder(address stakeholder) external returns(bool);
/**
* @notice
* @dev
*/
function distributeReward() external returns(bool);
/**
* @notice
* @dev
*/
function withdrawReward() external returns(bool);
} | interface ISWLToken {
/**
* @notice
* @dev
*/
function createStake(uint256 stake) external returns(bool);
/**
* @notice
* @dev
*/
function removeStake(uint256 stake) external returns(bool);
/**
* @notice
* @dev
*/
function addStakeHolder(address stakeholder) external returns(bool);
/**
* @notice
* @dev
*/
function removeStakeHolder(address stakeholder) external returns(bool);
/**
* @notice
* @dev
*/
function distributeReward() external returns(bool);
/**
* @notice
* @dev
*/
function withdrawReward() external returns(bool);
} | 45,724 |
18 | // What is the balance of a particular account? | function balanceOf(address _owner) constant returns (uint256) {
return balances[_owner];
}
| function balanceOf(address _owner) constant returns (uint256) {
return balances[_owner];
}
| 25,680 |
26 | // Update Mobs Finish/Internal - Calculates mob owners and emits events sending to them. Second part of mobs moving | function updateMobFinish() internal {
if(!mobReleased) {
require(gasleft() > 100000,"gas failsafe");
return;
}
if(mobTokenIds[3] == 0) return;
require(gasleft() > 64500,"gas failsafe");
bytes32 _mobHash = mobHash; //READ
uint eliminationBlock = block.number - (block.number % 245) - 10; //READ
bytes32 updateHash = extractBytes(keccak256(abi.encodePacked(_mobHash)),0);
bytes32 mobModulo0 = extractBytes(_mobHash,1);
bytes32 mobModulo1 = extractBytes(_mobHash,2);
bytes32 mobModulo2 = extractBytes(_mobHash,3);
bytes32 destinationHash = extractBytes( blockhash(eliminationBlock),4);
bytes32 newMobHash = shiftBytes(updateHash,0) ^
shiftBytes(mobModulo0,1) ^
shiftBytes(mobModulo1,2) ^
shiftBytes(mobModulo2,3) ^
shiftBytes(destinationHash,4);
mobHash = newMobHash; //WRITE
for(uint i = 0; i < 3; i++){
uint _tokenId = _getMobTokenId(i); //READ x 3
if(_tokenId != MOB_OFFSET){
emit Transfer(address(0),getMobOwner(i,newMobHash),_tokenId); //READx3, EMIT x 3 max
}
}
}
| function updateMobFinish() internal {
if(!mobReleased) {
require(gasleft() > 100000,"gas failsafe");
return;
}
if(mobTokenIds[3] == 0) return;
require(gasleft() > 64500,"gas failsafe");
bytes32 _mobHash = mobHash; //READ
uint eliminationBlock = block.number - (block.number % 245) - 10; //READ
bytes32 updateHash = extractBytes(keccak256(abi.encodePacked(_mobHash)),0);
bytes32 mobModulo0 = extractBytes(_mobHash,1);
bytes32 mobModulo1 = extractBytes(_mobHash,2);
bytes32 mobModulo2 = extractBytes(_mobHash,3);
bytes32 destinationHash = extractBytes( blockhash(eliminationBlock),4);
bytes32 newMobHash = shiftBytes(updateHash,0) ^
shiftBytes(mobModulo0,1) ^
shiftBytes(mobModulo1,2) ^
shiftBytes(mobModulo2,3) ^
shiftBytes(destinationHash,4);
mobHash = newMobHash; //WRITE
for(uint i = 0; i < 3; i++){
uint _tokenId = _getMobTokenId(i); //READ x 3
if(_tokenId != MOB_OFFSET){
emit Transfer(address(0),getMobOwner(i,newMobHash),_tokenId); //READx3, EMIT x 3 max
}
}
}
| 33,008 |
39 | // EIP20 Transfer event / | event Transfer(address indexed from, address indexed to, uint amount);
| event Transfer(address indexed from, address indexed to, uint amount);
| 2,930 |
45 | // Pay upgrading bonus in TGO | payUpgradeBonus(_id, i);
emit Upgrade(positions[_id].addr, _id, i);
| payUpgradeBonus(_id, i);
emit Upgrade(positions[_id].addr, _id, i);
| 41,585 |
51 | // Set or change of manager. Throws if called by any account other than the owner. _newManager New _manager address.return Boolean to indicate if the operation was successful or not. / | function setManager(address _newManager) external onlyOwner returns (bool) {
return _setManager(_newManager);
}
| function setManager(address _newManager) external onlyOwner returns (bool) {
return _setManager(_newManager);
}
| 42,335 |
24 | // emit an event about it | emit ContractValidationDropped(addr);
| emit ContractValidationDropped(addr);
| 49,861 |
1 | // A map of token IDs to the associated position data | mapping(uint256 => LockedPosition) private _positions;
| mapping(uint256 => LockedPosition) private _positions;
| 47,850 |
9 | // Character length | mstore(0x24, 12)
| mstore(0x24, 12)
| 39,095 |
2,982 | // 1492 | entry "pneumatized" : ENG_ADJECTIVE
| entry "pneumatized" : ENG_ADJECTIVE
| 18,104 |
17 | // require(msg.sender == patients[msg.sender].client); | require(_AppointmentIndex > 0);
require(_AppointmentIndex <= AppointmentIndex);
appointments[_AppointmentIndex].stat = _stat;
appointments[_AppointmentIndex].remark = _remark;
| require(_AppointmentIndex > 0);
require(_AppointmentIndex <= AppointmentIndex);
appointments[_AppointmentIndex].stat = _stat;
appointments[_AppointmentIndex].remark = _remark;
| 43,811 |
2 | // return the implementation address of the proxy / | function implementation() external view returns (address impl) {
return ERC1967Upgrade._getImplementation();
}
| function implementation() external view returns (address impl) {
return ERC1967Upgrade._getImplementation();
}
| 10,021 |
25 | // Set price of the msg.sender's contribution to a session, if not yet minted/_tokenId The session of contribution/_price New contribution price | function setPrice(uint256 _tokenId, uint256 _price)
external
memberContributed(_tokenId)
isNotMinted(_tokenId)
| function setPrice(uint256 _tokenId, uint256 _price)
external
memberContributed(_tokenId)
isNotMinted(_tokenId)
| 27,571 |
23 | // Boolean variable that indicates whether the investors set was finalized. | bool public isFinalized = false;
| bool public isFinalized = false;
| 60,259 |
41 | // Initializing Safe owners. | address currentOwner = SENTINEL_OWNERS;
for (uint256 i = 0; i < _owners.length; i++) {
| address currentOwner = SENTINEL_OWNERS;
for (uint256 i = 0; i < _owners.length; i++) {
| 26,079 |
16 | // event | event Bought(address buyer, uint32 bundles);
event ContractUpgrade(address newContract);
| event Bought(address buyer, uint32 bundles);
event ContractUpgrade(address newContract);
| 63,936 |
30 | // A multi-chain AMPL interface method. The Ampleforth monetary policy contracton the base-chain and XC-AmpleController contracts on the satellite-chainsimplement this method. It atomically returns two values:what the current contract believes to be,the globalAmpleforthEpoch and globalAMPLSupply.return globalAmpleforthEpoch The current epoch number.return globalAMPLSupply The total supply at the current epoch. / | function globalAmpleforthEpochAndAMPLSupply() external view returns (uint256, uint256) {
return (epoch, uFrags.totalSupply());
}
| function globalAmpleforthEpochAndAMPLSupply() external view returns (uint256, uint256) {
return (epoch, uFrags.totalSupply());
}
| 37,112 |
85 | // Get the Nyan rewards of msg.sender./ | // function getNyanRewards() public _updateRewards delegatedOnly {
// require(!rewardsWithdrawalPaused);
// require(userStake[msg.sender].nyanV2Rewards > 0, "Zero rewards balance");
// IERC20(address(this)).safeTransfer(msg.sender, userStake[msg.sender].nyanV2Rewards);
// emit nyanV2RewardsClaimed(msg.sender, userStake[msg.sender].nyanV2Rewards);
// userStake[msg.sender].nyanV2Rewards = 0;
// }
| // function getNyanRewards() public _updateRewards delegatedOnly {
// require(!rewardsWithdrawalPaused);
// require(userStake[msg.sender].nyanV2Rewards > 0, "Zero rewards balance");
// IERC20(address(this)).safeTransfer(msg.sender, userStake[msg.sender].nyanV2Rewards);
// emit nyanV2RewardsClaimed(msg.sender, userStake[msg.sender].nyanV2Rewards);
// userStake[msg.sender].nyanV2Rewards = 0;
// }
| 29,710 |
65 | // END - 10% Fees Distribution |
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount = 5000000 * 10**6 * 10**18;
uint256 private numTokensSellToAddToLiquidity = 500000 * 10**6 * 10**18;
|
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount = 5000000 * 10**6 * 10**18;
uint256 private numTokensSellToAddToLiquidity = 500000 * 10**6 * 10**18;
| 16,311 |
236 | // Take fees from want increase and deposit remaining into Gauge | harvestData.wantProcessed = (IERC20Upgradeable(want).balanceOf(address(this))).sub(_before);
if (harvestData.wantProcessed > 0) {
harvestData.governancePerformanceFee = _processFee(
want,
harvestData.wantProcessed,
performanceFeeGovernance,
IController(controller).rewards()
);
| harvestData.wantProcessed = (IERC20Upgradeable(want).balanceOf(address(this))).sub(_before);
if (harvestData.wantProcessed > 0) {
harvestData.governancePerformanceFee = _processFee(
want,
harvestData.wantProcessed,
performanceFeeGovernance,
IController(controller).rewards()
);
| 44,069 |
13 | // Have we found enough itemIds to start storing them yet? | if (offset == 0) {
| if (offset == 0) {
| 20,457 |
7 | // Multiplies two unsigned integers, reverts on overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
| function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
| 433 |
20 | // Redeem the frax | FRAX.approve(address(pool), frax_amount);
pool.redeemFractionalFRAX(frax_amount, 0, 0);
| FRAX.approve(address(pool), frax_amount);
pool.redeemFractionalFRAX(frax_amount, 0, 0);
| 5,243 |
49 | // update the amount of dividends per token | profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
| profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
| 54,645 |
8 | // Inspired by https:blog.aragon.one/library-driven-development-in-solidity-2bebcaf88736 | struct TokenStorage {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 totalSupply;
}
| struct TokenStorage {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 totalSupply;
}
| 49,212 |
31 | // Contracts that should not own Tokens Remco Bloemen <remco@2π.com> This blocks incoming ERC23 tokens to prevent accidental loss of tokens.Should tokens (any ERC20Basic compatible) end up in the contract, it allows theowner to reclaim the tokens. / | contract HasNoTokens is CanReclaimToken {
/**
* @dev Reject all ERC23 compatible tokens
* @param from_ address The address that is transferring the tokens
* @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
*/
function tokenFallback(address from_, uint256 value_, bytes data_) external {
from_;
value_;
data_;
revert();
}
}
| contract HasNoTokens is CanReclaimToken {
/**
* @dev Reject all ERC23 compatible tokens
* @param from_ address The address that is transferring the tokens
* @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
*/
function tokenFallback(address from_, uint256 value_, bytes data_) external {
from_;
value_;
data_;
revert();
}
}
| 14,374 |
21 | // Convert byte to Move enum '0'>Rock, '1'>Paper, '2'>Scissors | function byteToMove(bytes1 b) private pure returns (Move) {
if(b == '0')
return Move.Rock;
if(b == '1')
return Move.Paper;
return Move.Scissors;
}
| function byteToMove(bytes1 b) private pure returns (Move) {
if(b == '0')
return Move.Rock;
if(b == '1')
return Move.Paper;
return Move.Scissors;
}
| 28,892 |
51 | // Have gUsers[1] try to add gUsers[2] as a member | addAUserWithImpersonateWithRevert(gUsers[2], AccessType.Member, gUsers[1], "Not authorized to grant");
assertEq(dao.getUserCount(), 2);
| addAUserWithImpersonateWithRevert(gUsers[2], AccessType.Member, gUsers[1], "Not authorized to grant");
assertEq(dao.getUserCount(), 2);
| 22,509 |
32 | // ^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/ / | function _checkRole(bytes32 role, address account) internal view {
if(!hasRole(role, account)) {
revert(string(abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)));
}
| function _checkRole(bytes32 role, address account) internal view {
if(!hasRole(role, account)) {
revert(string(abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)));
}
| 21,158 |
324 | // Issued synth balances for individual fee entitlements and exit price calculations | mapping(address => IssuanceData) public issuanceData;
| mapping(address => IssuanceData) public issuanceData;
| 6,069 |
83 | // Mapping hold the delagate details | mapping (address => bytes32) public delegateDetails;
| mapping (address => bytes32) public delegateDetails;
| 71,759 |
10 | // Function to destroy minted tokens owned by the proxy contract.Destroys token id `_assetId` of amount `_amount`._assetId - token id to be destroyed. _amount - amount to be destroyed. Requirements: - Only accounts which have default admin or subadmin role can call this function. / | function burnToken(
uint256 _assetId,
uint256 _amount
)
external
| function burnToken(
uint256 _assetId,
uint256 _amount
)
external
| 6,378 |
7 | // returns the number of investors/ | function getNumInvestors() constant returns(uint){
return investors.length;
}
| function getNumInvestors() constant returns(uint){
return investors.length;
}
| 50,668 |
878 | // Burns `numTokens` of `tokenCurrency` to decrease sponsors position size, without sending back `collateralCurrency`.This is done by a sponsor to increase position CR. Resulting size is bounded by minSponsorTokens. Can only be called by token sponsor. This contract must be approved to spend `numTokens` of `tokenCurrency`. This contract must have the Burner role for the `tokenCurrency`. numTokens is the number of tokens to be burnt from the sponsor's debt position. / | function repay(FixedPoint.Unsigned memory numTokens)
public
onlyPreExpiration()
noPendingWithdrawal(msg.sender)
fees()
nonReentrant()
| function repay(FixedPoint.Unsigned memory numTokens)
public
onlyPreExpiration()
noPendingWithdrawal(msg.sender)
fees()
nonReentrant()
| 9,411 |
28 | // TRANSFER USDT FROM BUYER TO THIS CONTRACT | _usdt.transferFrom(_msgSender(), address(this), usdtAllowance);
| _usdt.transferFrom(_msgSender(), address(this), usdtAllowance);
| 34,763 |
156 | // See {event Mint} | emit Mint(address(0), _owner, _amount);
| emit Mint(address(0), _owner, _amount);
| 39,782 |
27 | // an old way of string concatenation (Solidity 0.4) is commented out/ convert s1 into buffer 1 | bytes memory buf1 = bytes(s1);
| bytes memory buf1 = bytes(s1);
| 9,594 |
832 | // Same as `_upscale`, but for an entire array. This function does not return anything, but instead mutatesthe `amounts` array. / | function _upscaleArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view {
for (uint256 i = 0; i < _getTotalTokens(); ++i) {
amounts[i] = Math.mul(amounts[i], scalingFactors[i]);
}
}
| function _upscaleArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view {
for (uint256 i = 0; i < _getTotalTokens(); ++i) {
amounts[i] = Math.mul(amounts[i], scalingFactors[i]);
}
}
| 52,553 |
82 | // Approved token transfer amounts on behalf of others / | mapping (address => mapping (address => uint256)) transferAllowances;
| mapping (address => mapping (address => uint256)) transferAllowances;
| 9,207 |
38 | // swap | address[] memory path = new address[](2);
path[0] = address(this);
path[1] = UNISWAP_V2_ROUTER.WETH();
UNISWAP_V2_ROUTER.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap, 0, path, address(this), block.timestamp
);
uint256 amountETH = address(this).balance;
| address[] memory path = new address[](2);
path[0] = address(this);
path[1] = UNISWAP_V2_ROUTER.WETH();
UNISWAP_V2_ROUTER.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap, 0, path, address(this), block.timestamp
);
uint256 amountETH = address(this).balance;
| 1,432 |
15 | // Base URI for computing {tokenURI}. Empty by default, can be overridenin child contracts. / | function _baseURI() internal view virtual returns (string memory) {
return "";
}
| function _baseURI() internal view virtual returns (string memory) {
return "";
}
| 9,560 |
213 | // Deposit LP tokens to EthfundMaster for ETHF allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accEthfundPerShare).div(1e12).sub(user.rewardDebt);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(pool.accEthfundPerShare).div(1e12);
if (pending > 0) safeEthfundTransfer(msg.sender, pending);
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
emit Deposit(msg.sender, _pid, _amount);
}
| function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accEthfundPerShare).div(1e12).sub(user.rewardDebt);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(pool.accEthfundPerShare).div(1e12);
if (pending > 0) safeEthfundTransfer(msg.sender, pending);
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
emit Deposit(msg.sender, _pid, _amount);
}
| 5,407 |
24 | // uint256 loanTokenAmount, | uint256 closeAmount)
internal
| uint256 closeAmount)
internal
| 29,775 |
8 | // We allow invalid public keys to be set for accounts to disable offchain request signing. Make sure we can detect accounts that were not yet created in the circuits by forcing the pubKeyX to be non-zero. | require(pubKeyX > 0, "INVALID_PUBKEY");
| require(pubKeyX > 0, "INVALID_PUBKEY");
| 46,903 |
35 | // Ensure the fee is less than divisor | require(_protocolFee < FEE_DIVISOR, "INVALID_FEE");
protocolFee = _protocolFee;
emit SetProtocolFee(_protocolFee);
| require(_protocolFee < FEE_DIVISOR, "INVALID_FEE");
protocolFee = _protocolFee;
emit SetProtocolFee(_protocolFee);
| 25,325 |
2 | // Get the medianizer source for the price feed the Meta Oracle uses. returnsAddress of source medianizer of Price Feed / | function getSourceMedianizer()
external
view
| function getSourceMedianizer()
external
view
| 25,741 |
3 | // Test successful call | Multicall3.Call[] memory calls = new Multicall3.Call[](1);
calls[0] = Multicall3.Call(address(callee), abi.encodeWithSignature("getBlockHash(uint256)", block.number));
(uint256 blockNumber, bytes[] memory returnData) = multicall.aggregate(calls);
assertEq(blockNumber, block.number);
assertEq(keccak256(returnData[0]), keccak256(abi.encodePacked(blockhash(block.number))));
| Multicall3.Call[] memory calls = new Multicall3.Call[](1);
calls[0] = Multicall3.Call(address(callee), abi.encodeWithSignature("getBlockHash(uint256)", block.number));
(uint256 blockNumber, bytes[] memory returnData) = multicall.aggregate(calls);
assertEq(blockNumber, block.number);
assertEq(keccak256(returnData[0]), keccak256(abi.encodePacked(blockhash(block.number))));
| 7,806 |
5 | // burn / | returns (bool) {
// safeSub already has throw, so no need to throw
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
return true;
}
| returns (bool) {
// safeSub already has throw, so no need to throw
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
return true;
}
| 7,549 |
9 | // Get things to work on OpenSea with mock methods below/ |
function safeTransferFrom(address _from, address _to, uint256 _optionId, uint256 _amount, bytes calldata _data) external;
function balanceOf(address _owner, uint256 _optionId) external view returns (uint256);
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
|
function safeTransferFrom(address _from, address _to, uint256 _optionId, uint256 _amount, bytes calldata _data) external;
function balanceOf(address _owner, uint256 _optionId) external view returns (uint256);
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
| 28,756 |
2 | // Mapping of activity slots with participating identities | mapping (uint16 => address[]) epochIdentities;
| mapping (uint16 => address[]) epochIdentities;
| 50,943 |
4 | // Função para mudar para envio | function Shipped() public {
status = ShippingStatus.Shipped;
emit LogNewAlert("Your package has been shipped");
}
| function Shipped() public {
status = ShippingStatus.Shipped;
emit LogNewAlert("Your package has been shipped");
}
| 27,346 |
95 | // The timestamp in second when last distribute happened. | uint128 timestamp;
| uint128 timestamp;
| 12,325 |
9 | // Modifier that checks if the caller is authorized to add certificates to the blockchain. | modifier canAddCert() {
require(
Admins[msg.sender].blockNumber != 0,
"Caller is not authorised to add documents to the blockchain"
);
_;
}
| modifier canAddCert() {
require(
Admins[msg.sender].blockNumber != 0,
"Caller is not authorised to add documents to the blockchain"
);
_;
}
| 25,491 |
19 | // Internal transfer, only can be called by this contract / | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _value > balances[_to]);
// Save this for an assertion in the future
uint previousBalances = balances[_from] + balances[_to];
// Subtract from the sender
balances[_from] = balances[_from].sub(_value);
// Add the same to the recipient
balances[_to] = balances[_to].add(_value);
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balances[_from] + balances[_to] == previousBalances);
}
| function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _value > balances[_to]);
// Save this for an assertion in the future
uint previousBalances = balances[_from] + balances[_to];
// Subtract from the sender
balances[_from] = balances[_from].sub(_value);
// Add the same to the recipient
balances[_to] = balances[_to].add(_value);
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balances[_from] + balances[_to] == previousBalances);
}
| 45,494 |
3 | // Il costruttore esegue quando lo smart contract viene deploiato sulla blockchain | constructor() public {
addTask("Imparare a fare dapp");
}
| constructor() public {
addTask("Imparare a fare dapp");
}
| 2,670 |
15 | // Returns the 32-bit number at the specified index of self.self The byte string.idx The index into the bytes return The specified 32 bits of the string, interpreted as an integer./ | function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {
require(idx + 4 <= self.length);
assembly {
ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)
}
}
| function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {
require(idx + 4 <= self.length);
assembly {
ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)
}
}
| 38,730 |
114 | // File: src\contracts\HrsToken.solDappToken.sol | contract HrsToken is ERC20, Ownable {
address private _hodlerPool;
constructor() public ERC20("Hodler Rewards System Token", "HRST") {
_mint(msg.sender, 100000000000000000000);
}
// //only to debug
// function char(byte b) private pure returns (byte c) {
// if (uint8(b) < 10) return byte(uint8(b) + 0x30);
// else return byte(uint8(b) + 0x57);
// }
// function addressToString(address x) private pure returns (string memory) {
// bytes memory s = new bytes(40);
// for (uint i = 0; i < 20; i++) {
// byte b = byte(uint8(uint(x) / (2**(8*(19 - i)))));
// byte hi = byte(uint8(b) / 16);
// byte lo = byte(uint8(b) - 16 * uint8(hi));
// s[2*i] = char(hi);
// s[2*i+1] = char(lo);
// }
// return strConcat("0x", string(s), "", "", "");
// }
// function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory){
// bytes memory _ba = bytes(_a);
// bytes memory _bb = bytes(_b);
// bytes memory _bc = bytes(_c);
// bytes memory _bd = bytes(_d);
// bytes memory _be = bytes(_e);
// string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
// bytes memory babcde = bytes(abcde);
// uint k = 0;
// for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
// for (uint i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
// for (uint i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
// for (uint i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
// for (uint i = 0; i < _be.length; i++) babcde[k++] = _be[i];
// return string(babcde);
// }
// //
modifier onlyMinter() {
require(_hodlerPool == _msgSender(), "Ownable: caller is not the Minter");
// TO DEBUG...
// string memory aaa = strConcat("_hodlerPool: ", addressToString(_hodlerPool), " | _msgSender: ", addressToString(_msgSender()), " | Ownable: caller is not the minter");
// require(_hodlerPool == _msgSender(), aaa);
//
// TO TEST... (by pass this check)
//require(1 == 1, "Ownable: 1 is not same as 1");
_;
}
function setHodlerPool(address hodlerPool) external onlyOwner
{
_hodlerPool = hodlerPool;
}
function mint(address _to, uint256 _amount) external onlyMinter returns (bool)
{
_mint(_to, _amount);
return true;
}
// function _burn(address account, uint256 amount) internal virtual {
// require(account != address(0), "ERC20: burn from the zero address");
// _beforeTokenTransfer(account, address(0), amount);
// _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
// _totalSupply = _totalSupply.sub(amount);
// emit Transfer(account, address(0), amount);
// }
function burn(address account, uint256 amount) external onlyMinter {
// TODO: make sure it can only be called by HodlerPool
_burn(account, amount);
}
}
| contract HrsToken is ERC20, Ownable {
address private _hodlerPool;
constructor() public ERC20("Hodler Rewards System Token", "HRST") {
_mint(msg.sender, 100000000000000000000);
}
// //only to debug
// function char(byte b) private pure returns (byte c) {
// if (uint8(b) < 10) return byte(uint8(b) + 0x30);
// else return byte(uint8(b) + 0x57);
// }
// function addressToString(address x) private pure returns (string memory) {
// bytes memory s = new bytes(40);
// for (uint i = 0; i < 20; i++) {
// byte b = byte(uint8(uint(x) / (2**(8*(19 - i)))));
// byte hi = byte(uint8(b) / 16);
// byte lo = byte(uint8(b) - 16 * uint8(hi));
// s[2*i] = char(hi);
// s[2*i+1] = char(lo);
// }
// return strConcat("0x", string(s), "", "", "");
// }
// function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory){
// bytes memory _ba = bytes(_a);
// bytes memory _bb = bytes(_b);
// bytes memory _bc = bytes(_c);
// bytes memory _bd = bytes(_d);
// bytes memory _be = bytes(_e);
// string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
// bytes memory babcde = bytes(abcde);
// uint k = 0;
// for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
// for (uint i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
// for (uint i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
// for (uint i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
// for (uint i = 0; i < _be.length; i++) babcde[k++] = _be[i];
// return string(babcde);
// }
// //
modifier onlyMinter() {
require(_hodlerPool == _msgSender(), "Ownable: caller is not the Minter");
// TO DEBUG...
// string memory aaa = strConcat("_hodlerPool: ", addressToString(_hodlerPool), " | _msgSender: ", addressToString(_msgSender()), " | Ownable: caller is not the minter");
// require(_hodlerPool == _msgSender(), aaa);
//
// TO TEST... (by pass this check)
//require(1 == 1, "Ownable: 1 is not same as 1");
_;
}
function setHodlerPool(address hodlerPool) external onlyOwner
{
_hodlerPool = hodlerPool;
}
function mint(address _to, uint256 _amount) external onlyMinter returns (bool)
{
_mint(_to, _amount);
return true;
}
// function _burn(address account, uint256 amount) internal virtual {
// require(account != address(0), "ERC20: burn from the zero address");
// _beforeTokenTransfer(account, address(0), amount);
// _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
// _totalSupply = _totalSupply.sub(amount);
// emit Transfer(account, address(0), amount);
// }
function burn(address account, uint256 amount) external onlyMinter {
// TODO: make sure it can only be called by HodlerPool
_burn(account, amount);
}
}
| 6,442 |
183 | // Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode.Otherwise, it will return the block timestamp.return uint for the current Testable timestamp. / | function getCurrentTime() public view virtual returns (uint256) {
if (timerAddress != address(0x0)) {
return Timer(timerAddress).getCurrentTime();
} else {
return block.timestamp; // solhint-disable-line not-rely-on-time
}
}
| function getCurrentTime() public view virtual returns (uint256) {
if (timerAddress != address(0x0)) {
return Timer(timerAddress).getCurrentTime();
} else {
return block.timestamp; // solhint-disable-line not-rely-on-time
}
}
| 26,707 |
10 | // Create an Entry with the given daily data/The day and date must not be empty/_breakfast What breakfast was that day/_lunch What lunch was that day/_dinner What dinner was that day/_meditation How long was meditation that day/_day What day it is/_date What date it is | function createEntry(
string memory _breakfast,
string memory _lunch,
string memory _dinner,
string memory _meditation,
string memory _day,
string memory _date
)
public onlyOwner()
| function createEntry(
string memory _breakfast,
string memory _lunch,
string memory _dinner,
string memory _meditation,
string memory _day,
string memory _date
)
public onlyOwner()
| 36,116 |
7 | // Override the mintTo function of the base contract Set the power levl of the token to be the power level of the token Id | function mintTo(address _to, string memory _tokenURI) public virtual override{
// Grab the next available token ID
uint256 tokenId = nextTokenIdToMint();
//Actually mint the NFT (using the underlying logic)
super.mintTo(_to, _tokenURI); //super refers to ERC721
//Set the power level of that NFT
powerLevel[tokenId] = tokenId;
}
| function mintTo(address _to, string memory _tokenURI) public virtual override{
// Grab the next available token ID
uint256 tokenId = nextTokenIdToMint();
//Actually mint the NFT (using the underlying logic)
super.mintTo(_to, _tokenURI); //super refers to ERC721
//Set the power level of that NFT
powerLevel[tokenId] = tokenId;
}
| 29,434 |
96 | // register an api-key on behalf of the sender/irreversible operation; the apiKey->sender association cannot be broken or overwritten/ (but further apiKey->sender associations can be provided)//apiKey the account to be used to stand-in for the registering sender | function register(address apiKey) external whenOn validAddress(apiKey) isAbsent(apiKey) {
data.addKey(apiKey, msg.sender);
emit Registered(apiKey, msg.sender);
}
| function register(address apiKey) external whenOn validAddress(apiKey) isAbsent(apiKey) {
data.addKey(apiKey, msg.sender);
emit Registered(apiKey, msg.sender);
}
| 15,476 |
5 | // SafeMath Unsigned math operations with safety checks that revert on error. / | library SafeMath {
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient,
* reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return a / b;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
| library SafeMath {
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient,
* reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return a / b;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
| 9,503 |
58 | // DEBUG - Disable for production | certificate_[_crtId].ocspRevoked = _revoking;
| certificate_[_crtId].ocspRevoked = _revoking;
| 48,032 |
162 | // returns the address of the FeeProvider proxy return the address of the Fee provider proxy/ | function getFeeProvider() public view returns (address) {
return getAddress(FEE_PROVIDER);
}
| function getFeeProvider() public view returns (address) {
return getAddress(FEE_PROVIDER);
}
| 34,819 |
267 | // Направляю вам Черняка.^^^^^^^ | recognition Черняка_1 language=Russian
| recognition Черняка_1 language=Russian
| 29,175 |
114 | // -------------------------------------------------------------------------- //INTERNAL HELPERS// -------------------------------------------------------------------------- / unchecked division | function uDiv(uint256 x, uint256 y) internal pure returns (uint256 z) {assembly {z := div(x, y)}}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {z = x < y ? x : y;}
}
| function uDiv(uint256 x, uint256 y) internal pure returns (uint256 z) {assembly {z := div(x, y)}}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {z = x < y ? x : y;}
}
| 61,751 |
20 | // mint 1-3000 | require(
totalMintedStandard() + _mintAmount <= MAX_STANDARD_TOKEN_SUPPLY,
"Will exceed token supply."
);
_safeMint(_to, _mintAmount, _currentIndexStandard);
_currentIndexStandard = _currentIndexStandard + _mintAmount;
| require(
totalMintedStandard() + _mintAmount <= MAX_STANDARD_TOKEN_SUPPLY,
"Will exceed token supply."
);
_safeMint(_to, _mintAmount, _currentIndexStandard);
_currentIndexStandard = _currentIndexStandard + _mintAmount;
| 38,153 |
15 | // Gets all owned lands of an account in a world / | function landsOf(uint32 _world, address _owner) external view returns (int64[], int64[]) {
uint256 length = ownedTokens[_owner].length;
int64[] memory xs = new int64[](length);
int64[] memory ys = new int64[](length);
uint32 world;
int64 x;
int64 y;
for (uint i = 0; i < length; i++) {
(world, x, y) = decodeTokenId(ownedTokens[_owner][i]);
if (world == _world) {
xs[i] = x;
ys[i] = y;
}
}
return (xs, ys);
}
| function landsOf(uint32 _world, address _owner) external view returns (int64[], int64[]) {
uint256 length = ownedTokens[_owner].length;
int64[] memory xs = new int64[](length);
int64[] memory ys = new int64[](length);
uint32 world;
int64 x;
int64 y;
for (uint i = 0; i < length; i++) {
(world, x, y) = decodeTokenId(ownedTokens[_owner][i]);
if (world == _world) {
xs[i] = x;
ys[i] = y;
}
}
return (xs, ys);
}
| 48,711 |
39 | // TAX SELLERS 30% WHO SELL WITHIN 12 HOURS | if (_buyMap[from] != 0 &&
(_buyMap[from] + (12 hours) >= block.timestamp)) {
_feeAddr1 = 2;
_feeAddr2 = 18;
} else {
| if (_buyMap[from] != 0 &&
(_buyMap[from] + (12 hours) >= block.timestamp)) {
_feeAddr1 = 2;
_feeAddr2 = 18;
} else {
| 49,809 |
6 | // Returns token symbol | * @dev See {IERC20Metadata}
* @return Token symbol
*/
function symbol() public view override returns (string memory) {
return _symbol;
}
| * @dev See {IERC20Metadata}
* @return Token symbol
*/
function symbol() public view override returns (string memory) {
return _symbol;
}
| 36,689 |
6 | // The AO ONLY METHODS // Transfer ownership of The AO to new address _theAO The new address to be transferred / | function transferOwnership(address _theAO) public onlyTheAO {
require (_theAO != address(0));
theAO = _theAO;
}
| function transferOwnership(address _theAO) public onlyTheAO {
require (_theAO != address(0));
theAO = _theAO;
}
| 9,730 |
14 | // Set the manager address for deposits./ | function setManager(address manager) public onlyOwner {
_manager = manager;
}
| function setManager(address manager) public onlyOwner {
_manager = manager;
}
| 4,795 |
286 | // See {IToken-freezePartialTokens}./ | function freezePartialTokens(address _userAddress, uint256 _amount) public override onlyAgent {
uint256 balance = balanceOf(_userAddress);
require(balance >= frozenTokens[_userAddress] + _amount, "Amount exceeds available balance");
frozenTokens[_userAddress] = frozenTokens[_userAddress].add(_amount);
emit TokensFrozen(_userAddress, _amount);
}
| function freezePartialTokens(address _userAddress, uint256 _amount) public override onlyAgent {
uint256 balance = balanceOf(_userAddress);
require(balance >= frozenTokens[_userAddress] + _amount, "Amount exceeds available balance");
frozenTokens[_userAddress] = frozenTokens[_userAddress].add(_amount);
emit TokensFrozen(_userAddress, _amount);
}
| 15,266 |
0 | // Number of decimal places in the representation. // The number representing 1.0. //return True iff adding x and y will not overflow. / | function addIsSafe(uint x, uint y)
pure
internal
returns (bool)
| function addIsSafe(uint x, uint y)
pure
internal
returns (bool)
| 64,809 |
0 | // state variables | struct ProtocolVersion {
uint8 major;
uint8 minor;
uint8 patch;
}
| struct ProtocolVersion {
uint8 major;
uint8 minor;
uint8 patch;
}
| 148 |
173 | // Version of signature should be 27 or 28, but 0 and 1 are also possible versions |
if (v < 27) {
v += 27;
}
|
if (v < 27) {
v += 27;
}
| 1,468 |
43 | // Deposit in nestamount Deposit quantity/ | function depositIn(uint256 amount) public {
require(address(tx.origin) == address(msg.sender));
uint256 nowTime = now;
if (nowTime < nextTime) {
require(!(nowTime >= nextTime.sub(timeLimit) && nowTime <= nextTime.sub(timeLimit).add(getAbonusTimeLimit)));
} else {
require(!(nowTime >= nextTime && nowTime <= nextTime.add(getAbonusTimeLimit)));
uint256 time = (nowTime.sub(nextTime)).div(timeLimit);
uint256 startTime = nextTime.add((time).mul(timeLimit));
uint256 endTime = startTime.add(getAbonusTimeLimit);
require(!(nowTime >= startTime && nowTime <= endTime));
}
baseMapping.depositIn(amount);
}
| function depositIn(uint256 amount) public {
require(address(tx.origin) == address(msg.sender));
uint256 nowTime = now;
if (nowTime < nextTime) {
require(!(nowTime >= nextTime.sub(timeLimit) && nowTime <= nextTime.sub(timeLimit).add(getAbonusTimeLimit)));
} else {
require(!(nowTime >= nextTime && nowTime <= nextTime.add(getAbonusTimeLimit)));
uint256 time = (nowTime.sub(nextTime)).div(timeLimit);
uint256 startTime = nextTime.add((time).mul(timeLimit));
uint256 endTime = startTime.add(getAbonusTimeLimit);
require(!(nowTime >= startTime && nowTime <= endTime));
}
baseMapping.depositIn(amount);
}
| 50,005 |
25 | // Mint a 12 EggZ Pack from reserve/ | function summon12PackEggZromReserve() public payable {
mintInFreeEggZReserve(12,unitPrice12EggPack);
}
| function summon12PackEggZromReserve() public payable {
mintInFreeEggZReserve(12,unitPrice12EggPack);
}
| 71,916 |
0 | // shares are how a users balance is generated. For rebase tokens, balances are always generated at runtime, while shares stay constant. shares is your proportion of the total pool of invested UnderlyingToken shares are like a Compound.finance cToken, while our token balances are like an Aave aToken. | mapping(address => uint256) private shares;
mapping(address => mapping (address => uint256)) private allowances;
uint256 public totalShares;
string public name;
string public symbol;
string public underlying;
address public underlyingContract;
| mapping(address => uint256) private shares;
mapping(address => mapping (address => uint256)) private allowances;
uint256 public totalShares;
string public name;
string public symbol;
string public underlying;
address public underlyingContract;
| 24,184 |
1,400 | // PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Send specific amount of funds to Randomness Provider, from our contract's balance. This is useful in cases when gas prices change, and current funds inside randomness provider are not enough to execute operations on the new gas cost.This operation is limited to 6 ethers once in 12 hours.- What's payable? We send Ether to the randomness provider. / |
function provideRandomnessProviderFunds(
uint etherAmount )
external
ownerApprovedAddressOnly
mutexLOCKED
|
function provideRandomnessProviderFunds(
uint etherAmount )
external
ownerApprovedAddressOnly
mutexLOCKED
| 6,152 |
42 | // Update the function parameters of savings threshold level 2/ | function changeSavingLevelTwoSub(uint256 num) public onlyOwner {
_savingLevelTwoSub = num;
}
| function changeSavingLevelTwoSub(uint256 num) public onlyOwner {
_savingLevelTwoSub = num;
}
| 26,045 |
29 | // Show_Available_balance_for_Sale_in_ETH_equivalent | function show_Balance_available_for_Sale_in_ETH_equivalent () constant public returns (uint256 you_can_buy_all_the_available_assets_with_this_amount_in_ETH) {
you_can_buy_all_the_available_assets_with_this_amount_in_ETH = buyPrice * balances[this] / 1e18;
}
| function show_Balance_available_for_Sale_in_ETH_equivalent () constant public returns (uint256 you_can_buy_all_the_available_assets_with_this_amount_in_ETH) {
you_can_buy_all_the_available_assets_with_this_amount_in_ETH = buyPrice * balances[this] / 1e18;
}
| 40,467 |
4 | // Sets the protocol state to either a global pause, a publishing pause or an unpaused state. This functioncan only be called by the governance address or the emergency admin address.newState The state to set, as a member of the ProtocolState enum. / | function setState(DataTypes.ProtocolState newState) external;
| function setState(DataTypes.ProtocolState newState) external;
| 38,471 |
48 | // Описание см. в конструкторе // Событие обновления токена (имя и символ) //Конструктор Токен должен быть создан только владельцем через кошелек (либо с мультиподписью, либо без нее)_name - имя токена _symbol - символ токена _initialSupply - со сколькими токенами мы стартуем _decimals - кол-во знаков после запятой / | function CrowdsaleToken(string _name, string _symbol, uint _initialSupply, uint _decimals) {
require(_initialSupply != 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _initialSupply;
}
| function CrowdsaleToken(string _name, string _symbol, uint _initialSupply, uint _decimals) {
require(_initialSupply != 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _initialSupply;
}
| 37,254 |
8 | // Records for which addresses, for which entries have been accepted Otherwise, people could keep submitting the same entry. | mapping (address => mapping(uint256 => bool)) submittedEntries; // Storage slot 14
int256 constant MAX_INT128 = 2**127 - 1;
int256 constant MIN_INT128 = (2**127)*(-1);
| mapping (address => mapping(uint256 => bool)) submittedEntries; // Storage slot 14
int256 constant MAX_INT128 = 2**127 - 1;
int256 constant MIN_INT128 = (2**127)*(-1);
| 669 |
153 | // 输入数量=合约收到的主币数量 | uint256 amountIn = msg.value;
| uint256 amountIn = msg.value;
| 15,715 |
25 | // withdraw the bid amount | sender.transfer(price);
| sender.transfer(price);
| 51,079 |
166 | // 2. transfer token from use to this machine | currencyToken.transferFrom(msg.sender, address(this), burnAmount);
| currencyToken.transferFrom(msg.sender, address(this), burnAmount);
| 33,105 |
12 | // Get price/token mortgage asset address/uToken underlying asset address/payback return address of excess fee/ return tokenPrice Mortgage asset price(1 ETH = ? token)/ return pTokenPrice PToken price(1 ETH = ? pToken) | function getPriceForPToken(
address token,
address uToken,
address payback
) external payable returns (uint256 tokenPrice, uint256 pTokenPrice);
| function getPriceForPToken(
address token,
address uToken,
address payback
) external payable returns (uint256 tokenPrice, uint256 pTokenPrice);
| 50,845 |
4 | // ERC20 | function totalSupply() external view override virtual returns (uint256) {
return _totalSupply + _currentDeposits;
}
| function totalSupply() external view override virtual returns (uint256) {
return _totalSupply + _currentDeposits;
}
| 43,383 |
45 | // Modifier to make a function callable only when the contract is not frozen. Requirements: - The contract must not be frozen. / | modifier whenNotFrozen() {
require(!frozen(), "Freezable: frozen");
_;
}
| modifier whenNotFrozen() {
require(!frozen(), "Freezable: frozen");
_;
}
| 33,837 |
361 | // If the debt is greater than the remaining collateral, they cannot redeem anything. | FixedPoint.Unsigned memory positionRedeemableCollateral = tokenDebtValueInCollateral.isLessThan(
positionCollateral
)
? positionCollateral.sub(tokenDebtValueInCollateral)
: FixedPoint.Unsigned(0);
| FixedPoint.Unsigned memory positionRedeemableCollateral = tokenDebtValueInCollateral.isLessThan(
positionCollateral
)
? positionCollateral.sub(tokenDebtValueInCollateral)
: FixedPoint.Unsigned(0);
| 11,991 |
127 | // Leftover tokens will be swapped into liquidity the next time this is called | 2,530 | ||
26 | // Admin function for setting the voting delaynewVotingDelay new voting delay, in seconds/ | function _setVotingDelay(uint newVotingDelay) external {
require(msg.sender == admin, "GovernorBravo::_setVotingDelay: admin only");
require(newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY, "GovernorBravo::_setVotingDelay: invalid voting delay");
uint oldVotingDelay = votingDelay;
votingDelay = newVotingDelay;
emit VotingDelaySet(oldVotingDelay,votingDelay);
}
| function _setVotingDelay(uint newVotingDelay) external {
require(msg.sender == admin, "GovernorBravo::_setVotingDelay: admin only");
require(newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY, "GovernorBravo::_setVotingDelay: invalid voting delay");
uint oldVotingDelay = votingDelay;
votingDelay = newVotingDelay;
emit VotingDelaySet(oldVotingDelay,votingDelay);
}
| 25,554 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.