Latest 25 from a total of 38 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Buy Good | 24569973 | 3 days ago | IN | 0.05 ETH | 0.0000109 | ||||
| Buy Good | 24548896 | 6 days ago | IN | 0.01 ETH | 0.00001243 | ||||
| Buy Good | 24546520 | 7 days ago | IN | 0.01 ETH | 0.00000362 | ||||
| Buy Good | 24542738 | 7 days ago | IN | 0.01 ETH | 0.0000056 | ||||
| Buy Good | 24541168 | 7 days ago | IN | 0.04 ETH | 0.00000368 | ||||
| Buy Good | 24541159 | 7 days ago | IN | 0.04 ETH | 0.00000399 | ||||
| Buy Good | 24540962 | 7 days ago | IN | 0 ETH | 0.00000272 | ||||
| Upgrade | 24538360 | 8 days ago | IN | 0 ETH | 0.00000193 | ||||
| Buy Good | 24452253 | 20 days ago | IN | 0.05 ETH | 0.000002 | ||||
| Buy Good | 24434245 | 22 days ago | IN | 0 ETH | 0.00004701 | ||||
| Buy Good | 24433909 | 22 days ago | IN | 0 ETH | 0.00001529 | ||||
| Buy Good | 24433899 | 22 days ago | IN | 0 ETH | 0.00001348 | ||||
| Invest Good | 24331191 | 37 days ago | IN | 0 ETH | 0.00001401 | ||||
| Buy Good | 24288524 | 43 days ago | IN | 0 ETH | 0.00000478 | ||||
| Invest Good | 24284206 | 43 days ago | IN | 0 ETH | 0.00005266 | ||||
| Init Good | 24284191 | 43 days ago | IN | 0 ETH | 0.00012752 | ||||
| Invest Good | 24283940 | 43 days ago | IN | 0 ETH | 0.00005716 | ||||
| Buy Good | 24283541 | 43 days ago | IN | 0 ETH | 0.00001737 | ||||
| Buy Good | 24283524 | 43 days ago | IN | 0 ETH | 0.00001424 | ||||
| Invest Good | 24282583 | 44 days ago | IN | 0.0019 ETH | 0.00001145 | ||||
| Disinvest Proof | 24282570 | 44 days ago | IN | 0 ETH | 0.00002389 | ||||
| Invest Good | 24282401 | 44 days ago | IN | 0.01213695 ETH | 0.00001106 | ||||
| Transfer | 24281898 | 44 days ago | IN | 1 wei | 0.00000295 | ||||
| Buy Good | 24281895 | 44 days ago | IN | 0.03191103 ETH | 0.00001346 | ||||
| Buy Good | 24281843 | 44 days ago | IN | 0 ETH | 0.00000892 |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x3f3bD120...E2c889822 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
TTSwap_Market_Proxy
Compiler Version
v0.8.29+commit.ab55807c
Optimization Enabled:
Yes with 100 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.29;
import {TTSwapError} from "./libraries/L_Error.sol";
import {L_UserConfigLibrary} from "./libraries/L_UserConfig.sol";
import {toTTSwapUINT256} from "./libraries/L_TTSwapUINT256.sol";
import {I_TTSwap_Token} from "./interfaces/I_TTSwap_Token.sol";
/**
* @title TTSwap Market Proxy
* @dev Proxy contract for TTSwap Market using delegatecall.
* @notice This contract holds the storage and delegates logic execution to the implementation contract.
* It supports upgradability controlled by admins.
*/
contract TTSwap_Market_Proxy {
using L_UserConfigLibrary for uint256;
address public implementation;
I_TTSwap_Token public immutable TTS_CONTRACT;
mapping(address _trader => uint256 nonce) private nonces;
bool public upgradeable;
/// @notice Initializes the proxy with the token contract and initial implementation.
/// @param _TTS_Contract The address of the TTSwap Token contract (for permission checks).
/// @param _implementation The address of the initial Market implementation logic.
constructor(
I_TTSwap_Token _TTS_Contract,
address _implementation
) {
TTS_CONTRACT = _TTS_Contract;
implementation = _implementation;
upgradeable = true;
}
/// @notice Fallback function that delegates calls to the implementation contract.
fallback() external payable {
address impl = implementation;
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
if iszero(result) {
revert(0, returndatasize())
}
return(0, returndatasize())
}
}
/// @dev Restricts access to Market Admins.
modifier onlyMarketAdminProxy() {
if (!TTS_CONTRACT.userConfig(msg.sender).isMarketAdmin() || !upgradeable)
revert TTSwapError(1);
_;
}
/// @dev Restricts access to Market Managers.
modifier onlyMarketManagerProxy() {
if (!TTS_CONTRACT.userConfig(msg.sender).isMarketManager() || !upgradeable)
revert TTSwapError(1);
_;
}
/// @notice Upgrades the market implementation contract.
/// @param _implementation The new implementation address.
function upgrade(address _implementation) external onlyMarketAdminProxy {
implementation = _implementation;
}
/// @notice Permanently disables upgradability.
/// @dev Can only be called by DAO Admin. Once disabled, the implementation cannot be changed.
function disableUpgrade() external {
if (!TTS_CONTRACT.userConfig(msg.sender).isDAOAdmin()) revert TTSwapError(62);
upgradeable = false;
}
/// @notice Freezes the market by setting implementation to address(0).
/// @dev Can be called by Market Manager for emergency stops.
function freezeMarket() external onlyMarketManagerProxy {
implementation = address(0);
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.29;
/// @title Investment Proof Interface
/// @notice Contains a series of interfaces for goods
interface I_TTSwap_Token {
/// @notice Emitted when environment variables are set
/// @param marketcontract The address of the market contract
event e_setenv(address marketcontract);
/// @notice Emitted when user config is updated
/// @param user The address of the user
/// @param config The new config value
event e_updateUserConfig(address user, uint256 config);
/// @notice Emitted when a referral relationship is added
/// @param user The address of the user being referred
event e_addreferral(address user, address referal);
/// @notice Emitted when minting is added
/// @param recipient The address receiving the minted tokens
/// @param leftamount The remaining amount to be minted
/// @param metric The metric used for minting
/// @param chips The number of chips
event e_addShare(
address recipient,
uint128 leftamount,
uint120 metric,
uint8 chips
);
/// @notice Emitted when minting is burned
/// @param owner The index of the minting operation being burned
event e_burnShare(address owner);
/// @notice Emitted when DAO minting occurs
/// @param mintamount The amount being minted
/// @param owner The index of the minting operation
event e_shareMint(uint128 mintamount, address owner);
/// @notice Emitted during a public sale
/// @param usdtamount The amount of USDT involved
/// @param ttsamount The amount of TTS involved
event e_publicsell(uint256 usdtamount, uint256 ttsamount);
/// @notice Emitted when chain stake is synchronized
/// @param chain The chain ID
/// @param poolasset The pool asset value
/// @param proofstate The value of the pool
//first 128 bit proofvalue,last 128 bit proofconstruct
event e_syncChainStake(uint32 chain, uint128 poolasset, uint256 proofstate);
/// @notice Emitted when unstaking occurs
/// @param recipient The address receiving the unstaked tokens
/// @param proofvalue first 128 bit proofvalue,last 128 bit poolcontruct
/// @param unstakestate The state after unstaking
/// @param stakestate The state of the stake
/// @param poolstate The state of the pool
event e_stakeinfo(
address recipient,
uint256 proofvalue,
uint256 unstakestate,
uint256 stakestate,
uint256 poolstate
);
/// @notice Emitted when the pool state is updated
/// @param poolstate The new state of the pool
event e_updatepool(uint256 poolstate);
/// @notice Emitted when the pool state is updated
/// @param ttsconfig The new state of the pool
event e_updatettsconfig(uint256 ttsconfig);
/**
* @dev Returns the share information for a given user address.
* @param user The address to query for share information.
* @return The s_share struct containing the user's share details.
*/
function usershares(address user) external view returns (s_share memory);
/**
* @dev Returns the current staking state.
* @return The staking state as a uint256 value.
*/
function stakestate() external view returns (uint256);
/**
* @dev Returns the current pool state.
* @return The pool state as a uint256 value.
*/
function poolstate() external view returns (uint256);
/**
* @dev Returns the TTS token configuration value.
* @return The configuration as a uint256 value.
*/
function ttstokenconfig() external view returns (uint256);
/**
* @dev Returns the amount of left share available for minting.
* @return The left share as a uint128 value.
*/
function left_share() external view returns (uint128);
/**
* @dev Returns the stake proof information for a given index.
* @param index The index to query for stake proof information.
* @return The s_proof struct containing the stake proof details.
*/
function stakeproofinfo(uint256 index) external view returns (s_proof memory);
/**
* @dev Sets the trading volume ratio for the protocol.
* @param _ratio The new ratio value (max 10000).
*/
function setRatio(uint256 _ratio) external;
/**
* @dev Grants or revokes DAO admin privileges to a recipient address.
* @param _recipient The address to grant or revoke DAO admin rights.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setDAOAdmin(address _recipient, bool result) external;
/**
* @dev Grants or revokes Token admin privileges to a recipient address.
* @param _recipient The address to grant or revoke Token admin rights.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setTokenAdmin(address _recipient, bool result) external;
/**
* @dev Grants or revokes Token manager privileges to a recipient address.
* @param _recipient The address to grant or revoke Token manager rights.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setTokenManager(address _recipient, bool result) external;
/**
* @dev Grants or revokes permission to call mintTTS to a recipient address.
* @param _recipient The address to grant or revoke permission.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setCallMintTTS(address _recipient, bool result) external;
/**
* @dev Grants or revokes Market admin privileges to a recipient address.
* @param _recipient The address to grant or revoke Market admin rights.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setMarketAdmin(address _recipient, bool result) external;
/**
* @dev Grants or revokes Market manager privileges to a recipient address.
* @param _recipient The address to grant or revoke Market manager rights.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setMarketManager(address _recipient, bool result) external;
/**
* @dev Grants or revokes Stake admin privileges to a recipient address.
* @param _recipient The address to grant or revoke Stake admin rights.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setStakeAdmin(address _recipient, bool result) external;
/**
* @dev Grants or revokes Stake manager privileges to a recipient address.
* @param _recipient The address to grant or revoke Stake manager rights.
* @param result Boolean indicating whether to grant (true) or revoke (false) the privilege.
*/
function setStakeManager(address _recipient, bool result) external;
/**
* @dev Sets or unsets a ban on a recipient address, restricting their access.
* @param _recipient The address to ban or unban.
* @param result Boolean indicating whether to ban (true) or unban (false) the address.
*/
function setBan(address _recipient, bool result) external;
/**
* @dev Returns the amount of TTS available for public sale
* @return _publicsell Returns the amount of TTS available for public sale
*/
function publicsell() external view returns (uint128 _publicsell);
/**
* @dev Returns the authorization level for a given address
* @param recipent user's address
* @return _auth Returns the authorization level
*/
function userConfig(address recipent) external view returns (uint256 _auth);
/**
* @dev Sets the environment variables for normal good ID, value good ID, and market contract address
* @param _marketcontract The address of the market contract
*/
function setEnv(address _marketcontract) external;
/**
* @dev Adds a new mint share to the contract
* @param _share The share structure containing recipient, amount, metric, and chips
* @notice Only callable on the main chain by the DAO admin
* @notice Reduces the left_share by the amount in _share
* @notice Increments the shares_index and adds the new share to the shares mapping
* @notice Emits an e_addShare event with the share details
*/
function addShare(s_share calldata _share, address owner) external;
/**
* @dev Burns the share at the specified index
* @param owner owner of share
*/
function burnShare(address owner) external;
/**
* @dev Mints a share at the specified
*/
function shareMint() external;
/**
* @dev how much cost to buy tts
* @param usdtamount usdt amount
*/
function publicSell(uint256 usdtamount, bytes calldata data) external;
/**
* @dev Withdraws the specified amount from the public sale to the recipient
* @param amount admin tranfer public sell to another address
* @param recipent user's address
*/
function withdrawPublicSell(uint256 amount, address recipent) external;
/**
* @dev Burns the specified value of tokens from the given account
* @param value the amount will be burned
*/
function burn(uint256 value) external;
/// @notice Add a referral relationship
/// @param user The address of the user being referred
/// @param referral The address of the referrer
function setReferral(address user, address referral) external;
/// @notice Stake tokens
/// @param staker The address of the staker
/// @param proofvalue The proof value for the stake
/// @return construct The construct value after staking
function stake(
address staker,
uint128 proofvalue
) external returns (uint128 construct);
/// @notice Unstake tokens
/// @param staker The address of the staker
/// @param proofvalue The proof value for unstaking
function unstake(address staker, uint128 proofvalue) external;
/// @notice Get the DAO admin and referral for a customer
/// @param _customer The address of the customer
/// @return referral The address of the referrer
function getreferral(
address _customer
) external view returns (address referral);
/**
* @dev Permits a share to be transferred
* @param _share The share structure containing recipient, amount, metric, and chips
* @param dealline The deadline for the share transfer
* @param signature The signature of the share transfer
* @param signer The address of the signer
*/
function permitShare(
s_share memory _share,
uint128 dealline,
bytes calldata signature,
address signer
) external;
/**
* @dev Calculates the hash of a share transfer
* @param _share The share structure containing recipient, amount, metric, and chips
* @param owner The address of the owner
* @param leftamount The amount of left share
* @param deadline The deadline for the share transfer
*/
function shareHash(
s_share memory _share,
address owner,
uint128 leftamount,
uint128 deadline,
uint256 nonce
) external pure returns (bytes32);
}
/// @notice Struct for share information
/// @dev Contains information about a share, including the amount of left to unlock, the metric, and the chips
struct s_share {
uint128 leftamount; // unlock amount
uint120 metric; //last unlock's metric
uint8 chips; // define the share's chips, and every time unlock one chips
}
/// @notice Struct for proof information
/// @dev Contains information about a proof, including the contract address and the state
struct s_proof {
address fromcontract; // from which contract
uint256 proofstate; // stake's state amount0 value 128 construct asset
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.29;
using L_TTSwapUINT256Library for uint256;
/// @notice Converts two uint128 values into a T_BalanceUINT256
/// @param _amount0 The first 128-bit amount
/// @param _amount1 The second 128-bit amount
/// @return balanceDelta The resulting T_BalanceUINT256
function toTTSwapUINT256(uint128 _amount0, uint128 _amount1) pure returns (uint256 balanceDelta) {
assembly ("memory-safe") {
balanceDelta :=
or(shl(128, _amount0), and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, _amount1))
}
}
/// @notice Adds two T_BalanceUINT256 values
/// @param a The first T_BalanceUINT256
/// @param b The second T_BalanceUINT256
/// @return The sum of a and b as a T_BalanceUINT256
function add(uint256 a, uint256 b) pure returns (uint256) {
uint256 res0;
uint256 res1;
uint256 a0;
uint256 a1;
uint256 b0;
uint256 b1;
assembly ("memory-safe") {
a0 := shr(128, a)
a1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, a)
b0 := shr(128, b)
b1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, b)
res0 := add(a0, b0)
res1 := add(a1, b1)
}
require(res0 >= a0 && res0 >= b0 && res1 >= a1 && res1 >= b1 && res1 <type(uint128).max && res0 <type(uint128).max, "TTSwapUINT256: add overflow");
return (res0<<128)+res1;
}
/// @notice Subtracts two T_BalanceUINT256 values
/// @param a The first T_BalanceUINT256
/// @param b The second T_BalanceUINT256
/// @return The difference of a and b as a T_BalanceUINT256
function sub(uint256 a, uint256 b) pure returns (uint256) {
uint256 res0;
uint256 res1;
uint256 a0;
uint256 a1;
uint256 b0;
uint256 b1;
unchecked{
assembly ("memory-safe") {
a0 := shr(128, a)
a1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, a)
b0 := shr(128, b)
b1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, b)
res0 := sub(a0, b0)
res1 := sub(a1, b1)
}}
require(res0 <=a0 && res1<=a1 &&a1>=b1 && a0>=b0, "TTSwapUINT256: sub overflow");
return (res0<<128)+res1;
}
/// @notice Adds the first components and subtracts the second components of two T_BalanceUINT256 values
/// @param a The first T_BalanceUINT256
/// @param b The second T_BalanceUINT256
/// @return The result of (a0 + b0, a1 - b1) as a T_BalanceUINT256
function addsub(uint256 a, uint256 b) pure returns (uint256) {
uint256 res0;
uint256 res1;
uint256 a0;
uint256 a1;
uint256 b0;
uint256 b1;
unchecked{
assembly ("memory-safe") {
a0 := shr(128, a)
a1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, a)
b0 := shr(128, b)
b1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, b)
res0 := add(a0, b0)
res1 := sub(a1, b1)
}}
require(res0 >=a0 && res0>=b0 && res1<=a1 && a1>=b1 && res0<type(uint128).max , "TTSwapUINT256: addsub overflow");
return (res0<<128)+res1;
}
/// @notice Subtracts the first components and adds the second components of two T_BalanceUINT256 values
/// @param a The first T_BalanceUINT256
/// @param b The second T_BalanceUINT256
/// @return The result of (a0 - b0, a1 + b1) as a T_BalanceUINT256
function subadd(uint256 a, uint256 b) pure returns (uint256) {
uint256 res0;
uint256 res1;
uint256 a0;
uint256 a1;
uint256 b0;
uint256 b1;
unchecked{
assembly ("memory-safe") {
a0 := sar(128, a)
a1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, a)
b0 := sar(128, b)
b1 := and(0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff, b)
res0 := sub(a0, b0)
res1 := add(a1, b1)
}}
require(res1 >=a1 && res1>=b1 && res0<=a0 && a0>=b0 && res1<type(uint128).max , "TTSwapUINT256: subadd overflow");
return (res0<<128)+res1;
}
/// @notice Safely converts a uint256 to a uint128
/// @param a The uint256 value to convert
/// @return b converted uint128 value, or 0 if overflow
function toUint128(uint256 a) pure returns (uint128 b) {
b=uint128(a);
require(a==uint256(b) , "TTSwapUINT256: toUint128 overflow");
}
/// @notice Compares the prices of three T_BalanceUINT256 values
/// @param a The first T_BalanceUINT256
/// @param b The second T_BalanceUINT256
/// @param c The third T_BalanceUINT256
/// @return True if the price of a is lower than the prices of b and c, false otherwise
function lowerprice(uint256 a, uint256 b, uint256 c) pure returns (bool) {
return uint256(a.amount0()) * uint256(b.amount1()) * uint256(c.amount1())
> uint256(a.amount1()) * uint256(b.amount0()) * uint256(c.amount0()) ? true : false;
}
/// @notice Performs a multiplication followed by a division (full precision)
/// @dev Optimized to prevent intermediate overflow during multiplication
/// @param config The multiplicand
/// @param amount The multiplier
/// @param domitor The divisor
/// @return a The result as a uint128
function mulDiv(uint256 config, uint256 amount, uint256 domitor) pure returns (uint128 a) {
uint256 result;
unchecked {
assembly {
config := mul(config, amount)
result := div(config, domitor)
}
}
return toUint128(result);
}
/// @title L_TTSwapUINT256Library
/// @notice A library for operations on T_BalanceUINT256
library L_TTSwapUINT256Library {
/// @notice Extracts the first 128-bit amount from a T_BalanceUINT256
/// @param balanceDelta The T_BalanceUINT256 to extract from
/// @return _amount0 The extracted first 128-bit amount
function amount0(uint256 balanceDelta) internal pure returns (uint128 _amount0) {
assembly {
_amount0 := shr(128, balanceDelta)
}
}
/// @notice Extracts the second 128-bit amount from a T_BalanceUINT256
/// @param balanceDelta The T_BalanceUINT256 to extract from
/// @return _amount1 The extracted second 128-bit amount
function amount1(uint256 balanceDelta) internal pure returns (uint128 _amount1) {
assembly {
_amount1 := balanceDelta
}
}
/// @notice Extracts the first and second 128-bit amounts from a T_BalanceUINT256
/// @param balanceDelta The T_BalanceUINT256 to extract from
/// @return _amount0 The extracted first 128-bit amount
/// @return _amount1 The extracted second 128-bit amount
function amount01(uint256 balanceDelta) internal pure returns (uint128 _amount0,uint128 _amount1) {
assembly {
_amount0 := shr(128, balanceDelta)
_amount1 := balanceDelta
}
}
/// @notice Calculates amount0 based on a given amount1 and the ratio in balanceDelta
/// @param balanceDelta The T_BalanceUINT256 containing the ratio
/// @param amount1delta The amount1 to base the calculation on
/// @return _amount0 The calculated amount0
function getamount0fromamount1(uint256 balanceDelta, uint128 amount1delta)
internal
pure
returns (uint128 _amount0)
{
return mulDiv(balanceDelta.amount0(), amount1delta, balanceDelta.amount1());
}
/// @notice Calculates amount1 based on a given amount0 and the ratio in balanceDelta
/// @param balanceDelta The T_BalanceUINT256 containing the ratio
/// @param amount0delta The amount0 to base the calculation on
/// @return _amount1 The calculated amount1
function getamount1fromamount0(uint256 balanceDelta, uint128 amount0delta)
internal
pure
returns (uint128 _amount1)
{
return mulDiv(balanceDelta.amount1(), amount0delta, balanceDelta.amount0());
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.29;
/// @title User Configuration Library
/// @notice Library for managing user permissions and roles within the TTSwap system.
/// @dev Uses bitwise operations on a `uint256` to store boolean flags and addresses efficiently.
///
/// Permission Layout (Bit Index):
/// - 255: DAO Admin
/// - 254: Token Admin
/// - 253: Token Manager
/// - 252: Market Admin
/// - 251: Market Manager
/// - 250: Can Call Mint TTS (Contract Role)
/// - 249: Stake Admin
/// - 248: Stake Manager
/// - 160: Ban Status
/// - [0-159]: Referral Address (160 bits)
library L_UserConfigLibrary {
/// @notice Checks if the user has DAO Admin privileges.
/// @param config The user's configuration value.
/// @return a True if DAO Admin, false otherwise.
function isDAOAdmin(uint256 config) internal pure returns(bool a){
return (config&uint256(2**255))>0;
}
/// @notice Sets or unsets DAO Admin privileges.
/// @param config The current configuration value.
/// @param a The new boolean status.
/// @return e The updated configuration value.
function setDAOAdmin(uint256 config,bool a)internal pure returns(uint256 e){
return (config&(~(uint256(2**255))))|(a?uint256(2**255):0);
}
/// @notice Checks if the user has Token Admin privileges.
function isTokenAdmin(uint256 config) internal pure returns(bool a){
return (config&uint256(2**254))>0;
}
/// @notice Sets or unsets Token Admin privileges.
function setTokenAdmin(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**254))|(a?uint256(2**254):0);
}
/// @notice Checks if the user has Token Manager privileges.
function isTokenManager(uint256 config) internal pure returns(bool a){
return (config&uint256(2**253))>0;
}
/// @notice Sets or unsets Token Manager privileges.
function setTokenManager(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**253))|(a?uint256(2**253):0);
}
/// @notice Checks if the user has Market Admin privileges.
function isMarketAdmin(uint256 config)internal pure returns(bool a){
return (config&uint256(2**252))>0;
}
/// @notice Sets or unsets Market Admin privileges.
function setMarketAdmin(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**252))|(a?uint256(2**252):0);
}
/// @notice Checks if the user has Market Manager privileges.
function isMarketManager(uint256 config)internal pure returns(bool a){
return (config&uint256(2**251))>0;
}
/// @notice Sets or unsets Market Manager privileges.
function setMarketManager(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**251))|(a?uint256(2**251):0);
}
/// @notice Checks if the user (contract) is authorized to call mint functions.
function isCallMintTTS(uint256 config)internal pure returns(bool a){
return (config&uint256(2**250))>0;
}
/// @notice Sets or unsets mint calling authorization.
function setCallMintTTS(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**250))|(a?uint256(2**250):0);
}
/// @notice Checks if the user has Stake Admin privileges.
function isStakeAdmin(uint256 config)internal pure returns(bool a){
return (config&uint256(2**249))>0;
}
/// @notice Sets or unsets Stake Admin privileges.
function setStakeAdmin(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**249))|(a?uint256(2**249):0);
}
/// @notice Checks if the user has Stake Manager privileges.
function isStakeManager(uint256 config)internal pure returns(bool a){
return (config&uint256(2**248))>0;
}
/// @notice Sets or unsets Stake Manager privileges.
function setStakeManager(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**248))|(a?uint256(2**248):0);
}
/// @notice Checks if the user is banned.
function isBan(uint256 config)internal pure returns(bool a){
return (config&uint256(2**160))>0;
}
/// @notice Sets or unsets the ban status.
function setBan(uint256 config,bool a)internal pure returns(uint256 e){
return config&~(uint256(2**160))|(a?uint256(2**160):0);
}
/// @notice Retrieves the referral address associated with the user.
/// @dev Returns the lower 160 bits cast as an address.
function referral(uint256 config)internal pure returns(address a){
return address(uint160(config));
}
/// @notice Sets the referral address for the user.
/// @dev Clears the lower 160 bits and ORs them with the new address.
function setReferral(uint256 config,address a)internal pure returns(uint256 e){
return (config&~(uint256(2**160)-1))|uint256(uint160(a));
}
}// SPDX-License-Identifier: MIT pragma solidity 0.8.29; /// @notice Defines the standard error type used throughout the TTSwap protocol. /// @dev Errors are identified by a unique sequence code `seq` to save bytecode size compared to string revert messages. error TTSwapError(uint256 seq);
{
"viaIR": true,
"evmVersion": "cancun",
"optimizer": {
"enabled": true,
"runs": 100
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"forge-gas-snapshot/=lib/forge-gas-snapshot/",
"forge-std-1.10.0/=dependencies/forge-std-1.10.0/",
"forge-std/=lib/forge-std/",
"permit2/=lib/permit2/",
"solmate/=lib/solmate/",
"@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"forge-gas-snapshot/=lib/forge-gas-snapshot/",
"forge-std-1.10.0/=dependencies/forge-std-1.10.0/",
"forge-std/=lib/forge-std/",
"permit2/=lib/permit2/",
"solmate/=lib/solmate/"
]
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract I_TTSwap_Token","name":"_TTS_Contract","type":"address"},{"internalType":"address","name":"_implementation","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"seq","type":"uint256"}],"name":"TTSwapError","type":"error"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"TTS_CONTRACT","outputs":[{"internalType":"contract I_TTSwap_Token","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disableUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"freezeMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upgradeable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
0x60a0346100b657601f61055f38819003918201601f19168301916001600160401b038311848410176100ba5780849260409485528339810103126100b6578051906001600160a01b03821682036100b657602001516001600160a01b03811691908290036100b6576080525f80546001600160a01b0319169190911790556002805460ff1916600117905560405161049090816100cf823960805181818160b901528181610200015281816102b701526103190152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe60806040526004361015610015575b3661043257005b5f3560e01c80630900f0101461007457806341c20c8e1461006f5780635c60da1b1461006a57806367fc913814610065578063c6d8954c146100605763df2e50660361000e576102e6565b6102a2565b6101d5565b6101ae565b61018c565b34610188576020366003190112610188576004356001600160a01b038116810361018857635f35b0b360e01b6080908152336084526020906024816001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165afa8015610183575f9061014d575b600160fc1b16156100f8565b1590565b8015610138575b610124575f80546001600160a01b0319166001600160a01b039092169190911790555b005b63d1b5191160e01b5f52600160045260245ffd5b506101486100f460025460ff1690565b6100ff565b5060203d60201161017c575b6100f46101748261016c6100f8946103ad565b608001610406565b9150506100e8565b503d610159565b610427565b5f80fd5b34610188575f36600319011261018857602060ff600254166040519015158152f35b34610188575f366003190112610188575f546040516001600160a01b039091168152602090f35b34610188575f36600319011261018857604051635f35b0b360e01b81523360048201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156101835761024c916100f4915f91610273575b50600160ff1b16151590565b61025f5761012260ff1960025416600255565b63d1b5191160e01b5f52603e60045260245ffd5b610295915060203d60201161029b575b61028d81836103e4565b810190610418565b5f610240565b503d610283565b34610188575f366003190112610188576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b34610188575f36600319011261018857604051635f35b0b360e01b81523360048201526020816024816001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165afa9081156101835761035d916100f4915f9161038e575b50600160fb1b16151590565b8015610379575b610124575f80546001600160a01b0319169055005b506103896100f460025460ff1690565b610364565b6103a7915060203d60201161029b5761028d81836103e4565b5f610351565b601f80199101166080016080811067ffffffffffffffff8211176103d057604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176103d057604052565b602090607f1901126101885760805190565b90816020910312610188575190565b6040513d5f823e3d90fd5b5f805481906001600160a01b0316368280378136915af43d5f803e15610456573d5ff35b3d5ffdfea26469706673582212209f3e14cd60e5a3becebc187d8c9f6f2aa14cc4c152fb580b60130b76dcaf518164736f6c634300081d0033000000000000000000000000e9d469b641bdcc9967ac19aefc038710d98f0b5d00000000000000000000000080c1f3a5455377164f40e80b1d10b1633291ed4a
Deployed Bytecode
0x60806040526004361015610015575b3661043257005b5f3560e01c80630900f0101461007457806341c20c8e1461006f5780635c60da1b1461006a57806367fc913814610065578063c6d8954c146100605763df2e50660361000e576102e6565b6102a2565b6101d5565b6101ae565b61018c565b34610188576020366003190112610188576004356001600160a01b038116810361018857635f35b0b360e01b6080908152336084526020906024816001600160a01b037f000000000000000000000000e9d469b641bdcc9967ac19aefc038710d98f0b5d165afa8015610183575f9061014d575b600160fc1b16156100f8565b1590565b8015610138575b610124575f80546001600160a01b0319166001600160a01b039092169190911790555b005b63d1b5191160e01b5f52600160045260245ffd5b506101486100f460025460ff1690565b6100ff565b5060203d60201161017c575b6100f46101748261016c6100f8946103ad565b608001610406565b9150506100e8565b503d610159565b610427565b5f80fd5b34610188575f36600319011261018857602060ff600254166040519015158152f35b34610188575f366003190112610188575f546040516001600160a01b039091168152602090f35b34610188575f36600319011261018857604051635f35b0b360e01b81523360048201526020816024817f000000000000000000000000e9d469b641bdcc9967ac19aefc038710d98f0b5d6001600160a01b03165afa9081156101835761024c916100f4915f91610273575b50600160ff1b16151590565b61025f5761012260ff1960025416600255565b63d1b5191160e01b5f52603e60045260245ffd5b610295915060203d60201161029b575b61028d81836103e4565b810190610418565b5f610240565b503d610283565b34610188575f366003190112610188576040517f000000000000000000000000e9d469b641bdcc9967ac19aefc038710d98f0b5d6001600160a01b03168152602090f35b34610188575f36600319011261018857604051635f35b0b360e01b81523360048201526020816024816001600160a01b037f000000000000000000000000e9d469b641bdcc9967ac19aefc038710d98f0b5d165afa9081156101835761035d916100f4915f9161038e575b50600160fb1b16151590565b8015610379575b610124575f80546001600160a01b0319169055005b506103896100f460025460ff1690565b610364565b6103a7915060203d60201161029b5761028d81836103e4565b5f610351565b601f80199101166080016080811067ffffffffffffffff8211176103d057604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176103d057604052565b602090607f1901126101885760805190565b90816020910312610188575190565b6040513d5f823e3d90fd5b5f805481906001600160a01b0316368280378136915af43d5f803e15610456573d5ff35b3d5ffdfea26469706673582212209f3e14cd60e5a3becebc187d8c9f6f2aa14cc4c152fb580b60130b76dcaf518164736f6c634300081d0033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$11,773.99
Net Worth in ETH
5.695814
Token Allocations
USDT
31.72%
USDC
15.66%
WBTC
14.93%
Others
37.69%
Multichain Portfolio | 33 Chains
Loading...
Loading
Loading...
Loading
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.