Add export/import functionality #224

Merged
raucao merged 23 commits from feature/export-import into master 2022-09-02 20:31:28 +00:00
3 changed files with 8 additions and 5 deletions
Showing only changes of commit d3fb1010d5 - Show all commits

View File

@ -18,7 +18,11 @@ contract Token is Initializable, ERC20Upgradeable {
event KreditsMinted(address indexed recipient, uint256 amount);
function initialize() public virtual initializer {
__ERC20_init('Kredits', 'KS');
__ERC20_init("Kredits", "KS");
}
function decimals() public view virtual override returns (uint8) {
return 0;
}
Outdated
Review

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?

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.
function setContributorContract(address contributor) public {
@ -31,8 +35,7 @@ contract Token is Initializable, ERC20Upgradeable {
require(contributorContractAddress == msg.sender, "Only Contributor");
require(amount > 0, "INVALID_AMOUNT");
uint256 amountInWei = amount.mul(1 ether);
_mint(contributorAccount, amountInWei);
_mint(contributorAccount, amount);
emit KreditsMinted(contributorAccount, amount);
}
}

File diff suppressed because one or more lines are too long

View File

@ -95,7 +95,7 @@ describe("Contributor contract", async function () {
expect(c['balance']).to.equal(0);
await Contributor.connect(addr1).withdraw();
c = await Contributor.getContributorById(2);
expect(c['balance'].toString()).to.equal("6500000000000000000000");
expect(c['balance']).to.equal(6500);
expect(c['kreditsWithdrawn']).to.equal(6500);
});