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: improve mint price #6

Open
wants to merge 1 commit 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
8 changes: 5 additions & 3 deletions contracts/dynamic-nft/DevNFTRenderer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "./GithubLinkResolver.sol";
import "./NFTRenderer.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

address payable constant SCHEMA_RESOLVER = payable(0x63FD503800a89280EA1319c7B59E6aa419161aAB);
address payable constant SCHEMA_RESOLVER = payable(0xa1FCf93a451de8De96B6083088648fe0DDAb6707);
address payable constant GITHUB_RESOLVER = payable(0x6455E470f9Ecee5755930c9979b559768BF53170);

contract DevNFTRenderer is NFTRenderer {
Expand All @@ -26,8 +26,10 @@ contract DevNFTRenderer is NFTRenderer {
}

function isEligibleToMint(address tokenOwner, string memory repository) public view returns (bool) {
(uint256 totalAttestations,,,) = getAttestationInfo(tokenOwner, repository);
return (totalAttestations > 0);
string memory githubUsername = getGithubUsername(tokenOwner);
bool isElegible = schemaResolver.userHaveAttestations(githubUsername, repository, _attester);
require(isElegible, "User doesn't have any contributions");
return isElegible;
}

function formatTokenURI(address tokenOwner, string memory nftName, string memory repository, uint256 tokenId) public view returns (string memory) {
Expand Down
4 changes: 4 additions & 0 deletions contracts/dynamic-nft/DevSchemaResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ contract DevSchemaResolver is SchemaResolver {
return true;
}

function userHaveAttestations(string memory _username, string memory _repository, address _attester) public view returns(bool) {
return devAttestations[_attester][_username][_repository].length > 0;
}

function getUserAttestationInformation(string memory _username, string memory _repository, address _attester)
public view
returns (AttestationInfo memory) {
Expand Down
1 change: 0 additions & 1 deletion contracts/dynamic-nft/DynamicNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "./NFTRenderer.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";


contract DynamicNFT is ERC721URIStorage {
uint256 public tokenId;
NFTRenderer public nftRenderer;
Expand Down