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 Aug 14, 2018

First run implementation of rebalancing set. WIP. Testing not complete b/c need to find way to more gracefully move through states and need future functionality for full test.

@coveralls
Copy link

coveralls commented Aug 14, 2018

Pull Request Test Coverage Report for Build 1365

  • 40 of 40 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 1332: 0.0%
Covered Lines: 382
Relevant Lines: 382

💛 - Coveralls

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.

Nice start on this! I was just able to take a first look. I'll try to spend more time on this

@@ -0,0 +1,389 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can move the SetToken, SetTokenFactory, RebalancingSet, and RebalancingSetFactory into their own directory

Copy link
Contributor Author

@bweick bweick Aug 15, 2018

Choose a reason for hiding this comment

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

Sure...I'll leave the organization to @asoong :)

import { ISetFactory } from "./interfaces/ISetFactory.sol";

/**
* @title SetToken
Copy link
Contributor

Choose a reason for hiding this comment

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

Rebalancing Set Token

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RebalancingToken is the verbage we settled on

/* ============ Constructor ============ */

/**
* Constructor function for Rebalancing Set Token
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we note that this initial Rebalancing Set uses a manager vs. other oracle system

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my mind this can use either. It's just an address, all someone needs to do is prop up a smart contract that acts as the oracle and set that as the manager.

*/

constructor(
address _factory,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this Rebalancing Set to conform to a normal Set? So that it includes components, units, naturalUnit, etc.?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see from below that share Ratio is just the internal naming

DetailedERC20(_name, _symbol, 18)
{
// Require day long proposal period
require(_proposalPeriod > 86400);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ethereum has a global variable / unit called day

https://solidity.readthedocs.io/en/v0.4.24/units-and-global-variables.html?highlight=day

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool yeah still not sure what I wanna set that at, but yeah that's a good thing to use.

external
{
// Must be in "Proposal" state before going into "Rebalance" state
require(rebalanceState == State.Proposal);
Copy link
Contributor

Choose a reason for hiding this comment

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

We could probably abstract the state transition and timing checks into a private function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you explain what you mean? If it's what I think you mean I suppose that would look cleaner but not sure it'd be more efficient.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's just an optimization (can be done later), but we can have a state transition function so we dedupe the logic.

require(block.timestamp >= lastRebalanceTimestamp.add(rebalanceInterval));

// Set auction parameters
rebalancingSet = _rebalancingSet;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have a check to ensure that the address proposed is indeed a Set, perhaps querying Core

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I'd be ok with that.

function getComponents()
external
view
returns(address[1])
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this more efficient? I think the normal getComponents interface is just address[]. Wonder if there's any issues with address[1]

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 wouldn't let me return a dynamic address for whatever reason. Perhaps because what's being returned isn't dynamic in nature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be an issue when we go to issue (lol)...I'll have to consider ways to be able to return a dynamic address array

public
returns (bool)
{
// Confirm address is not null
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason we remove this

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 duped...that logic already exists in the StandardToken contract which we call through super.

@bweick bweick force-pushed the brian/rebalancing_set_basic branch from b5dcf16 to 516040d Compare August 16, 2018 04:30
@bweick bweick requested a review from a team August 16, 2018 16:36
external
{
// Must be in "Proposal" state before going into "Rebalance" state
require(rebalanceState == State.Proposal);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's just an optimization (can be done later), but we can have a state transition function so we dedupe the logic.

const RebalancingToken = artifacts.require('RebalancingToken');

contract('RebalancingSet', accounts => {
contract('RebalancingToken', accounts => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we normalize to rebalancing set or rebalancing token?

@bweick bweick merged commit fde0770 into master Aug 16, 2018
@bweick bweick deleted the brian/rebalancing_set_basic branch August 16, 2018 21:27
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.

3 participants