ETH Price: $2,581.25 (+6.71%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Data180300682023-08-30 21:23:59433 days ago1693430639IN
0x65E30a86...1A78fe07d
0 ETH0.0019157824.94085026

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
180300602023-08-30 21:22:11433 days ago1693430531  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xCAE4D4Ab...f5a08A4Bb
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
UTPhysicalRedeemStorage

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 5 : UTPhysicalRedeemStorage.sol
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.13;
/*
 *    ██████  ██   ██ ██    ██ ███████ ██  ██████  █████  ██          ██████  ███████ ██████  ███████ ███████ ███    ███ 
 *    ██   ██ ██   ██  ██  ██  ██      ██ ██      ██   ██ ██          ██   ██ ██      ██   ██ ██      ██      ████  ████ 
 *    ██████  ███████   ████   ███████ ██ ██      ███████ ██          ██████  █████   ██   ██ █████   █████   ██ ████ ██ 
 *    ██      ██   ██    ██         ██ ██ ██      ██   ██ ██          ██   ██ ██      ██   ██ ██      ██      ██  ██  ██ 
 *    ██      ██   ██    ██    ███████ ██  ██████ ██   ██ ███████     ██   ██ ███████ ██████  ███████ ███████ ██      ██ 
 *                                                                                                                       
 *                                                                                                                       
 *    ███████ ████████  ██████  ██████   █████   ██████  ███████                                                         
 *    ██         ██    ██    ██ ██   ██ ██   ██ ██       ██                                                              
 *    ███████    ██    ██    ██ ██████  ███████ ██   ███ █████                                                           
 *         ██    ██    ██    ██ ██   ██ ██   ██ ██    ██ ██                                                              
 *    ███████    ██     ██████  ██   ██ ██   ██  ██████  ███████                                                         
 *
 *
 *    GALAXIS - Physical Redemption Trait Storage
 *
 */

import "./UTGenericDroppableStorage.sol";

contract UTPhysicalRedeemStorage is UTGenericDroppableStorage {

    uint256     public constant version    = 20230619;

    uint8       public constant TRAIT_TYPE = 3;     // Physical redemption

    // -- Trait storage per tokenID --
    // tokenID => uint8 value
    mapping(uint16 => uint8) data;

    // Events
    event updateTraitEvent(uint16 indexed _tokenId, uint8 _newData);

    constructor(
        address _registry,
        uint16 _traitId
    ) UTGenericStorage(_registry, _traitId) {
    }

    // update multiple token values at once
    function setData(uint16[] memory _tokenIds, uint8[] memory _value) public onlyAllowed {
        for (uint16 i = 0; i < _tokenIds.length; i++) {
            data[_tokenIds[i]] = _value[i];
            emit updateTraitEvent(_tokenIds[i], _value[i]);
        }
    }

    // update one token value
    function setValue(uint16 _tokenId, uint8 _value) public onlyAllowed {
        data[_tokenId] = _value;
        emit updateTraitEvent(_tokenId, _value);
    }

    // get trait value for one token
    function getValue(uint16 _tokenId) public view returns (uint8) {
        return data[_tokenId];
    }

    // get trait values for an array of tokens
    function getValues(uint16[] memory _tokenIds) public view returns (uint8[] memory) {
        uint8[] memory retval = new uint8[](_tokenIds.length);
        for(uint16 i = 0; i < _tokenIds.length; i++) {
            retval[i] = data[_tokenIds[i]];
        }
        return retval;
    }

    // get trait values for a range of tokens
    function getValues(uint16 _start, uint16 _len) public view returns (uint8[] memory) {
        uint8[] memory retval = new uint8[](_len);
        for(uint16 i = 0; i < _len; i++) {
            retval[i] = data[i+_start];
        }
        return retval;
    }

    // --- For interface: IGenericDroppableStorage ---
    // These functions must be implemented for this trait to be used with UTGenericDropper contract

    // Update one token value to TRAIT_OPEN_VALUE (unified trait opener for each storage)
    // used by the traitDropper contracts
    // return bool - was the trait actually opened (or already in a non initial state)?
    function addTraitToToken(uint16 _tokenId) public onlyAllowed returns(bool wasSet) {
        if (data[_tokenId] == TRAIT_INITIAL_VALUE) {
            data[_tokenId] = TRAIT_OPEN_VALUE;
            emit updateTraitEvent(_tokenId, TRAIT_OPEN_VALUE);
            return true;
        } else {
            return false;            
        }
    }

    // Update multiple token to value TRAIT_OPEN_VALUE (unified trait opener for each storage)
    // used by the traitDropper contracts
    // return: number of tokens actually set (not counting tokens already had the trait opened)
    // addTraitToToken() was not called from the loop to skip the recurring "onlyAllowed"
    function addTraitOnMultiple(uint16[] memory tokenIds) public onlyAllowed returns(uint16 changes) {
        for (uint16 i = 0; i < tokenIds.length; i++) {
            if (data[tokenIds[i]] == TRAIT_INITIAL_VALUE) {
                data[tokenIds[i]] = TRAIT_OPEN_VALUE;
                emit updateTraitEvent(tokenIds[i], TRAIT_OPEN_VALUE);
                changes++;
            }
        }
    }

    // Was the trait activated (meaning it has non zero uint8 value)
    function hasTrait(uint16 _tokenId) public view returns(bool) {
        return getValue(_tokenId) != 0;
    }

    // Read the generic part of the trait (the uint8 status value)
    function getUint8Value(uint16 _tokenId) public view returns(uint8) {
        return getValue(_tokenId);
    }

    // Read the generic part of the trait for multiple tokens (the uint8 status value)
    function getUint8Values(uint16[] memory _tokenIds) public view returns (uint8[] memory) {
        return getValues(_tokenIds);
    }
}

File 2 of 5 : UTGenericDroppableStorage.sol
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.13;

import "../interfaces/IECRegistry.sol";
import "../interfaces/IGenericDroppableStorage.sol";
import "./UTGenericStorage.sol";

abstract contract UTGenericDroppableStorage is UTGenericStorage, IGenericDroppableStorage {
    uint8              constant     TRAIT_INITIAL_VALUE = 0;
    uint8              constant     TRAIT_OPEN_VALUE = 1;
}

File 3 of 5 : IECRegistry.sol
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.13;

interface IECRegistry {
    function addTrait(traitStruct[] memory) external; 
    function getImplementer(uint16 traitID) external view returns (address);
    function addressCanModifyTrait(address, uint16) external view returns (bool);
    function addressCanModifyTraits(address, uint16[] memory) external view returns (bool);
    function hasTrait(uint16 traitID, uint16 tokenID) external view returns (bool);
    // ---- Change start ----
    function setTrait(uint16 traitID, uint16 tokenID, bool) external returns (bool);
    function setTraitUnchecked(uint16 traitID, uint16 tokenId, bool _value) external;
    function setTraitOnMultiple(uint16 traitID, uint16[] memory tokenIds, bool _value) external returns(uint16 changes);
    function setTraitOnMultipleUnchecked(uint16 traitID, uint16[] memory tokenIds, bool[] memory _value) external;
    function getTrait(uint16 id) external view returns (traitStruct memory);
    function getTraits() external view returns (traitStruct[] memory);
    // ---- Change end ----
    function owner() external view returns (address);
    function contractController(address) external view returns (bool);
    function getDefaultTraitControllerByType(uint8) external view returns (address);
    function setDefaultTraitControllerType(address, uint8) external;
    function setTraitControllerAccess(address, uint16, bool) external;
    function traitCount() external view returns (uint16);

    struct traitStruct {
        uint16  id;
        uint8   traitType;              // 0 normal (1bit), 1 range, 2 inverted range, >=3 with storageImplementer
        uint16  start;
        uint16  end;
        bool    enabled;
        address storageImplementer;     // address of the smart contract that will implement the storage for the trait
        string  ipfsHash;
        string  name;
    }
}

File 4 of 5 : IGenericDroppableStorage.sol
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.13;

interface IGenericDroppableStorage {
    // Update one token to value TRAIT_OPEN_VALUE (unified trait opener for each storage)
    // used by the traitDropper contracts
    // return: bool - was the trait actually opened?
    function addTraitToToken(uint16 _tokenId) external returns(bool);

    // Update multiple token to value TRAIT_OPEN_VALUE (unified trait opener for each storage)
    // used by the traitDropper contracts
    // return: number of tokens actually set (not counting tokens already had the trait opened)
    function addTraitOnMultiple(uint16[] memory tokenIds) external returns(uint16 changes);

    // Was the trait activated (meaning it has non zero uint8 value)
    function hasTrait(uint16 _tokenId) external view returns(bool);

    // // Was the trait activated (meaning it has non zero uint8 value) on multiple token
    // function haveTrait(uint16[] memory _tokenId) external view returns(bool[] memory);

    // Read the generic part of the trait (the uint8 status value)
    function getUint8Value(uint16 _tokenId) external view returns(uint8);

    // Read the generic part of the trait for multiple tokens (the uint8 status value)
    function getUint8Values(uint16[] memory _tokenIds) external view returns (uint8[] memory);
}

File 5 of 5 : UTGenericStorage.sol
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.13;

import "../interfaces/IECRegistry.sol";

abstract contract UTGenericStorage {
    uint16      public immutable    traitId;
    IECRegistry public immutable    ECRegistry;

    // Errors
    error UTStorageNotAuthorised(address);

    constructor(
        address _registry,
        uint16 _traitId
    ) {       
        traitId = _traitId;
        ECRegistry = IECRegistry(_registry);
    }

    modifier onlyAllowed() {
        if(!ECRegistry.addressCanModifyTrait(msg.sender, traitId)) {
            revert UTStorageNotAuthorised(msg.sender);
        }
        _;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_registry","type":"address"},{"internalType":"uint16","name":"_traitId","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"UTStorageNotAuthorised","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_tokenId","type":"uint16"},{"indexed":false,"internalType":"uint8","name":"_newData","type":"uint8"}],"name":"updateTraitEvent","type":"event"},{"inputs":[],"name":"ECRegistry","outputs":[{"internalType":"contract IECRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRAIT_TYPE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"addTraitOnMultiple","outputs":[{"internalType":"uint16","name":"changes","type":"uint16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_tokenId","type":"uint16"}],"name":"addTraitToToken","outputs":[{"internalType":"bool","name":"wasSet","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_tokenId","type":"uint16"}],"name":"getUint8Value","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"_tokenIds","type":"uint16[]"}],"name":"getUint8Values","outputs":[{"internalType":"uint8[]","name":"","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_tokenId","type":"uint16"}],"name":"getValue","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_start","type":"uint16"},{"internalType":"uint16","name":"_len","type":"uint16"}],"name":"getValues","outputs":[{"internalType":"uint8[]","name":"","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"_tokenIds","type":"uint16[]"}],"name":"getValues","outputs":[{"internalType":"uint8[]","name":"","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_tokenId","type":"uint16"}],"name":"hasTrait","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"_tokenIds","type":"uint16[]"},{"internalType":"uint8[]","name":"_value","type":"uint8[]"}],"name":"setData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_tokenId","type":"uint16"},{"internalType":"uint8","name":"_value","type":"uint8"}],"name":"setValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"traitId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100e95760003560e01c806354fd4d501161008c578063b9e7a58c11610066578063b9e7a58c14610232578063dc535c5214610245578063ddc39ff114610284578063f6042cc21461029757600080fd5b806354fd4d50146101b65780635bf63c88146101cf578063a45b64941461020957600080fd5b8063184fd4fb116100c8578063184fd4fb1461013f5780632a65a22d146101625780632d0738f81461017c578063384f4a131461018f57600080fd5b8062e7adde146100ee578063133f67f5146101035780631345aa9914610116575b600080fd5b6101016100fc366004610bab565b6102aa565b005b610101610111366004610c6d565b610481565b610129610124366004610ca0565b610599565b6040516101369190610cca565b60405180910390f35b61015261014d366004610d11565b61066c565b6040519015158152602001610136565b61016a600381565b60405160ff9091168152602001610136565b61012961018a366004610d33565b6107ad565b61016a61019d366004610d11565b61ffff1660009081526020819052604090205460ff1690565b6101c1630134b1db81565b604051908152602001610136565b6101f67f000000000000000000000000000000000000000000000000000000000000000b81565b60405161ffff9091168152602001610136565b610152610217366004610d11565b61ffff1660009081526020819052604090205460ff16151590565b610129610240366004610d33565b6107be565b61026c7f000000000000000000000000fe4f33405874abfdc38bc99866911b7264b170b381565b6040516001600160a01b039091168152602001610136565b6101f6610292366004610d33565b61089e565b61016a6102a5366004610d11565b610a8f565b604051630403639960e31b815233600482015261ffff7f000000000000000000000000000000000000000000000000000000000000000b1660248201527f000000000000000000000000fe4f33405874abfdc38bc99866911b7264b170b36001600160a01b03169063201b1cc890604401602060405180830381865afa158015610338573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035c9190610d70565b6103805760405163313b578760e21b81523360048201526024015b60405180910390fd5b60005b82518161ffff16101561047c57818161ffff16815181106103a6576103a6610d92565b6020026020010151600080858461ffff16815181106103c7576103c7610d92565b602002602001015161ffff1661ffff16815260200190815260200160002060006101000a81548160ff021916908360ff160217905550828161ffff168151811061041357610413610d92565b602002602001015161ffff16600080516020610e06833981519152838361ffff168151811061044457610444610d92565b6020026020010151604051610462919060ff91909116815260200190565b60405180910390a28061047481610dbe565b915050610383565b505050565b604051630403639960e31b815233600482015261ffff7f000000000000000000000000000000000000000000000000000000000000000b1660248201527f000000000000000000000000fe4f33405874abfdc38bc99866911b7264b170b36001600160a01b03169063201b1cc890604401602060405180830381865afa15801561050f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105339190610d70565b6105525760405163313b578760e21b8152336004820152602401610377565b61ffff821660008181526020818152604091829020805460ff191660ff86169081179091559151918252600080516020610e06833981519152910160405180910390a25050565b606060008261ffff1667ffffffffffffffff8111156105ba576105ba610aab565b6040519080825280602002602001820160405280156105e3578160200160208202803683370190505b50905060005b8361ffff168161ffff161015610664576000806106068784610ddf565b61ffff1661ffff16815260200190815260200160002060009054906101000a900460ff16828261ffff168151811061064057610640610d92565b60ff909216602092830291909101909101528061065c81610dbe565b9150506105e9565b509392505050565b604051630403639960e31b815233600482015261ffff7f000000000000000000000000000000000000000000000000000000000000000b1660248201526000907f000000000000000000000000fe4f33405874abfdc38bc99866911b7264b170b36001600160a01b03169063201b1cc890604401602060405180830381865afa1580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190610d70565b6107405760405163313b578760e21b8152336004820152602401610377565b61ffff821660009081526020819052604090205460ff166107a45761ffff821660008181526020818152604091829020805460ff191660019081179091559151918252600080516020610e06833981519152910160405180910390a2506001919050565b5060005b919050565b60606107b8826107be565b92915050565b60606000825167ffffffffffffffff8111156107dc576107dc610aab565b604051908082528060200260200182016040528015610805578160200160208202803683370190505b50905060005b83518161ffff16101561089757600080858361ffff168151811061083157610831610d92565b602002602001015161ffff1661ffff16815260200190815260200160002060009054906101000a900460ff16828261ffff168151811061087357610873610d92565b60ff909216602092830291909101909101528061088f81610dbe565b91505061080b565b5092915050565b604051630403639960e31b815233600482015261ffff7f000000000000000000000000000000000000000000000000000000000000000b1660248201526000907f000000000000000000000000fe4f33405874abfdc38bc99866911b7264b170b36001600160a01b03169063201b1cc890604401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190610d70565b6109725760405163313b578760e21b8152336004820152602401610377565b60005b82518161ffff161015610a8957600060ff16600080858461ffff16815181106109a0576109a0610d92565b60209081029190910181015161ffff1682528101919091526040016000205460ff1603610a77576001600080858461ffff16815181106109e2576109e2610d92565b602002602001015161ffff1661ffff16815260200190815260200160002060006101000a81548160ff021916908360ff160217905550828161ffff1681518110610a2e57610a2e610d92565b602002602001015161ffff16600080516020610e068339815191526001604051610a61919060ff91909116815260200190565b60405180910390a281610a7381610dbe565b9250505b80610a8181610dbe565b915050610975565b50919050565b61ffff811660009081526020819052604081205460ff166107b8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610aea57610aea610aab565b604052919050565b600067ffffffffffffffff821115610b0c57610b0c610aab565b5060051b60200190565b803561ffff811681146107a857600080fd5b600082601f830112610b3957600080fd5b81356020610b4e610b4983610af2565b610ac1565b82815260059290921b84018101918181019086841115610b6d57600080fd5b8286015b84811015610b8f57610b8281610b16565b8352918301918301610b71565b509695505050505050565b803560ff811681146107a857600080fd5b60008060408385031215610bbe57600080fd5b823567ffffffffffffffff80821115610bd657600080fd5b610be286838701610b28565b9350602091508185013581811115610bf957600080fd5b85019050601f81018613610c0c57600080fd5b8035610c1a610b4982610af2565b81815260059190911b82018301908381019088831115610c3957600080fd5b928401925b82841015610c5e57610c4f84610b9a565b82529284019290840190610c3e565b80955050505050509250929050565b60008060408385031215610c8057600080fd5b610c8983610b16565b9150610c9760208401610b9a565b90509250929050565b60008060408385031215610cb357600080fd5b610cbc83610b16565b9150610c9760208401610b16565b6020808252825182820181905260009190848201906040850190845b81811015610d0557835160ff1683529284019291840191600101610ce6565b50909695505050505050565b600060208284031215610d2357600080fd5b610d2c82610b16565b9392505050565b600060208284031215610d4557600080fd5b813567ffffffffffffffff811115610d5c57600080fd5b610d6884828501610b28565b949350505050565b600060208284031215610d8257600080fd5b81518015158114610d2c57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600061ffff808316818103610dd557610dd5610da8565b6001019392505050565b600061ffff808316818516808303821115610dfc57610dfc610da8565b0194935050505056fe59e36a51ef2e8e13e64329fb6b5fbf7374047b9ea243ba010d54c737a726f8bda26469706673582212201857ec59904d93e6226a7833ed4743d58e0d5b3ef97c664bb4d67297e46e716464736f6c634300080d0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.