mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Give unamed parameters unique keys and update tests to new spec
Fix whitespace
This commit is contained in:
parent
18fe693fdd
commit
f598b1515f
@ -14,6 +14,7 @@ Breaking changes:
|
|||||||
* Syntax: Abstract contracts need to be marked explicitly as abstract by using the ``abstract`` keyword.
|
* Syntax: Abstract contracts need to be marked explicitly as abstract by using the ``abstract`` keyword.
|
||||||
* Inline Assembly: Only strict inline assembly is allowed.
|
* Inline Assembly: Only strict inline assembly is allowed.
|
||||||
* Type checker: Resulting type of exponentiation is equal to the type of the base. Also allow signed types for the base.
|
* Type checker: Resulting type of exponentiation is equal to the type of the base. Also allow signed types for the base.
|
||||||
|
* Natspec JSON Interface: Support multiple ``@return`` statements in dev documentation to behave like named parameters.
|
||||||
* Source mappings: Add "modifier depth" as a fifth field in the source mappings.
|
* Source mappings: Add "modifier depth" as a fifth field in the source mappings.
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,37 +99,36 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef)
|
|||||||
if (auto fun = dynamic_cast<FunctionDefinition const*>(&it.second->declaration()))
|
if (auto fun = dynamic_cast<FunctionDefinition const*>(&it.second->declaration()))
|
||||||
{
|
{
|
||||||
Json::Value method(devDocumentation(fun->annotation().docTags));
|
Json::Value method(devDocumentation(fun->annotation().docTags));
|
||||||
|
|
||||||
// add the function, only if we have any documentation to add
|
|
||||||
if (!method.empty())
|
if (!method.empty())
|
||||||
{
|
{
|
||||||
|
// add the function, only if we have any documentation to add
|
||||||
Json::Value ret(Json::objectValue);
|
Json::Value ret(Json::objectValue);
|
||||||
|
|
||||||
// for constructors, the "return" node will never exist. invalid tags
|
|
||||||
// will already generate an error within dev::solidity::DocStringAnalyzer.
|
|
||||||
auto returnParams = fun->returnParameters();
|
auto returnParams = fun->returnParameters();
|
||||||
auto returnDoc = fun->annotation().docTags.equal_range("return");
|
auto returnDoc = fun->annotation().docTags.equal_range("return");
|
||||||
|
|
||||||
if (!returnParams.empty())
|
if (!returnParams.empty())
|
||||||
{
|
{
|
||||||
// if there is no name then append subsequent return notices like previous behavior
|
|
||||||
string value;
|
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
for (auto i = returnDoc.first; i != returnDoc.second; i++)
|
for (auto i = returnDoc.first; i != returnDoc.second; i++)
|
||||||
{
|
{
|
||||||
string paramName = returnParams.at(n)->name();
|
string paramName = returnParams.at(n)->name();
|
||||||
|
string content = i->second.content;
|
||||||
|
|
||||||
if (!paramName.empty() && returnParams.size() != 1)
|
if (paramName.empty())
|
||||||
{
|
{
|
||||||
ret[paramName] = Json::Value(i->second.content);
|
paramName = "_" + std::to_string(n+1);
|
||||||
n++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value += i->second.content;
|
//check to make sure the first word of the doc str is the same as the return name
|
||||||
method["return"] = Json::Value(value);
|
auto nameEndPos = content.find_first_of(" \t");
|
||||||
|
solAssert(content.substr(0, nameEndPos) == paramName, "No return param name given: " + paramName);
|
||||||
|
content = content.substr(nameEndPos+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret[paramName] = Json::Value(content);
|
||||||
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ contract MultiSigWallet {
|
|||||||
/// @param destination Transaction target address.
|
/// @param destination Transaction target address.
|
||||||
/// @param value Transaction ether value.
|
/// @param value Transaction ether value.
|
||||||
/// @param data Transaction data payload.
|
/// @param data Transaction data payload.
|
||||||
/// @return Returns transaction ID.
|
/// @return transactionId Returns transaction ID.
|
||||||
function submitTransaction(address destination, uint value, bytes memory data)
|
function submitTransaction(address destination, uint value, bytes memory data)
|
||||||
public
|
public
|
||||||
returns (uint transactionId)
|
returns (uint transactionId)
|
||||||
@ -258,7 +258,7 @@ contract MultiSigWallet {
|
|||||||
/// @param destination Transaction target address.
|
/// @param destination Transaction target address.
|
||||||
/// @param value Transaction ether value.
|
/// @param value Transaction ether value.
|
||||||
/// @param data Transaction data payload.
|
/// @param data Transaction data payload.
|
||||||
/// @return Returns transaction ID.
|
/// @return transactionId Returns transaction ID.
|
||||||
function addTransaction(address destination, uint value, bytes memory data)
|
function addTransaction(address destination, uint value, bytes memory data)
|
||||||
internal
|
internal
|
||||||
notNull(destination)
|
notNull(destination)
|
||||||
@ -280,7 +280,7 @@ contract MultiSigWallet {
|
|||||||
*/
|
*/
|
||||||
/// @dev Returns number of confirmations of a transaction.
|
/// @dev Returns number of confirmations of a transaction.
|
||||||
/// @param transactionId Transaction ID.
|
/// @param transactionId Transaction ID.
|
||||||
/// @return Number of confirmations.
|
/// @return count Number of confirmations.
|
||||||
function getConfirmationCount(uint transactionId)
|
function getConfirmationCount(uint transactionId)
|
||||||
public
|
public
|
||||||
view
|
view
|
||||||
@ -294,7 +294,7 @@ contract MultiSigWallet {
|
|||||||
/// @dev Returns total number of transactions after filers are applied.
|
/// @dev Returns total number of transactions after filers are applied.
|
||||||
/// @param pending Include pending transactions.
|
/// @param pending Include pending transactions.
|
||||||
/// @param executed Include executed transactions.
|
/// @param executed Include executed transactions.
|
||||||
/// @return Total number of transactions after filters are applied.
|
/// @return count Total number of transactions after filters are applied.
|
||||||
function getTransactionCount(bool pending, bool executed)
|
function getTransactionCount(bool pending, bool executed)
|
||||||
public
|
public
|
||||||
view
|
view
|
||||||
@ -318,7 +318,7 @@ contract MultiSigWallet {
|
|||||||
|
|
||||||
/// @dev Returns array with owner addresses, which confirmed transaction.
|
/// @dev Returns array with owner addresses, which confirmed transaction.
|
||||||
/// @param transactionId Transaction ID.
|
/// @param transactionId Transaction ID.
|
||||||
/// @return Returns array of owner addresses.
|
/// @return _confirmations Returns array of owner addresses.
|
||||||
function getConfirmations(uint transactionId)
|
function getConfirmations(uint transactionId)
|
||||||
public
|
public
|
||||||
view
|
view
|
||||||
@ -342,7 +342,7 @@ contract MultiSigWallet {
|
|||||||
/// @param to Index end position of transaction array.
|
/// @param to Index end position of transaction array.
|
||||||
/// @param pending Include pending transactions.
|
/// @param pending Include pending transactions.
|
||||||
/// @param executed Include executed transactions.
|
/// @param executed Include executed transactions.
|
||||||
/// @return Returns array of transaction IDs.
|
/// @return _transactionIds Returns array of transaction IDs.
|
||||||
function getTransactionIds(uint from, uint to, bool pending, bool executed)
|
function getTransactionIds(uint from, uint to, bool pending, bool executed)
|
||||||
public
|
public
|
||||||
view
|
view
|
||||||
|
@ -10,7 +10,7 @@ contract MultiSigWalletFactory is Factory {
|
|||||||
/// @dev Allows verified creation of multisignature wallet.
|
/// @dev Allows verified creation of multisignature wallet.
|
||||||
/// @param _owners List of initial owners.
|
/// @param _owners List of initial owners.
|
||||||
/// @param _required Number of required confirmations.
|
/// @param _required Number of required confirmations.
|
||||||
/// @return Returns wallet address.
|
/// @return wallet Returns wallet address.
|
||||||
function create(address[] memory _owners, uint _required)
|
function create(address[] memory _owners, uint _required)
|
||||||
public
|
public
|
||||||
returns (address wallet)
|
returns (address wallet)
|
||||||
|
@ -11,7 +11,7 @@ contract MultiSigWalletWithDailyLimitFactory is Factory {
|
|||||||
/// @param _owners List of initial owners.
|
/// @param _owners List of initial owners.
|
||||||
/// @param _required Number of required confirmations.
|
/// @param _required Number of required confirmations.
|
||||||
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
|
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
|
||||||
/// @return Returns wallet address.
|
/// @return wallet Returns wallet address.
|
||||||
function create(address[] memory _owners, uint _required, uint _dailyLimit)
|
function create(address[] memory _owners, uint _required, uint _dailyLimit)
|
||||||
public
|
public
|
||||||
returns (address wallet)
|
returns (address wallet)
|
||||||
|
@ -84,7 +84,7 @@ contract premium is module, safeMath {
|
|||||||
* @param spender The address of the account able to transfer the tokens
|
* @param spender The address of the account able to transfer the tokens
|
||||||
* @param amount The amount of tokens to be approved for transfer
|
* @param amount The amount of tokens to be approved for transfer
|
||||||
* @param nonce The transaction count of the authorised address
|
* @param nonce The transaction count of the authorised address
|
||||||
* @return True if the approval was successful
|
* @return success True if the approval was successful
|
||||||
*/
|
*/
|
||||||
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -106,7 +106,7 @@ contract premium is module, safeMath {
|
|||||||
* @param amount The amount of tokens to be approved for transfer
|
* @param amount The amount of tokens to be approved for transfer
|
||||||
* @param nonce The transaction count of the authorised address
|
* @param nonce The transaction count of the authorised address
|
||||||
* @param extraData Data to give forward to the receiver
|
* @param extraData Data to give forward to the receiver
|
||||||
* @return True if the approval was successful
|
* @return success True if the approval was successful
|
||||||
*/
|
*/
|
||||||
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes calldata extraData) isReady external returns (bool success) {
|
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes calldata extraData) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -159,7 +159,7 @@ contract premium is module, safeMath {
|
|||||||
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
||||||
* @param to The address of the recipient
|
* @param to The address of the recipient
|
||||||
* @param amount The amount of tokens to be transferred
|
* @param amount The amount of tokens to be transferred
|
||||||
* @return Whether the transfer was successful or not
|
* @return success Whether the transfer was successful or not
|
||||||
*/
|
*/
|
||||||
function transfer(address to, uint256 amount) isReady external returns (bool success) {
|
function transfer(address to, uint256 amount) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -187,7 +187,7 @@ contract premium is module, safeMath {
|
|||||||
* @param from The address holding the tokens being transferred
|
* @param from The address holding the tokens being transferred
|
||||||
* @param to The address of the recipient
|
* @param to The address of the recipient
|
||||||
* @param amount The amount of tokens to be transferred
|
* @param amount The amount of tokens to be transferred
|
||||||
* @return True if the transfer was successful
|
* @return success True if the transfer was successful
|
||||||
*/
|
*/
|
||||||
function transferFrom(address from, address to, uint256 amount) isReady external returns (bool success) {
|
function transferFrom(address from, address to, uint256 amount) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -224,7 +224,7 @@ contract premium is module, safeMath {
|
|||||||
* @param to The contract address of the recipient
|
* @param to The contract address of the recipient
|
||||||
* @param amount The amount of tokens to be transferred
|
* @param amount The amount of tokens to be transferred
|
||||||
* @param extraData Data to give forward to the receiver
|
* @param extraData Data to give forward to the receiver
|
||||||
* @return Whether the transfer was successful or not
|
* @return success Whether the transfer was successful or not
|
||||||
*/
|
*/
|
||||||
function transfer(address to, uint256 amount, bytes calldata extraData) isReady external returns (bool success) {
|
function transfer(address to, uint256 amount, bytes calldata extraData) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
|
@ -99,7 +99,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
* @param spender The address of the account able to transfer the tokens
|
* @param spender The address of the account able to transfer the tokens
|
||||||
* @param amount The amount of tokens to be approved for transfer
|
* @param amount The amount of tokens to be approved for transfer
|
||||||
* @param nonce The transaction count of the authorised address
|
* @param nonce The transaction count of the authorised address
|
||||||
* @return True if the approval was successful
|
* @return success True if the approval was successful
|
||||||
*/
|
*/
|
||||||
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -121,7 +121,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
* @param amount The amount of tokens to be approved for transfer
|
* @param amount The amount of tokens to be approved for transfer
|
||||||
* @param nonce The transaction count of the authorised address
|
* @param nonce The transaction count of the authorised address
|
||||||
* @param extraData Data to give forward to the receiver
|
* @param extraData Data to give forward to the receiver
|
||||||
* @return True if the approval was successful
|
* @return success True if the approval was successful
|
||||||
*/
|
*/
|
||||||
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes calldata extraData) isReady external returns (bool success) {
|
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes calldata extraData) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -174,7 +174,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
||||||
* @param to The address of the recipient
|
* @param to The address of the recipient
|
||||||
* @param amount The amount of tokens to be transferred
|
* @param amount The amount of tokens to be transferred
|
||||||
* @return Whether the transfer was successful or not
|
* @return success Whether the transfer was successful or not
|
||||||
*/
|
*/
|
||||||
function transfer(address to, uint256 amount) isReady external returns (bool success) {
|
function transfer(address to, uint256 amount) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -202,7 +202,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
* @param from The address holding the tokens being transferred
|
* @param from The address holding the tokens being transferred
|
||||||
* @param to The address of the recipient
|
* @param to The address of the recipient
|
||||||
* @param amount The amount of tokens to be transferred
|
* @param amount The amount of tokens to be transferred
|
||||||
* @return True if the transfer was successful
|
* @return success True if the transfer was successful
|
||||||
*/
|
*/
|
||||||
function transferFrom(address from, address to, uint256 amount) isReady external returns (bool success) {
|
function transferFrom(address from, address to, uint256 amount) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -239,7 +239,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
* @param from The address holding the tokens being transferred
|
* @param from The address holding the tokens being transferred
|
||||||
* @param to The address of the recipient
|
* @param to The address of the recipient
|
||||||
* @param amount The amount of tokens to be transferred
|
* @param amount The amount of tokens to be transferred
|
||||||
* @return True if the transfer was successful
|
* @return success True if the transfer was successful
|
||||||
*/
|
*/
|
||||||
function transferFromByModule(address from, address to, uint256 amount, bool fee) isReady external returns (bool success) {
|
function transferFromByModule(address from, address to, uint256 amount, bool fee) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -265,7 +265,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
* @param to The contract address of the recipient
|
* @param to The contract address of the recipient
|
||||||
* @param amount The amount of tokens to be transferred
|
* @param amount The amount of tokens to be transferred
|
||||||
* @param extraData Data to give forward to the receiver
|
* @param extraData Data to give forward to the receiver
|
||||||
* @return Whether the transfer was successful or not
|
* @return success Whether the transfer was successful or not
|
||||||
*/
|
*/
|
||||||
function transfer(address to, uint256 amount, bytes calldata extraData) isReady external returns (bool success) {
|
function transfer(address to, uint256 amount, bytes calldata extraData) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
@ -341,7 +341,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
* @notice Transaction fee will be deduced from `owner` for transacting `value`
|
* @notice Transaction fee will be deduced from `owner` for transacting `value`
|
||||||
* @param owner The address where will the transaction fee deduced
|
* @param owner The address where will the transaction fee deduced
|
||||||
* @param value The base for calculating the fee
|
* @param value The base for calculating the fee
|
||||||
* @return True if the transfer was successful
|
* @return success True if the transfer was successful
|
||||||
*/
|
*/
|
||||||
function processTransactionFee(address owner, uint256 value) isReady external returns (bool success) {
|
function processTransactionFee(address owner, uint256 value) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
|
@ -25,7 +25,7 @@ contract CategoricalEvent is Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Exchanges sender's winning outcome tokens for collateral tokens
|
/// @dev Exchanges sender's winning outcome tokens for collateral tokens
|
||||||
/// @return Sender's winnings
|
/// @return winnings Sender's winnings
|
||||||
function redeemWinnings()
|
function redeemWinnings()
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
|
@ -107,7 +107,7 @@ abstract contract Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Returns the amount of outcome tokens held by owner
|
/// @dev Returns the amount of outcome tokens held by owner
|
||||||
/// @return Outcome token distribution
|
/// @return outcomeTokenDistribution Outcome token distribution
|
||||||
function getOutcomeTokenDistribution(address owner)
|
function getOutcomeTokenDistribution(address owner)
|
||||||
public
|
public
|
||||||
view
|
view
|
||||||
|
@ -26,7 +26,7 @@ contract EventFactory {
|
|||||||
/// @param collateralToken Tokens used as collateral in exchange for outcome tokens
|
/// @param collateralToken Tokens used as collateral in exchange for outcome tokens
|
||||||
/// @param oracle Oracle contract used to resolve the event
|
/// @param oracle Oracle contract used to resolve the event
|
||||||
/// @param outcomeCount Number of event outcomes
|
/// @param outcomeCount Number of event outcomes
|
||||||
/// @return Event contract
|
/// @return eventContract Event contract
|
||||||
function createCategoricalEvent(
|
function createCategoricalEvent(
|
||||||
Token collateralToken,
|
Token collateralToken,
|
||||||
Oracle oracle,
|
Oracle oracle,
|
||||||
@ -53,7 +53,7 @@ contract EventFactory {
|
|||||||
/// @param oracle Oracle contract used to resolve the event
|
/// @param oracle Oracle contract used to resolve the event
|
||||||
/// @param lowerBound Lower bound for event outcome
|
/// @param lowerBound Lower bound for event outcome
|
||||||
/// @param upperBound Lower bound for event outcome
|
/// @param upperBound Lower bound for event outcome
|
||||||
/// @return Event contract
|
/// @return eventContract Event contract
|
||||||
function createScalarEvent(
|
function createScalarEvent(
|
||||||
Token collateralToken,
|
Token collateralToken,
|
||||||
Oracle oracle,
|
Oracle oracle,
|
||||||
|
@ -44,7 +44,7 @@ contract ScalarEvent is Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Exchanges sender's winning outcome tokens for collateral tokens
|
/// @dev Exchanges sender's winning outcome tokens for collateral tokens
|
||||||
/// @return Sender's winnings
|
/// @return winnings Sender's winnings
|
||||||
function redeemWinnings()
|
function redeemWinnings()
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
|
@ -21,7 +21,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @param market Market contract
|
/// @param market Market contract
|
||||||
/// @param outcomeTokenIndex Index of outcome to buy
|
/// @param outcomeTokenIndex Index of outcome to buy
|
||||||
/// @param outcomeTokenCount Number of outcome tokens to buy
|
/// @param outcomeTokenCount Number of outcome tokens to buy
|
||||||
/// @return Cost
|
/// @return cost Cost
|
||||||
function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
@ -57,7 +57,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @param market Market contract
|
/// @param market Market contract
|
||||||
/// @param outcomeTokenIndex Index of outcome to sell
|
/// @param outcomeTokenIndex Index of outcome to sell
|
||||||
/// @param outcomeTokenCount Number of outcome tokens to sell
|
/// @param outcomeTokenCount Number of outcome tokens to sell
|
||||||
/// @return Profit
|
/// @return profit Profit
|
||||||
function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
@ -84,7 +84,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @dev Returns marginal price of an outcome
|
/// @dev Returns marginal price of an outcome
|
||||||
/// @param market Market contract
|
/// @param market Market contract
|
||||||
/// @param outcomeTokenIndex Index of outcome to determine marginal price of
|
/// @param outcomeTokenIndex Index of outcome to determine marginal price of
|
||||||
/// @return Marginal price of an outcome as a fixed point number
|
/// @return price Marginal price of an outcome as a fixed point number
|
||||||
function calcMarginalPrice(Market market, uint8 outcomeTokenIndex)
|
function calcMarginalPrice(Market market, uint8 outcomeTokenIndex)
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
@ -110,7 +110,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @param logN Logarithm of the number of outcomes
|
/// @param logN Logarithm of the number of outcomes
|
||||||
/// @param netOutcomeTokensSold Net outcome tokens sold by market
|
/// @param netOutcomeTokensSold Net outcome tokens sold by market
|
||||||
/// @param funding Initial funding for market
|
/// @param funding Initial funding for market
|
||||||
/// @return Cost level
|
/// @return costLevel Cost level
|
||||||
function calcCostLevel(int logN, int[] memory netOutcomeTokensSold, uint funding)
|
function calcCostLevel(int logN, int[] memory netOutcomeTokensSold, uint funding)
|
||||||
private
|
private
|
||||||
view
|
view
|
||||||
@ -131,7 +131,9 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @param netOutcomeTokensSold Net outcome tokens sold by market
|
/// @param netOutcomeTokensSold Net outcome tokens sold by market
|
||||||
/// @param funding Initial funding for market
|
/// @param funding Initial funding for market
|
||||||
/// @param outcomeIndex Index of exponential term to extract (for use by marginal price function)
|
/// @param outcomeIndex Index of exponential term to extract (for use by marginal price function)
|
||||||
/// @return A result structure composed of the sum, the offset used, and the summand associated with the supplied index
|
/// @return sum of the outcomes
|
||||||
|
/// @return offset that is used for all
|
||||||
|
/// @return outcomeExpTerm the summand associated with the supplied index
|
||||||
function sumExpOffset(int logN, int[] memory netOutcomeTokensSold, uint funding, uint8 outcomeIndex)
|
function sumExpOffset(int logN, int[] memory netOutcomeTokensSold, uint funding, uint8 outcomeIndex)
|
||||||
private
|
private
|
||||||
view
|
view
|
||||||
@ -170,7 +172,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// number of collateral tokens (which is the same as the number of outcome tokens the
|
/// number of collateral tokens (which is the same as the number of outcome tokens the
|
||||||
/// market created) subtracted by the quantity of that token held by the market.
|
/// market created) subtracted by the quantity of that token held by the market.
|
||||||
/// @param market Market contract
|
/// @param market Market contract
|
||||||
/// @return Net outcome tokens sold by market
|
/// @return quantities Net outcome tokens sold by market
|
||||||
function getNetOutcomeTokensSold(Market market)
|
function getNetOutcomeTokensSold(Market market)
|
||||||
private
|
private
|
||||||
view
|
view
|
||||||
|
@ -115,7 +115,7 @@ contract Campaign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Withdraws refund amount
|
/// @dev Withdraws refund amount
|
||||||
/// @return Refund amount
|
/// @return refundAmount Refund amount
|
||||||
function refund()
|
function refund()
|
||||||
public
|
public
|
||||||
timedTransitions
|
timedTransitions
|
||||||
@ -162,7 +162,7 @@ contract Campaign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Allows to withdraw fees from campaign contract to contributor
|
/// @dev Allows to withdraw fees from campaign contract to contributor
|
||||||
/// @return Fee amount
|
/// @return fees Fee amount
|
||||||
function withdrawFees()
|
function withdrawFees()
|
||||||
public
|
public
|
||||||
atStage(Stages.MarketClosed)
|
atStage(Stages.MarketClosed)
|
||||||
|
@ -21,7 +21,7 @@ contract CampaignFactory {
|
|||||||
/// @param fee Market fee
|
/// @param fee Market fee
|
||||||
/// @param funding Initial funding for market
|
/// @param funding Initial funding for market
|
||||||
/// @param deadline Campaign deadline
|
/// @param deadline Campaign deadline
|
||||||
/// @return Market contract
|
/// @return campaign Market contract
|
||||||
function createCampaigns(
|
function createCampaigns(
|
||||||
Event eventContract,
|
Event eventContract,
|
||||||
MarketFactory marketFactory,
|
MarketFactory marketFactory,
|
||||||
|
@ -84,7 +84,7 @@ contract StandardMarket is Market {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Allows market creator to withdraw fees generated by trades
|
/// @dev Allows market creator to withdraw fees generated by trades
|
||||||
/// @return Fee amount
|
/// @return fees Fee amount
|
||||||
function withdrawFees()
|
function withdrawFees()
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
@ -101,7 +101,7 @@ contract StandardMarket is Market {
|
|||||||
/// @param outcomeTokenIndex Index of the outcome token to buy
|
/// @param outcomeTokenIndex Index of the outcome token to buy
|
||||||
/// @param outcomeTokenCount Amount of outcome tokens to buy
|
/// @param outcomeTokenCount Amount of outcome tokens to buy
|
||||||
/// @param maxCost The maximum cost in collateral tokens to pay for outcome tokens
|
/// @param maxCost The maximum cost in collateral tokens to pay for outcome tokens
|
||||||
/// @return Cost in collateral tokens
|
/// @return cost Cost in collateral tokens
|
||||||
function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost)
|
function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost)
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
@ -132,7 +132,7 @@ contract StandardMarket is Market {
|
|||||||
/// @param outcomeTokenIndex Index of the outcome token to sell
|
/// @param outcomeTokenIndex Index of the outcome token to sell
|
||||||
/// @param outcomeTokenCount Amount of outcome tokens to sell
|
/// @param outcomeTokenCount Amount of outcome tokens to sell
|
||||||
/// @param minProfit The minimum profit in collateral tokens to earn for outcome tokens
|
/// @param minProfit The minimum profit in collateral tokens to earn for outcome tokens
|
||||||
/// @return Profit in collateral tokens
|
/// @return profit Profit in collateral tokens
|
||||||
function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)
|
function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
@ -163,7 +163,7 @@ contract StandardMarket is Market {
|
|||||||
/// @param outcomeTokenIndex Index of the outcome token to short sell
|
/// @param outcomeTokenIndex Index of the outcome token to short sell
|
||||||
/// @param outcomeTokenCount Amount of outcome tokens to short sell
|
/// @param outcomeTokenCount Amount of outcome tokens to short sell
|
||||||
/// @param minProfit The minimum profit in collateral tokens to earn for short sold outcome tokens
|
/// @param minProfit The minimum profit in collateral tokens to earn for short sold outcome tokens
|
||||||
/// @return Cost to short sell outcome in collateral tokens
|
/// @return cost Cost to short sell outcome in collateral tokens
|
||||||
function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)
|
function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
|
@ -14,7 +14,7 @@ contract StandardMarketFactory is MarketFactory {
|
|||||||
/// @param eventContract Event contract
|
/// @param eventContract Event contract
|
||||||
/// @param marketMaker Market maker contract
|
/// @param marketMaker Market maker contract
|
||||||
/// @param fee Market fee
|
/// @param fee Market fee
|
||||||
/// @return Market contract
|
/// @return market Market contract
|
||||||
function createMarket(Event eventContract, MarketMaker marketMaker, uint24 fee)
|
function createMarket(Event eventContract, MarketMaker marketMaker, uint24 fee)
|
||||||
public
|
public
|
||||||
override
|
override
|
||||||
|
@ -16,7 +16,7 @@ contract CentralizedOracleFactory {
|
|||||||
*/
|
*/
|
||||||
/// @dev Creates a new centralized oracle contract
|
/// @dev Creates a new centralized oracle contract
|
||||||
/// @param ipfsHash Hash identifying off chain event description
|
/// @param ipfsHash Hash identifying off chain event description
|
||||||
/// @return Oracle contract
|
/// @return centralizedOracle Oracle contract
|
||||||
function createCentralizedOracle(bytes memory ipfsHash)
|
function createCentralizedOracle(bytes memory ipfsHash)
|
||||||
public
|
public
|
||||||
returns (CentralizedOracle centralizedOracle)
|
returns (CentralizedOracle centralizedOracle)
|
||||||
|
@ -16,7 +16,7 @@ contract DifficultyOracleFactory {
|
|||||||
*/
|
*/
|
||||||
/// @dev Creates a new difficulty oracle contract
|
/// @dev Creates a new difficulty oracle contract
|
||||||
/// @param blockNumber Target block number
|
/// @param blockNumber Target block number
|
||||||
/// @return Oracle contract
|
/// @return difficultyOracle Oracle contract
|
||||||
function createDifficultyOracle(uint blockNumber)
|
function createDifficultyOracle(uint blockNumber)
|
||||||
public
|
public
|
||||||
returns (DifficultyOracle difficultyOracle)
|
returns (DifficultyOracle difficultyOracle)
|
||||||
|
@ -50,7 +50,7 @@ contract FutarchyOracleFactory {
|
|||||||
/// @param marketMaker Market maker contract
|
/// @param marketMaker Market maker contract
|
||||||
/// @param fee Market fee
|
/// @param fee Market fee
|
||||||
/// @param deadline Decision deadline
|
/// @param deadline Decision deadline
|
||||||
/// @return Oracle contract
|
/// @return futarchyOracle Oracle contract
|
||||||
function createFutarchyOracle(
|
function createFutarchyOracle(
|
||||||
Token collateralToken,
|
Token collateralToken,
|
||||||
Oracle oracle,
|
Oracle oracle,
|
||||||
|
@ -28,8 +28,8 @@ contract MajorityOracle is Oracle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Allows to registers oracles for a majority vote
|
/// @dev Allows to registers oracles for a majority vote
|
||||||
/// @return Is outcome set?
|
/// @return outcomeSet Is outcome set?
|
||||||
/// @return Outcome
|
/// @return outcome Outcome
|
||||||
function getStatusAndOutcome()
|
function getStatusAndOutcome()
|
||||||
public
|
public
|
||||||
view
|
view
|
||||||
|
@ -16,7 +16,7 @@ contract MajorityOracleFactory {
|
|||||||
*/
|
*/
|
||||||
/// @dev Creates a new majority oracle contract
|
/// @dev Creates a new majority oracle contract
|
||||||
/// @param oracles List of oracles taking part in the majority vote
|
/// @param oracles List of oracles taking part in the majority vote
|
||||||
/// @return Oracle contract
|
/// @return majorityOracle Oracle contract
|
||||||
function createMajorityOracle(Oracle[] memory oracles)
|
function createMajorityOracle(Oracle[] memory oracles)
|
||||||
public
|
public
|
||||||
returns (MajorityOracle majorityOracle)
|
returns (MajorityOracle majorityOracle)
|
||||||
|
@ -19,7 +19,7 @@ contract SignedMessageOracleFactory {
|
|||||||
/// @param v Signature parameter
|
/// @param v Signature parameter
|
||||||
/// @param r Signature parameter
|
/// @param r Signature parameter
|
||||||
/// @param s Signature parameter
|
/// @param s Signature parameter
|
||||||
/// @return Oracle contract
|
/// @return signedMessageOracle Oracle contract
|
||||||
function createSignedMessageOracle(bytes32 descriptionHash, uint8 v, bytes32 r, bytes32 s)
|
function createSignedMessageOracle(bytes32 descriptionHash, uint8 v, bytes32 r, bytes32 s)
|
||||||
public
|
public
|
||||||
returns (SignedMessageOracle signedMessageOracle)
|
returns (SignedMessageOracle signedMessageOracle)
|
||||||
|
@ -126,7 +126,7 @@ contract UltimateOracle is Oracle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Withdraws winnings for user
|
/// @dev Withdraws winnings for user
|
||||||
/// @return Winnings
|
/// @return amount Winnings
|
||||||
function withdraw()
|
function withdraw()
|
||||||
public
|
public
|
||||||
returns (uint amount)
|
returns (uint amount)
|
||||||
|
@ -30,7 +30,7 @@ contract UltimateOracleFactory {
|
|||||||
/// @param challengePeriod Time to challenge oracle outcome
|
/// @param challengePeriod Time to challenge oracle outcome
|
||||||
/// @param challengeAmount Amount to challenge the outcome
|
/// @param challengeAmount Amount to challenge the outcome
|
||||||
/// @param frontRunnerPeriod Time to overbid the front-runner
|
/// @param frontRunnerPeriod Time to overbid the front-runner
|
||||||
/// @return Oracle contract
|
/// @return ultimateOracle Oracle contract
|
||||||
function createUltimateOracle(
|
function createUltimateOracle(
|
||||||
Oracle oracle,
|
Oracle oracle,
|
||||||
Token collateralToken,
|
Token collateralToken,
|
||||||
|
@ -154,7 +154,7 @@ library Math {
|
|||||||
|
|
||||||
/// @dev Returns base 2 logarithm value of given x
|
/// @dev Returns base 2 logarithm value of given x
|
||||||
/// @param x x
|
/// @param x x
|
||||||
/// @return logarithmic value
|
/// @return lo logarithmic value
|
||||||
function floorLog2(uint x)
|
function floorLog2(uint x)
|
||||||
public
|
public
|
||||||
pure
|
pure
|
||||||
@ -175,7 +175,7 @@ library Math {
|
|||||||
|
|
||||||
/// @dev Returns maximum of an array
|
/// @dev Returns maximum of an array
|
||||||
/// @param nums Numbers to look through
|
/// @param nums Numbers to look through
|
||||||
/// @return Maximum number
|
/// @return max Maximum number
|
||||||
function max(int[] memory nums)
|
function max(int[] memory nums)
|
||||||
public
|
public
|
||||||
pure
|
pure
|
||||||
|
@ -365,7 +365,7 @@ BOOST_AUTO_TEST_CASE(dev_return)
|
|||||||
/// @param a Documentation for the first parameter starts here.
|
/// @param a Documentation for the first parameter starts here.
|
||||||
/// Since it's a really complicated parameter we need 2 lines
|
/// Since it's a really complicated parameter we need 2 lines
|
||||||
/// @param second Documentation for the second parameter
|
/// @param second Documentation for the second parameter
|
||||||
/// @return The result of the multiplication
|
/// @return d The result of the multiplication
|
||||||
function mul(uint a, uint second) public returns (uint d) { return a * 7 + second; }
|
function mul(uint a, uint second) public returns (uint d) { return a * 7 + second; }
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
@ -378,12 +378,15 @@ BOOST_AUTO_TEST_CASE(dev_return)
|
|||||||
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
||||||
" \"second\": \"Documentation for the second parameter\"\n"
|
" \"second\": \"Documentation for the second parameter\"\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" \"return\": \"The result of the multiplication\"\n"
|
" \"return\": {\n"
|
||||||
|
" \"d\": \"The result of the multiplication\"\n"
|
||||||
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}}";
|
"}}";
|
||||||
|
|
||||||
checkNatspec(sourceCode, "test", natspec, false);
|
checkNatspec(sourceCode, "test", natspec, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(dev_return_desc_after_nl)
|
BOOST_AUTO_TEST_CASE(dev_return_desc_after_nl)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
@ -393,7 +396,7 @@ BOOST_AUTO_TEST_CASE(dev_return_desc_after_nl)
|
|||||||
/// Since it's a really complicated parameter we need 2 lines
|
/// Since it's a really complicated parameter we need 2 lines
|
||||||
/// @param second Documentation for the second parameter
|
/// @param second Documentation for the second parameter
|
||||||
/// @return
|
/// @return
|
||||||
/// The result of the multiplication
|
/// d The result of the multiplication
|
||||||
function mul(uint a, uint second) public returns (uint d) {
|
function mul(uint a, uint second) public returns (uint d) {
|
||||||
return a * 7 + second;
|
return a * 7 + second;
|
||||||
}
|
}
|
||||||
@ -408,7 +411,9 @@ BOOST_AUTO_TEST_CASE(dev_return_desc_after_nl)
|
|||||||
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
||||||
" \"second\": \"Documentation for the second parameter\"\n"
|
" \"second\": \"Documentation for the second parameter\"\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" \"return\": \"The result of the multiplication\"\n"
|
" \"return\": {\n"
|
||||||
|
" \"d\": \"The result of the multiplication\"\n"
|
||||||
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}}";
|
"}}";
|
||||||
|
|
||||||
@ -440,7 +445,10 @@ BOOST_AUTO_TEST_CASE(dev_return_desc_multiple_unamed)
|
|||||||
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
||||||
" \"second\": \"Documentation for the second parameter\"\n"
|
" \"second\": \"Documentation for the second parameter\"\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" \"return\": \"The result of the multiplicationAnd cookies with nutella\"\n"
|
" \"return\": {\n"
|
||||||
|
" \"_1\": \"The result of the multiplication\",\n"
|
||||||
|
" \"_2\": \"And cookies with nutella\"\n"
|
||||||
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}}";
|
"}}";
|
||||||
|
|
||||||
@ -455,8 +463,8 @@ BOOST_AUTO_TEST_CASE(dev_return_desc_multiple)
|
|||||||
/// @param a Documentation for the first parameter starts here.
|
/// @param a Documentation for the first parameter starts here.
|
||||||
/// Since it's a really complicated parameter we need 2 lines
|
/// Since it's a really complicated parameter we need 2 lines
|
||||||
/// @param second Documentation for the second parameter
|
/// @param second Documentation for the second parameter
|
||||||
/// @return The result of the multiplication
|
/// @return d The result of the multiplication
|
||||||
/// @return And cookies with nutella
|
/// @return f And cookies with nutella
|
||||||
function mul(uint a, uint second) public returns (uint d, uint f) {
|
function mul(uint a, uint second) public returns (uint d, uint f) {
|
||||||
uint mul = a * 7;
|
uint mul = a * 7;
|
||||||
return (mul, second);
|
return (mul, second);
|
||||||
@ -490,7 +498,7 @@ BOOST_AUTO_TEST_CASE(dev_multiline_return)
|
|||||||
/// @param a Documentation for the first parameter starts here.
|
/// @param a Documentation for the first parameter starts here.
|
||||||
/// Since it's a really complicated parameter we need 2 lines
|
/// Since it's a really complicated parameter we need 2 lines
|
||||||
/// @param second Documentation for the second parameter
|
/// @param second Documentation for the second parameter
|
||||||
/// @return The result of the multiplication
|
/// @return d The result of the multiplication
|
||||||
/// and cookies with nutella
|
/// and cookies with nutella
|
||||||
function mul(uint a, uint second) public returns (uint d) {
|
function mul(uint a, uint second) public returns (uint d) {
|
||||||
return a * 7 + second;
|
return a * 7 + second;
|
||||||
@ -506,7 +514,9 @@ BOOST_AUTO_TEST_CASE(dev_multiline_return)
|
|||||||
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
||||||
" \"second\": \"Documentation for the second parameter\"\n"
|
" \"second\": \"Documentation for the second parameter\"\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" \"return\": \"The result of the multiplication and cookies with nutella\"\n"
|
" \"return\": {\n"
|
||||||
|
" \"d\": \"The result of the multiplication and cookies with nutella\",\n"
|
||||||
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}}";
|
"}}";
|
||||||
|
|
||||||
@ -522,7 +532,7 @@ BOOST_AUTO_TEST_CASE(dev_multiline_comment)
|
|||||||
* @param a Documentation for the first parameter starts here.
|
* @param a Documentation for the first parameter starts here.
|
||||||
* Since it's a really complicated parameter we need 2 lines
|
* Since it's a really complicated parameter we need 2 lines
|
||||||
* @param second Documentation for the second parameter
|
* @param second Documentation for the second parameter
|
||||||
* @return The result of the multiplication
|
* @return d The result of the multiplication
|
||||||
* and cookies with nutella
|
* and cookies with nutella
|
||||||
*/
|
*/
|
||||||
function mul(uint a, uint second) public returns (uint d) {
|
function mul(uint a, uint second) public returns (uint d) {
|
||||||
@ -539,7 +549,9 @@ BOOST_AUTO_TEST_CASE(dev_multiline_comment)
|
|||||||
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
||||||
" \"second\": \"Documentation for the second parameter\"\n"
|
" \"second\": \"Documentation for the second parameter\"\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" \"return\": \"The result of the multiplication and cookies with nutella\"\n"
|
" \"return\": {\n"
|
||||||
|
" \"d\": \"The result of the multiplication and cookies with nutella\",\n"
|
||||||
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}}";
|
"}}";
|
||||||
|
|
||||||
@ -843,7 +855,7 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function)
|
|||||||
/// @param a Documentation for the first parameter starts here.
|
/// @param a Documentation for the first parameter starts here.
|
||||||
/// Since it's a really complicated parameter we need 2 lines
|
/// Since it's a really complicated parameter we need 2 lines
|
||||||
/// @param second Documentation for the second parameter
|
/// @param second Documentation for the second parameter
|
||||||
/// @return The result of the multiplication
|
/// @return d The result of the multiplication
|
||||||
/// and cookies with nutella
|
/// and cookies with nutella
|
||||||
function mul(uint a, uint second) public returns(uint d) {
|
function mul(uint a, uint second) public returns(uint d) {
|
||||||
return a * 7 + second;
|
return a * 7 + second;
|
||||||
@ -859,7 +871,9 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function)
|
|||||||
"a" : "Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines",
|
"a" : "Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines",
|
||||||
"second" : "Documentation for the second parameter"
|
"second" : "Documentation for the second parameter"
|
||||||
},
|
},
|
||||||
"return" : "The result of the multiplication and cookies with nutella"
|
"return" : {
|
||||||
|
"d": "The result of the multiplication and cookies with nutella"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"constructor" : {
|
"constructor" : {
|
||||||
"author" : "Alex",
|
"author" : "Alex",
|
||||||
|
Loading…
Reference in New Issue
Block a user