Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move state management to Redux/Mobx #184

Closed
igorbarinov opened this issue Sep 25, 2017 · 10 comments
Closed

Move state management to Redux/Mobx #184

igorbarinov opened this issue Sep 25, 2017 · 10 comments

Comments

@igorbarinov
Copy link
Member

igorbarinov commented Sep 25, 2017

Roman suggested to look into https://github.com/mobxjs/mobx instead of Redux

@igorbarinov igorbarinov changed the title Move state management to Redux Move state management to Redux/Mobx Sep 25, 2017
@rstormsf
Copy link

@mark-antony1
Copy link
Contributor

mark-antony1 commented Sep 27, 2017

@rstormsf upon further review, mobx is a great approach to state management here. My only concern is decoupling the actions from the underlying data in a store. Do you have any insight here?

@vbaranov
Copy link
Collaborator

@15chrjef current state structure is here

@mark-antony1
Copy link
Contributor

mark-antony1 commented Sep 28, 2017

{
	"icoWizard": {
		"compilerVersion": "0.4.11",
		"contractName": "MintedTokenCappedCrowdsaleExt",
		"contractType": "white-list-with-cap",
		"optimized": true,
		"crowdsaleWalletAddress": "0x005364854d51a0a12cb3cb9a402ef8b30702a565"
	},
	"contracts": {
		"token": {
			"src": "",
			"bin": "",
			"abi": [],
			"addr": "",
			"abiConstructor": ""
		},
		"crowdsale": {
			"src": "",
			"bin": "",
			"abi": [],
			"addr": [],
			"abiConstructor": []
		},
		"pricingStrategy": {
			"src": "",
			"bin": "",
			"abi": [],
			"addr": [],
			"abiConstructor": []
		},
		"multisig": {},
		"nullFinalizeAgent": {
			"src": "",
			"bin": "",
			"abi": [],
			"addr": "",
			"abiConstructor": ""
		},
		"finalizeAgent": {
			"src": "",
			"bin": "",
			"addr": [],
			"abiConstructor": []
		},
		"tokenTransferProxy": {},
		"safeMathLib": {
			"src": "",
			"bin": "",
			"addr": "",
			"abiConstructor": ""
		}
	},
	"token": {
		"name": "MyToken",
		"ticker": "MTK",
		"supply": 0,
		"decimals": "18"
	},
	"reservedTokens": [
		{
			"addr": "0x005364854d51A0A12cb3cb9A402ef8b30702a565",
			"dim": "tokens",
			"val": "10"
		}
	],
	"reservedTokensElements": [
		{
			"key": "0",
			"ref": null,
			"props": {
				"num": 0,
				"addr": "0x005364854d51A0A12cb3cb9A402ef8b30702a565",
				"dim": "tokens",
				"val": "10"
			},
			"_owner": null,
			"_store": {}
		}
	],
	"reservedTokensInput": {
		"dim": "tokens",
		"addr": "",
		"val": ""
	},
	"stepTwoValidations": {
		"name": "VALIDATED",
		"ticker": "VALIDATED",
		"decimals": "VALIDATED",
	},
	"stepThreeValidations": {
		"tier": "VALIDATED",
		"startTime": "VALIDATED",
		"endTime": "VALIDATED",
		"supply": "VALIDATED",
		"rate": "VALIDATED",
		"updatable": "INVALID"
	},
	"pricingStrategies": [
		{
			"rate": "10000"
		},
		{
			"rate": "1000"
		}
	],
	"tiers": [
		{
			"tier": "Tier 1",
			"updatable": "on",
			"whitelistdisabled": "no",
			"startTime": "2017-09-28T17:05",
			"endTime": "2017-10-03T00:05:00",
			"supply": "1000",
			"whitelist": {
				"addr": "0x005364854d51A0A12cb3cb9A402ef8b30702a565",
				"min": "1",
				"max": "10"
			},
			"whiteListElements": {
				"key": "0",
				"ref": null,
				"props": {
					"crowdsaleNum": 0,
					"whiteListNum": 0,
					"addr": "0x005364854d51A0A12cb3cb9A402ef8b30702a565",
					"min": "1",
					"max": "10"
				},
				"_owner": null,
				"_store": {}
			},
			"whiteListInput": {
				"addr": "",
				"min": "",
				"max": ""
			},
		},
		{
			"tier": "Tier 2",
			"supply": "1000",
			"updatable": "on",
			"whitelist": [],
			"whiteListElements": [],
			"whiteListInput": {},
			"startTime": "2017-10-03T00:05:00",
			"endTime": "2017-10-07T00:05:00"
		}
	],
}

@vbaranov
Copy link
Collaborator

My suggestions:
1.

"crowdsale": {
"startTime": "2017-09-28T17:05",
"endTime": "2017-10-03T00:05:00",
"walletAddress": "0x005364854d51a0a12cb3cb9a402ef8b30702a565",
"supply": "1000"
}

Only walletAddress here is the global parameter of the crowdsale. Others relate to tier. I suggest, to move startTime, endTime, supply back to tiers[0] element properties.
2.

"whitelist": {
"addr": "0x005364854d51A0A12cb3cb9A402ef8b30702a565",
"min": "1",
"max": "10"
},
"whiteListElements": {
"key": "0",
"ref": null,
"props": {
"crowdsaleNum": 0,
"whiteListNum": 0,
"addr": "0x005364854d51A0A12cb3cb9A402ef8b30702a565",
"min": "1",
"max": "10"
},
"_owner": null,
"_store": {}
},
"whiteListInput": {
"addr": "",
"min": "",
"max": ""
},

It is the tier[0] properties too. It should be moved there.

In this case the total change, that you suggest is to

  1. rename crowdsale[] to tiers[]
  2. move walletAddress property from tiers[0] to crowdsale{}

Right @15chrjef ?

@mark-antony1
Copy link
Contributor

Those are the changes yes, but what does 'it' refer to in 'It is the tier[0] properties too. It should be moved there.'? Should the whitelist, whitelistelement, _owner, _store, and whiteListInput all be moved to tier?

@mark-antony1
Copy link
Contributor

@vbaranov updated json above.

@vbaranov
Copy link
Collaborator

vbaranov commented Oct 1, 2017

Those are the changes yes, but what does 'it' refer to in 'It is the tier[0] properties too. It should be moved there.'? Should the whitelist, whitelistelement, _owner, _store, and whiteListInput all be moved to tier?

Yes, Jeff. They should be moved to the first element of tiers array (except _owner, _store): each tier has own whitelist, whitelistelement, and whiteListInput.

@mark-antony1
Copy link
Contributor

alright, updated JSON above, let me know if there are any other changes to be made otherwise, I'll start working on state management.

@igorbarinov
Copy link
Member Author

Implemented here #363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants