Address: 0x3b107Fc3Db445c159A77DF01a71bee86B3D52460
Balance (XRP): 0 XRP
Bytecode: 0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063d02641a011610066578063d02641a014610294578063d820ed42146102a7578063e660cc08146102ce578063f2fde38b146102fa57600080fd5b80638da5cb5b14610207578063a200e15314610218578063bfa646311461023f578063cd5d2c741461026d57600080fd5b80633078fff5116100d35780633078fff51461018a57806359b6b86c146101b5578063715018a6146101dc5780638a0737a0146101e457600080fd5b806301ffc9a71461010557806306cd61171461012d578063204daa931461014e5780632c0fd74c14610163575b600080fd5b610118610113366004610b17565b61030d565b60405190151581526020015b60405180910390f35b61014061013b366004610b7c565b6103a6565b604051908152602001610124565b61016161015c366004610c0e565b6103fe565b005b6101407f000000000000000000000000000000000000000000000000000015a1422a526f81565b60015461019d906001600160a01b031681565b6040516001600160a01b039091168152602001610124565b6101407f00000000000000000000000000000000000000000000000000000049d482455d81565b610161610469565b6101186101f2366004610c4a565b60026020526000908152604090205460ff1681565b6000546001600160a01b031661019d565b6101407f0000000000000000000000000000000000000000000000000000045373a2107c81565b61025261024d366004610b7c565b61047d565b60408051825181526020928301519281019290925201610124565b6101407f00000000000000000000000000000000000000000000000000000a180dcf7bcd81565b6101406102a2366004610c4a565b610693565b6101407f00000000000000000000000000000000000000000000000000000171268b5ad481565b6101186102dc366004610c4a565b6001600160a01b031660009081526002602052604090205460ff1690565b610161610308366004610c4a565b610702565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806103a057507fffffffff0000000000000000000000000000000000000000000000000000000082167f59c68a3900000000000000000000000000000000000000000000000000000000145b92915050565b60006103f4866103ef87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508992508891506107979050565b6107a0565b9695505050505050565b6104066108c6565b6001600160a01b038216600081815260026020908152604091829020805460ff19168515159081179091558251938452908301527f55982ab4704ed0d290c824e2a9587f13ee4556fc8ef89c25f7ef037baaf74017910160405180910390a15050565b6104716108c6565b61047b6000610920565b565b60408051808201909152600080825260208201526001600160a01b03861660009081526002602052604090205460ff166104e3576040517f2dbb611b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061052486868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061098892505050565b90506000600582106105615761055a847f00000000000000000000000000000000000000000000000000000049d482455d610c7b565b9050610624565b816004036105935761055a847f00000000000000000000000000000000000000000000000000000171268b5ad4610c7b565b816003036105c55761055a847f0000000000000000000000000000000000000000000000000000045373a2107c610c7b565b816002036105f75761055a847f00000000000000000000000000000000000000000000000000000a180dcf7bcd610c7b565b610621847f000000000000000000000000000000000000000000000000000015a1422a526f610c7b565b90505b60405180604001604052806106398a846107a0565b81526020016106858a6103ef8b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91506107979050565b905298975050505050505050565b6001546040516317a6948f60e21b81526001600160a01b0383811660048301526000921690635e9a523c90602401602060405180830381865afa1580156106de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a09190610c92565b61070a6108c6565b6001600160a01b03811661078b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61079481610920565b50565b60009392505050565b6001546040516317a6948f60e21b81526001600160a01b0384811660048301526000928392911690635e9a523c90602401602060405180830381865afa1580156107ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108129190610c92565b905061082681670de0b6b3a7640000610c7b565b846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610864573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108889190610cab565b61089390600a610db2565b61089d9085610c7b565b6108b4906c0c9f2c9cd04674edea40000000610c7b565b6108be9190610dc1565b949350505050565b6000546001600160a01b0316331461047b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610782565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051600090819081905b80821015610b0e5760008583815181106109ae576109ae610de3565b01602001516001600160f81b03191690507f80000000000000000000000000000000000000000000000000000000000000008110156109f9576109f2600184610df9565b9250610afb565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610a36576109f2600284610df9565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610a73576109f2600384610df9565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610ab0576109f2600484610df9565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610aed576109f2600584610df9565b610af8600684610df9565b92505b5082610b0681610e0c565b935050610992565b50909392505050565b600060208284031215610b2957600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610b5957600080fd5b9392505050565b80356001600160a01b0381168114610b7757600080fd5b919050565b600080600080600060808688031215610b9457600080fd5b610b9d86610b60565b9450602086013567ffffffffffffffff80821115610bba57600080fd5b818801915088601f830112610bce57600080fd5b813581811115610bdd57600080fd5b896020828501011115610bef57600080fd5b9699602092909201985095966040810135965060600135945092505050565b60008060408385031215610c2157600080fd5b610c2a83610b60565b915060208301358015158114610c3f57600080fd5b809150509250929050565b600060208284031215610c5c57600080fd5b610b5982610b60565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176103a0576103a0610c65565b600060208284031215610ca457600080fd5b5051919050565b600060208284031215610cbd57600080fd5b815160ff81168114610b5957600080fd5b600181815b80851115610d09578160001904821115610cef57610cef610c65565b80851615610cfc57918102915b93841c9390800290610cd3565b509250929050565b600082610d20575060016103a0565b81610d2d575060006103a0565b8160018114610d435760028114610d4d57610d69565b60019150506103a0565b60ff841115610d5e57610d5e610c65565b50506001821b6103a0565b5060208310610133831016604e8410600b8410161715610d8c575081810a6103a0565b610d968383610cce565b8060001904821115610daa57610daa610c65565b029392505050565b6000610b5960ff841683610d11565b600082610dde57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b808201808211156103a0576103a0610c65565b600060018201610e1e57610e1e610c65565b506001019056fea264697066735822122010d0c2bf07be4b6511d785bae7b0cc63a4f55a9c3549d3f66e38e3b731de7aa564736f6c63430008110033
StringUtils.sol
pragma solidity >=0.8.4; library StringUtils { /** * @dev Returns the length of a given string * * @param s The string to measure the length of * @return The length of the input string */ function strlen(string memory s) internal pure returns (uint256) { uint256 len; uint256 i = 0; uint256 bytelength = bytes(s).length; for (len = 0; i < bytelength; len++) { bytes1 b = bytes(s)[i]; if (b < 0x80) { i += 1; } else if (b < 0xE0) { i += 2; } else if (b < 0xF0) { i += 3; } else if (b < 0xF8) { i += 4; } else if (b < 0xFC) { i += 5; } else { i += 6; } } return len; } }
Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
IERC20PriceOracle.sol
//SPDX-License-Identifier: MIT pragma solidity >=0.8.17 <0.9.0; interface IERC20PriceOracle { struct Price { uint256 base; uint256 premium; } /** * @dev Returns the price to register or renew a name. * @param token Address of ERC20 token being used for payment. * @param name The name being registered or renewed. * @param expires When the name presently expires (0 if this is a new registration). * @param duration How long the name is being registered or extended for, in seconds. * @return base premium tuple of base price + premium price */ function price( address token, string calldata name, uint256 expires, uint256 duration ) external view returns (Price calldata); function support(address token) external returns (bool); }
FixedERC20PriceOracle.sol
//SPDX-License-Identifier: MIT pragma solidity ~0.8.17; import "./IERC20PriceOracle.sol"; import "./StringUtils.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; interface PriceAggregatorInterface { // 30 decimals function assetPrices(address asset) external view returns (uint); } interface IERC20Extended { function decimals() external view returns (uint8); } error UnSupportedERC20Token(); // StablePriceOracle sets a price in USD, based on an oracle. contract FixedERC20PriceOracle is IERC20PriceOracle, Ownable { using StringUtils for *; // Rent in base price units by length uint256 public immutable price1Letter; uint256 public immutable price2Letter; uint256 public immutable price3Letter; uint256 public immutable price4Letter; uint256 public immutable price5Letter; // Oracle address PriceAggregatorInterface public priceAggregator; mapping(address => bool) public supportTokens; event RentPriceChanged(uint256[] prices); event SetSupportToken(address token, bool isSupported); constructor(PriceAggregatorInterface _aggregator) { priceAggregator = _aggregator; price1Letter = 23782343987823; price2Letter = 11098427194317; price3Letter = 4756468797564; price4Letter = 1585489599188; price5Letter = 317097919837; } function price( address token, string calldata name, uint256 expires, uint256 duration ) external view override returns (IERC20PriceOracle.Price memory) { if (!support(token)) { revert UnSupportedERC20Token(); } uint256 len = name.strlen(); uint256 basePrice; if (len >= 5) { basePrice = price5Letter * duration; } else if (len == 4) { basePrice = price4Letter * duration; } else if (len == 3) { basePrice = price3Letter * duration; } else if (len == 2) { basePrice = price2Letter * duration; } else { basePrice = price1Letter * duration; } return IERC20PriceOracle.Price({ base: attoUSDtoDecimals(token, basePrice), premium: attoUSDtoDecimals( token, _premium(name, expires, duration) ) }); } /** * @dev Returns the pricing premium in wei. */ function premium( address token, string calldata name, uint256 expires, uint256 duration ) external view returns (uint256) { return attoUSDtoDecimals(token, _premium(name, expires, duration)); } /** * @dev Returns the pricing premium in internal base units. */ function _premium( string memory /*name*/, uint256 /*expires*/, uint256 /*duration*/ ) internal view virtual returns (uint256) { return 0; } function attoUSDtoDecimals( address token, uint256 amount ) internal view returns (uint256) { uint256 answer = priceAggregator.assetPrices(token); return (amount * (10 ** IERC20Extended(token).decimals()) * 1e30) / (answer * 1e18); } function getTokenPrice(address token) external view returns (uint256) { return priceAggregator.assetPrices(token); } function setSupportToken( address token, bool isSupported ) external onlyOwner { supportTokens[token] = isSupported; emit SetSupportToken(token, isSupported); } function support(address token) public view returns (bool) { return supportTokens[token]; } function supportsInterface( bytes4 interfaceID ) public view virtual returns (bool) { return interfaceID == type(IERC165).interfaceId || interfaceID == type(IERC20PriceOracle).interfaceId; } }
IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
Gas Token: