Skip to content

GitFactory

jacekv edited this page Jun 28, 2021 · 3 revisions

This Section will describe which methods the GitFactory contract provides and how it internally works.

The GitFactory contract inherits from the Ownable contract and provides the following methods:

createRepository(string memory _repoName) public 
removeRepository(string memory _repoName, uint256 _userIndex, uint256 _repoIndex) public
collectTips() public onlyOwner()
getRepositoryNames() view public returns (string[] memory)
getUsersRepositories(address _owner) view public returns (string[] memory)
getRepositoriesUserList(string memory _repoName) view public returns (address[] memory)
getUserRepoNameHash(address _owner, string memory _repoName) pure public returns (bytes32)
getRepository(bytes32 location) view public returns (LibGitFactory.Repository memory)
addFacet(IDiamondCut.FacetCut memory _diamondCut) public onlyOwner
removeFacet(uint index) public onlyOwner
replaceFacet(IDiamondCut.FacetCut memory _diamondCut, uint index) public onlyOwner
updateRepositoriesFacets(address reposAddress, IDiamondCut.FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) public onlyOwner
receive() public

Create Repository

createRepository(string memory _repoName) public 

This function is used to create a new repository. By providing a name, a new GitRepository smart contract is deployed.

Remove Repository

removeRepository(string memory _repoName, uint256 _userIndex, uint256 _repoIndex) public

Used to remove a repository from the internal 'database'. It takes the owner of the repository, the repository name, the userIndex (describes at what position the owner's address is written in the reposUserList array), and the repoIndex (describes at what position the repositories name is written in the usersRepoList array). It removes the values from the arrays and reorganizes them.

This function should be called only by GitRepository contracts.

Collect tips

collectTips() public onlyOwner()

Get Repository Names

getRepositoryNames() view public returns (string[] memory)

Get Users Repositories

getUsersRepositories(address _owner) view public returns (string[] memory)

Get Repositories User List

getRepositoriesUserList(string memory _repoName) view public returns (address[] memory)

Get User Repo Name Hash

getUserRepoNameHash(address _owner, string memory _repoName) pure public returns (bytes32)

Get Repository

getRepository(bytes32 location) view public returns (LibGitFactory.Repository memory)

AddFacet

addFacet(IDiamondCut.FacetCut memory _diamondCut) public onlyOwner

Remove Facet

removeFacet(uint index) public onlyOwner

Replace Facet

replaceFacet(IDiamondCut.FacetCut memory _diamondCut, uint index) public onlyOwner

Update Repositories Facets

updateRepositoriesFacets(address reposAddress, IDiamondCut.FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) public

Only Owner

onlyOwner

Receive

receive() public