Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add payroll app to all templates #124
I've been wasting a lot of time dealing with
Note that the code looks completely awkward due to how we need to load from storage, pass by argument, and the rest of ticks and tricks that we needed to do to avoid compiling issues, it definitely won't look good for inexperienced users as an example of how to build a template :/
IDEA: What about implementing a very simple system in which any template can be initialized with 2 transactions, no matter how basic or complex it is.
tx 1) The user deploys a "configuration contract" that simply holds state in a bunch of public variables that can be read later by a template being initialized.
tx 2) The template's initialize function, instead of getting its settings from parameters in a function call, retrieves them from the configuration contract by reading state. The template could even selfdestruct the configuration contract, getting a bit of gas refunded.
The configuration contract could also contain booleans like "installPayrollApp", so that much of the modular functionality of installing a particular combination of apps could be abstracted to the BaseTemplate, making templates even simpler to read and understand.
Would ABI encoder V2 help with the stack issues? There's probably not too much we can do on that regard since we only get 16 slots?
I'm not sure if this would be cheaper than just passing along arguments; the main benefit I see with deploying a configuration contract (or writing to a global, shared one), would be ease of recovering if you only sent 1 / 3 transactions during onboarding or etc.
I made a quick experiment in remix to see if a configuration contract would help with the stack too deep problem, and it looks like the technique produces the errors even sooner than when using plain old function parameters. If you want to have a look and play with it yourselves: https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=17461f2c1dbd9edb598acba1a46ea412