From 131a71dd0a8f8fe695e6451be40ffe6b465dac4d Mon Sep 17 00:00:00 2001 From: Jonathan Becker <64037729+Jon-Becker@users.noreply.github.com> Date: Wed, 1 Jun 2022 22:19:20 -0400 Subject: [PATCH] Fixing rendering & some more optimizations for renoun.sol --- src/contracts/BadgeRenderer.sol | 6 +++++- src/contracts/renoun.sol | 10 +++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contracts/BadgeRenderer.sol b/src/contracts/BadgeRenderer.sol index ffada7c..c2ccad1 100644 --- a/src/contracts/BadgeRenderer.sol +++ b/src/contracts/BadgeRenderer.sol @@ -113,7 +113,11 @@ contract BadgeRenderer { /// @param _precision The number of decimal places to include in the string /// @return The formatted string function _formatInteger(uint256 _integerAsUint, uint256 _precision) internal pure returns (string memory) { - + + if (_integerAsUint == 0) { + return "0"; + } + // calculate the length of _integerAsUint uint256 len; uint256 j = _integerAsUint; diff --git a/src/contracts/renoun.sol b/src/contracts/renoun.sol index 3f08553..e29243e 100644 --- a/src/contracts/renoun.sol +++ b/src/contracts/renoun.sol @@ -87,8 +87,6 @@ contract Renoun is ERC721 { string _pullRequestCreatorPictureURL; string _pullRequestCreatorUsername; string _commitHash; - string _repositoryOwner; - string _repositoryName; } mapping(uint256 => address) private _ownership; @@ -150,9 +148,7 @@ contract Renoun is ERC721 { _deletions, _pullRequestCreatorPictureURL, _pullRequestCreatorUsername, - _commitHash, - repositoryOwner, - repositoryName + _commitHash ); totalSupply++; _ownership[totalSupply] = _to; @@ -280,8 +276,8 @@ contract Renoun is ERC721 { _contribution._pullRequestCreatorPictureURL, _contribution._pullRequestCreatorUsername, _contribution._commitHash, - _contribution._repositoryOwner, - _contribution._repositoryName, + repositoryOwner, + repositoryName, repositoryStars, repositoryContributors );