Add export/import functionality #224

Merged
raucao merged 23 commits from feature/export-import into master 2022-09-02 20:31:28 +00:00
Owner

Export/import functionality for both development and migrations.

refs #197, #103

Export/import functionality for both development and migrations. refs #197, #103
bumi added 1 commit 2022-08-22 16:13:55 +00:00
Added export/import function for contributors
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2fca436fa8
raucao changed title from Added export/import function for contributors to WIP: Add export/import functionality 2022-08-22 16:14:31 +00:00
raucao added 2 commits 2022-08-23 08:39:27 +00:00
Fix ignored contributions not resolving their promise
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
883f9adb96
raucao added 1 commit 2022-08-23 08:51:00 +00:00
Also export vetoed contributions
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
990e2a9649
raucao added 1 commit 2022-08-23 09:01:58 +00:00
Finish contributor import script
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
1521e272f9
raucao added 2 commits 2022-08-23 09:42:41 +00:00
Formatting
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
55877897be
raucao added 1 commit 2022-08-23 09:46:32 +00:00
Improve CI output
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
3ac1baa569
raucao force-pushed feature/export-import from 3ac1baa569 to 55877897be 2022-08-23 09:47:25 +00:00 Compare
raucao added 1 commit 2022-08-23 09:49:44 +00:00
CI
Some checks reported errors
continuous-integration/drone/push Build is running
continuous-integration/drone/pr Build was killed
27c7e60aed
raucao force-pushed feature/export-import from 27c7e60aed to cf58b9214d 2022-08-23 09:51:22 +00:00 Compare
raucao force-pushed feature/export-import from cf58b9214d to 55877897be 2022-08-23 09:52:22 +00:00 Compare
raucao added 1 commit 2022-08-23 09:55:41 +00:00
CI
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
0fc4eed09a
raucao added 1 commit 2022-08-23 11:17:25 +00:00
Allow deployer to set a migration-done flag
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
de1574155c
* Save deployer's address on contract initialization
* Add modifier for requiring tx sender to be deployer
* Add migrationDone flag and function to set it to finished status
raucao added 1 commit 2022-08-23 11:20:56 +00:00
Add test for setting deployer address
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
90172071fa
raucao added 1 commit 2022-08-23 12:14:37 +00:00
Revert core flag change
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
cd07313679
raucao added 1 commit 2022-08-23 13:42:06 +00:00
Add tests for Contribution#add()
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
67add71a22
raucao added 1 commit 2022-08-23 15:21:11 +00:00
Allow setting confirmedAtBlock and vetoed during migration
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
9dd9d298cc
raucao added 1 commit 2022-08-23 15:35:09 +00:00
Move contract test to its own subdirectory
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
d72413eb66
raucao added 1 commit 2022-08-24 11:56:28 +00:00
Add first Contributor contract test
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
796ccebd84
raucao added 1 commit 2022-08-30 10:19:06 +00:00
Add script for importing contributions
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
f29054bc0b
raucao changed title from WIP: Add export/import functionality to Add export/import functionality 2022-08-30 10:20:03 +00:00
raucao added the
kredits-2
label 2022-08-30 10:20:13 +00:00
raucao self-assigned this 2022-08-30 10:21:20 +00:00
bumi was assigned by raucao 2022-08-30 10:22:29 +00:00
raucao requested review from Contributors 2022-08-30 10:22:51 +00:00
raucao requested review from hueso 2022-08-30 10:24:06 +00:00
raucao removed review request for Contributors 2022-08-30 10:24:06 +00:00
raucao requested review from Core 2022-08-30 10:24:06 +00:00
Owner

Prepare for lift-off!

Prepare for lift-off!
bumi reviewed 2022-08-30 17:38:18 +00:00
@ -61,2 +67,2 @@
require(address(tokenContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
tokenContract = IToken(token);
function finishMigration() public onlyDeployer {
migrationDone = true;
Author
Owner

just to confirm: we do not enable/disable this? once it is "done" it's done.

just to confirm: we do not enable/disable this? once it is "done" it's done.
Owner

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.

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.
Author
Owner

yes, I think so, too

yes, I think so, too
raucao marked this conversation as resolved
@ -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');
Author
Owner

what is the confirmedAtBlock == 0 && vetoed == false?

what is the `confirmedAtBlock == 0 && vetoed == false`?
Owner

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.

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.
Author
Owner

ah ok. yes. makes sense

ah ok. yes. makes sense
raucao marked this conversation as resolved
@ -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;
Author
Owner

where is contributorContract and contributorContractAddress defined? do we need both?
isn't contributorContract already the address?

where is `contributorContract` and `contributorContractAddress` defined? do we need both? isn't `contributorContract` already the address?
Owner

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.

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();
Author
Owner

why XMLHttpRequest ? should this be hre.ethers.provider?

why `XMLHttpRequest` ? should this be ` hre.ethers.provider`?
Owner

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. :)

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. :)
raucao marked this conversation as resolved
raucao added 1 commit 2022-08-31 07:56:08 +00:00
Use ethers from correct parent object
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
258c1cc755
raucao added 1 commit 2022-09-02 07:54:12 +00:00
Merge branch 'master' into feature/export-import
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
d3fb1010d5
hueso approved these changes 2022-09-02 18:47:19 +00:00
raucao merged commit 1c097f37a6 into master 2022-09-02 20:31:28 +00:00
raucao deleted branch feature/export-import 2022-09-02 20:31:28 +00:00
Sign in to join this conversation.
No description provided.