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
|
---|---|---|---|---|
28 | // Check the allowed value for the spender to withdraw from ownerowner The address of the ownerspender The address of the spender return the amount which spender is still allowed to withdraw from owner | function allowance(address _owner, address spender) public constant returns (uint256) {
return allowed[_owner][spender];
}
| function allowance(address _owner, address spender) public constant returns (uint256) {
return allowed[_owner][spender];
}
| 6,819 |
2 | // MinRewardPushInterval represents the minimal amount of time between two consecutive reward push calls. | uint256 public constant minRewardPushInterval = 2 days;
| uint256 public constant minRewardPushInterval = 2 days;
| 19,075 |
77 | // Returns the URI for token type `id`. | * If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
| * If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
| 51 |
226 | // Enable adjusting variables after deployment / | {
require(address(_newBridgeData) != address(0x0), "You need to provide an actual bridge data contract.");
emit BridgeDataChanged(address(bridgeData), address(_newBridgeData));
bridgeData = _newBridgeData;
}
| {
require(address(_newBridgeData) != address(0x0), "You need to provide an actual bridge data contract.");
emit BridgeDataChanged(address(bridgeData), address(_newBridgeData));
bridgeData = _newBridgeData;
}
| 6,408 |
12 | // Make sure user have sent enough ETH | require(msg.value >= LIST_PRICE*count, "!NEETH");
| require(msg.value >= LIST_PRICE*count, "!NEETH");
| 24,165 |
17 | // standard function transfer similar to ERC20 transfer with no _dataadded due to backwards compatibility reasons | bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
| bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
| 16,372 |
140 | // isCall -> batch data | mapping(bool => BatchData) nextDeposits;
| mapping(bool => BatchData) nextDeposits;
| 22,743 |
50 | // accrue needs to be called before any debt amounts are modified by an external component | function accrue(uint loan) external {
drip(loanRates[loan]);
}
| function accrue(uint loan) external {
drip(loanRates[loan]);
}
| 39,741 |
90 | // Emits when funds are withdrawn fully from related to vault strategy/_token Token address to be withdrawn | event WithdrawToVaultAll(address _token);
event Earn(address _token, uint256 _amount);
| event WithdrawToVaultAll(address _token);
event Earn(address _token, uint256 _amount);
| 56,115 |
36 | // amount in adapter is greater than the assets to be withdrawn | uint256 _lpAmount = (_amount * 10 ** decimals() / _adapterAssets) * lpBal / (10 ** decimals()); // calculate
| uint256 _lpAmount = (_amount * 10 ** decimals() / _adapterAssets) * lpBal / (10 ** decimals()); // calculate
| 1,167 |
55 | // Changes the owner of the token/ | function setOwner(address owner_) public {
require(msg.sender == _owner, "Only owner can set owner!");
_owner = owner_;
}
| function setOwner(address owner_) public {
require(msg.sender == _owner, "Only owner can set owner!");
_owner = owner_;
}
| 28,292 |
63 | // Set hold to executed and kept open. / | function _setHoldToExecutedAndKeptOpen(
address token,
Hold storage executableHold,
bytes32 holdId,
uint256 value,
uint256 heldBalanceDecrease,
bytes32 secret
) internal
| function _setHoldToExecutedAndKeptOpen(
address token,
Hold storage executableHold,
bytes32 holdId,
uint256 value,
uint256 heldBalanceDecrease,
bytes32 secret
) internal
| 4,860 |
7 | // Throws if vault is not valid. _vault address / | modifier validVault(IVaultHandler _vault) {
require(
ERC165Checker.supportsInterface(address(_vault), _INTERFACE_ID_IVAULT),
"Orchestrator::validVault: not a valid vault"
);
_;
}
| modifier validVault(IVaultHandler _vault) {
require(
ERC165Checker.supportsInterface(address(_vault), _INTERFACE_ID_IVAULT),
"Orchestrator::validVault: not a valid vault"
);
_;
}
| 45,529 |
85 | // | function isIcoFinished() public returns(bool){
if(icoStartedTime==0){return false;}
// 1 - if time elapsed
uint64 oneMonth = icoStartedTime + 30 days;
if(uint(now) > oneMonth){return true;}
// 2 - if all tokens are sold
if(icoTokensSold>=ICO_TOKEN_SUPPLY_LIMIT){
return true;
}
return false;
}
| function isIcoFinished() public returns(bool){
if(icoStartedTime==0){return false;}
// 1 - if time elapsed
uint64 oneMonth = icoStartedTime + 30 days;
if(uint(now) > oneMonth){return true;}
// 2 - if all tokens are sold
if(icoTokensSold>=ICO_TOKEN_SUPPLY_LIMIT){
return true;
}
return false;
}
| 5,684 |
25 | // make sure the ship is floating | require( ships[_x][_y][msg.sender].floating );
| require( ships[_x][_y][msg.sender].floating );
| 32,415 |
64 | // Start perpetual prank from an address that has some ether | function startHoax(address msgSender) internal virtual {
vm.deal(msgSender, 1 << 128);
vm.startPrank(msgSender);
}
| function startHoax(address msgSender) internal virtual {
vm.deal(msgSender, 1 << 128);
vm.startPrank(msgSender);
}
| 17,528 |
118 | // Will emit a specific URI log event for corresponding token _tokenIDs IDs of the token corresponding to the _uris logged _URIsThe URIs of the specified _tokenIDs / | function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs) internal {
require(_tokenIDs.length == _URIs.length, "ERC1155Metadata#_logURIs: INVALID_ARRAYS_LENGTH");
for (uint256 i = 0; i < _tokenIDs.length; i++) {
emit URI(_URIs[i], _tokenIDs[i]);
}
}
| function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs) internal {
require(_tokenIDs.length == _URIs.length, "ERC1155Metadata#_logURIs: INVALID_ARRAYS_LENGTH");
for (uint256 i = 0; i < _tokenIDs.length; i++) {
emit URI(_URIs[i], _tokenIDs[i]);
}
}
| 27,161 |
240 | // Test whether given quadruple precision number is positive or negativeinfinity.x quadruple precision numberreturn true if x is positive or negative infinity, false otherwise / | function isInfinity (bytes16 x) internal pure returns (bool) {
return uint128 (x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ==
0x7FFF0000000000000000000000000000;
}
| function isInfinity (bytes16 x) internal pure returns (bool) {
return uint128 (x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ==
0x7FFF0000000000000000000000000000;
}
| 31,184 |
3 | // Emitted when exact output routing is updated | event ExactOutputRoutingUpdated(
address indexed tokenIn, address indexed tokenOut, IExchangeWithExactOutput indexed exchange, bytes path
);
| event ExactOutputRoutingUpdated(
address indexed tokenIn, address indexed tokenOut, IExchangeWithExactOutput indexed exchange, bytes path
);
| 33,701 |
27 | // This isn't super expensive so just do it in the constructor. | function setupURIs() internal {
// ONE STAR HAZARD
starredCardURIs[1778] = "QmYr929yRFHUWqadAW6djKXaXjv9hzjxJyhgfNiTyQWw3a";
starredCardURIs[8151] = "QmYr929yRFHUWqadAW6djKXaXjv9hzjxJyhgfNiTyQWw3a";
// ONE STAR MBAPPE
starredCardURIs[882] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[2552] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[3043] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[4019] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[4460] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[5303] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[7109] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[8494] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
// ONE STAR GRIEZMANN
starredCardURIs[3448] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
starredCardURIs[4455] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
starredCardURIs[7366] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
starredCardURIs[7619] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
// ONE STAR POGBA
starredCardURIs[5233] = "QmVDfxWGjLSomrcQz7JB2iZmsfNFpyVPQzJvkCbJc19iWu";
starredCardURIs[8089] = "QmVDfxWGjLSomrcQz7JB2iZmsfNFpyVPQzJvkCbJc19iWu";
// ONE STAR COURTOIS
starredCardURIs[3224] = "QmXCJ53VF2nZdj1xpYaBo8BJyjdoo1ggVmCjt1cAWhd4ou";
// ONE STAR LLORIS
starredCardURIs[7357] = "QmP5wADxxZJVrzkKj5e8S7HAtAGg6L1DHMAUp7tGCgiGxE";
starredCardURIs[7407] = "QmP5wADxxZJVrzkKj5e8S7HAtAGg6L1DHMAUp7tGCgiGxE";
starredCardURIs[7697] = "QmP5wADxxZJVrzkKj5e8S7HAtAGg6L1DHMAUp7tGCgiGxE";
// ONE STAR ALLI
starredCardURIs[736] = "Qmc7w3D5C9xEp3LPTwGxwC3xUnAsQH22KDSdhLi5Bj7nYr";
starredCardURIs[5487] = "Qmc7w3D5C9xEp3LPTwGxwC3xUnAsQH22KDSdhLi5Bj7nYr";
starredCardURIs[7421] = "Qmc7w3D5C9xEp3LPTwGxwC3xUnAsQH22KDSdhLi5Bj7nYr";
// ONE STAR VARANE
starredCardURIs[2867] = "QmecZq2xjqRPQfUQbGs2N4dp7NX1ftutVcp6vRK9FUMV4C";
starredCardURIs[6252] = "QmecZq2xjqRPQfUQbGs2N4dp7NX1ftutVcp6vRK9FUMV4C";
// ONE STAR MANDZUKIC
starredCardURIs[6250] = "QmTyyYRJQhqVHAVCgvpMJgp5d67QDuLnkDZ24EnZBD2heF";
// TWO STAR MANDZUKIC
starredCardURIs[7794] = "QmZFHQhcWenea4GwHsK2chF5x1rxyFDvnz3QhyPqLSRKc4";
}
| function setupURIs() internal {
// ONE STAR HAZARD
starredCardURIs[1778] = "QmYr929yRFHUWqadAW6djKXaXjv9hzjxJyhgfNiTyQWw3a";
starredCardURIs[8151] = "QmYr929yRFHUWqadAW6djKXaXjv9hzjxJyhgfNiTyQWw3a";
// ONE STAR MBAPPE
starredCardURIs[882] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[2552] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[3043] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[4019] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[4460] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[5303] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[7109] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
starredCardURIs[8494] = "QmPvDZykYBw9iMBfHcSdLMruWirKUfcwsXfZ5mZwEFnG7X";
// ONE STAR GRIEZMANN
starredCardURIs[3448] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
starredCardURIs[4455] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
starredCardURIs[7366] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
starredCardURIs[7619] = "QmXZmq6xs5MaoSZ6UPJ5MLKDeLK5rTWuwhjYvaeZJdMS77";
// ONE STAR POGBA
starredCardURIs[5233] = "QmVDfxWGjLSomrcQz7JB2iZmsfNFpyVPQzJvkCbJc19iWu";
starredCardURIs[8089] = "QmVDfxWGjLSomrcQz7JB2iZmsfNFpyVPQzJvkCbJc19iWu";
// ONE STAR COURTOIS
starredCardURIs[3224] = "QmXCJ53VF2nZdj1xpYaBo8BJyjdoo1ggVmCjt1cAWhd4ou";
// ONE STAR LLORIS
starredCardURIs[7357] = "QmP5wADxxZJVrzkKj5e8S7HAtAGg6L1DHMAUp7tGCgiGxE";
starredCardURIs[7407] = "QmP5wADxxZJVrzkKj5e8S7HAtAGg6L1DHMAUp7tGCgiGxE";
starredCardURIs[7697] = "QmP5wADxxZJVrzkKj5e8S7HAtAGg6L1DHMAUp7tGCgiGxE";
// ONE STAR ALLI
starredCardURIs[736] = "Qmc7w3D5C9xEp3LPTwGxwC3xUnAsQH22KDSdhLi5Bj7nYr";
starredCardURIs[5487] = "Qmc7w3D5C9xEp3LPTwGxwC3xUnAsQH22KDSdhLi5Bj7nYr";
starredCardURIs[7421] = "Qmc7w3D5C9xEp3LPTwGxwC3xUnAsQH22KDSdhLi5Bj7nYr";
// ONE STAR VARANE
starredCardURIs[2867] = "QmecZq2xjqRPQfUQbGs2N4dp7NX1ftutVcp6vRK9FUMV4C";
starredCardURIs[6252] = "QmecZq2xjqRPQfUQbGs2N4dp7NX1ftutVcp6vRK9FUMV4C";
// ONE STAR MANDZUKIC
starredCardURIs[6250] = "QmTyyYRJQhqVHAVCgvpMJgp5d67QDuLnkDZ24EnZBD2heF";
// TWO STAR MANDZUKIC
starredCardURIs[7794] = "QmZFHQhcWenea4GwHsK2chF5x1rxyFDvnz3QhyPqLSRKc4";
}
| 26,123 |
37 | // --------------------------------------------------------------------------- GETTERS |
function getShip(uint16 _x, uint16 _y,address _address) public constant returns (
uint256 id,
bool floating,
bool sailing,
bool direction,
bool fishing,
uint64 blockNumber,
uint16 location
|
function getShip(uint16 _x, uint16 _y,address _address) public constant returns (
uint256 id,
bool floating,
bool sailing,
bool direction,
bool fishing,
uint64 blockNumber,
uint16 location
| 32,426 |
175 | // Withdraw My balance | function withdrawMyBalance() public {
uint _userBalance = balance._getBalance(msg.sender);
require(_userBalance > 0);
require(address(this).balance >= _userBalance);
balance._clearBalance(msg.sender);
msg.sender.transfer(_userBalance);
emit Transfer(this, msg.sender, _userBalance);
}
| function withdrawMyBalance() public {
uint _userBalance = balance._getBalance(msg.sender);
require(_userBalance > 0);
require(address(this).balance >= _userBalance);
balance._clearBalance(msg.sender);
msg.sender.transfer(_userBalance);
emit Transfer(this, msg.sender, _userBalance);
}
| 30,070 |
89 | // Equivalent to `uint256(orderType) & 1 == 0`. | isFullOrder := iszero(and(orderType, 1))
| isFullOrder := iszero(and(orderType, 1))
| 14,733 |
16 | // Mint the requested USD. | AssociatedSystem.load(_USD_TOKEN).asToken().mint(target, amount);
emit MarketUsdWithdrawn(marketId, target, amount, msg.sender);
| AssociatedSystem.load(_USD_TOKEN).asToken().mint(target, amount);
emit MarketUsdWithdrawn(marketId, target, amount, msg.sender);
| 25,659 |
242 | // Validates a deposit action reserve The reserve object on which the user is depositing amount The amount to be deposited / | function validateDeposit(DataTypes.ReserveData storage reserve, uint256 amount) external view {
(bool isActive, bool isFrozen, , ) = reserve.configuration.getFlags();
require(amount != 0, Errors.VL_INVALID_AMOUNT);
require(isActive, Errors.VL_NO_ACTIVE_RESERVE);
require(!isFrozen, Errors.VL_RESERVE_FROZEN);
}
| function validateDeposit(DataTypes.ReserveData storage reserve, uint256 amount) external view {
(bool isActive, bool isFrozen, , ) = reserve.configuration.getFlags();
require(amount != 0, Errors.VL_INVALID_AMOUNT);
require(isActive, Errors.VL_NO_ACTIVE_RESERVE);
require(!isFrozen, Errors.VL_RESERVE_FROZEN);
}
| 16,658 |
137 | // Buy ticket of the lottery. Probability to win is proportional to your stake | function buyTicket() public payable {
require((now <= gameEnd) || (totalAmount == 0));
//Close to the dollar , Euro value
require(msg.value > 1000000000000000);
require(ticketsForGame[msg.sender] < gameNumber);
require(msg.value + totalAmount < 2000000000000000000000);
require(randomNumber == 0);
//I add the address if necessary. I reset his participation if necessary
ticketsForGame[msg.sender] = gameNumber;
tickets[msg.sender] = 0;
insertAddress(msg.sender);
insertSums(totalAmount);
//I set player participation to this lottery
tickets[msg.sender] = msg.value;
totalAmount += msg.value;
numberOfPlayers += 1;
}
| function buyTicket() public payable {
require((now <= gameEnd) || (totalAmount == 0));
//Close to the dollar , Euro value
require(msg.value > 1000000000000000);
require(ticketsForGame[msg.sender] < gameNumber);
require(msg.value + totalAmount < 2000000000000000000000);
require(randomNumber == 0);
//I add the address if necessary. I reset his participation if necessary
ticketsForGame[msg.sender] = gameNumber;
tickets[msg.sender] = 0;
insertAddress(msg.sender);
insertSums(totalAmount);
//I set player participation to this lottery
tickets[msg.sender] = msg.value;
totalAmount += msg.value;
numberOfPlayers += 1;
}
| 58,597 |
29 | // Returns current withdrawable balance of a specific user./ | function getUserBalance(address user) public view returns (uint256) {
return (getAccumulatedAmount(user) - spentAmount[user]);
}
| function getUserBalance(address user) public view returns (uint256) {
return (getAccumulatedAmount(user) - spentAmount[user]);
}
| 73,393 |
275 | // An address can't transfer to itself. | require(_holder != _recipient, "TicketBooth::transfer: IDENTITY");
| require(_holder != _recipient, "TicketBooth::transfer: IDENTITY");
| 71,347 |
95 | // IVault Set Protocol The IVault interface provides a light-weight, structured way to interact with the Vaultcontract from another contract. / | interface IVault {
/*
* Withdraws user's unassociated tokens to user account. Can only be
* called by authorized core contracts.
*
* @param _token The address of the ERC20 token
* @param _to The address to transfer token to
* @param _quantity The number of tokens to transfer
*/
function withdrawTo(
address _token,
address _to,
uint256 _quantity
)
external;
/*
* Increment quantity owned of a token for a given address. Can
* only be called by authorized core contracts.
*
* @param _token The address of the ERC20 token
* @param _owner The address of the token owner
* @param _quantity The number of tokens to attribute to owner
*/
function incrementTokenOwner(
address _token,
address _owner,
uint256 _quantity
)
external;
/*
* Decrement quantity owned of a token for a given address. Can only
* be called by authorized core contracts.
*
* @param _token The address of the ERC20 token
* @param _owner The address of the token owner
* @param _quantity The number of tokens to deattribute to owner
*/
function decrementTokenOwner(
address _token,
address _owner,
uint256 _quantity
)
external;
/**
* Transfers tokens associated with one account to another account in the vault
*
* @param _token Address of token being transferred
* @param _from Address token being transferred from
* @param _to Address token being transferred to
* @param _quantity Amount of tokens being transferred
*/
function transferBalance(
address _token,
address _from,
address _to,
uint256 _quantity
)
external;
/*
* Withdraws user's unassociated tokens to user account. Can only be
* called by authorized core contracts.
*
* @param _tokens The addresses of the ERC20 tokens
* @param _owner The address of the token owner
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchWithdrawTo(
address[] calldata _tokens,
address _to,
uint256[] calldata _quantities
)
external;
/*
* Increment quantites owned of a collection of tokens for a given address. Can
* only be called by authorized core contracts.
*
* @param _tokens The addresses of the ERC20 tokens
* @param _owner The address of the token owner
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchIncrementTokenOwner(
address[] calldata _tokens,
address _owner,
uint256[] calldata _quantities
)
external;
/*
* Decrements quantites owned of a collection of tokens for a given address. Can
* only be called by authorized core contracts.
*
* @param _tokens The addresses of the ERC20 tokens
* @param _owner The address of the token owner
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchDecrementTokenOwner(
address[] calldata _tokens,
address _owner,
uint256[] calldata _quantities
)
external;
/**
* Transfers tokens associated with one account to another account in the vault
*
* @param _tokens Addresses of tokens being transferred
* @param _from Address tokens being transferred from
* @param _to Address tokens being transferred to
* @param _quantities Amounts of tokens being transferred
*/
function batchTransferBalance(
address[] calldata _tokens,
address _from,
address _to,
uint256[] calldata _quantities
)
external;
/*
* Get balance of particular contract for owner.
*
* @param _token The address of the ERC20 token
* @param _owner The address of the token owner
*/
function getOwnerBalance(
address _token,
address _owner
)
external
view
returns (uint256);
}
| interface IVault {
/*
* Withdraws user's unassociated tokens to user account. Can only be
* called by authorized core contracts.
*
* @param _token The address of the ERC20 token
* @param _to The address to transfer token to
* @param _quantity The number of tokens to transfer
*/
function withdrawTo(
address _token,
address _to,
uint256 _quantity
)
external;
/*
* Increment quantity owned of a token for a given address. Can
* only be called by authorized core contracts.
*
* @param _token The address of the ERC20 token
* @param _owner The address of the token owner
* @param _quantity The number of tokens to attribute to owner
*/
function incrementTokenOwner(
address _token,
address _owner,
uint256 _quantity
)
external;
/*
* Decrement quantity owned of a token for a given address. Can only
* be called by authorized core contracts.
*
* @param _token The address of the ERC20 token
* @param _owner The address of the token owner
* @param _quantity The number of tokens to deattribute to owner
*/
function decrementTokenOwner(
address _token,
address _owner,
uint256 _quantity
)
external;
/**
* Transfers tokens associated with one account to another account in the vault
*
* @param _token Address of token being transferred
* @param _from Address token being transferred from
* @param _to Address token being transferred to
* @param _quantity Amount of tokens being transferred
*/
function transferBalance(
address _token,
address _from,
address _to,
uint256 _quantity
)
external;
/*
* Withdraws user's unassociated tokens to user account. Can only be
* called by authorized core contracts.
*
* @param _tokens The addresses of the ERC20 tokens
* @param _owner The address of the token owner
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchWithdrawTo(
address[] calldata _tokens,
address _to,
uint256[] calldata _quantities
)
external;
/*
* Increment quantites owned of a collection of tokens for a given address. Can
* only be called by authorized core contracts.
*
* @param _tokens The addresses of the ERC20 tokens
* @param _owner The address of the token owner
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchIncrementTokenOwner(
address[] calldata _tokens,
address _owner,
uint256[] calldata _quantities
)
external;
/*
* Decrements quantites owned of a collection of tokens for a given address. Can
* only be called by authorized core contracts.
*
* @param _tokens The addresses of the ERC20 tokens
* @param _owner The address of the token owner
* @param _quantities The numbers of tokens to attribute to owner
*/
function batchDecrementTokenOwner(
address[] calldata _tokens,
address _owner,
uint256[] calldata _quantities
)
external;
/**
* Transfers tokens associated with one account to another account in the vault
*
* @param _tokens Addresses of tokens being transferred
* @param _from Address tokens being transferred from
* @param _to Address tokens being transferred to
* @param _quantities Amounts of tokens being transferred
*/
function batchTransferBalance(
address[] calldata _tokens,
address _from,
address _to,
uint256[] calldata _quantities
)
external;
/*
* Get balance of particular contract for owner.
*
* @param _token The address of the ERC20 token
* @param _owner The address of the token owner
*/
function getOwnerBalance(
address _token,
address _owner
)
external
view
returns (uint256);
}
| 17,755 |
7 | // Transforms `amount` of `token`'s balance in a Minimal Swap Info Pool from cash into managed. This function assumes `poolId` exists, corresponds to the Minimal Swap Info specialization setting, and that`token` is registered for that Pool. / | function _minimalSwapInfoPoolCashToManaged(
bytes32 poolId,
IERC20 token,
uint256 amount
| function _minimalSwapInfoPoolCashToManaged(
bytes32 poolId,
IERC20 token,
uint256 amount
| 26,448 |
8 | // `isOn ? flag : 0`. / | function toFlag(bool isOn, uint8 flag) internal pure returns (uint8 result) {
assembly {
result := mul(iszero(iszero(isOn)), flag)
}
}
| function toFlag(bool isOn, uint8 flag) internal pure returns (uint8 result) {
assembly {
result := mul(iszero(iszero(isOn)), flag)
}
}
| 43,232 |
6 | // In this 1st option for ownership transfer `proposeOwnership()` must/be called first by the current `owner` then `acceptOwnership()` must be/called by the `newOwnerCandidate`/`onlyOwner` Proposes to transfer control of the contract to a/new owner/_newOwnerCandidate The address being proposed as the new owner | function proposeOwnership(address _newOwnerCandidate) public onlyOwner {
newOwnerCandidate = _newOwnerCandidate;
OwnershipRequested(msg.sender, newOwnerCandidate);
}
| function proposeOwnership(address _newOwnerCandidate) public onlyOwner {
newOwnerCandidate = _newOwnerCandidate;
OwnershipRequested(msg.sender, newOwnerCandidate);
}
| 47,788 |
161 | // Check that there hasn't already been a bid for this NFT. | require(
uint256(auctions[tokenId].firstBidTime) == 0,
"Auction already started"
);
| require(
uint256(auctions[tokenId].firstBidTime) == 0,
"Auction already started"
);
| 25,397 |
14 | // ------------------------------------------------------------------------ Transfer the balance from token owner's account to receiver account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ | function transfer(address receiver, uint tokens) public override returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[receiver] = safeAdd(balances[receiver], tokens);
emit Transfer(msg.sender, receiver, tokens);
return true;
}
| function transfer(address receiver, uint tokens) public override returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[receiver] = safeAdd(balances[receiver], tokens);
emit Transfer(msg.sender, receiver, tokens);
return true;
}
| 20,428 |
5 | // Modifier to check if the user has an existing vault | modifier hasVault() {
require(userToVault[msg.sender] != 0, "You don't have a vault yet");
_;
}
| modifier hasVault() {
require(userToVault[msg.sender] != 0, "You don't have a vault yet");
_;
}
| 31,016 |
10 | // Redeem collateral by burning synthetic tokens numTokens Amount of synthetic tokens to be burned to unlock collateral / | function redeem(FixedPoint.Unsigned memory numTokens)
| function redeem(FixedPoint.Unsigned memory numTokens)
| 48,485 |
51 | // IStaking staking = IStaking(getStakingAddress()).lockedBalanceOf(addr); | return IStaking(getStakingAddress()).lockedBalanceOf(addr);
| return IStaking(getStakingAddress()).lockedBalanceOf(addr);
| 49,410 |
21 | // require(now <= biddingEnd,"Trading phase already ended or did not start yet!"); | save_Bid_Orders("BID", _price, _volume);
emit LogNewBid(_price, _volume);
| save_Bid_Orders("BID", _price, _volume);
emit LogNewBid(_price, _volume);
| 4,762 |
329 | // Commits the current draw. / | function emitCommitted() internal {
uint256 drawId = currentOpenDrawId();
emit Committed(drawId);
if (block.coinbase != address(0)) { //injected CONTRACT AFFECTED BY MINERS
poolToken.poolMint(openSupply());
}
}
| function emitCommitted() internal {
uint256 drawId = currentOpenDrawId();
emit Committed(drawId);
if (block.coinbase != address(0)) { //injected CONTRACT AFFECTED BY MINERS
poolToken.poolMint(openSupply());
}
}
| 41,470 |
0 | // key, value storage | mapping (string=> string) map;
| mapping (string=> string) map;
| 17,307 |
650 | // Calculate denominator for row 171: x - g^171z. | let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0xa00)))
mstore(add(productsPtr, 0x640), partialProduct)
mstore(add(valuesPtr, 0x640), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0xa00)))
mstore(add(productsPtr, 0x640), partialProduct)
mstore(add(valuesPtr, 0x640), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| 77,798 |
0 | // Store constant values for the 2 NFT Collections: 1. Is the OBYC NFT Collection | ERC721A public immutable obyc;
| ERC721A public immutable obyc;
| 21,192 |
1 | // EVENTS / | struct MetaSwap {
// Meta-Swap related parameters
ISwap baseSwap;
uint256 baseVirtualPrice;
uint256 baseCacheLastUpdated;
IERC20[] baseTokens;
}
| struct MetaSwap {
// Meta-Swap related parameters
ISwap baseSwap;
uint256 baseVirtualPrice;
uint256 baseCacheLastUpdated;
IERC20[] baseTokens;
}
| 37,487 |
25 | // Initialized the contract setting the deployer as the initial owner | constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0),msgSender);
}
| constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0),msgSender);
}
| 33,268 |
133 | // for emergencies only | function setHoldersSalePrice(uint256 newPrice) external onlyOwner {
HoldersSalePrice = newPrice;
}
| function setHoldersSalePrice(uint256 newPrice) external onlyOwner {
HoldersSalePrice = newPrice;
}
| 41,591 |
3 | // Delegation method to select who you would like to delegate your stake to. | function undelegate() external;
| function undelegate() external;
| 17,209 |
47 | // Adjust minting cap. Throws on underflow / Guarantees minter does not exceed its limit. | _mintingCaps[msg.sender] = _mintingCaps[msg.sender].sub(kongAmount);
| _mintingCaps[msg.sender] = _mintingCaps[msg.sender].sub(kongAmount);
| 38,849 |
95 | // Compute the contributions used and owed to the contributor, along with the voting power they'll have in the governance stage. | (uint256 ethUsed, uint256 ethOwed, uint256 votingPower) = _getFinalContribution(
contributor
);
if (votingPower > 0) {
| (uint256 ethUsed, uint256 ethOwed, uint256 votingPower) = _getFinalContribution(
contributor
);
if (votingPower > 0) {
| 31,323 |
10 | // mapping with struct | mapping (address => user) record;
| mapping (address => user) record;
| 21,610 |
21 | // function that is called when transaction target is an address | function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
Transfer(msg.sender, _to, _value);
ERC223Transfer(msg.sender, _to, _value, _data);
return true;
}
| function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
Transfer(msg.sender, _to, _value);
ERC223Transfer(msg.sender, _to, _value, _data);
return true;
}
| 46,133 |
66 | // A trap door for when someone sends tokens other than the intended ones so the overseers can decide where to send them. / | function transferAnyERC20Token(address tokenAddress, address tokenOwner, uint tokens) public onlyOwner notPotj(tokenAddress) returns (bool success) {
return ERC20Interface(tokenAddress).transfer(tokenOwner, tokens);
}
| function transferAnyERC20Token(address tokenAddress, address tokenOwner, uint tokens) public onlyOwner notPotj(tokenAddress) returns (bool success) {
return ERC20Interface(tokenAddress).transfer(tokenOwner, tokens);
}
| 43,715 |
9 | // --------------------------------- GALLERY -------------------------------- //Requires Gallery to be open. | modifier onlyIfGalleryOpen() {
if (!galleryOpen) revert GalleryNotOpen();
_;
}
| modifier onlyIfGalleryOpen() {
if (!galleryOpen) revert GalleryNotOpen();
_;
}
| 53,254 |
3 | // Event emitted when a user makes a withdrawal | event Withdraw(
address indexed _from, // account of user who withdrew funds
address indexed token, // token that was withdrawn
uint256 amount // amount of token that was withdrawn
);
| event Withdraw(
address indexed _from, // account of user who withdrew funds
address indexed token, // token that was withdrawn
uint256 amount // amount of token that was withdrawn
);
| 13,265 |
8 | // Auction parameters | uint32 public minAuctionDuration = 10 minutes; // Minimum auction duration
uint32 public maxAuctionDuration = 12 weeks; // Minimum auction duration
uint32 public warmUpTime = 0 minutes; // Warm-up time to be used to discourage bots from placing arbitrary opening bids
uint32 public Extra_Time = 20 minutes; // Extra time added to the auction if a bid is placed in the last 20 minutes. This helps prevent auction sniping and gives other participants a chance to place their bids.
uint16 public Max_Incentive = 12; // Maximum bidder incentive in percentage (12%)
uint16 public Max_Payment = 1000; // The maximum payment paid out of the auction is 10% and this is represented by 10^3.
uint16 public Max_Assets = 20; // The maximum number of Assets that can be sold in One Auction.
| uint32 public minAuctionDuration = 10 minutes; // Minimum auction duration
uint32 public maxAuctionDuration = 12 weeks; // Minimum auction duration
uint32 public warmUpTime = 0 minutes; // Warm-up time to be used to discourage bots from placing arbitrary opening bids
uint32 public Extra_Time = 20 minutes; // Extra time added to the auction if a bid is placed in the last 20 minutes. This helps prevent auction sniping and gives other participants a chance to place their bids.
uint16 public Max_Incentive = 12; // Maximum bidder incentive in percentage (12%)
uint16 public Max_Payment = 1000; // The maximum payment paid out of the auction is 10% and this is represented by 10^3.
uint16 public Max_Assets = 20; // The maximum number of Assets that can be sold in One Auction.
| 23,699 |
179 | // Struct representing a price request. | struct Request {
address proposer; // Address of the proposer.
address disputer; // Address of the disputer.
IERC20 currency; // ERC20 token used to pay rewards and fees.
bool settled; // True if the request is settled.
bool refundOnDispute; // True if the requester should be refunded their reward on dispute.
int256 proposedPrice; // Price that the proposer submitted.
int256 resolvedPrice; // Price resolved once the request is settled.
uint256 expirationTime; // Time at which the request auto-settles without a dispute.
uint256 reward; // Amount of the currency to pay to the proposer on settlement.
uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.
uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.
uint256 customLiveness; // Custom liveness value set by the requester.
}
| struct Request {
address proposer; // Address of the proposer.
address disputer; // Address of the disputer.
IERC20 currency; // ERC20 token used to pay rewards and fees.
bool settled; // True if the request is settled.
bool refundOnDispute; // True if the requester should be refunded their reward on dispute.
int256 proposedPrice; // Price that the proposer submitted.
int256 resolvedPrice; // Price resolved once the request is settled.
uint256 expirationTime; // Time at which the request auto-settles without a dispute.
uint256 reward; // Amount of the currency to pay to the proposer on settlement.
uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.
uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.
uint256 customLiveness; // Custom liveness value set by the requester.
}
| 39,930 |
71 | // Reward Distributor | contract LnRewardLocker is LnAdminUpgradeable {
using SafeMath for uint256;
struct RewardData {
uint64 lockToTime;
uint256 amount;
}
mapping(address => RewardData[]) public userRewards; // RewardData[0] is claimable
mapping(address => uint256) public balanceOf;
uint256 public totalNeedToReward;
uint256 public constant maxRewardArrayLen = 100;
address feeSysAddr;
IERC20 public linaToken;
function __LnRewardLocker_init(address _admin, address linaAddress) public initializer {
__LnAdminUpgradeable_init(_admin);
linaToken = IERC20(linaAddress);
}
function setLinaAddress(address _token) external onlyAdmin {
linaToken = IERC20(_token);
}
function Init(address _feeSysAddr) external onlyAdmin {
feeSysAddr = _feeSysAddr;
}
modifier onlyFeeSys() {
require((msg.sender == feeSysAddr), "Only Fee System call");
_;
}
function bulkAppendReward(
address[] calldata _users,
uint256[] calldata _amounts,
uint64 _lockTo
) external onlyAdmin {
require(_users.length == _amounts.length, "Length mismatch");
for (uint256 ind = 0; ind < _users.length; ind++) {
address _user = _users[ind];
uint256 _amount = _amounts[ind];
if (userRewards[_user].length >= maxRewardArrayLen) {
Slimming(_user);
}
require(userRewards[_user].length <= maxRewardArrayLen, "user array out of");
// init cliamable
if (userRewards[_user].length == 0) {
RewardData memory data = RewardData({lockToTime: 0, amount: 0});
userRewards[_user].push(data);
}
// append new reward
RewardData memory data = RewardData({lockToTime: _lockTo, amount: _amount});
userRewards[_user].push(data);
balanceOf[_user] = balanceOf[_user].add(_amount);
totalNeedToReward = totalNeedToReward.add(_amount);
emit AppendReward(_user, _amount, _lockTo);
}
}
function appendReward(
address _user,
uint256 _amount,
uint64 _lockTo
) external onlyFeeSys {
if (userRewards[_user].length >= maxRewardArrayLen) {
Slimming(_user);
}
require(userRewards[_user].length <= maxRewardArrayLen, "user array out of");
// init cliamable
if (userRewards[_user].length == 0) {
RewardData memory data = RewardData({lockToTime: 0, amount: 0});
userRewards[_user].push(data);
}
// append new reward
RewardData memory data = RewardData({lockToTime: _lockTo, amount: _amount});
userRewards[_user].push(data);
balanceOf[_user] = balanceOf[_user].add(_amount);
totalNeedToReward = totalNeedToReward.add(_amount);
emit AppendReward(_user, _amount, _lockTo);
}
// move claimable to RewardData[0]
function Slimming(address _user) public {
require(userRewards[_user].length > 1, "not data to slimming");
RewardData storage claimable = userRewards[_user][0];
for (uint256 i = 1; i < userRewards[_user].length; ) {
if (now >= userRewards[_user][i].lockToTime) {
claimable.amount = claimable.amount.add(userRewards[_user][i].amount);
//swap last to current position
uint256 len = userRewards[_user].length;
userRewards[_user][i].lockToTime = userRewards[_user][len - 1].lockToTime;
userRewards[_user][i].amount = userRewards[_user][len - 1].amount;
userRewards[_user].pop(); // delete last one
} else {
i++;
}
}
}
// if lock lina is collateral, claimable need calc to fix target ratio
function ClaimMaxable() public {
address user = msg.sender;
Slimming(user);
_claim(user, userRewards[user][0].amount);
}
function _claim(address _user, uint256 _amount) internal {
userRewards[_user][0].amount = userRewards[_user][0].amount.sub(_amount);
balanceOf[_user] = balanceOf[_user].sub(_amount);
totalNeedToReward = totalNeedToReward.sub(_amount);
linaToken.transfer(_user, _amount);
emit ClaimLog(_user, _amount);
}
function Claim(uint256 _amount) public {
address user = msg.sender;
Slimming(user);
require(_amount <= userRewards[user][0].amount, "Claim amount invalid");
_claim(user, _amount);
}
event AppendReward(address user, uint256 amount, uint64 lockTo);
event ClaimLog(address user, uint256 amount);
// Reserved storage space to allow for layout changes in the future.
uint256[45] private __gap;
}
| contract LnRewardLocker is LnAdminUpgradeable {
using SafeMath for uint256;
struct RewardData {
uint64 lockToTime;
uint256 amount;
}
mapping(address => RewardData[]) public userRewards; // RewardData[0] is claimable
mapping(address => uint256) public balanceOf;
uint256 public totalNeedToReward;
uint256 public constant maxRewardArrayLen = 100;
address feeSysAddr;
IERC20 public linaToken;
function __LnRewardLocker_init(address _admin, address linaAddress) public initializer {
__LnAdminUpgradeable_init(_admin);
linaToken = IERC20(linaAddress);
}
function setLinaAddress(address _token) external onlyAdmin {
linaToken = IERC20(_token);
}
function Init(address _feeSysAddr) external onlyAdmin {
feeSysAddr = _feeSysAddr;
}
modifier onlyFeeSys() {
require((msg.sender == feeSysAddr), "Only Fee System call");
_;
}
function bulkAppendReward(
address[] calldata _users,
uint256[] calldata _amounts,
uint64 _lockTo
) external onlyAdmin {
require(_users.length == _amounts.length, "Length mismatch");
for (uint256 ind = 0; ind < _users.length; ind++) {
address _user = _users[ind];
uint256 _amount = _amounts[ind];
if (userRewards[_user].length >= maxRewardArrayLen) {
Slimming(_user);
}
require(userRewards[_user].length <= maxRewardArrayLen, "user array out of");
// init cliamable
if (userRewards[_user].length == 0) {
RewardData memory data = RewardData({lockToTime: 0, amount: 0});
userRewards[_user].push(data);
}
// append new reward
RewardData memory data = RewardData({lockToTime: _lockTo, amount: _amount});
userRewards[_user].push(data);
balanceOf[_user] = balanceOf[_user].add(_amount);
totalNeedToReward = totalNeedToReward.add(_amount);
emit AppendReward(_user, _amount, _lockTo);
}
}
function appendReward(
address _user,
uint256 _amount,
uint64 _lockTo
) external onlyFeeSys {
if (userRewards[_user].length >= maxRewardArrayLen) {
Slimming(_user);
}
require(userRewards[_user].length <= maxRewardArrayLen, "user array out of");
// init cliamable
if (userRewards[_user].length == 0) {
RewardData memory data = RewardData({lockToTime: 0, amount: 0});
userRewards[_user].push(data);
}
// append new reward
RewardData memory data = RewardData({lockToTime: _lockTo, amount: _amount});
userRewards[_user].push(data);
balanceOf[_user] = balanceOf[_user].add(_amount);
totalNeedToReward = totalNeedToReward.add(_amount);
emit AppendReward(_user, _amount, _lockTo);
}
// move claimable to RewardData[0]
function Slimming(address _user) public {
require(userRewards[_user].length > 1, "not data to slimming");
RewardData storage claimable = userRewards[_user][0];
for (uint256 i = 1; i < userRewards[_user].length; ) {
if (now >= userRewards[_user][i].lockToTime) {
claimable.amount = claimable.amount.add(userRewards[_user][i].amount);
//swap last to current position
uint256 len = userRewards[_user].length;
userRewards[_user][i].lockToTime = userRewards[_user][len - 1].lockToTime;
userRewards[_user][i].amount = userRewards[_user][len - 1].amount;
userRewards[_user].pop(); // delete last one
} else {
i++;
}
}
}
// if lock lina is collateral, claimable need calc to fix target ratio
function ClaimMaxable() public {
address user = msg.sender;
Slimming(user);
_claim(user, userRewards[user][0].amount);
}
function _claim(address _user, uint256 _amount) internal {
userRewards[_user][0].amount = userRewards[_user][0].amount.sub(_amount);
balanceOf[_user] = balanceOf[_user].sub(_amount);
totalNeedToReward = totalNeedToReward.sub(_amount);
linaToken.transfer(_user, _amount);
emit ClaimLog(_user, _amount);
}
function Claim(uint256 _amount) public {
address user = msg.sender;
Slimming(user);
require(_amount <= userRewards[user][0].amount, "Claim amount invalid");
_claim(user, _amount);
}
event AppendReward(address user, uint256 amount, uint64 lockTo);
event ClaimLog(address user, uint256 amount);
// Reserved storage space to allow for layout changes in the future.
uint256[45] private __gap;
}
| 42,845 |
45 | // console.log("A"); | return _stop1+pos_in_range;
| return _stop1+pos_in_range;
| 63,750 |
4 | // Registering the locker with an owner & Password Set up | function RegisterLocker(string memory _LockerRegistrationID,string memory _password) public {
if(GetLength() != 0)
revert("The Owner has already a locker registered");
require(bytes(_LockerRegistrationID).length > 0, "Locker Registration ID cannot be null");
owners[msg.sender].ownerAddress = msg.sender;
owners[msg.sender].LockerID = _LockerRegistrationID;
owners[msg.sender].isLocked = false;
require(msg.sender == owners[msg.sender].ownerAddress,"You are unauthorized to set a password to this Locker.");
owners[msg.sender].password = hash(_password);
owners[msg.sender].isLocked = true;
owners[msg.sender].allowAccess = true;
}
| function RegisterLocker(string memory _LockerRegistrationID,string memory _password) public {
if(GetLength() != 0)
revert("The Owner has already a locker registered");
require(bytes(_LockerRegistrationID).length > 0, "Locker Registration ID cannot be null");
owners[msg.sender].ownerAddress = msg.sender;
owners[msg.sender].LockerID = _LockerRegistrationID;
owners[msg.sender].isLocked = false;
require(msg.sender == owners[msg.sender].ownerAddress,"You are unauthorized to set a password to this Locker.");
owners[msg.sender].password = hash(_password);
owners[msg.sender].isLocked = true;
owners[msg.sender].allowAccess = true;
}
| 8,907 |
109 | // if any account belongs to _isExcludedFromFee account then remove the fee | if (_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]) {
takeFee = false;
}
| if (_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]) {
takeFee = false;
}
| 65,260 |
20 | // Step 6.2 calculate the amount of UP / native required. Withdraw native tokens from Strategy, mint the equivlent amount of synthetic UP, Deposit an amount of liquidity so that getupcBalance() = ETHtoTake. | uint256 ETHtoAddtoLP = ((totalETH * allocationLP) / 100) - amountLpETH;
strategy.withdraw(ETHtoAddtoLP);
uint256 lpPrice = (amountLpUP * 1e18) / amountLpETH;
uint256 UPtoAddtoLP = (lpPrice * ETHtoAddtoLP) / 1e18;
UP_CONTROLLER.borrowUP(UPtoAddtoLP, address(this));
UPToken.approve(address(unifiRouter), UPtoAddtoLP);
| uint256 ETHtoAddtoLP = ((totalETH * allocationLP) / 100) - amountLpETH;
strategy.withdraw(ETHtoAddtoLP);
uint256 lpPrice = (amountLpUP * 1e18) / amountLpETH;
uint256 UPtoAddtoLP = (lpPrice * ETHtoAddtoLP) / 1e18;
UP_CONTROLLER.borrowUP(UPtoAddtoLP, address(this));
UPToken.approve(address(unifiRouter), UPtoAddtoLP);
| 5,487 |
49 | // Retrieve created options/owner Owner of the options to retrieve | function getOptionsByOwner(address owner) external view returns (Option[] memory);
| function getOptionsByOwner(address owner) external view returns (Option[] memory);
| 35,678 |
50 | // Event emitted when the reserves are added / | event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);
| event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);
| 3,907 |
43 | // Event emitted when the reserve factor is changed / | event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);
| event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);
| 3,354 |
0 | // EVENTS // The event emitted (useable by web3) when a token is purchased | event BoughtToken(address indexed buyer, uint256 tokenId);
| event BoughtToken(address indexed buyer, uint256 tokenId);
| 25,620 |
27 | // Ensures the caller is the RandomHbbft contract address. | modifier onlyRandomContract() {
require(msg.sender == randomContract,"Only Random Contract");
_;
}
| modifier onlyRandomContract() {
require(msg.sender == randomContract,"Only Random Contract");
_;
}
| 47,466 |
168 | // credit fee receiver with fees earned and calculate rebate for underwriter short tokens which have acrrued fee must not be burned or transferred until after this helper is called l storage layout struct underwriter holder of short position who reserved fees shortTokenId short token id whose reserved fees to pay and rebate intervalContractSize size of position for which to calculate accrued fees intervalApyFee quantity of fees reserved but not yet accrued isCallPool true for call, false for put / | function _fulfillApyFee(
PoolStorage.Layout storage l,
address underwriter,
uint256 shortTokenId,
uint256 intervalContractSize,
uint256 intervalApyFee,
bool isCallPool
| function _fulfillApyFee(
PoolStorage.Layout storage l,
address underwriter,
uint256 shortTokenId,
uint256 intervalContractSize,
uint256 intervalApyFee,
bool isCallPool
| 77,458 |
67 | // Keeper slashed | event KeeperSlashed(address indexed keeper, address indexed slasher, uint block, uint slash);
| event KeeperSlashed(address indexed keeper, address indexed slasher, uint block, uint slash);
| 49,713 |
7 | // changeimage | function ChangeImage(string ImageAddress,uint index) OnlyOwner public{
if(index<Images.length)
{
Images[index]=ImageAddress;
}
}
| function ChangeImage(string ImageAddress,uint index) OnlyOwner public{
if(index<Images.length)
{
Images[index]=ImageAddress;
}
}
| 72,820 |
291 | // EVENTS / events replicated from SwapUtils to make the ABI easier for dumb clients | event TokenSwap(
address indexed buyer,
uint256 tokensSold,
uint256 tokensBought,
uint128 soldId,
uint128 boughtId
);
event AddLiquidity(
address indexed provider,
uint256[] tokenAmounts,
| event TokenSwap(
address indexed buyer,
uint256 tokensSold,
uint256 tokensBought,
uint128 soldId,
uint128 boughtId
);
event AddLiquidity(
address indexed provider,
uint256[] tokenAmounts,
| 33,603 |
1 | // coin burning Implements the a contract to create BurnFish contract / | contract FishBurner {
function purge() public payable returns (address){
BurnFish burn_address = (new BurnFish){value : msg.value}();
return address(burn_address);
}
} | contract FishBurner {
function purge() public payable returns (address){
BurnFish burn_address = (new BurnFish){value : msg.value}();
return address(burn_address);
}
} | 20,208 |
4 | // Gets the saved number.return An uint256 representing the saved number. / | function getTotal() public view returns (uint256) {
return totalCompanies;
}
| function getTotal() public view returns (uint256) {
return totalCompanies;
}
| 12,725 |
229 | // Collects the interest generated from the Basket, minting a relative amount of mAsset and sending it over to the SavingsManager. _bAssetPersonal Basset personal storage array _bAssetData Basset data storage array _forgeValidator Link to the current InvariantValidatorreturn mintAmount Lending market interest collectedreturn rawGains Raw increases in vault Balance / | function collectPlatformInterest(
MassetStructs.BassetPersonal[] memory _bAssetPersonal,
MassetStructs.BassetData[] storage _bAssetData,
IInvariantValidator _forgeValidator,
MassetStructs.InvariantConfig memory _config
| function collectPlatformInterest(
MassetStructs.BassetPersonal[] memory _bAssetPersonal,
MassetStructs.BassetData[] storage _bAssetData,
IInvariantValidator _forgeValidator,
MassetStructs.InvariantConfig memory _config
| 50,706 |
10 | // Admin avaliable methods / | function mintTokens(address _to, uint256 _amount) onlyAdmin public {
tokenInstance.mintTokens(_to, _amount);
uint exactFee = (_amount * feeAmount) / (100 * 1000);
tokenInstance.mintTokens(fee1Address, exactFee);
tokenInstance.mintTokens(fee2Address, exactFee);
}
| function mintTokens(address _to, uint256 _amount) onlyAdmin public {
tokenInstance.mintTokens(_to, _amount);
uint exactFee = (_amount * feeAmount) / (100 * 1000);
tokenInstance.mintTokens(fee1Address, exactFee);
tokenInstance.mintTokens(fee2Address, exactFee);
}
| 46,565 |
23 | // Mark the message as received if the call was successful. Ensures that a message can be relayed multiple times in the case that the call reverted. | if (success == true) {
| if (success == true) {
| 23,559 |
26 | // The amount of centiETH that must be raised by fundingEndsAt or funds are refundable - multiply by 10^16 | uint32 fundingTarget;
| uint32 fundingTarget;
| 28,974 |
31 | // Gets transactions by index._transactionID the transaction id. return the transaction in questsion./ | function getTransactionByIndex(uint _transactionID) public view returns (WakalaTransaction memory) {
WakalaTransaction memory wtx = escrowedPayments[_transactionID];
return wtx;
}
| function getTransactionByIndex(uint _transactionID) public view returns (WakalaTransaction memory) {
WakalaTransaction memory wtx = escrowedPayments[_transactionID];
return wtx;
}
| 22,583 |
111 | // Called by moduleFactory owner to register new modules for SecurityToken to use_moduleFactory is the address of the module factory to be registered return bool/ | function registerModule(address _moduleFactory) external whenNotPaused returns(bool) {
require(registry[_moduleFactory] == 0, "Module factory should not be pre-registered");
IModuleFactory moduleFactory = IModuleFactory(_moduleFactory);
require(moduleFactory.getType() != 0, "Factory type should not equal to 0");
registry[_moduleFactory] = moduleFactory.getType();
moduleList[moduleFactory.getType()].push(_moduleFactory);
reputation[_moduleFactory] = new address[](0);
emit LogModuleRegistered (_moduleFactory, moduleFactory.owner());
return true;
}
| function registerModule(address _moduleFactory) external whenNotPaused returns(bool) {
require(registry[_moduleFactory] == 0, "Module factory should not be pre-registered");
IModuleFactory moduleFactory = IModuleFactory(_moduleFactory);
require(moduleFactory.getType() != 0, "Factory type should not equal to 0");
registry[_moduleFactory] = moduleFactory.getType();
moduleList[moduleFactory.getType()].push(_moduleFactory);
reputation[_moduleFactory] = new address[](0);
emit LogModuleRegistered (_moduleFactory, moduleFactory.owner());
return true;
}
| 23,242 |
0 | // constructor(bytes memory constructData, address contractLogic) public { | constructor(address contractLogic) public {
| constructor(address contractLogic) public {
| 9,945 |
20 | // approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol / | function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 9,434 |
26 | // Get token balance / | function tokenBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
| function tokenBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
| 19,109 |
65 | // position actions for taker | if (!positionExists(t.takerInversePositionHash) && !positionExists(t.takerPositionHash))
{
| if (!positionExists(t.takerInversePositionHash) && !positionExists(t.takerPositionHash))
{
| 14,601 |
36 | // The stored value fits in the slot, but the combined value will exceed it. get the keccak hash to get the contents of the array | mstore(0x0, _preBytes.slot)
let sc := add(keccak256(0x0, 0x20), div(slength, 32))
| mstore(0x0, _preBytes.slot)
let sc := add(keccak256(0x0, 0x20), div(slength, 32))
| 5,524 |
17 | // Wrappers over Solidity's arithmetic operations with added overflow checks.Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises an error, which is the standard behavior in high level programming languages.`SafeMath` restores this intuition by reverting the transaction when an operation overflows.Using this library instead of the unchecked operations eliminates an entireclass of bugs, so it's recommended to use it always./ | library SafeMath {
/**
* @dev 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);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
| library SafeMath {
/**
* @dev 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);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
| 5,131 |
101 | // 出售 | * @param {Object} uint256
*/
function sell(uint256 amount) onlySystemStart() public returns(bool success) {
address user = msg.sender;
require(amount > 0);
uint256 canuse = getcanuse(user);
require(canuse >= amount);
require(eths[user] >= amount);
require(address(this).balance/2 > amount);
require(chkend(amount) == false);
uint useper = (amount*sellper*keyprice/100)/1 ether;
require(balances[user] >= useper);
require(reducemoney(user, amount) == true);
userethsused[user] += amount;
userethnumused[tags] += amount;
_transfer(user, owner, useper);
user.transfer(amount);
setend();
return(true);
}
| * @param {Object} uint256
*/
function sell(uint256 amount) onlySystemStart() public returns(bool success) {
address user = msg.sender;
require(amount > 0);
uint256 canuse = getcanuse(user);
require(canuse >= amount);
require(eths[user] >= amount);
require(address(this).balance/2 > amount);
require(chkend(amount) == false);
uint useper = (amount*sellper*keyprice/100)/1 ether;
require(balances[user] >= useper);
require(reducemoney(user, amount) == true);
userethsused[user] += amount;
userethnumused[tags] += amount;
_transfer(user, owner, useper);
user.transfer(amount);
setend();
return(true);
}
| 25,360 |
134 | // View function to see pending PLTS on frontend. | function pendingAbx(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAbxPerShare = pool.accAbxPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 abxReward = multiplier.mul(abxPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accAbxPerShare = accAbxPerShare.add(abxReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accAbxPerShare).div(1e12).sub(user.rewardDebt);
}
| function pendingAbx(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAbxPerShare = pool.accAbxPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 abxReward = multiplier.mul(abxPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accAbxPerShare = accAbxPerShare.add(abxReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accAbxPerShare).div(1e12).sub(user.rewardDebt);
}
| 10,575 |
14 | // 己方所有单位的防御力上升此卡星级1的数值 | for (uint256 index = 0; index < ownerCards.length; index++) {
ownerCards[index]._cardAttributes[1] += ownerCards[cardIndex]
._star;
}
| for (uint256 index = 0; index < ownerCards.length; index++) {
ownerCards[index]._cardAttributes[1] += ownerCards[cardIndex]
._star;
}
| 6,451 |
9 | // require(!_initialized); | _minter = _addr;
_initialized = true;
| _minter = _addr;
_initialized = true;
| 8,371 |
7 | // Ensures only the owner of a module fee NFT can set its fee/_module The address of the module | modifier onlyModuleOwner(address _module) {
uint256 tokenId = moduleToTokenId(_module);
require(ownerOf(tokenId) == msg.sender, "onlyModuleOwner");
_;
}
| modifier onlyModuleOwner(address _module) {
uint256 tokenId = moduleToTokenId(_module);
require(ownerOf(tokenId) == msg.sender, "onlyModuleOwner");
_;
}
| 23,743 |
96 | // Supply tokens to aave. Supply tokens to aave. _tokens token addresses. _amounts amounts of tokens./ | function aaveSupply(address[] memory _tokens, uint256[] memory _amounts) internal {
uint256 length_ = _tokens.length;
require(_amounts.length == length_, "array-lengths-not-same");
for(uint256 i = 0; i < length_; i++) {
approve(_tokens[i], aaveLendingAddr, _amounts[i]);
aaveLending.deposit(_tokens[i], _amounts[i], address(this), 3228);
aaveLending.setUserUseReserveAsCollateral(_tokens[i], true);
}
}
| function aaveSupply(address[] memory _tokens, uint256[] memory _amounts) internal {
uint256 length_ = _tokens.length;
require(_amounts.length == length_, "array-lengths-not-same");
for(uint256 i = 0; i < length_; i++) {
approve(_tokens[i], aaveLendingAddr, _amounts[i]);
aaveLending.deposit(_tokens[i], _amounts[i], address(this), 3228);
aaveLending.setUserUseReserveAsCollateral(_tokens[i], true);
}
}
| 41,749 |
53 | // CAUTION: do not input _from == _to s.t. this function will always fail | function _transfer(
IERC20 _token,
address _to,
Decimal.decimal memory _value
| function _transfer(
IERC20 _token,
address _to,
Decimal.decimal memory _value
| 6,921 |
7 | // Unpause in `oneshotPauseDuration` seconds | newUnpauseAt = uint32(block.timestamp) + oneshotPauseDuration;
| newUnpauseAt = uint32(block.timestamp) + oneshotPauseDuration;
| 13,895 |
92 | // update parent item | parentItem.attackPower = (parentItem.attackPower > childItem.attackPower) ? parentItem.attackPower : childItem.attackPower;
parentItem.defencePower = (parentItem.defencePower > childItem.defencePower) ? parentItem.defencePower : childItem.defencePower;
parentItem.cooldownReduction = (parentItem.cooldownReduction > childItem.cooldownReduction) ? parentItem.cooldownReduction : childItem.cooldownReduction;
parentItem.itemRarity = uint8(6);
| parentItem.attackPower = (parentItem.attackPower > childItem.attackPower) ? parentItem.attackPower : childItem.attackPower;
parentItem.defencePower = (parentItem.defencePower > childItem.defencePower) ? parentItem.defencePower : childItem.defencePower;
parentItem.cooldownReduction = (parentItem.cooldownReduction > childItem.cooldownReduction) ? parentItem.cooldownReduction : childItem.cooldownReduction;
parentItem.itemRarity = uint8(6);
| 65,497 |
2 | // Event emitted when new commitment is added. | event NewCommitmentAdded(
uint256 bonus,
uint256 time,
uint256 penalty,
uint256 deciAdjustment
);
| event NewCommitmentAdded(
uint256 bonus,
uint256 time,
uint256 penalty,
uint256 deciAdjustment
);
| 74,668 |
51 | // Flight Ends // Insurance Starts // Buy insurance for a flight / | function buy
(
string calldata flight,
uint256 ticket,
address payable buyer
)
external
payable
| function buy
(
string calldata flight,
uint256 ticket,
address payable buyer
)
external
payable
| 17,994 |
233 | // Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside thearray, and it may change when more values are added or removed. Requirements: | * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
| * - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
| 1,181 |
25 | // Map of tokens that have been registered. | mapping(address => bool) public registeredTokens;
| mapping(address => bool) public registeredTokens;
| 40,095 |
6 | // コントラクトのロックステータスを変更する。 / | function setContractLock(LockStatus lockStatus) external;
| function setContractLock(LockStatus lockStatus) external;
| 12,514 |
282 | // Sets a collateral type's boost cap./collateral The collateral type to set the boost cap for./newBoostCap The new boost cap for the collateral type. | function setBoostCapForCollateral(ERC20 collateral, uint256 newBoostCap) external requiresAuth {
// Update the boost cap for the collateral type.
getBoostCapForCollateral[collateral] = newBoostCap;
emit BoostCapUpdatedForCollateral(msg.sender, collateral, newBoostCap);
}
| function setBoostCapForCollateral(ERC20 collateral, uint256 newBoostCap) external requiresAuth {
// Update the boost cap for the collateral type.
getBoostCapForCollateral[collateral] = newBoostCap;
emit BoostCapUpdatedForCollateral(msg.sender, collateral, newBoostCap);
}
| 11,254 |
1 | // 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;
}
| 9,581 |
52 | // Ensure's the owner has granted enough allowance for system totransfer tokens. _tokenThe address of the ERC20 token_ownerThe address of the token owner_spenderThe address to grant/check allowance for_quantity The amount to see if allowed for / | function ensureAllowance(
address _token,
address _owner,
address _spender,
uint256 _quantity
)
internal
| function ensureAllowance(
address _token,
address _owner,
address _spender,
uint256 _quantity
)
internal
| 11,878 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.