StakingBoostAdapter

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "StakingBoostAdapter.sol": {
      "content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.20;\r
\r
interface IBattleNFT {\r
    function getRarity(uint256 tokenId) external view returns (uint8);\r
    function ownerOf(uint256 tokenId) external view returns (address);\r
}\r
\r
contract StakingBoostAdapter {\r
    IBattleNFT public immutable battleNFT;\r
\r
    constructor(address _battleNFT) {\r
        require(_battleNFT != address(0), "Invalid NFT address");\r
        battleNFT = IBattleNFT(_battleNFT);\r
    }\r
\r
    // Returns a boost multiplier scaled to 10000 (e.g., 10500 = +5% boost)\r
    function getBoost(address user, uint256[] calldata tokenIds) external view returns (uint256) {\r
        uint256 highestRarity = 0;\r
\r
        for (uint256 i = 0; i < tokenIds.length; i++) {\r
            if (battleNFT.ownerOf(tokenIds[i]) == user) {\r
                uint8 rarity = battleNFT.getRarity(tokenIds[i]);\r
                if (rarity > highestRarity) {\r
                    highestRarity = rarity;\r
                }\r
            }\r
        }\r
\r
        // Example boost table:\r
        // 1-star = 10000 (no boost)\r
        // 2-star = 10200\r
        // 3-star = 10500\r
        // 4-star = 11000\r
        // 5-star = 12000\r
        if (highestRarity == 5) return 12000;\r
        if (highestRarity == 4) return 11000;\r
        if (highestRarity == 3) return 10500;\r
        if (highestRarity == 2) return 10200;\r
        return 10000;\r
    }\r
}\r
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": [],
    "evmVersion": "shanghai"
  }
}}

Tags:
Factory|addr:0xbc57d7397681ac05c5a1d7558b1f7a6d13b8be52|verified:true|block:23700130|tx:0x5d4f248a393f545349a433a1f96b56ee70c27b85938e894dcb06d1cc1ad993e2|first_check:1761989652

Submitted on: 2025-11-01 10:34:12

Comments

Log in to comment.

No comments yet.