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

feat: first part of service registry replacing agent registry #48

Merged
merged 11 commits into from
Dec 13, 2024

Conversation

DavidMinarsch
Copy link
Contributor

No description provided.

@@ -12,45 +12,71 @@ interface IAgentRegistry {
function create(address agentOwner, bytes32 agentHash) external returns (uint256 agentId);
}


// Service Registry interface
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of duplication now - needs cleaning

/// @title Agent Factory - Periphery smart contract for managing agent and mech creation
contract AgentFactory is GenericManager {
event CreateMech(address indexed mech, uint256 indexed agentId, uint256 indexed price);

// Agent factory version number
string public constant VERSION = "1.1.0";

// Agent registry address
address public immutable agentRegistry;
// Service registry address
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factory should point to service registry. IMO factory could even be deprecated and we add this function to marketplace itself...

// revert WrongServiceState(uint256(state), serviceId);
// }
bytes32 salt = keccak256(abi.encode(multisig, serviceId));
// multisig is isOperator() for the mech
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires us to fly our own mech implementation. Otherwise we have an unnecessary layer of NFT in between

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd vote for that as well

/**
* @dev A Mech that is operated by the multisig of an Olas service
*/
contract OlasMech is Mech, ImmutableStorage {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is almost identical to ERC721Mech except the constructor and isOperator implementations

Comment on lines 120 to 124
IService.ServiceState state;
(, multisig, , , , , state) = IService(_token).mapServices(_tokenId);
if (state != IService.ServiceState.Deployed) {
revert WrongServiceState(uint256(state), _tokenId);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check the service exists and is live

Comment on lines 148 to 150
address multisig;
(, multisig, , , , , ) = IService(_token).mapServices(_tokenId);
return multisig == signer;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operator simplified - we now check if the multisig is the signer

@@ -401,6 +478,7 @@ contract AgentMech is ERC721Mech {
_locked = 1;
}

/// TODO: We need the same system to work with Nevermined pricing.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important that we consider this right from the start. Ideally the factory takes care of creating both types of mechs

@DavidMinarsch DavidMinarsch merged commit 0f89398 into unchained_mm Dec 13, 2024
1 of 2 checks passed
@DavidMinarsch DavidMinarsch deleted the service branch December 13, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants