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

BT-129 - IRS ERC3643 implementation #233

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

mplelis
Copy link
Contributor

@mplelis mplelis commented Dec 6, 2024

No description provided.

* @dev See {IIdentityRegistryStorage-bindIdentityRegistry}.
*/
function bindIdentityRegistry() external view override {
revert ContractIsReadOnly();
Copy link
Collaborator

Choose a reason for hiding this comment

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

just do nothing, don't revert, otherwise the factory won't be able to use this contract, as the factory will try to bind

* @dev See {IIdentityRegistryStorage-storedInvestorCountry}.
*/
function storedInvestorCountry(address _userAddress) external view override returns (uint16) {
return _identities[_userAddress].investorCountry;
Copy link
Collaborator

Choose a reason for hiding this comment

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

just return 42 or something, by default, in case the _identities[_userAddress].investorCountry value is 0
Should have a way for OID owners to publish their country code there in a decentralized way, so that a wallet that is linked to an OID on the IdFactory can update their own country code on this contract

error MaxIRByIRSReached(uint256 _max);


contract IdentityRegistryStorage is IERC3643IdentityRegistryStorage, AgentRoleUpgradeable, IRSStorage, IERC165 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

call this contract another way, we already have an identity registry storage

Copy link
Collaborator

Choose a reason for hiding this comment

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

call it GlobalIRS or something

/**
* @dev See {IIdentityRegistryStorage-addIdentityToStorage}.
*/
function addIdentityToStorage() external view override onlyAgent {
Copy link
Collaborator

Choose a reason for hiding this comment

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

the whole idea of this contract is to provide a decentralized way of managing the links between OIDs and wallet addresses, therefore i think we should allow users to add and remove wallets linked to their OID, but to make sure they are really owning these wallets, they should provide a signature done by this wallet to make the transaction happen. the transaction should be called either by a wallet that is a management key on the OID or by the OID itself (through approve/execute)

/**
* @dev See {IIdentityRegistryStorage-removeIdentityFromStorage}.
*/
function removeIdentityFromStorage() external view override onlyAgent {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment as the addIdentity stuff, but in this case no need of a signature. A wallet can be removed by another wallet that is a management key on the OID or by the OID itself, note that you cannot remove the initial wallet linked to the OID on the IDFactory as that one is registered there forever

* @dev See {IIdentityRegistryStorage-storedIdentity}.
*/
function storedIdentity(address _userAddress) external view override returns (IIdentity) {
return IIdentity(_iidFactory.getIdentity(_userAddress));
Copy link
Collaborator

Choose a reason for hiding this comment

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

fetch from IdFactory only the first time, and store locally, it costs less gas to call internal memory

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