-
-
Save longngn/a9766049a978b7459d460f489ef0dc23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given the assetName of LBE NFT, return the booster rate from 110% to 200% | |
function getBoosterRate(nftName) { | |
if (nftName.length !== 32) { | |
throw new Error('NFT name must have 32 chars') | |
} | |
let sum = 0 | |
// only the first 30 chars of NFT name is tied to the wallet | |
// we calculate booster rate from the first 30 chars | |
for (let i = 0; i < 30; i++) { | |
sum += nftName.charCodeAt(i) | |
} | |
return 110 + (sum % 10) * 10 | |
} | |
console.log(getBoosterRate("ZY8B1n0vVm6+11geNb7b8QASBfs9Jz05")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment