-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathITIP20Factory.sol
More file actions
80 lines (73 loc) · 3.51 KB
/
ITIP20Factory.sol
File metadata and controls
80 lines (73 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.13 <0.9.0;
import {ITIP20} from "./ITIP20.sol";
/// @title The interface for TIP-20 token factory
/// @notice Factory contract for creating and deploying TIP-20 compliant tokens
interface ITIP20Factory {
error AddressReserved();
error AddressNotReserved();
error InvalidQuoteToken();
error TokenAlreadyExists(address tokenAddress);
/// @notice Emitted when a new TIP-20 token is created
/// @param token The address of the newly created token contract
/// @param name The name of the created token
/// @param symbol The symbol of the created token
/// @param currency The currency identifier of the created token
/// @param quoteToken The address of the quote token for the created token
/// @param admin The address assigned as the admin of the new token
/// @param salt The salt used for deterministic deployment
event TokenCreated(
address indexed token,
string name,
string symbol,
string currency,
ITIP20 quoteToken,
address admin,
bytes32 salt
);
/// @notice Creates a new TIP-20 compliant token
/// @param name The name for the new token
/// @param symbol The symbol for the new token
/// @param currency The currency identifier for the new token
/// @param admin The address to be assigned as the admin of the new token
/// @return The address of the newly created token contract
function createToken(
string memory name,
string memory symbol,
string memory currency,
ITIP20 quoteToken,
address admin,
bytes32 salt
) external returns (address);
/// @notice Creates a new TIP-20 token and atomically sets its `logoURI` (TIP-1026).
/// @dev Solidity overload of `createToken` with an additional `logoURI` argument.
/// The legacy 6-argument selector is unchanged and remains supported.
/// The logo URI is validated **before** the token is deployed.
/// Reverts with `LogoURITooLong` if `bytes(logoURI).length > 256`, or with
/// `InvalidLogoURI` if `logoURI` is non-empty and either has no parseable
/// scheme (RFC 3986 §3.1) or its scheme is not in the allowlist
/// (`https`, `http`, `ipfs`, `data`, case-insensitive).
/// The `LogoURIUpdated` event is emitted by the new token (not the factory)
/// with `updater = msg.sender`. An empty `logoURI` is valid and skips both
/// the slot write and the event.
/// @return The address of the newly created token contract
function createToken(
string memory name,
string memory symbol,
string memory currency,
ITIP20 quoteToken,
address admin,
bytes32 salt,
string memory logoURI
) external returns (address);
/// @notice Checks if a given address is a TIP-20 compliant token
/// @param token The address of the token to check
/// @return True if the address is a TIP-20 token, false otherwise
function isTIP20(address token) external view returns (bool);
/// @notice Predicts the address of a token deployment given sender and salt
/// @dev Reverts with AddressReserved if the computed address would be in the reserved range
/// @param sender The address that will call createToken
/// @param salt The salt to use for deterministic deployment
/// @return The predicted token address
function getTokenAddress(address sender, bytes32 salt) external pure returns (address);
}