Where is ‘uint256[] memory tokenTraits’ getting called from in this NFT contract?

Hello,

​

I’m looking into NFT contracts and I am analyzing the infamous CREEPZ INVASION GROUNDS contract.

​

Viewable at [

​

On line 307 of CBCStaking.sol, the function \_setTokensValues takes two arrays from memory as arguments, which are used to set the yield value ($loomi token) for a staked NFT. They are uint256\[\] memory tokenIds, and uint256\[\] memory tokenTraits.

​

`function _setTokensValues(`

`address contractAddress,`

`uint256[] memory tokenIds,`

`uint256[] memory tokenTraits`

`) internal {`

`require(tokenIds.length == tokenTraits.length, “Wrong arrays provided”);`

`for (uint256 i; i < tokenIds.length; i++) {`

`if (tokenTraits[i] != 0 && tokenTraits[i] <= 3000 ether) {`

`_tokensMultiplier[contractAddress][tokenIds[i]] = tokenTraits[i];`

`}`

`}`

`}`

&#x200B;

How was data first input into those arrays? Where are they first defined? tokenTraits\[\] in particular only exists in CBCStaking.sol as arguments for functions. Outside of that it is not present in any other creepz contracts.

&#x200B;

How do they do it? If they are derived from the metadata somehow, where is the function responsible

View Source

Categories NFT

Leave a Comment