From 060b36cb77ac893619c5c2f6ee1ca3e58060aff6 Mon Sep 17 00:00:00 2001 From: Roy Date: Wed, 6 Jul 2022 07:32:32 -0700 Subject: [PATCH] [REFAC] Upgraded applyTojoin() to nominate() --- contracts/CaseUpgradable.sol | 8 ++++---- contracts/JurisdictionUpgradable.sol | 8 ++++---- contracts/abstract/CommonYJUpgradable.sol | 2 +- contracts/interfaces/ICase.sol | 8 ++++---- contracts/interfaces/IJurisdictionUp.sol | 8 ++++---- test/index.ts | 24 +++++++++++------------ 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/contracts/CaseUpgradable.sol b/contracts/CaseUpgradable.sol index 934602f..66fd338 100644 --- a/contracts/CaseUpgradable.sol +++ b/contracts/CaseUpgradable.sol @@ -135,11 +135,11 @@ contract CaseUpgradable is return repo().addressGetOf(address(_HUB), "avatar"); } - /// Apply to join a jurisdiction - function applyTojoin(string memory uri_) external override { + /// Request to Join + function nominate(uint256 soulToken, string memory uri_) external override { // uint256 soulToken = _getExtTokenId(_msgSender()); - uint256 soulToken = _getExtTokenId(msg.sender); //May be a contract - emit Application(soulToken, _msgSender(), uri_); + // uint256 soulToken = _getExtTokenId(msg.sender); //May be a contract + emit Nominate(_msgSender(), soulToken, uri_); } /// Assign to a Role diff --git a/contracts/JurisdictionUpgradable.sol b/contracts/JurisdictionUpgradable.sol index 1363856..e125b01 100644 --- a/contracts/JurisdictionUpgradable.sol +++ b/contracts/JurisdictionUpgradable.sol @@ -229,10 +229,10 @@ contract JurisdictionUpgradable is return _GUIDRemove(_msgSender(), _stringToBytes32("member"), 1); } - /// Apply to join a jurisdiction - function applyTojoin(string memory uri_) external override { - uint256 soulToken = _getExtTokenId(_msgSender()); - emit Application(soulToken, _msgSender(), uri_); + /// Request to Join + function nominate(uint256 soulToken, string memory uri_) external override { + // uint256 soulToken = _getExtTokenId(_msgSender()); + emit Nominate(_msgSender(), soulToken, uri_); } /// Assign Someone Else to a Role diff --git a/contracts/abstract/CommonYJUpgradable.sol b/contracts/abstract/CommonYJUpgradable.sol index 25bdd41..00c07a3 100644 --- a/contracts/abstract/CommonYJUpgradable.sol +++ b/contracts/abstract/CommonYJUpgradable.sol @@ -77,5 +77,5 @@ abstract contract CommonYJUpgradable is function repo() internal view returns (IOpenRepo) { return IOpenRepo(repoAddr()); } - + } diff --git a/contracts/interfaces/ICase.sol b/contracts/interfaces/ICase.sol index 8a5d72a..c03ffda 100644 --- a/contracts/interfaces/ICase.sol +++ b/contracts/interfaces/ICase.sol @@ -14,8 +14,8 @@ interface ICase { /// Set Contract URI function setContractURI(string calldata contract_uri) external; - /// Apply to join a jurisdiction - function applyTojoin(string memory uri) external; + /// Request to Join + function nominate(uint256 soulToken, string memory uri) external; /// Assign Someone to a Role function roleAssign(address account, string calldata role) external; @@ -65,7 +65,7 @@ interface ICase { //Rule Denied (Changed from Confirmed) // event RuleDenied(uint256 ruleId); - /// Applied to Join the Case - event Application(uint256 indexed id, address account, string uri); + /// Nominate + event Nominate(address account, uint256 indexed id, string uri); } diff --git a/contracts/interfaces/IJurisdictionUp.sol b/contracts/interfaces/IJurisdictionUp.sol index 257b28e..295c0d1 100644 --- a/contracts/interfaces/IJurisdictionUp.sol +++ b/contracts/interfaces/IJurisdictionUp.sol @@ -32,8 +32,8 @@ interface IJurisdiction { /// Leave member role in current jurisdiction function leave() external returns (uint256); - /// Apply to join a jurisdiction - function applyTojoin(string memory uri) external; + /// Request to Join + function nominate(uint256 soulToken, string memory uri) external; /// Assign Someone to a Role function roleAssign(address account, string calldata role) external; @@ -97,7 +97,7 @@ interface IJurisdiction { /// New Case Created event CaseCreated(uint256 indexed id, address contractAddress); - /// Applied to Join Jurisdiction - event Application(uint256 indexed id, address account, string uri); + /// Nominate + event Nominate(address account, uint256 indexed id, string uri); } \ No newline at end of file diff --git a/test/index.ts b/test/index.ts index aa383d9..65057bc 100644 --- a/test/index.ts +++ b/test/index.ts @@ -576,13 +576,13 @@ describe("Protocol", function () { }); it("Can Apply to Join", async function () { - //Apply to Join Jurisdiction - let tx = await this.jurisdictionContract.connect(tester).applyTojoin(test_uri); - await tx.wait(); //Get Tester's Avatar TokenID let tokenId = await avatarContract.tokenByAddress(this.testerAddr); + //Apply to Join Jurisdiction + let tx = await this.jurisdictionContract.connect(tester).nominate(tokenId, test_uri); + await tx.wait(); //Expect Event - await expect(tx).to.emit(jurisdictionContract, 'Application').withArgs(tokenId, this.testerAddr, test_uri); + await expect(tx).to.emit(jurisdictionContract, 'Nominate').withArgs(this.testerAddr, tokenId, test_uri); }); it("Can Re-Open Jurisdiction", async function () { @@ -719,13 +719,13 @@ describe("Protocol", function () { }); it("Users Can Apply to Join", async function () { - //Apply to Join Jurisdiction - let tx = await this.caseContract.connect(tester).applyTojoin(test_uri); - await tx.wait(); //Get Tester's Avatar TokenID let tokenId = await avatarContract.tokenByAddress(this.testerAddr); + //Apply to Join Jurisdiction + let tx = await this.caseContract.connect(tester).nominate(tokenId, test_uri); + await tx.wait(); //Expect Event - await expect(tx).to.emit(this.caseContract, 'Application').withArgs(tokenId, this.testerAddr, test_uri); + await expect(tx).to.emit(this.caseContract, 'Nominate').withArgs(this.testerAddr, tokenId, test_uri); }); it("Should Update", async function () { @@ -837,13 +837,13 @@ describe("Protocol", function () { }); it("Anyonw Can Apply to Join", async function () { - //Apply to Join Jurisdiction - let tx = await this.caseContract.connect(tester).applyTojoin(test_uri); - await tx.wait(); //Get Tester's Avatar TokenID let tokenId = await avatarContract.tokenByAddress(this.testerAddr); + //Apply to Join Jurisdiction + let tx = await this.caseContract.connect(tester).nominate(tokenId, test_uri); + await tx.wait(); //Expect Event - await expect(tx).to.emit(this.caseContract, 'Application').withArgs(tokenId, this.testerAddr, test_uri); + await expect(tx).to.emit(this.caseContract, 'Nominate').withArgs(this.testerAddr, tokenId, test_uri); }); it("Should Accept Verdict URI & Close Case", async function () {