Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added arbitratorAdded and arbitratorRemoved events #196

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions contracts/TalentLayerPlatformID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ contract TalentLayerPlatformID is ERC721Upgradeable, AccessControlUpgradeable, U
function addArbitrator(address _arbitrator, bool _isInternal) public onlyRole(DEFAULT_ADMIN_ROLE) {
validArbitrators[address(_arbitrator)] = true;
internalArbitrators[address(_arbitrator)] = _isInternal;
emit ArbitratorAdded(_arbitrator, _isInternal);
}

/**
Expand All @@ -429,6 +430,7 @@ contract TalentLayerPlatformID is ERC721Upgradeable, AccessControlUpgradeable, U
function removeArbitrator(address _arbitrator) public onlyRole(DEFAULT_ADMIN_ROLE) {
validArbitrators[address(_arbitrator)] = false;
internalArbitrators[address(_arbitrator)] = false;
emit ArbitratorRemoved(_arbitrator);
}

/**
Expand Down Expand Up @@ -638,6 +640,19 @@ contract TalentLayerPlatformID is ERC721Upgradeable, AccessControlUpgradeable, U
*/
event OriginValidatedProposalFeeRateUpdated(uint256 platformId, uint16 originValidatedProposalFeeRate);

/**
* @notice Emit after the arbitrator is added
* @param arbitrator The address of the new arbitrator
* @param isInternal Boolean denoting if the arbitrator is internal (is part of TalentLayer) or not
*/
event ArbitratorAdded(address arbitrator, bool isInternal);

/**
* @notice Emit after the arbitrator is removed
* @param arbitrator The address of the arbitrator
*/
event ArbitratorRemoved(address arbitrator);

/**
* @notice Emit after the arbitrator is updated for a platform
* @param platformId The Platform Id
Expand Down
4 changes: 4 additions & 0 deletions contracts/interfaces/ITalentLayerPlatformID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ interface ITalentLayerPlatformID is IERC721Upgradeable {
event Mint(address indexed _platformOwnerAddress, uint256 _tokenId, string _platformName);

event CidUpdated(uint256 indexed _tokenId, string _newCid);

event ArbitratorAdded(address arbitrator, bool isInternal);

event ArbitratorRemoved(address arbitrator);
}
8 changes: 7 additions & 1 deletion test/batch/disputeResolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ async function deployAndSetup(
await talentLayerPlatformID.connect(deployer).mintForAddress(platformName, carol.address)

// Add arbitrator to platform available arbitrators
await talentLayerPlatformID.connect(deployer).addArbitrator(talentLayerArbitrator.address, true)
expect(
await talentLayerPlatformID
.connect(deployer)
.addArbitrator(talentLayerArbitrator.address, true),
)
.to.emit(talentLayerPlatformID, 'ArbitratorAdded')
.withArgs(talentLayerArbitrator.address, true)

// Update platform arbitrator, and fee timeout
await talentLayerPlatformID
Expand Down
18 changes: 14 additions & 4 deletions test/batch/fullWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,13 @@ describe('TalentLayer protocol global testing', function () {
})

it('The deployer can add a new available arbitrator', async function () {
await talentLayerPlatformID
.connect(deployer)
.addArbitrator(talentLayerArbitrator.address, true)
expect(
await talentLayerPlatformID
.connect(deployer)
.addArbitrator(talentLayerArbitrator.address, true),
)
.to.emit(talentLayerPlatformID, 'ArbitratorAdded')
.withArgs(talentLayerArbitrator.address, true)
const isValid = await talentLayerPlatformID.validArbitrators(talentLayerArbitrator.address)
expect(isValid).to.be.true

Expand Down Expand Up @@ -441,7 +445,13 @@ describe('TalentLayer protocol global testing', function () {
})

it('The deployer can remove an available arbitrator', async function () {
await talentLayerPlatformID.connect(deployer).removeArbitrator(talentLayerArbitrator.address)
expect(
await talentLayerPlatformID
.connect(deployer)
.removeArbitrator(talentLayerArbitrator.address),
)
.to.emit(talentLayerPlatformID, 'ArbitratorRemoved')
.withArgs(talentLayerArbitrator.address)
const isValid = await talentLayerPlatformID.validArbitrators(talentLayerArbitrator.address)
expect(isValid).to.be.false

Expand Down
Loading