fix
This commit is contained in:
parent
11bc4f9213
commit
54f665b572
|
|
@ -13,9 +13,15 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
|
|
||||||
event NewBuild(uint256 indexed token, string indexed commit_hash);
|
event NewBuild(uint256 indexed token, string indexed commit_hash);
|
||||||
event NewTokenName(uint256 indexed token, string indexed name);
|
event NewTokenName(uint256 indexed token, string indexed name);
|
||||||
event NewTokenDescription(uint256 indexed token, string indexed description);
|
event NewTokenDescription(
|
||||||
|
uint256 indexed token,
|
||||||
|
string indexed description
|
||||||
|
);
|
||||||
event NewTokenImage(uint256 indexed token, string indexed image);
|
event NewTokenImage(uint256 indexed token, string indexed image);
|
||||||
event NewTokenExternalURL(uint256 indexed token, string indexed external_url);
|
event NewTokenExternalURL(
|
||||||
|
uint256 indexed token,
|
||||||
|
string indexed external_url
|
||||||
|
);
|
||||||
event NewTokenENS(uint256 indexed token, string indexed ENS);
|
event NewTokenENS(uint256 indexed token, string indexed ENS);
|
||||||
|
|
||||||
struct Build {
|
struct Build {
|
||||||
|
|
@ -63,7 +69,7 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
string memory ENS,
|
string memory ENS,
|
||||||
string memory commit_hash,
|
string memory commit_hash,
|
||||||
string memory git_repository
|
string memory git_repository
|
||||||
) public payable requireCollectionOwner returns (uint256) {
|
) public payable requireCollectionRole(Roles.Owner) returns (uint256) {
|
||||||
uint256 tokenId = _tokenIds.current();
|
uint256 tokenId = _tokenIds.current();
|
||||||
_mint(to, tokenId);
|
_mint(to, tokenId);
|
||||||
_tokenIds.increment();
|
_tokenIds.increment();
|
||||||
|
|
@ -90,19 +96,37 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
App storage app = _apps[tokenId];
|
App storage app = _apps[tokenId];
|
||||||
|
|
||||||
bytes memory dataURI = abi.encodePacked(
|
bytes memory dataURI = abi.encodePacked(
|
||||||
'{',
|
"{",
|
||||||
'"name":"', app.name, '",',
|
'"name":"',
|
||||||
'"description":"', app.description, '",',
|
app.name,
|
||||||
'"owner":"', Strings.toHexString(uint160(owner), 20), '",',
|
'",',
|
||||||
'"external_url":"', app.external_url, '",',
|
'"description":"',
|
||||||
'"image":"', app.image, '",',
|
app.description,
|
||||||
'"attributes": [',
|
'",',
|
||||||
'{"trait_type": "ENS", "value":"', app.ENS,'"},',
|
'"owner":"',
|
||||||
'{"trait_type": "Commit Hash", "value":"', app.builds[app.current_build].commit_hash,'"},',
|
Strings.toHexString(uint160(owner), 20),
|
||||||
'{"trait_type": "Repository", "value":"', app.builds[app.current_build].git_repository,'"},',
|
'",',
|
||||||
'{"trait_type": "Version", "value":"', Strings.toString(app.current_build),'"}',
|
'"external_url":"',
|
||||||
']',
|
app.external_url,
|
||||||
'}'
|
'",',
|
||||||
|
'"image":"',
|
||||||
|
app.image,
|
||||||
|
'",',
|
||||||
|
'"attributes": [',
|
||||||
|
'{"trait_type": "ENS", "value":"',
|
||||||
|
app.ENS,
|
||||||
|
'"},',
|
||||||
|
'{"trait_type": "Commit Hash", "value":"',
|
||||||
|
app.builds[app.current_build].commit_hash,
|
||||||
|
'"},',
|
||||||
|
'{"trait_type": "Repository", "value":"',
|
||||||
|
app.builds[app.current_build].git_repository,
|
||||||
|
'"},',
|
||||||
|
'{"trait_type": "Version", "value":"',
|
||||||
|
Strings.toString(app.current_build),
|
||||||
|
'"}',
|
||||||
|
"]",
|
||||||
|
"}"
|
||||||
);
|
);
|
||||||
|
|
||||||
return string(abi.encodePacked(_baseURI(), Base64.encode((dataURI))));
|
return string(abi.encodePacked(_baseURI(), Base64.encode((dataURI))));
|
||||||
|
|
@ -191,9 +215,12 @@ contract FleekERC721 is ERC721, FleekAccessControl {
|
||||||
uint256 tokenId,
|
uint256 tokenId,
|
||||||
string memory _commit_hash,
|
string memory _commit_hash,
|
||||||
string memory _git_repository
|
string memory _git_repository
|
||||||
) public virtual requireTokenController(tokenId) {
|
) public virtual requireTokenRole(tokenId, Roles.Controller) {
|
||||||
_requireMinted(tokenId);
|
_requireMinted(tokenId);
|
||||||
_apps[tokenId].builds[++_apps[tokenId].current_build] = Build(_commit_hash, _git_repository);
|
_apps[tokenId].builds[++_apps[tokenId].current_build] = Build(
|
||||||
|
_commit_hash,
|
||||||
|
_git_repository
|
||||||
|
);
|
||||||
emit NewBuild(tokenId, _commit_hash);
|
emit NewBuild(tokenId, _commit_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue