Verified contractExactMIT
MigrationMinter
Address0x295d30f69688fb33430fad6399e469fe385c1bb6
- Balance
0 ETH
- Transactions
179
- Compiler
solc 0.8.30
- Same code
2 more contracts
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- prague
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,725,769
- Creation transaction
- 0x08fd0638eb…6a3bf1598b
75 files
The source code is large: one file is shown at a time. Choose a file in the list.
- project/contracts/migration/MigrationMinter.solmain5.51 KB
- npm/@openzeppelin/[email protected]/access/AccessControlUpgradeable.sol8.28 KB
- npm/@openzeppelin/[email protected]/proxy/utils/Initializable.sol144 B
- npm/@openzeppelin/[email protected]/proxy/utils/UUPSUpgradeable.sol148 B
- npm/@openzeppelin/[email protected]/token/ERC721/ERC721Upgradeable.sol17.92 KB
- npm/@openzeppelin/[email protected]/token/common/ERC2981Upgradeable.sol6.5 KB
- npm/@openzeppelin/[email protected]/utils/ContextUpgradeable.sol1.22 KB
- npm/@openzeppelin/[email protected]/utils/PausableUpgradeable.sol3.68 KB
- npm/@openzeppelin/[email protected]/utils/cryptography/EIP712Upgradeable.sol6.85 KB
- npm/@openzeppelin/[email protected]/utils/introspection/ERC165Upgradeable.sol1.17 KB
- npm/@openzeppelin/[email protected]/access/AccessControl.sol7.02 KB
- npm/@openzeppelin/[email protected]/access/IAccessControl.sol3.34 KB
- npm/@openzeppelin/[email protected]/interfaces/IERC1363.sol4.45 KB
- npm/@openzeppelin/[email protected]/interfaces/IERC165.sol193 B
- npm/@openzeppelin/[email protected]/interfaces/IERC1967.sol637 B
- npm/@openzeppelin/[email protected]/interfaces/IERC20.sol182 B
- npm/@openzeppelin/[email protected]/interfaces/IERC2981.sol1.11 KB
- npm/@openzeppelin/[email protected]/interfaces/IERC5267.sol740 B
- npm/@openzeppelin/[email protected]/interfaces/draft-IERC1822.sol882 B
- npm/@openzeppelin/[email protected]/interfaces/draft-IERC6093.sol6.54 KB
- npm/@openzeppelin/[email protected]/proxy/ERC1967/ERC1967Utils.sol6.26 KB
- npm/@openzeppelin/[email protected]/proxy/beacon/IBeacon.sol473 B
- npm/@openzeppelin/[email protected]/proxy/utils/Initializable.sol9.28 KB
- npm/@openzeppelin/[email protected]/proxy/utils/UUPSUpgradeable.sol6.32 KB
- npm/@openzeppelin/[email protected]/token/ERC20/IERC20.sol2.78 KB
- npm/@openzeppelin/[email protected]/token/ERC20/utils/SafeERC20.sol13.31 KB
- npm/@openzeppelin/[email protected]/token/ERC721/IERC721.sol4.93 KB
- npm/@openzeppelin/[email protected]/token/ERC721/IERC721Receiver.sol997 B
- npm/@openzeppelin/[email protected]/token/ERC721/extensions/IERC721Metadata.sol792 B
- npm/@openzeppelin/[email protected]/token/ERC721/utils/ERC721Utils.sol1.92 KB
- npm/@openzeppelin/[email protected]/utils/Address.sol6.8 KB
- npm/@openzeppelin/[email protected]/utils/Bytes.sol14.74 KB
- npm/@openzeppelin/[email protected]/utils/Context.sol963 B
- npm/@openzeppelin/[email protected]/utils/Errors.sol896 B
- npm/@openzeppelin/[email protected]/utils/LowLevelCall.sol5.55 KB
- npm/@openzeppelin/[email protected]/utils/Panic.sol1.97 KB
- npm/@openzeppelin/[email protected]/utils/ReentrancyGuardTransient.sol2.85 KB
- npm/@openzeppelin/[email protected]/utils/StorageSlot.sol4.18 KB
- npm/@openzeppelin/[email protected]/utils/Strings.sol21.54 KB
- npm/@openzeppelin/[email protected]/utils/TransientSlot.sol5.08 KB
- npm/@openzeppelin/[email protected]/utils/cryptography/ECDSA.sol12.15 KB
- npm/@openzeppelin/[email protected]/utils/cryptography/MessageHashUtils.sol8.63 KB
- npm/@openzeppelin/[email protected]/utils/introspection/ERC165.sol879 B
- npm/@openzeppelin/[email protected]/utils/introspection/IERC165.sol871 B
- npm/@openzeppelin/[email protected]/utils/math/Math.sol32.66 KB
- npm/@openzeppelin/[email protected]/utils/math/SafeCast.sol34.94 KB
- npm/@openzeppelin/[email protected]/utils/math/SignedMath.sol2.61 KB
- project/contracts/dao/ProposalDeposit.sol11.83 KB
- project/contracts/hub/EarthmetaHub.sol21.37 KB
- project/contracts/interfaces/IAggregatorV3.sol419 B
- project/contracts/interfaces/IEarthmetaERC721.sol1.43 KB
- project/contracts/interfaces/IEarthmetaHub.sol2.83 KB
- project/contracts/interfaces/IErrors.sol3.98 KB
- project/contracts/interfaces/IMarketplace.sol2.91 KB
- project/contracts/interfaces/IPriceOracle.sol1.1 KB
- project/contracts/interfaces/IStaking.sol1.76 KB
- project/contracts/lib/Roles.sol2.84 KB
- project/contracts/lib/uniswap/FullMath.sol2.38 KB
- project/contracts/lib/uniswap/OracleLibrary.sol5.49 KB
- project/contracts/lib/uniswap/TickMath.sol3.74 KB
- project/contracts/marketplace/EarthmetaMarketplace.sol20.07 KB
- project/contracts/migration/EMTAirdropDistributor.sol7.27 KB
- project/contracts/mocks/EarthmetaCityV2Mock.sol800 B
- project/contracts/mocks/EarthmetaHubV2Mock.sol809 B
- project/contracts/mocks/EarthmetaMarketplaceV2Mock.sol914 B
- project/contracts/mocks/ReentrantTreasury.sol1.27 KB
- project/contracts/nft/EarthmetaCity.sol1.12 KB
- project/contracts/nft/EarthmetaCountry.sol2.39 KB
- project/contracts/nft/EarthmetaERC721Base.sol13.41 KB
- project/contracts/nft/EarthmetaLand.sol1.09 KB
- project/contracts/oracle/EmtUsdtTwapOracle.sol17.23 KB
- project/contracts/payments/PrimarySale.sol27.28 KB
- project/contracts/staking/AuroraNationsStaking.sol30.34 KB
- project/contracts/staking/EarthmetaStaking.sol22.69 KB
- project/contracts/vesting/EarthmetaVesting.sol23.31 KB
project/contracts/migration/MigrationMinter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IEarthmetaERC721} from "../interfaces/IEarthmetaERC721.sol";
import {Roles} from "../lib/Roles.sol";
import {IErrors} from "../interfaces/IErrors.sol";
/// @title MigrationMinter
/// @author EarthMeta 2026.
/// @notice One-time migration helper that re-mints an EarthMeta ERC-721 collection
/// (City / Country / Land) 1:1 from the v1 → v2 migration snapshot. It
/// holds `MINTER_ROLE` on a single collection and batch-mints the snapshot
/// tokens to their recorded owners with their recorded metadata URIs.
/// @dev Deliberately NOT upgradeable: a disposable, single-purpose box. The
/// collection is fixed at construction (`immutable`, no setter needed). The
/// collection's admin must grant this contract `MINTER_ROLE`; after the
/// migration completes that role is revoked, permanently powering the helper
/// down. Uses a plain `AccessControl` + constructor and a transient
/// reentrancy guard for house-style consistency.
contract MigrationMinter is AccessControl, ReentrancyGuardTransient, IErrors {
/// @notice The ERC-721 collection this helper mints into. Set once at
/// construction and never changed.
IEarthmetaERC721 public immutable collection;
/// @notice One token to (re)mint from the snapshot.
/// @param tokenId The real-world (non-sequential) token id to mint.
/// @param to The snapshot owner that should receive the token.
/// @param uri The token's metadata URI (typically an `ipfs://` URI).
struct MintReq {
uint256 tokenId;
address to;
string uri;
}
/// @dev A token id already exists but belongs to someone other than the
/// snapshot owner — the batch was built from a different plan.
error OwnerMismatch(uint256 tokenId, address actual, address expected);
/// @notice A batch of snapshot tokens was minted.
/// @param count The number of tokens newly minted in THIS batch
/// (tokens that already existed are skipped and not counted).
event MintedBatch(uint256 count);
/// @param collection_ The City/Country/Land collection to mint into.
/// @param admin The DEFAULT_ADMIN (the Timelock in production). Also granted
/// `MIGRATOR_ROLE` so it can drive the mint; revoked after migration.
constructor(address collection_, address admin) {
if (collection_ == address(0) || admin == address(0)) revert ZeroAddress();
collection = IEarthmetaERC721(collection_);
_grantRole(DEFAULT_ADMIN_ROLE, admin);
_grantRole(Roles.MIGRATOR_ROLE, admin);
}
// ─────────────────────────────────────────────────────────────────────────
// Migration minting (MIGRATOR_ROLE, revoked after migration)
// ─────────────────────────────────────────────────────────────────────────
/// @notice Mint a batch of snapshot tokens into the collection.
/// @dev Idempotent per token: any `tokenId` that already exists is skipped,
/// so a batch can be safely retried after a partial/failed run without
/// reverting on the already-minted tokens. Zero-address recipients are
/// rejected by the collection's own `mint`, so no extra check is needed.
/// @param reqs The tokens to mint (id, owner, uri).
function mintBatch(MintReq[] calldata reqs) external onlyRole(Roles.MIGRATOR_ROLE) nonReentrant {
uint256 count;
for (uint256 i = 0; i < reqs.length; i++) {
MintReq calldata r = reqs[i];
// Idempotent ONLY for a genuine retry: a token that already exists
// must already belong to the snapshot owner. If it does not, the id
// was minted from a different plan (or by another minter) and
// skipping would silently deprive the rightful owner of the asset.
if (collection.exists(r.tokenId)) {
if (IERC721(address(collection)).ownerOf(r.tokenId) != r.to)
revert OwnerMismatch(r.tokenId, IERC721(address(collection)).ownerOf(r.tokenId), r.to);
continue;
}
collection.mint(r.tokenId, r.to, r.uri);
unchecked {
++count;
}
}
emit MintedBatch(count);
}
// ─────────────────────────────────────────────────────────────────────────
// Views
// ─────────────────────────────────────────────────────────────────────────
/// @notice Semantic contract version.
/// @return The version string.
function version() external pure returns (string memory) {
return "2.0.0";
}
}
Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"npm/@openzeppelin/[email protected]/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts-upgradeable/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.