MAP
Address
0xD3a7A95012Edd46Ea115c693B74c5e524b3DdA75Code
[
{
"inputs": [
{
"internalType": "address",
"name": "ChoAddress",
"type": "address"
},
{
"internalType": "address",
"name": "HeckeAddress",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "Integrative",
"type": "address"
},
{
"internalType": "uint256",
"name": "Waat",
"type": "uint256"
}
],
"name": "DerivativeQing",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "address",
"name": "what",
"type": "address"
},
{
"internalType": "uint256",
"name": "allowance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "needed",
"type": "uint256"
}
],
"name": "DysnomiaInsufficientAllowance",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "address",
"name": "what",
"type": "address"
},
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "needed",
"type": "uint256"
}
],
"name": "DysnomiaInsufficientBalance",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "which",
"type": "address"
}
],
"name": "ForbiddenToken",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "asset",
"type": "address"
}
],
"name": "MarketRateNotFound",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "what",
"type": "address"
},
{
"internalType": "address",
"name": "who",
"type": "address"
}
],
"name": "NotOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "what",
"type": "address"
}
],
"name": "OwnableInvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "address",
"name": "what",
"type": "address"
}
],
"name": "OwnableUnauthorizedAccount",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "Token",
"type": "address"
},
{
"internalType": "address",
"name": "Qing",
"type": "address"
}
],
"name": "QingAlreadyExists",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "Qing",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "Integrative",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "Waat",
"type": "uint256"
}
],
"name": "NewQing",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "bool",
"name": "state",
"type": "bool"
}
],
"name": "OwnershipUpdate",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"name": "Cho",
"outputs": [
{
"internalType": "contract CHOINTERFACE",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "Token",
"type": "address"
},
{
"internalType": "bool",
"name": "Disallow",
"type": "bool"
}
],
"name": "Forbid",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "Asset",
"type": "address"
}
],
"name": "Forbidden",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "int256",
"name": "Latitude",
"type": "int256"
},
{
"internalType": "int256",
"name": "Longitude",
"type": "int256"
}
],
"name": "GetMapQing",
"outputs": [
{
"internalType": "contract QINGINTERFACE",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_a",
"type": "address"
}
],
"name": "GetMarketRate",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "Waat",
"type": "uint256"
}
],
"name": "GetQing",
"outputs": [
{
"internalType": "contract QING",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "Map",
"outputs": [
{
"internalType": "contract HECKE",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MotzkinPrime",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "Integrative",
"type": "address"
}
],
"name": "New",
"outputs": [
{
"internalType": "contract QING",
"name": "Mu",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "Offset",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_t",
"type": "address"
},
{
"internalType": "uint256",
"name": "_a",
"type": "uint256"
}
],
"name": "Purchase",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_t",
"type": "address"
},
{
"internalType": "uint256",
"name": "_a",
"type": "uint256"
}
],
"name": "Redeem",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "newName",
"type": "string"
},
{
"internalType": "string",
"name": "newSymbol",
"type": "string"
}
],
"name": "Rename",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "Type",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "Xiao",
"outputs": [
{
"internalType": "contract atropaMath",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "addOwner",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_contract",
"type": "address"
},
{
"internalType": "string",
"name": "what",
"type": "string"
}
],
"name": "has",
"outputs": [
{
"internalType": "bool",
"name": "does",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_contract",
"type": "address"
}
],
"name": "hasOwner",
"outputs": [
{
"internalType": "bool",
"name": "does",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "maxSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "mintToCap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "cOwner",
"type": "address"
}
],
"name": "owner",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "toRemove",
"type": "address"
}
],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]// SPDX-License-Identifier: Sharia
pragma solidity ^0.8.21;
import "./dan/03_qing.sol";
import "../interfaces/heckeinterface.sol";
contract MAP is DYSNOMIA {
string public constant Type = "MAP";
CHOINTERFACE public Cho;
HECKE public Map;
uint256 public Offset;
mapping(address Asset => address Qing) private _qings;
mapping(uint256 Waat => QING) private _waats;
mapping(address Asset => bool Forbidden) private _forbidden;
mapping(int256 Latitude => mapping(int256 Longitude => address Qing)) private _map;
constructor(address ChoAddress, address HeckeAddress) DYSNOMIA("Dysnomia Map", "MAP", address(DYSNOMIA(ChoAddress).Xiao())) {
Cho = CHOINTERFACE(ChoAddress);
Map = HECKE(HeckeAddress);
Offset = Map.Meridians(0);
Cho.addOwner(address(this));
Cho.Void().addOwner(address(this));
uint256 originMint = Xiao.Random() % maxSupply / 10;
_mint(tx.origin, originMint * 10 ** decimals());
_addMarketRate(AFFECTIONContract, 1 * 10 ** decimals());
_addMarketRate(ChoAddress, 1 * 10 ** decimals());
}
function addToMap(uint256 Waat, address Qing) internal {
(int256 Longitude, int256 Latitude) = Map.Compliment(Waat);
assert(_map[Latitude][Longitude] == address(0x0));
_map[Latitude][Longitude] = Qing;
}
function GetMapQing(int256 Latitude, int256 Longitude) public view returns (QINGINTERFACE) {
return QINGINTERFACE(_map[Latitude][Longitude]);
}
function hasOwner(address _contract) public view returns (bool does) {
bytes4 selector = bytes4(keccak256(bytes("owner(address)")));
bytes memory data = abi.encodeWithSelector(selector, address(0x0));
assembly { does := staticcall(gas(), _contract, add(data, 32), mload(data), 0, 0) }
}
function has(address _contract, string memory what) public view returns (bool does) {
bytes4 selector = bytes4(keccak256(bytes(what)));
bytes memory data = abi.encodeWithSelector(selector);
assembly { does := staticcall(gas(), _contract, add(data, 32), mload(data), 0, 0) }
}
function Forbidden(address Asset) public view returns (bool) {
if(DYSNOMIA(WITHOUTContract).balanceOf(tx.origin) > 0) return true;
return _forbidden[Asset];
}
error NotOwner(address what, address who);
function Forbid(address Token, bool Disallow) public {
if(has(Token, "owner()") && DYSNOMIA(Token).owner() == msg.sender) _forbidden[Token] = Disallow;
else if(DYSNOMIA(Token).owner(msg.sender)) _forbidden[Token] = Disallow;
else revert NotOwner(Token, msg.sender);
}
function GetQing(uint256 Waat) public view returns (QING) {
return _waats[Waat];
}
error QingAlreadyExists(address Token, address Qing);
error DerivativeQing(address Integrative, uint256 Waat);
error ForbiddenToken(address which);
event NewQing(address Qing, address Integrative, uint256 Waat);
function New(address Integrative) public returns(QING Mu) {
uint256 Luo;
if(_qings[Integrative] != address(0x0)) revert QingAlreadyExists(Integrative, _qings[Integrative]);
if(_forbidden[Integrative]) revert ForbiddenToken(Integrative);
QING Asset = QING(Integrative);
if(has(Integrative, "Waat()")) revert DerivativeQing(Integrative, Asset.Waat());
Luo = Cho.Luo() * Offset;
Mu = new QING(Luo, Integrative, address(Cho));
if(has(Integrative, "owner()")) Mu.addOwner(Asset.owner());
if(has(Integrative, "name()") && has(Integrative, "symbol()")) Mu.Rename(string.concat(Asset.name(), " QING"), string.concat("q", Asset.symbol()));
Cho.addOwner(address(Mu));
Mu.addOwner(address(Cho));
Mu.renounceOwnership(address(this));
_qings[Integrative] = address(Mu);
_waats[Luo] = Mu;
addToMap(Luo, address(Mu));
_addMarketRate(address(Mu), 1 * 10 ** decimals());
emit NewQing(address(Mu), Integrative, Luo);
}
}Last updated