Source Code
Latest 25 from a total of 1,868 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Lock And Convert | 144563141 | 61 days ago | IN | 0 ETH | 0.00000000065 | ||||
| Lock And Convert | 144562969 | 61 days ago | IN | 0 ETH | 0.000000000692 | ||||
| Vest | 144548787 | 61 days ago | IN | 0 ETH | 0.000000231906 | ||||
| Lock And Convert | 144548782 | 61 days ago | IN | 0 ETH | 0.000000117803 | ||||
| Vest | 144114382 | 71 days ago | IN | 0 ETH | 0.000000065124 | ||||
| Lock And Convert | 144114378 | 71 days ago | IN | 0 ETH | 0.000000033641 | ||||
| Vest | 143168202 | 93 days ago | IN | 0 ETH | 0.000000017681 | ||||
| Lock And Convert | 143168178 | 93 days ago | IN | 0 ETH | 0.000000010366 | ||||
| Vest | 142862666 | 100 days ago | IN | 0 ETH | 0.000000016669 | ||||
| Vest | 142419528 | 110 days ago | IN | 0 ETH | 0.000000026506 | ||||
| Vest | 142388629 | 111 days ago | IN | 0 ETH | 0.000000006552 | ||||
| Lock And Convert | 142388622 | 111 days ago | IN | 0 ETH | 0.000000006137 | ||||
| Vest | 142375440 | 111 days ago | IN | 0 ETH | 0.000000079289 | ||||
| Vest | 142351266 | 112 days ago | IN | 0 ETH | 0.000000002623 | ||||
| Lock And Convert | 142351259 | 112 days ago | IN | 0 ETH | 0.000000002623 | ||||
| Vest | 142349058 | 112 days ago | IN | 0 ETH | 0.00000026617 | ||||
| Lock And Convert | 142349054 | 112 days ago | IN | 0 ETH | 0.000000128479 | ||||
| Vest | 142346711 | 112 days ago | IN | 0 ETH | 0.00000013877 | ||||
| Lock And Convert | 142346707 | 112 days ago | IN | 0 ETH | 0.000000070891 | ||||
| Vest | 142252792 | 114 days ago | IN | 0 ETH | 0.000000135791 | ||||
| Lock And Convert | 142252789 | 114 days ago | IN | 0 ETH | 0.000000067497 | ||||
| Vest | 142252760 | 114 days ago | IN | 0 ETH | 0.000000134275 | ||||
| Lock And Convert | 142252756 | 114 days ago | IN | 0 ETH | 0.000000066476 | ||||
| Vest | 142231423 | 115 days ago | IN | 0 ETH | 0.000000156383 | ||||
| Lock And Convert | 142231419 | 115 days ago | IN | 0 ETH | 0.000000075047 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
TLXConversion
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
import {ITLXConversion} from "./interfaces/ITLXConversion.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from
"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/// @title TLX Acquisition Token Conversion Contract
/// @notice Responsible for converting TLX tokens to SNX at a fixed rate of 18:1
/// @author Jeremy Chiaramonte ([email protected])
/// @author Andrew Chiaramonte ([email protected])
contract TLXConversion is ITLXConversion {
/*//////////////////////////////////////////////////////////////
CONSTANTS/IMMUTABLES
//////////////////////////////////////////////////////////////*/
/// @notice Fixed rate of 18:1 for TLX to SNX conversion
uint256 public constant CONVERSION_RATE = 18;
/// @notice Vesting lock duration in seconds (1 month)
uint256 public constant VESTING_LOCK_DURATION = 31 days;
/// @notice Linear vesting duration in seconds (4 month)
uint256 public constant LINEAR_VESTING_DURATION = 120 days;
/// @notice Withdrawal start time in seconds (2 years)
uint256 public constant WITHDRAW_START = 730 days;
/// @notice Global start time for vesting
/// @notice Thursday, December 5, 2024 12:00:00 AM (GMT)
/// @dev From this derive 1 month lock 4 month linear vesting
uint256 public constant VESTING_START_TIME = 1_733_356_800;
/// @notice Address of the Synthetix treasury
address public constant SYNTHETIX_TREASURY =
0xD25215758734dd3aDE497CE04De1c35820964126;
/// @notice Time at which the lock ends
/// @dev VESTING_START_TIME + VESTING_LOCK_DURATION
/// @dev initialized during construction
uint256 public immutable timeLockEnds;
// CONTRACTS //////////////////////////////////////////
/// @notice TLX token contract
IERC20 public immutable TLX;
/// @notice SNX token contract
IERC20 public immutable SNX;
/*//////////////////////////////////////////////////////////////
STATE
//////////////////////////////////////////////////////////////*/
/// @notice Mapping of addresses to the amount of SNX owed
/// @dev the amount of SNX owed is the amount of TLX / CONVERSION_RATE
mapping(address => uint256) public owedSNX;
/// @notice Mapping of addresses to the amount of SNX claimed
mapping(address => uint256) public claimedSNX;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
/// @param _tlx $TLX token address
/// @param _snx $SNX token address
constructor(address _tlx, address _snx) {
if (_tlx == address(0) || _snx == address(0)) {
revert AddressZero();
}
TLX = IERC20(_tlx);
SNX = IERC20(_snx);
timeLockEnds = VESTING_START_TIME + VESTING_LOCK_DURATION;
}
/*///////////////////////////////////////////////////////////////
VIEWS
///////////////////////////////////////////////////////////////*/
/// @inheritdoc ITLXConversion
function vestableAmount(address _account) public view returns (uint256) {
if (block.timestamp <= timeLockEnds) {
return 0;
}
if (claimedSNX[_account] >= owedSNX[_account]) {
return 0;
}
uint256 vestable;
uint256 elapsed = block.timestamp - timeLockEnds;
if (elapsed >= LINEAR_VESTING_DURATION) {
vestable = owedSNX[_account] - claimedSNX[_account];
} else {
vestable = (owedSNX[_account] * elapsed) / LINEAR_VESTING_DURATION
- claimedSNX[_account];
}
return vestable;
}
/*///////////////////////////////////////////////////////////////
MUTATIVE FUNCTIONS
///////////////////////////////////////////////////////////////*/
/// @inheritdoc ITLXConversion
function lockAndConvert() public {
uint256 tlxAmount = TLX.balanceOf(msg.sender);
if (tlxAmount == 0) {
revert InsufficientTLX();
}
if (SNX.balanceOf(address(this)) == 0) {
revert ZeroContractSNX();
}
uint256 snxAmount = tlxAmount / CONVERSION_RATE;
owedSNX[msg.sender] += snxAmount;
SafeERC20.safeTransferFrom(TLX, msg.sender, address(this), tlxAmount);
emit TLXLocked(msg.sender, tlxAmount);
}
/// @inheritdoc ITLXConversion
function vest() public returns (uint256) {
return vest(msg.sender);
}
/// @inheritdoc ITLXConversion
function vest(address to) public returns (uint256 amountVested) {
address caller = msg.sender;
amountVested = vestableAmount(caller);
if (amountVested == 0) {
revert NoVestableAmount();
}
claimedSNX[caller] += amountVested;
SafeERC20.safeTransfer(SNX, to, amountVested);
emit SNXVested(caller, to, amountVested);
}
/// @inheritdoc ITLXConversion
function withdrawSNX() public {
if (msg.sender != SYNTHETIX_TREASURY) {
revert Unauthorized();
}
if (block.timestamp < VESTING_START_TIME + WITHDRAW_START) {
revert WithdrawalStartTimeNotReached();
}
uint256 balance = SNX.balanceOf(address(this));
SafeERC20.safeTransfer(SNX, msg.sender, balance);
emit SNXWithdrawn(SYNTHETIX_TREASURY, balance);
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
interface ITLXConversion {
/*///////////////////////////////////////////////////////////////
VIEWS
///////////////////////////////////////////////////////////////*/
/// @notice Returns the amount of SNX that can be vested
/// @return The amount of SNX that can be vested
function vestableAmount(address) external view returns (uint256);
/*///////////////////////////////////////////////////////////////
MUTATIVE FUNCTIONS
///////////////////////////////////////////////////////////////*/
/// @notice Locks TLX and converts it to SNX
/// @notice requires TLX to be approved
function lockAndConvert() external;
/// @notice Vests SNX
/// @return The amount of SNX vested
function vest() external returns (uint256);
/// @notice Vests SNX
/// @param to The account that will receive the vested SNX
/// @return The amount of SNX vested
function vest(address to) external returns (uint256);
/// @notice Withdraws leftover SNX after 2 years
/// @dev only callable by the owner
function withdrawSNX() external;
/*///////////////////////////////////////////////////////////////
EVENTS
///////////////////////////////////////////////////////////////*/
/// @notice emitted when TLX is deposited for conversion
/// @param from The account that locked TLX
/// @param value The amount of TLX that was locked
event TLXLocked(address indexed from, uint256 value);
/// @notice emitted when SNX is vested and withdrawn
/// @param from The account that is vesting SNX
/// @param from The account that is receiving vested SNX
/// @param value The amount of SNX that was vested
event SNXVested(address indexed from, address indexed to, uint256 value);
/// @notice emitted when SNX is withdrawn
/// @param to The account that is receiving SNX
/// @param value The amount of SNX that was withdrawn
event SNXWithdrawn(address indexed to, uint256 value);
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/// @notice thrown when address is 0
error AddressZero();
/// @notice thrown when insufficient TLX is locked
error InsufficientTLX();
/// @notice thrown when withdrawal start time is not reached
error WithdrawalStartTimeNotReached();
/// @notice thrown when caller is not the owner
error Unauthorized();
/// @notice thrown when contract has no SNX
error ZeroContractSNX();
/// @notice thrown when no SNX can be vested
error NoVestableAmount();
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC-20
* applications.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
*
* ```solidity
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert Errors.FailedCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* 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[ERC 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);
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_tlx","type":"address"},{"internalType":"address","name":"_snx","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"InsufficientTLX","type":"error"},{"inputs":[],"name":"NoVestableAmount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"WithdrawalStartTimeNotReached","type":"error"},{"inputs":[],"name":"ZeroContractSNX","type":"error"},{"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":"SNXVested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SNXWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TLXLocked","type":"event"},{"inputs":[],"name":"CONVERSION_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LINEAR_VESTING_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SNX","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SYNTHETIX_TREASURY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TLX","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VESTING_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VESTING_START_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_START","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimedSNX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockAndConvert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"owedSNX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeLockEnds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"vest","outputs":[{"internalType":"uint256","name":"amountVested","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"vestableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawSNX","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e060405234801561000f575f80fd5b50604051610d14380380610d1483398101604081905261002e916100b3565b6001600160a01b038216158061004b57506001600160a01b038116155b1561006957604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0380831660a052811660c05261008d6228de80636750ed006100e4565b608052506101099050565b80516001600160a01b03811681146100ae575f80fd5b919050565b5f80604083850312156100c4575f80fd5b6100cd83610098565b91506100db60208401610098565b90509250929050565b8082018082111561010357634e487b7160e01b5f52601160045260245ffd5b92915050565b60805160a05160c051610ba961016b5f395f81816102380152818161034e015281816103d30152818161069d015261087201525f8181610136015281816105b6015261078d01525f81816101cd0152818161044801526104b60152610ba95ff3fe608060405234801561000f575f80fd5b50600436106100fb575f3560e01c8063a836988c11610093578063ccfe0dfd11610063578063ccfe0dfd1461022b578063e8d6101e14610233578063f3c5f51e1461025a578063fb626e741461026d575f80fd5b8063a836988c146101c8578063bc0403e4146101ef578063bebc1007146101f9578063cc1d054014610218575f80fd5b8063458efde3116100ce578063458efde31461018f5780634aeb19a1146101975780636c0b1e8c146101a25780638909d57f146101ad575f80fd5b806303c0049f146100ff57806305f2733d146101315780632c8bff311461017d57806333d5d30c14610185575b5f80fd5b61011e61010d366004610a7a565b5f6020819052908152604090205481565b6040519081526020015b60405180910390f35b6101587f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610128565b61011e601281565b61011e6228de8081565b61011e610277565b61011e6303c2670081565b61011e636750ed0081565b61015873d25215758734dd3ade497ce04de1c3582096412681565b61011e7f000000000000000000000000000000000000000000000000000000000000000081565b6101f7610286565b005b61011e610207366004610a7a565b60016020525f908152604090205481565b61011e610226366004610a7a565b610445565b6101f7610586565b6101587f000000000000000000000000000000000000000000000000000000000000000081565b61011e610268366004610a7a565b6107ed565b61011e629e340081565b5f610281336107ed565b905090565b3373d25215758734dd3ade497ce04de1c35820964126146102d3576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6102e56303c26700636750ed00610ae1565b42101561031e576040517f24eb920400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156103a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103cc9190610afa565b90506103f97f00000000000000000000000000000000000000000000000000000000000000003383610905565b60405181815273d25215758734dd3ade497ce04de1c35820964126907fe6317a4a1ff7151c3d469dfcdef2f07e80590dc560c4f34d0908e4db8909185f9060200160405180910390a250565b5f7f0000000000000000000000000000000000000000000000000000000000000000421161047457505f919050565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526020818152604080832054600190925290912054106104af57505f919050565b5f806104db7f000000000000000000000000000000000000000000000000000000000000000042610b11565b9050629e340081106105285773ffffffffffffffffffffffffffffffffffffffff84165f9081526001602090815260408083205491839052909120546105219190610b11565b915061057f565b73ffffffffffffffffffffffffffffffffffffffff84165f908152600160209081526040808320549183905290912054629e340090610568908490610b24565b6105729190610b3b565b61057c9190610b11565b91505b5092915050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201525f907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610610573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106349190610afa565b9050805f0361066f576040517fce8ce46400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156106f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061071b9190610afa565b5f03610753576040517f06ba7b3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61075f601283610b3b565b335f90815260208190526040812080549293508392909190610782908490610ae1565b909155506107b490507f000000000000000000000000000000000000000000000000000000000000000033308561098b565b60405182815233907f911c74839017018049f3b58e1d9c889dd659eaaf2f4d7eed83939a4294ee299f9060200160405180910390a25050565b5f336107f881610445565b9150815f03610833576040517f7d52f2bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81165f9081526001602052604081208054849290610867908490610ae1565b9091555061089890507f00000000000000000000000000000000000000000000000000000000000000008484610905565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8e8d6436f1f9912b965fcdf9910ef54a0cb606dd120111c26b602a5b7e3890d0846040516108f791815260200190565b60405180910390a350919050565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261098691859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506109d7565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526109d19186918216906323b872dd9060840161093f565b50505050565b5f8060205f8451602086015f885af1806109f6576040513d5f823e3d81fd5b50505f513d91508115610a0d578060011415610a27565b73ffffffffffffffffffffffffffffffffffffffff84163b155b156109d1576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240160405180910390fd5b5f60208284031215610a8a575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610aad575f80fd5b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b80820180821115610af457610af4610ab4565b92915050565b5f60208284031215610b0a575f80fd5b5051919050565b81810381811115610af457610af4610ab4565b8082028115828204841417610af457610af4610ab4565b5f82610b6e577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea264697066735822122033106cf7b001b1d477ed25e125ab80df6dd17003360a25c343d79c307d5ef65264736f6c63430008190033000000000000000000000000d9cc3d70e730503e7f28c1b407389198c4b75fa20000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b4
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106100fb575f3560e01c8063a836988c11610093578063ccfe0dfd11610063578063ccfe0dfd1461022b578063e8d6101e14610233578063f3c5f51e1461025a578063fb626e741461026d575f80fd5b8063a836988c146101c8578063bc0403e4146101ef578063bebc1007146101f9578063cc1d054014610218575f80fd5b8063458efde3116100ce578063458efde31461018f5780634aeb19a1146101975780636c0b1e8c146101a25780638909d57f146101ad575f80fd5b806303c0049f146100ff57806305f2733d146101315780632c8bff311461017d57806333d5d30c14610185575b5f80fd5b61011e61010d366004610a7a565b5f6020819052908152604090205481565b6040519081526020015b60405180910390f35b6101587f000000000000000000000000d9cc3d70e730503e7f28c1b407389198c4b75fa281565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610128565b61011e601281565b61011e6228de8081565b61011e610277565b61011e6303c2670081565b61011e636750ed0081565b61015873d25215758734dd3ade497ce04de1c3582096412681565b61011e7f000000000000000000000000000000000000000000000000000000006779cb8081565b6101f7610286565b005b61011e610207366004610a7a565b60016020525f908152604090205481565b61011e610226366004610a7a565b610445565b6101f7610586565b6101587f0000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b481565b61011e610268366004610a7a565b6107ed565b61011e629e340081565b5f610281336107ed565b905090565b3373d25215758734dd3ade497ce04de1c35820964126146102d3576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6102e56303c26700636750ed00610ae1565b42101561031e576040517f24eb920400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f0000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b473ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156103a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103cc9190610afa565b90506103f97f0000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b43383610905565b60405181815273d25215758734dd3ade497ce04de1c35820964126907fe6317a4a1ff7151c3d469dfcdef2f07e80590dc560c4f34d0908e4db8909185f9060200160405180910390a250565b5f7f000000000000000000000000000000000000000000000000000000006779cb80421161047457505f919050565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526020818152604080832054600190925290912054106104af57505f919050565b5f806104db7f000000000000000000000000000000000000000000000000000000006779cb8042610b11565b9050629e340081106105285773ffffffffffffffffffffffffffffffffffffffff84165f9081526001602090815260408083205491839052909120546105219190610b11565b915061057f565b73ffffffffffffffffffffffffffffffffffffffff84165f908152600160209081526040808320549183905290912054629e340090610568908490610b24565b6105729190610b3b565b61057c9190610b11565b91505b5092915050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201525f907f000000000000000000000000d9cc3d70e730503e7f28c1b407389198c4b75fa273ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610610573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106349190610afa565b9050805f0361066f576040517fce8ce46400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f0000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b473ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156106f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061071b9190610afa565b5f03610753576040517f06ba7b3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61075f601283610b3b565b335f90815260208190526040812080549293508392909190610782908490610ae1565b909155506107b490507f000000000000000000000000d9cc3d70e730503e7f28c1b407389198c4b75fa233308561098b565b60405182815233907f911c74839017018049f3b58e1d9c889dd659eaaf2f4d7eed83939a4294ee299f9060200160405180910390a25050565b5f336107f881610445565b9150815f03610833576040517f7d52f2bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81165f9081526001602052604081208054849290610867908490610ae1565b9091555061089890507f0000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b48484610905565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8e8d6436f1f9912b965fcdf9910ef54a0cb606dd120111c26b602a5b7e3890d0846040516108f791815260200190565b60405180910390a350919050565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261098691859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506109d7565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526109d19186918216906323b872dd9060840161093f565b50505050565b5f8060205f8451602086015f885af1806109f6576040513d5f823e3d81fd5b50505f513d91508115610a0d578060011415610a27565b73ffffffffffffffffffffffffffffffffffffffff84163b155b156109d1576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240160405180910390fd5b5f60208284031215610a8a575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610aad575f80fd5b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b80820180821115610af457610af4610ab4565b92915050565b5f60208284031215610b0a575f80fd5b5051919050565b81810381811115610af457610af4610ab4565b8082028115828204841417610af457610af4610ab4565b5f82610b6e577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea264697066735822122033106cf7b001b1d477ed25e125ab80df6dd17003360a25c343d79c307d5ef65264736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d9cc3d70e730503e7f28c1b407389198c4b75fa20000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b4
-----Decoded View---------------
Arg [0] : _tlx (address): 0xD9cC3D70E730503E7f28c1B407389198c4B75FA2
Arg [1] : _snx (address): 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000d9cc3d70e730503e7f28c1b407389198c4b75fa2
Arg [1] : 0000000000000000000000008700daec35af8ff88c16bdf0418774cb3d7599b4
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.