Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

refactor: use constants to get forgeFactory address #355

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

peterjah
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Oct 15, 2021

Codecov Report

Merging #355 (40b35c4) into develop (c491880) will decrease coverage by 0.03%.
The diff coverage is 15.38%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #355      +/-   ##
===========================================
- Coverage    58.89%   58.86%   -0.04%     
===========================================
  Files          531      531              
  Lines        15092    15104      +12     
  Branches      2182     2185       +3     
===========================================
+ Hits          8889     8891       +2     
- Misses        6157     6167      +10     
  Partials        46       46              
Flag Coverage Δ
functional 26.82% <15.38%> (-0.01%) ⬇️
unit 44.54% <15.38%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
plugins/uns/uns-crypto/src/crypto/uns-crypto.ts 0.00% <0.00%> (ø)
...uns/uns-transactions/src/handlers/utils/helpers.ts 59.70% <22.22%> (-5.82%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c491880...40b35c4. Read the comment docs.

@peterjah peterjah force-pushed the forge_facory_addr branch 3 times, most recently from 8962c7a to ee04b7d Compare October 18, 2021 15:35
@peterjah peterjah marked this pull request as ready for review October 18, 2021 15:51
Copy link
Contributor

@dlecan dlecan left a comment

Choose a reason for hiding this comment

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

Please, no hardcoded addresses

Comment on lines 68 to 92
switch (network) {
case "dalinet":
if (tokenId === "5f96dd359ab300e2c702a54760f4d74a11db076aa17575179d36e06d75c96511") {
return "DTRnY3JjFpAnCX1nFtF8M4v8X7WdvPYRxb";
}
break;
case "sandbox":
if (tokenId === "ed4eaa7299284ac4c0665d2edecc3064a33134566d94e6ffceebc1ab32251a04") {
return "SYD1xMGubmzW1qme18yxmVhpWxpoBJqv2v";
}

if (tokenId === "8ddab07ee0f49c76db32018a9305d7634264c39a89317f68a8069c161f4b8ec6") {
return "Scms9QGQnSe7SGegVAa61dR2GTUTa586R1";
}
break;
case "livenet":
if (tokenId === "fbfbe7d9e8c005f1a9937d9fd17c4ef7da2ff8037a71e6cb7847b302eda4d08a") {
return "USLEkzoncHwRdNyPVTPNJSjRXt6pYHzk43";
}
if (tokenId === "8bdd3a5358a8c6e0d96796048a87a8d83d076c73f52a0b850575e95f192376f9") {
return "UYcNuMK46RdFyGVmwrT3i11W16fE5N59j4";
}
break;
}
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just use a Map for that
If the key is missing, look for it in the DB and add the result to the Map

// This little hack is intended to reduce the call to the nft database.
// We call getUnikOwnerAddress of forgefactory at every certified transactions, especially at core bootstrap.
// Its imply that forge factory NFT should not be transferable
public getForgeFactoryAddress(tokenId: string): string | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

undefined shouldn't be allowed as a returned value

@peterjah peterjah force-pushed the forge_facory_addr branch 2 times, most recently from 21bc83d to 78740d8 Compare October 19, 2021 15:24
@sonarcloud
Copy link

sonarcloud bot commented Oct 19, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
29.4% 29.4% Duplication

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants