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 |
|---|---|---|---|---|
4 | // ERC-20 Token Standard: function allowance(address _owner, address _spender) public view returns (uint256 remaining) | mapping(address => mapping(address => uint256)) public allowance;
| mapping(address => mapping(address => uint256)) public allowance;
| 18,873 |
4 | // Change product status | function changeTraceGoods(bytes32 goodsGroup, uint64 goodsId, int16 goodsStatus, string memory remark)public{
Traceability category = getTraceability(goodsGroup);
category.changeGoodsStatus(goodsId, goodsStatus, remark);
}
| function changeTraceGoods(bytes32 goodsGroup, uint64 goodsId, int16 goodsStatus, string memory remark)public{
Traceability category = getTraceability(goodsGroup);
category.changeGoodsStatus(goodsId, goodsStatus, remark);
}
| 27,194 |
17 | // Transfers ownership of the contract to the caller.Can only be called by a new potential owner set by the current owner. / | function acceptOwnership() external {
require(
msg.sender == _newPotentialOwner,
"TwoStepOwnable: current owner must set caller as new potential owner."
);
delete _newPotentialOwner;
emit OwnershipTransferred(_owner, msg.sender);
_owner = msg.sender;
}
| function acceptOwnership() external {
require(
msg.sender == _newPotentialOwner,
"TwoStepOwnable: current owner must set caller as new potential owner."
);
delete _newPotentialOwner;
emit OwnershipTransferred(_owner, msg.sender);
_owner = msg.sender;
}
| 24,026 |
6 | // Returns x / y rounded up (x / y + boolAsInt(x % y > 0)). | function divUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
// Division by 0 if
// y = 0
assembly {
if iszero(y) { revert(0, 0) }
z := add(gt(mod(x, y), 0), div(x, y))
}
}
| function divUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
// Division by 0 if
// y = 0
assembly {
if iszero(y) { revert(0, 0) }
z := add(gt(mod(x, y), 0), div(x, y))
}
}
| 26,703 |
439 | // The [0] fee period is not yet ready to claim, but it is a fee period that they can have fees owing for, so we need to report on it anyway. | uint feesFromPeriod;
uint rewardsFromPeriod;
(feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(0, userOwnershipPercentage);
results[0][0] = feesFromPeriod;
results[0][1] = rewardsFromPeriod;
| uint feesFromPeriod;
uint rewardsFromPeriod;
(feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(0, userOwnershipPercentage);
results[0][0] = feesFromPeriod;
results[0][1] = rewardsFromPeriod;
| 37,468 |
37 | // rewards info by staking token | mapping(address => StakingRewardsInfo)
public stakingRewardsInfoByStakingToken;
| mapping(address => StakingRewardsInfo)
public stakingRewardsInfoByStakingToken;
| 35,261 |
38 | // return The result of safely multiplying x and y, interpreting the operandsas fixed-point decimals of a precise unit.The operands should be in the precise unit factor which will bedivided out after the product of x and y is evaluated, so that product must beless than 2256. Unlike multiplyDecimal, this function rounds... | function multiplyDecimalRoundPrecise(uint x, uint y)
internal
pure
returns (uint)
| function multiplyDecimalRoundPrecise(uint x, uint y)
internal
pure
returns (uint)
| 23,089 |
1,503 | // pull the amount we flash loaned in collateral to be able to payback the debt | DSProxy(payable(_proxy)).execute(AAVE_BASIC_PROXY, abi.encodeWithSignature("withdraw(address,address,uint256)", _market, _exchangeData.srcAddr, _withdrawValue));
| DSProxy(payable(_proxy)).execute(AAVE_BASIC_PROXY, abi.encodeWithSignature("withdraw(address,address,uint256)", _market, _exchangeData.srcAddr, _withdrawValue));
| 31,603 |
205 | // squaring via mul is cheaper than via pow | int128 inputSquared64x64 = input64x64.mul(input64x64);
int128 value64x64 = (-inputSquared64x64 >> 1).exp().div(
CDF_CONST_0.add(CDF_CONST_1.mul(input64x64.abs())).add(
CDF_CONST_2.mul(inputSquared64x64.add(THREE_64x64).sqrt())
)
);
return input64... | int128 inputSquared64x64 = input64x64.mul(input64x64);
int128 value64x64 = (-inputSquared64x64 >> 1).exp().div(
CDF_CONST_0.add(CDF_CONST_1.mul(input64x64.abs())).add(
CDF_CONST_2.mul(inputSquared64x64.add(THREE_64x64).sqrt())
)
);
return input64... | 37,292 |
9 | // Result from Chainlink VRF | uint256 public randomResult = 0;
| uint256 public randomResult = 0;
| 19,523 |
6 | // Update internal Guild and Member balances | for (uint256 i = 0; i < states[address(dao)].tokens.length; i++) {
address token = states[address(dao)].tokens[i];
uint256 amountToRagequit = fairShare(states[address(dao)].tokenBalances[GUILD][token], sharesToBurn, totalShares);
if (amountToRagequit > 0) { // gas optimizatio... | for (uint256 i = 0; i < states[address(dao)].tokens.length; i++) {
address token = states[address(dao)].tokens[i];
uint256 amountToRagequit = fairShare(states[address(dao)].tokenBalances[GUILD][token], sharesToBurn, totalShares);
if (amountToRagequit > 0) { // gas optimizatio... | 49,827 |
5 | // Get ETH Loan from Aave | string memory loanAddress = manager.takeAaveLoan(loanAmount);
| string memory loanAddress = manager.takeAaveLoan(loanAmount);
| 21,410 |
124 | // After the channel is settled the storage is cleared, therefore the value will be NonExistent and not Settled. The value Settled is used for the external APIs | require(
channels[channel_identifier].state == ChannelState.NonExistent,
"TN/unlock: channel not settled"
);
bytes32 unlock_key;
bytes32 computed_locksroot;
uint256 unlocked_amount;
uint256 locked_amount;
uint256 returned_tokens;
| require(
channels[channel_identifier].state == ChannelState.NonExistent,
"TN/unlock: channel not settled"
);
bytes32 unlock_key;
bytes32 computed_locksroot;
uint256 unlocked_amount;
uint256 locked_amount;
uint256 returned_tokens;
| 27,783 |
14 | // Fallback function allows to deposit ether. | function() external payable {
if (msg.value > 0) emit Deposit(msg.sender, msg.value);
}
| function() external payable {
if (msg.value > 0) emit Deposit(msg.sender, msg.value);
}
| 23,702 |
155 | // wearable id | uint32 wearableID;
| uint32 wearableID;
| 41,797 |
376 | // Update the admin fee. Admin fee takes portion of the swap fee. newAdminFee new admin fee to be applied on future transactions / | function setAdminFee(uint256 newAdminFee) external onlyOwner {
swapStorage.setAdminFee(newAdminFee);
}
| function setAdminFee(uint256 newAdminFee) external onlyOwner {
swapStorage.setAdminFee(newAdminFee);
}
| 45,186 |
497 | // -- Deposits -- | function getNumDepositRequestsProcessed()
external
view
returns (uint)
| function getNumDepositRequestsProcessed()
external
view
returns (uint)
| 26,579 |
3 | // performs a transaction using the chi burning modifier target The address to send the transaction tovalue The amount of wei to send with the transactionsignature A string defining the interface of the function to be calledinputData The data sent with the call, such as the values of any input parameters of the functio... | function constructAndCallWithChi(address target, uint value, string memory signature, bytes memory inputData) public payable returns(bytes memory)
| function constructAndCallWithChi(address target, uint value, string memory signature, bytes memory inputData) public payable returns(bytes memory)
| 25,658 |
36 | // Delegate all `tokenURI` calls to another contract/Can only be called by the contract `owner`. Emits an ERC-4906 event./delegate The contract that will handle `tokenURI` responses | function delegateTokenURIs(address delegate) external onlyOwner {
// CHECKS inputs
require(delegate != address(0), "New metadata delegate must not be the zero address");
require(delegate.code.length > 0, "New metadata delegate must be a contract");
// EFFECTS
baseURI = "";
... | function delegateTokenURIs(address delegate) external onlyOwner {
// CHECKS inputs
require(delegate != address(0), "New metadata delegate must not be the zero address");
require(delegate.code.length > 0, "New metadata delegate must be a contract");
// EFFECTS
baseURI = "";
... | 34,948 |
73 | // SPDX-License-Identifier: MIT chainlink 价格合约接口 | interface AggregatorInterface {
function latestAnswer() external view returns (int256);
}
| interface AggregatorInterface {
function latestAnswer() external view returns (int256);
}
| 14,074 |
3 | // va = VulcanApplication(_t); | va_addr = _t;
| va_addr = _t;
| 12,418 |
125 | // Find exchange amount of one token, then find exchange amount for full value. | if (totalN == 0) {
arAmount = _nAmount;
} else {
| if (totalN == 0) {
arAmount = _nAmount;
} else {
| 42,795 |
68 | // _wallet Vault address / | function RefundVault(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
state = State.Active;
}
| function RefundVault(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
state = State.Active;
}
| 30,201 |
1 | // Unwraps the contract's WETH balance and sends it to recipient as ETH./The minAmount parameter prevents malicious contracts from stealing WETH from users./minAmount The minimum amount of WETH to unwrap/recipient The address receiving ETH | function unwrapWeth(uint256 minAmount, address recipient) external payable;
| function unwrapWeth(uint256 minAmount, address recipient) external payable;
| 11,203 |
307 | // Will not overflow unless all 2256 token ids are minted to the same owner. Given that tokens are minted one by one, it is impossible in practice that this ever happens. Might change if we allow batch minting. The ERC fails to describe this case. | _balances[to] += 1;
| _balances[to] += 1;
| 44,544 |
8 | // called by the owner on end of emergency, returns to normal state | function unhalt() external onlyOwner onlyInEmergency {
halted = false;
}
| function unhalt() external onlyOwner onlyInEmergency {
halted = false;
}
| 15,192 |
9 | // withdraw fees & accidentally sent erc20 tokens / | function reclaimERC20(IERC20 token, uint256 _amount) external onlyOwner {
require(address(token) != address(tuna), "cannot take tuna");
uint256 balance = token.balanceOf(address(this));
require(_amount <= balance, "incorrect amount");
token.transfer(msg.sender, _amount);
}
| function reclaimERC20(IERC20 token, uint256 _amount) external onlyOwner {
require(address(token) != address(tuna), "cannot take tuna");
uint256 balance = token.balanceOf(address(this));
require(_amount <= balance, "incorrect amount");
token.transfer(msg.sender, _amount);
}
| 33,877 |
275 | // fallback to 6 uppercase hex of address | return addressToSymbol(token);
| return addressToSymbol(token);
| 3,734 |
81 | // 0 = input token amt, 1 = weth output amt, 2 = stablecoin output amt | treasury.deposit(stablecoin, amounts[2]);
| treasury.deposit(stablecoin, amounts[2]);
| 5,237 |
4 | // 投票終了タイムスタンプ Voting end timestamp | uint voteEndAt;
| uint voteEndAt;
| 4,094 |
49 | // Revert if undefined function is called | revert(0, 0)
| revert(0, 0)
| 38,572 |
66 | // Deleting listing to prevent reentry | address owner = listing.owner;
uint unstakedDeposit = listing.unstakedDeposit;
delete listings[_listingHash];
| address owner = listing.owner;
uint unstakedDeposit = listing.unstakedDeposit;
delete listings[_listingHash];
| 16,199 |
60 | // Function which will return the whole target blocks. return _targetBlocks Array of target blocks/ | function getTargetBlocks() public view returns (uint256[] _targetBlocks) {
return targetBlocks;
}
| function getTargetBlocks() public view returns (uint256[] _targetBlocks) {
return targetBlocks;
}
| 46,371 |
66 | // Prepare the domain separator. | mstore(m, _DOMAIN_TYPEHASH)
mstore(add(m, 0x20), nameHash)
mstore(add(m, 0x40), _VERSION_HASH)
mstore(add(m, 0x60), chainid())
mstore(add(m, 0x80), address())
mstore(0x2e, keccak256(m, 0xa0))
| mstore(m, _DOMAIN_TYPEHASH)
mstore(add(m, 0x20), nameHash)
mstore(add(m, 0x40), _VERSION_HASH)
mstore(add(m, 0x60), chainid())
mstore(add(m, 0x80), address())
mstore(0x2e, keccak256(m, 0xa0))
| 6,646 |
54 | // ERC20Mintable ERC20 minting logic / | contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
uint256 ... | contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
uint256 ... | 25,998 |
3 | // Default maximum stake | uint256 internal maxStakeAmount = 0;
| uint256 internal maxStakeAmount = 0;
| 45,600 |
127 | // Internal function to burn a specific token.Reverts if the token does not exist. tokenId uint256 ID of the token being burned / | function _burn(uint256 tokenId) internal {
_burn(ownerOf(tokenId), tokenId);
}
| function _burn(uint256 tokenId) internal {
_burn(ownerOf(tokenId), tokenId);
}
| 10,063 |
17 | // Get amount of assets borrowed from the protocol by the vaultreturn Assets borrowed / | function getBorrowedFromProtocol() public virtual view returns (uint256);
| function getBorrowedFromProtocol() public virtual view returns (uint256);
| 6,976 |
87 | // Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account amount The number of tokens to transferreturn Whether or not the transfer succeeded / | function transferFrom(address src, address dst, uint amount) external returns (bool) {
address spender = msg.sender;
uint spenderAllowance = allowances[src][spender];
if (spender != src && spenderAllowance != uint(-1)) {
uint newAllowance = spenderAllowance.sub(amount, "transfer... | function transferFrom(address src, address dst, uint amount) external returns (bool) {
address spender = msg.sender;
uint spenderAllowance = allowances[src][spender];
if (spender != src && spenderAllowance != uint(-1)) {
uint newAllowance = spenderAllowance.sub(amount, "transfer... | 15,569 |
10 | // Calculates floor(xy÷denominator) with full precision.//Credit to Remco Bloemen under MIT license https:xn--2-umb.com/21/muldiv.// Requirements:/ - The denominator cannot be zero./ - The result must fit within uint256.// Caveats:/ - This function does not work with fixed-point numbers.//x The multiplicand as an uint2... | function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
| function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
| 76,470 |
32 | // Transfer the Stable Coin to Split Payment process |
bool success_treasury = _stableToken.transferFrom(
_msgSender(),
paymentAddresses[tier],
price
);
require(
success_treasury,
"ERC721: Can't create Donks, you don't have enough stable coins"
|
bool success_treasury = _stableToken.transferFrom(
_msgSender(),
paymentAddresses[tier],
price
);
require(
success_treasury,
"ERC721: Can't create Donks, you don't have enough stable coins"
| 8,360 |
829 | // nToken total supply factors for the nToken, includes factors related/ to claiming incentives, total storage 32 bytes | struct nTokenTotalSupplyStorage {
// Total supply of the nToken
uint96 totalSupply;
// Integral of the total supply used for calculating the average total supply
uint128 integralTotalSupply;
// Last timestamp the supply value changed, used for calculating the integralTotalSupply
uint32 lastSuppl... | struct nTokenTotalSupplyStorage {
// Total supply of the nToken
uint96 totalSupply;
// Integral of the total supply used for calculating the average total supply
uint128 integralTotalSupply;
// Last timestamp the supply value changed, used for calculating the integralTotalSupply
uint32 lastSuppl... | 11,256 |
15 | // Spread factor for face assets. | uint256 public faceSpreadFactor;
| uint256 public faceSpreadFactor;
| 12,705 |
290 | // Calculates the binary exponent of x using the binary fraction method.//See https:ethereum.stackexchange.com/q/79903/24693.// Requirements:/ - x must be 192 or less./ - The result must fit within MAX_UD60x18.//x The exponent as an unsigned 60.18-decimal fixed-point number./ return result The result as an unsigned 60.... | function exp2(uint256 x) internal pure returns (uint256 result) {
// 2^192 doesn't fit within the 192.64-bit format used internally in this function.
if (x >= 192e18) {
revert PRBMathUD60x18__Exp2InputTooBig(x);
}
unchecked {
// Convert x to the 192.64-bit fi... | function exp2(uint256 x) internal pure returns (uint256 result) {
// 2^192 doesn't fit within the 192.64-bit format used internally in this function.
if (x >= 192e18) {
revert PRBMathUD60x18__Exp2InputTooBig(x);
}
unchecked {
// Convert x to the 192.64-bit fi... | 26,559 |
45 | // Modifier to make a function callable only when the contract is paused. / | modifier whenPaused() {
require(_paused);
_;
}
| modifier whenPaused() {
require(_paused);
_;
}
| 8,075 |
47 | // Imitates a Solidity high-level call (i.e. a regular function on the return value: the return value is optional (but if data istoken The token targeted by the call. data The call data (encoded using abi.encode or one of its/ | function _callOptionalReturn(IERC20 token, bytes memory data) private
| function _callOptionalReturn(IERC20 token, bytes memory data) private
| 28,291 |
461 | // Will be in 1e6 format | return eth_usd_price.mul(PRICE_PRECISION).div(price_vs_eth);
| return eth_usd_price.mul(PRICE_PRECISION).div(price_vs_eth);
| 23,532 |
16 | // Mapping of voters: Voting Wallet address => vote information | mapping(address => Voter) voters;
| mapping(address => Voter) voters;
| 19,667 |
60 | // Returns the `latestTime` until which operators must serve. | function latestTime() external view returns (uint32) {
return dataStoresForDuration.latestTime;
}
| function latestTime() external view returns (uint32) {
return dataStoresForDuration.latestTime;
}
| 38,791 |
9 | // create first empty round | rounds.push();
| rounds.push();
| 57,487 |
49 | // Adds single address to whitelist._address Address to be added to the whitelist/ | function addToWhitelist(address _address) external onlyOwner {
allowedAddresses[_address] = true;
emit WhitelistUpdated(now, "Added", _address);
}
| function addToWhitelist(address _address) external onlyOwner {
allowedAddresses[_address] = true;
emit WhitelistUpdated(now, "Added", _address);
}
| 8,444 |
13 | // Check for preico | if (now <= start + ratePreICOEnd) {
rate = ratePreICO;
}
| if (now <= start + ratePreICOEnd) {
rate = ratePreICO;
}
| 3,791 |
56 | // Set the PSM-USDC-A dust | VatAbstract(MCD_VAT).file(ILK_PSM_USDC_A, "dust", 10 * RAD);
| VatAbstract(MCD_VAT).file(ILK_PSM_USDC_A, "dust", 10 * RAD);
| 7,883 |
3 | // instead of using the elegant PLCR voting, we are using just a list because this is simple-TCR | struct Vote {
bool value;
uint stake;
bool claimed;
}
| struct Vote {
bool value;
uint stake;
bool claimed;
}
| 44,712 |
54 | // The intended message sender for the call | address msgSender;
| address msgSender;
| 4,983 |
24 | // in case refunds are needed, money can be returned to the contract | function fundContract() external payable onlyOwner() returns (bool) {
return true;
}
| function fundContract() external payable onlyOwner() returns (bool) {
return true;
}
| 10,662 |
24 | // validate max buy/sell | if (shouldTakeFees) {
require(amount <= (isBuying ? maxTxAmountBuy : maxTxAmountSell), "Cannot transfer more than the max buy or sell");
}
| if (shouldTakeFees) {
require(amount <= (isBuying ? maxTxAmountBuy : maxTxAmountSell), "Cannot transfer more than the max buy or sell");
}
| 76,773 |
21 | // The currency the crowdsale accepts for payment. Can be ETH or token address | address public paymentCurrency;
| address public paymentCurrency;
| 22,800 |
141 | // destroy _sellAmount from the caller's balance in the smart token | token.destroy(msg.sender, _sellAmount);
| token.destroy(msg.sender, _sellAmount);
| 14,024 |
4 | // Library for managing an enumerable variant of Solidity'stype. Maps have the following properties: - Entries are added, removed, and checked for existence in constant time(O(1)).- Entries are enumerated in O(n). No guarantees are made on the ordering. ``` | * contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
| * contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
| 1,087 |
39 | // If permit calls are provided we make try to make them | _permitCall(data);
_;
| _permitCall(data);
_;
| 21,121 |
2 | // Emitted when the address of platform contract is updated./platform The new address of platform contract. | event UpdatePlatform(address platform);
| event UpdatePlatform(address platform);
| 41,297 |
103 | // Burn LP tokens | require(IBurnableToken(lpToken).burn(amountOfLP));
emit BurnLPTokensForFloat(
to,
amountOfLP,
amountOfFloat,
nowPrice,
withdrawal,
_txid
);
return true;
| require(IBurnableToken(lpToken).burn(amountOfLP));
emit BurnLPTokensForFloat(
to,
amountOfLP,
amountOfFloat,
nowPrice,
withdrawal,
_txid
);
return true;
| 3,988 |
13 | // Returns whether a record has been imported to the registry. _node The specified _node.return Bool if record exists / | function recordExists(bytes32 _node) public view override returns (bool) {
return records[_node].owner != address(0x0);
}
| function recordExists(bytes32 _node) public view override returns (bool) {
return records[_node].owner != address(0x0);
}
| 10,415 |
74 | // ====== POLICY FUNCTIONS ====== // / | function addRecipient( address _recipient, uint _rewardRate ) external onlyPolicy() {
require( _recipient != address(0) );
info.push( Info({
recipient: _recipient,
rate: _rewardRate
}));
}
| function addRecipient( address _recipient, uint _rewardRate ) external onlyPolicy() {
require( _recipient != address(0) );
info.push( Info({
recipient: _recipient,
rate: _rewardRate
}));
}
| 27,713 |
218 | // Initializes the contract settings / | constructor(address punkContract)
| constructor(address punkContract)
| 56,552 |
1 | // 代表一份提议的数据结构 | struct Proposal {
bytes32 name; // 提议的名称
bytes32 content; //提议的内容
uint voteCount; // 提议接受的投票数
}
| struct Proposal {
bytes32 name; // 提议的名称
bytes32 content; //提议的内容
uint voteCount; // 提议接受的投票数
}
| 25,554 |
86 | // Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._ / | function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
| function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
| 17,993 |
187 | // Token default partitions // Get default partitions to transfer from.Function used for ERC20 retrocompatibility.For example, a security token may return the bytes32("unrestricted").return Array of default partitions. / | function getDefaultPartitions() external view returns (bytes32[] memory) {
return _defaultPartitions;
}
| function getDefaultPartitions() external view returns (bytes32[] memory) {
return _defaultPartitions;
}
| 33,779 |
45 | // Withdrawing Platform Tokens supply | function proposePlatformWithdrawal(address recipient) public onlyOwner {
require(!platformWithdrawn);
platformWithdrawalRecipient = recipient;
platformWithdrawalProposed = true;
}
| function proposePlatformWithdrawal(address recipient) public onlyOwner {
require(!platformWithdrawn);
platformWithdrawalRecipient = recipient;
platformWithdrawalProposed = true;
}
| 6,197 |
62 | // uint256 RATE; | bool saleOn;
uint deadline;
| bool saleOn;
uint deadline;
| 45,115 |
5 | // Cross Chain Token Pool | contract CCPool is WmbApp {
address public poolToken;
// chain id => remote pool address
mapping(uint => address) public remotePools;
event CrossArrive(uint256 indexed fromChainId, address indexed from, address indexed to, uint256 amount, string crossType);
event CrossRequest(uint256 indexed toCh... | contract CCPool is WmbApp {
address public poolToken;
// chain id => remote pool address
mapping(uint => address) public remotePools;
event CrossArrive(uint256 indexed fromChainId, address indexed from, address indexed to, uint256 amount, string crossType);
event CrossRequest(uint256 indexed toCh... | 15,811 |
13 | // Finally, send stake fees to claimer | selfdestruct(_claimer);
| selfdestruct(_claimer);
| 25,061 |
50 | // transfer stake | unchecked {
for (uint256 i = 0; i < idList.length; i++) {
stakeToken().safeTransferFrom(
address(this),
msg.sender,
idList[i]
);
}
| unchecked {
for (uint256 i = 0; i < idList.length; i++) {
stakeToken().safeTransferFrom(
address(this),
msg.sender,
idList[i]
);
}
| 47,679 |
15 | // Retreive a contributor ID of a campaign contributor/The contributor ID can be used to get contributor information such as how much they contributed to a campaign/_campaignID (campaign id) The campaign id/_contributor (contributor address)/_contributionIndex (contribution index)/ return the contributor ID | function contributionID(uint _campaignID, address _contributor, uint _contributionIndex) constant returns (uint) {}
| function contributionID(uint _campaignID, address _contributor, uint _contributionIndex) constant returns (uint) {}
| 25,441 |
37 | // Emit approval event. | Approval(msg.sender, _to, _tokenId);
| Approval(msg.sender, _to, _tokenId);
| 24,004 |
56 | // Retrieves the array of components that are involved in the rebalancing of the given SetToken._setTokenInstance of the SetToken. return address[] Array of component addresses involved in the rebalance. / | function getRebalanceComponents(ISetToken _setToken)
external
view
onlyValidAndInitializedSet(_setToken)
returns (address[] memory)
| function getRebalanceComponents(ISetToken _setToken)
external
view
onlyValidAndInitializedSet(_setToken)
returns (address[] memory)
| 28,669 |
4 | // EOA emulation | vm.prank(address(this), address(this));
vm.expectEmit(true, true, false, true);
emit TransactionDeposited(
address(this),
NON_ZERO_ADDRESS,
ZERO_VALUE,
ZERO_VALUE,
NON_ZERO_GASLIMIT,
false,
NON_ZERO_DATA
| vm.prank(address(this), address(this));
vm.expectEmit(true, true, false, true);
emit TransactionDeposited(
address(this),
NON_ZERO_ADDRESS,
ZERO_VALUE,
ZERO_VALUE,
NON_ZERO_GASLIMIT,
false,
NON_ZERO_DATA
| 51,607 |
29 | // MozzaToken with Governance. | contract MozzaToken is BEP20('Mozza', 'MOZZA') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Co... | contract MozzaToken is BEP20('Mozza', 'MOZZA') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Co... | 5,240 |
9 | // 2. Instantiate NFT and query | ERC721 nft = ERC721(tokenAddress);
require(nft.ownerOf(tokenId) == msg.sender, "Invalid token id");
| ERC721 nft = ERC721(tokenAddress);
require(nft.ownerOf(tokenId) == msg.sender, "Invalid token id");
| 13,980 |
57 | // data setup | address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referra... | address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referra... | 3,057 |
41 | // remove overflow | pendingz = depositedAlTokens[toTransmute];
| pendingz = depositedAlTokens[toTransmute];
| 6,770 |
6 | // constructor/_core Fei Core to reference/_oracle the price oracle to reference/_backupOracle the backup oracle to reference/_scale the Scale target where peg fixes/_pcvDeposits the PCV Deposits for the PCVSplitter/_ratios the ratios for the PCVSplitter/_duration the duration between incentivizing allocations/_incenti... | constructor(
address _core,
address _oracle,
address _backupOracle,
uint256 _scale,
address[] memory _pcvDeposits,
uint256[] memory _ratios,
uint256 _duration,
uint256 _incentive,
IERC20 _token,
| constructor(
address _core,
address _oracle,
address _backupOracle,
uint256 _scale,
address[] memory _pcvDeposits,
uint256[] memory _ratios,
uint256 _duration,
uint256 _incentive,
IERC20 _token,
| 34,395 |
599 | // computes log(x / FIXED_1)FIXED_1.This functions assumes that "x >= FIXED_1", because the output would be negative otherwise. / | function generalLog(uint256 x) internal pure returns (uint256) {
uint256 res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we com... | function generalLog(uint256 x) internal pure returns (uint256) {
uint256 res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we com... | 66,278 |
53 | // Returns the address of a store _appId The app id / | function getStoreAddressById(
uint _appId
)
external
| function getStoreAddressById(
uint _appId
)
external
| 33,548 |
0 | // Constructor on SocialMoney _name string Name parameter of Token _symbol string Symbol parameter of Token _decimals uint8 Decimals parameter of Token _proportions uint256[3] Parameter that dictates how totalSupply will be divvied up, _vestingBeneficiary address Address of the Vesting Beneficiary _platformWallet Addre... | constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256[4] memory _proportions,
address _vestingBeneficiary,
address _platformWallet,
address _tokenVestingInstance,
address _referral
| constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256[4] memory _proportions,
address _vestingBeneficiary,
address _platformWallet,
address _tokenVestingInstance,
address _referral
| 41,825 |
23 | // The timestamp that the proposal will be available for execution, set once the vote succeeds | uint256 eta;
| uint256 eta;
| 22,695 |
46 | // uint256 public rate= 300000; for test's |
mapping (address => uint256) public deposited;
mapping(address => bool) public whitelist;
uint256 public constant INITIAL_SUPPLY = 7050000000 * (10 ** uint256(decimals));
uint256 public fundForSale = 4 * 10**12 * (10 ** uint256(decimals));
uint256 public fundPreSale = 1 * (10 ** 9) * (10 ** uint2... |
mapping (address => uint256) public deposited;
mapping(address => bool) public whitelist;
uint256 public constant INITIAL_SUPPLY = 7050000000 * (10 ** uint256(decimals));
uint256 public fundForSale = 4 * 10**12 * (10 ** uint256(decimals));
uint256 public fundPreSale = 1 * (10 ** 9) * (10 ** uint2... | 41,923 |
23 | // ERC20 transferFrom(). | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_t... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_t... | 11,604 |
1,000 | // silence compiler warning | _newStake = 0;
| _newStake = 0;
| 28,998 |
63 | // _account The address of the account which is checked./ return Whether the account is blocked (not allowed to transfer tokens) or not. | function isBlocked(address _account) internal virtual returns (bool);
| function isBlocked(address _account) internal virtual returns (bool);
| 22,146 |
45 | // set the address at validator-to-delete.index to last validator address | _validatorAccounts[_validators[validator].index] = lastAccount;
| _validatorAccounts[_validators[validator].index] = lastAccount;
| 34,627 |
9 | // uint32 id;uint16 artistId; | address artistAddress;
bool finished;
int64 currentFeatureId; // -1 if none
| address artistAddress;
bool finished;
int64 currentFeatureId; // -1 if none
| 9,383 |
19 | // (bool success, ) = institutionAddress.call(abi.encodeWithSignature("withdraw(uint, address)", amount, remittanceAddress)); | if(success){
totalRevenue= totalRevenue + amount;
emit WithdrawRequest(msg.sender, amount);
}
| if(success){
totalRevenue= totalRevenue + amount;
emit WithdrawRequest(msg.sender, amount);
}
| 31,560 |
141 | // Store the amount that makes up 1 unit given the asset's decimals | uint256 unit = 10**uint256(ERC20(_primitives[i]).decimals());
primitiveToUnit[_primitives[i]] = unit;
emit PrimitiveAdded(_primitives[i], _aggregators[i], _rateAssets[i], unit);
| uint256 unit = 10**uint256(ERC20(_primitives[i]).decimals());
primitiveToUnit[_primitives[i]] = unit;
emit PrimitiveAdded(_primitives[i], _aggregators[i], _rateAssets[i], unit);
| 51,994 |
18 | // Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updatesmust be proposed, scheduled, and executed through governance proposals. CAUTION: It is not recommended to change the timelock while there are other queued governance proposals. / | function updateTimelock(TimelockControllerUpgradeable newTimelock) external virtual onlyGovernance {
_updateTimelock(newTimelock);
}
| function updateTimelock(TimelockControllerUpgradeable newTimelock) external virtual onlyGovernance {
_updateTimelock(newTimelock);
}
| 1,842 |
19 | // Bubble down | ind = _heap.bubbleDown(ind, val);
| ind = _heap.bubbleDown(ind, val);
| 35,834 |
192 | // Only manager is able to call this function Enables/disables oracle types _type The type of the oracle asset The address of the main collateral token enabled The control flag / | function setOracleType(uint _type, address asset, bool enabled) public onlyManager {
isOracleTypeEnabled[_type][asset] = enabled;
}
| function setOracleType(uint _type, address asset, bool enabled) public onlyManager {
isOracleTypeEnabled[_type][asset] = enabled;
}
| 22,258 |
2 | // Contract creations are signalled by sending a transaction to the zero address. | if (decodedTx.to == address(0)) {
address created = Lib_SafeExecutionManagerWrapper.safeCREATE(
decodedTx.gasLimit,
decodedTx.data
);
| if (decodedTx.to == address(0)) {
address created = Lib_SafeExecutionManagerWrapper.safeCREATE(
decodedTx.gasLimit,
decodedTx.data
);
| 13,932 |
10 | // Exclusive presale minting | function mintPresale(uint256 _amount) public payable {
uint256 supply = totalSupply();
uint256 reservedAmt = presaleReserved[msg.sender];
require( presaleActive, "Presale isn't active" );
require( reservedAmt > 0, "No tokens reserved for your address" ... | function mintPresale(uint256 _amount) public payable {
uint256 supply = totalSupply();
uint256 reservedAmt = presaleReserved[msg.sender];
require( presaleActive, "Presale isn't active" );
require( reservedAmt > 0, "No tokens reserved for your address" ... | 12,859 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.