Add export/import functionality #224
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/export-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Export/import functionality for both development and migrations.
refs #197, #103
Added export/import function for contributorsto WIP: Add export/import functionality3ac1baa569
to55877897be
27c7e60aed
tocf58b9214d
cf58b9214d
to55877897be
WIP: Add export/import functionalityto Add export/import functionalityPrepare for lift-off!
@ -61,2 +67,2 @@
require(address(tokenContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
tokenContract = IToken(token);
function finishMigration() public onlyDeployer {
migrationDone = true;
just to confirm: we do not enable/disable this? once it is "done" it's done.
Anything is open for discussion still. But it does seem awfully dangerous to me to have a switch that allows creating confirmed contributions at any point in time.
yes, I think so, too
@ -156,0 +158,4 @@
function add(uint32 amount, uint32 contributorId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool vetoed) public {
// require(canPerform(msg.sender, ADD_CONTRIBUTION_ROLE, new uint32[](0)), 'nope');
// TODO hubot neither has kredits nor a core account
require((confirmedAtBlock == 0 && vetoed == false) || migrationDone == false, 'extra arguments during migration only');
what is the
confirmedAtBlock == 0 && vetoed == false
?It requires those argument values when it's not a migration. There are no optional arguments or default values in Solidity. After having played around with a few solutions, I thought this one was the most elegant, as well as clearest and safest one.
ah ok. yes. makes sense
@ -30,3 +24,4 @@
function setContributorContract(address contributor) public {
require(address(contributorContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
contributorContract = ContributorInterface(contributor);
contributorContractAddress = contributor;
where is
contributorContract
andcontributorContractAddress
defined? do we need both?isn't
contributorContract
already the address?Yes, I think we need both, since the interface doesn't seem to expose the address. But if you know a way to get from the interface to the address, then that would be great.
@ -0,0 +7,4 @@
console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`);
const count = await kredits.Contribution.count;
const currentBlockHeight = await XMLHttpRequest.ethers.provider.getBlockNumber();
why
XMLHttpRequest
? should this behre.ethers.provider
?Copied from somewhere, but now I can't find from where exactly. I'll change it. By the way, you added this yourself, according to Git. :)