Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Conversation

@bweick
Copy link
Contributor

@bweick bweick commented Sep 28, 2018

No description provided.

@bweick bweick requested review from a team, asoong and felix2feng September 28, 2018 00:16
@bweick
Copy link
Contributor Author

bweick commented Sep 28, 2018

Integrations with RebalancingSetToken will come next. The interface and constantPriceLibrary I'll be using for integration/tests are already included in this PR.

@coveralls
Copy link

coveralls commented Sep 28, 2018

Pull Request Test Coverage Report for Build 1947

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0004%) to 99.858%

Totals Coverage Status
Change from base Build 1905: 0.0004%
Covered Lines: 510
Relevant Lines: 510

💛 - Coveralls



/**
* @title LinearAuctionLibrary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Knit: ConstantPriceAuctionLibrary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops...yes +1

import { SafeMath } from "zeppelin-solidity/contracts/math/SafeMath.sol";

/**
* @title LinearAuctionLibrary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, we can remove the suffix Library. The other lib files do not have it. Thus, it would be consistent.

*
*/

contract ConstantPriceAuctionLibrary {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a manager proposes a constant price library, couldn't it be very likely that a rebalance could never end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for testing, not for actual deployment. Why I threw it in the mocks folder.

subjectAuctionStartPrice
);
expect(returnedPrice).to.be.bignumber.equal(expectedPrice);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the price hits 0? If possible, what if it becomes negative?

Maybe we can add unit test cases for these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't hit 0...

return {unitShares, issueAmount};
}

public getExpectedLinearAuctionPrice(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Knit: spacing

curveCoefficient: BigNumber,
auctionStartPrice: BigNumber
): BigNumber {
const contractTimeIncrement = new BigNumber(30);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in a constant file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

@asoong asoong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specs for constant price curve?

pragma solidity 0.4.24;

import { SafeMath } from "zeppelin-solidity/contracts/math/SafeMath.sol";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future. Inconsistent spacing. Two lines here

* Contract used in rebalancing auctions to calculate price based off of a linear curve
*
*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None here

uint256 _curveCoefficient
)
external
returns (uint256)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view modifier?

returns (uint256)
{
// Increment price every 30 seconds
uint256 timeIncrement = 30;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to define this since it's not being reused. Clarify the 30 in the comment below

uint256 _curveCoefficient
)
external
returns (uint256)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view

* @title ConstantAuctionPriceCurve
* @author Set Protocol
*
* Contract used in rebalancing auctions to calculate price based off of a linear curve
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comment here. What does constant curve mean? Constant ratio right?

/*
* Return constant price amount
*
* @param _auctionStartTime Time of auction start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these parameters and clarify they are unused but there to conform to IAuctionLibrary. See: https://github.com/SetProtocol/set-protocol-contracts/pull/218/files

* @param _curveCoefficient The slope (or convexity) of the price curve
*/
function getCurrentPrice(
uint256 _auctionStartTime,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these parameter names. Just leave uint256,

import { ERC20Wrapper } from '@utils/erc20Wrapper';
import { CoreWrapper } from '@utils/coreWrapper';
import { RebalancingTokenWrapper } from '@utils/RebalancingTokenWrapper';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove whitespace

export const STANDARD_QUANTITY_ISSUED: BigNumber = ether(10);
export const UNLIMITED_ALLOWANCE_IN_BASE_UNITS = new BigNumber(2).pow(256).minus(1);
export const ZERO: BigNumber = new BigNumber(0);
export const AUCTION_TIME_INCREMENT = new BigNumber(30);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does time denote in these tests? Blocks? Or unix time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unix seconds. Like it does on the blockchain.

…ctionPriceCurve and hard-coded instead. Added view modifier to getCurrentPrice function.
Copy link
Contributor

@felix2feng felix2feng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve sans knits

pragma solidity 0.4.24;

/**
* @title IAuctionLibrary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Knit IAuctionPriceCurve

* @title IAuctionLibrary
* @author Set Protocol
*
* The IAuctionLibrary interface provides a structured way to interact with any AuctionLibrary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Knit IAuctionPriceCurve

const { expect } = chai;


contract('LinearAuctionLibrary', accounts => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinearAuctionPriceCurve

@bweick bweick merged commit 5d42638 into master Sep 28, 2018
@bweick bweick deleted the brian/linear_auction_library branch September 28, 2018 21:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants