Verified contractExactMIT
MotoFeeRouter
Address0x2e8ad409e27cc8ded60244e617753794fb14e1b3
- Balance
0 ETH
- Transactions
13,396
- Compiler
solc 0.8.30
- Same code
Only this contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,075,518
- Creation transaction
- 0x5904d3da13…059a33294f
9 files
- src/swap/MotoFeeRouter.solmain25.09 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol4.45 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC165.sol193 B
- node_modules/@openzeppelin/contracts/interfaces/IERC20.sol182 B
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.78 KB
- node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol13.31 KB
- node_modules/@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol2.85 KB
- node_modules/@openzeppelin/contracts/utils/TransientSlot.sol5.08 KB
- node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol871 B
src/swap/MotoFeeRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {
ReentrancyGuardTransient
} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
/**
* Trading surface of the moto.fun LaunchpadCurve singleton.
*
* `buy` pays launch tokens and any unspent ETH (a partial fill at the floor)
* to its caller. `sell` pulls launch tokens from its caller into the curve
* (unbonded tokens exempt that pull from allowance) and pays ETH to its
* caller.
*/
interface IMotoFunCurve {
function WETH() external view returns (address);
function buy(address token, uint256 minTokensOut) external payable returns (uint256 tokensOut);
function sell(address token, uint256 tokensIn, uint256 minEthOut)
external
returns (uint256 ethOut);
}
/**
* Fee-on-transfer exact-input swap surface of the Motoswap FeeRouter, the only
* open swap entry point of Motoswap pairs.
*
* These are Uniswap V2's `SupportingFeeOnTransferTokens` entry points
* (selectors `0xb6f9de95`, `0x791ac947`, `0x5c11d795`) with the same
* Motoswap fee as the plain ones. They price each hop from the balance the
* pair actually received, check `amountOutMin` against what `to` actually
* received, and return that delivered amount. For tokens that do not tax
* transfers they deliver exactly what the plain entry points deliver. The
* FeeRouter is an upgradeable proxy, so the router ignores the returned
* amount and settles on its own balance measurement.
*/
interface IMotoSwapFeeRouter {
function WETH() external view returns (address);
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256 delivered);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256 delivered);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256 delivered);
}
/**
* Atomic fee router for moto.fun bonding curves and Motoswap pairs.
*
* Curve swaps are forwarded to the single immutable LaunchpadCurve and pair
* swaps to the single immutable Motoswap FeeRouter along the direct
* two-token path of the requested pair, so the router never calls a
* caller-supplied venue. The caller-supplied addresses it does call are the
* ERC-20 legs of a swap (balance and allowance reads, the approval of the
* Motoswap FeeRouter, and transfers between the caller, this router, and the
* recipients) and the native recipients (swap recipient, fee recipient, and
* the caller for a curve refund), which receive plain value transfers. Both
* swap entry points are guarded against reentry. Fees are either a fixed
* input-side transfer or an output-side portion of the amount the router
* actually receives, denominated in whichever leg the fee side names. Native
* ETH legs use the zero address; on Motoswap they map to WETH in the path.
*
* Both venues pay swap output to their caller, so every swap settles through
* this router: it forwards the curve's refund of unspent ETH to the caller,
* splits the output between the fee recipient and the swap recipient, and
* reports the input actually consumed. The caller's gross minimum is passed
* to the venue unchanged, and the router then enforces the same minimum, net
* of an output fee, against the output it received. Venue fees (the curve's
* trading fee and the Motoswap FeeRouter's quote-side fee) are charged by the
* venues themselves and are already reflected in the output the router
* measures.
*
* A curve buy that reaches the floor is a partial fill: the curve spends
* part of the ETH, refunds the rest (forwarded to the caller), and checks its
* minimum only after scaling it by the share of the ETH it spent. The router
* does not scale: it enforces the caller's minimum against the delivered
* output as an absolute amount. A minimum derived from the full ETH budget
* can therefore pass the curve and still revert here with
* `InsufficientOutput`, so callers derive the minimum of a buy that may reach
* the floor from the ETH the fill actually consumes.
*
* Motoswap swaps use the FeeRouter's fee-on-transfer entry points, so either
* leg may be a token that taxes transfers. ERC-20 input is measured after it
* is pulled from the caller and the venue is offered what arrived; output is
* measured as the router's balance increase, so fees and the minimum apply to
* what actually reached the router. A tax the token levies when the router
* forwards output (to the recipient or the fee recipient), or on the caller's
* input-fee transfer, is not covered: those parties receive the forwarded
* amount net of the token's own tax. moto.fun coins never tax transfers, so
* the curve path offers the curve exactly `amountIn`.
*
* The contract keeps no persistent state beyond the immutable venues and a
* standing allowance to the Motoswap FeeRouter for each input token it has
* traded there; the reentrancy guard lives in transient storage. It has no
* owner, upgrade path, stored fee recipient, or arbitrary external-call
* surface. Value force-sent to the router outside a swap is excluded from
* every swap's accounting and is not recoverable.
*/
contract MotoFeeRouter is ReentrancyGuardTransient {
using SafeERC20 for IERC20;
uint256 public constant FEE_BPS_BASE = 10_000;
enum FeeSide {
None,
Input,
Output
}
struct FeeConfig {
FeeSide side;
uint256 amount;
uint16 bps;
address recipient;
}
struct CurveExactInParams {
address token;
bool isBuy;
uint256 amountIn;
uint256 amountOutMinimum;
address recipient;
uint256 deadline;
FeeConfig fee;
}
struct MotoswapExactInParams {
address inputToken;
address outputToken;
uint256 amountIn;
uint256 amountOutMinimum;
address recipient;
uint256 deadline;
FeeConfig fee;
}
struct Baselines {
uint256 nativeBalance;
uint256 inputBalance;
uint256 outputBalance;
}
error DeadlineExpired(uint256 deadline);
error InsufficientOutput(uint256 minimum, uint256 actual);
error InvalidAmount();
error InvalidCurve();
error InvalidFee();
error InvalidMotoRouter();
error InvalidNativeSender();
error InvalidNativeValue(uint256 expected, uint256 actual);
error InvalidRecipient();
error InvalidTokenPair();
error NativeTransferFailed(address recipient, uint256 amount);
error ResidualBalance(address token, uint256 expected, uint256 actual);
error WethMismatch(address curveWeth, address routerWeth);
event SwapFeePaid(
address indexed payer,
address indexed recipient,
address indexed token,
FeeSide side,
uint256 amount
);
IMotoFunCurve public immutable CURVE;
IMotoSwapFeeRouter public immutable MOTO_ROUTER;
address public immutable WETH;
/**
* Creates a non-upgradeable router for one moto.fun curve and one
* Motoswap FeeRouter.
*
* @param curve LaunchpadCurve proxy address.
* @param motoFeeRouter Motoswap FeeRouter proxy address.
*
* Reverts when either venue is zero or has no code, or when the two
* venues report different WETH addresses.
* Example: `new MotoFeeRouter(curve, motoFeeRouter)`.
*/
constructor(address curve, address motoFeeRouter) {
if (curve == address(0) || curve.code.length == 0) {
revert InvalidCurve();
}
if (motoFeeRouter == address(0) || motoFeeRouter.code.length == 0) {
revert InvalidMotoRouter();
}
address routerWeth = IMotoSwapFeeRouter(motoFeeRouter).WETH();
address curveWeth = IMotoFunCurve(curve).WETH();
if (routerWeth == address(0) || routerWeth != curveWeth) {
revert WethMismatch(curveWeth, routerWeth);
}
CURVE = IMotoFunCurve(curve);
MOTO_ROUTER = IMotoSwapFeeRouter(motoFeeRouter);
WETH = routerWeth;
}
/**
* Accepts native value only from the venues: curve sell payouts, curve
* buy refunds of unspent input at the floor, and Motoswap ETH output.
*/
receive() external payable {
if (msg.sender != address(CURVE) && msg.sender != address(MOTO_ROUTER)) {
revert InvalidNativeSender();
}
}
/**
* Swaps an exact input on the moto.fun bonding curve with an atomic fee.
*
* Buys spend native ETH (`msg.value` must equal `amountIn` plus an input
* fee) and deliver launch tokens; sells pull `amountIn` launch tokens
* from the caller (approve this router) and deliver ETH. Input fees are
* paid to the fee recipient before the swap. Output fees are a portion
* of the amount the router actually receives, with the remainder
* forwarded to the swap recipient. ETH the curve refunds on a buy that
* reaches the floor is forwarded to the caller and excluded from
* `amountInSpent`. `amountOutMinimum` is the gross minimum: the curve
* enforces it (scaled by the share of the ETH it spent on a floor fill),
* and the router enforces it unscaled, net of an output fee, against the
* output it received. For a buy that may reach the floor, derive it from
* the ETH the fill consumes, not from the full `amountIn`.
*
* @param params Launch token, direction, exact input, minimum gross output, recipient, deadline, and fee.
* @return amountInSpent Gross caller input actually consumed, including an input fee.
* @return amountOutReceived Output delivered to `params.recipient`, net of an output fee.
*
* Reverts when the deadline, token, fee, amount, recipient, or native
* value is invalid, when the curve refuses the trade (not trading,
* paused, or below its minimum), or when the fee-adjusted recipient
* output is below the net minimum.
* Example: `router.swapCurveExactIn{ value: amountIn + inputFee }(params)`.
*/
function swapCurveExactIn(CurveExactInParams calldata params)
external
payable
nonReentrant
returns (uint256 amountInSpent, uint256 amountOutReceived)
{
if (params.token == address(0)) {
revert InvalidTokenPair();
}
_validate(
params.deadline, params.recipient, params.amountIn, params.amountOutMinimum, params.fee
);
address inputToken = params.isBuy ? address(0) : params.token;
address outputToken = params.isBuy ? params.token : address(0);
uint256 inputFee = params.fee.side == FeeSide.Input ? params.fee.amount : 0;
_validateNativeValue(params.isBuy, params.amountIn + inputFee);
Baselines memory baselines = _snapshot(inputToken, outputToken);
_collectInputFee(inputToken, params.isBuy, params.fee);
uint256 refund;
if (params.isBuy) {
CURVE.buy{ value: params.amountIn }(params.token, params.amountOutMinimum);
refund = _forwardNativeRefund(baselines.nativeBalance);
} else {
// moto.fun coins never tax transfers, so the router now holds exactly
// `amountIn`, which the curve pulls without an allowance. The residual
// check below still proves the curve took all of it.
IERC20(params.token).safeTransferFrom(msg.sender, address(this), params.amountIn);
CURVE.sell(params.token, params.amountIn, params.amountOutMinimum);
}
amountOutReceived = _settleOutput(
outputToken, params.amountOutMinimum, params.recipient, params.fee, baselines
);
_assertNoResiduals(inputToken, baselines);
amountInSpent = params.amountIn + inputFee - refund;
}
/**
* Swaps an exact input on the direct Motoswap pair of two assets with an
* atomic fee, through the Motoswap FeeRouter.
*
* The zero address is native ETH (WETH in the pair path); any ERC-20
* quote asset of the pair (WETH, MOTO, stablecoins) is supported as
* either leg, and either leg may be a token that taxes transfers. Native
* input requires `msg.value` equal to `amountIn` plus an input fee; ERC-20
* input is pulled from the caller (approve this router) and the venue is
* offered what actually arrived. Input fees are paid to the fee recipient
* before the swap. Output fees are a portion of the amount the router
* actually receives, with the remainder forwarded to the swap recipient.
* `amountOutMinimum` is the gross minimum (after the Motoswap FeeRouter's
* fee and any transfer tax on the way to this router, before this
* router's output fee) that the Motoswap FeeRouter enforces on what the
* router received; the router enforces the same minimum net of an output
* fee on what it forwards. A transfer tax on that forward is not covered.
*
* @param params Legs (zero address for native), exact input, minimum gross output, recipient, deadline, and fee.
* @return amountInSpent Gross caller input actually consumed, including an input fee.
* @return amountOutReceived Output delivered to `params.recipient`, net of an output fee.
*
* Reverts when the deadline, legs, fee, amount, recipient, or native
* value is invalid, when the pair does not exist or the Motoswap
* FeeRouter refuses the trade or its minimum, or when the fee-adjusted
* recipient output is below the net minimum.
* Example: `router.swapMotoswapExactIn{ value: amountIn + inputFee }(params)`.
*/
function swapMotoswapExactIn(MotoswapExactInParams calldata params)
external
payable
nonReentrant
returns (uint256 amountInSpent, uint256 amountOutReceived)
{
address[] memory path = _motoswapPath(params.inputToken, params.outputToken);
_validate(
params.deadline, params.recipient, params.amountIn, params.amountOutMinimum, params.fee
);
bool nativeInput = params.inputToken == address(0);
uint256 inputFee = params.fee.side == FeeSide.Input ? params.fee.amount : 0;
_validateNativeValue(nativeInput, params.amountIn + inputFee);
Baselines memory baselines = _snapshot(params.inputToken, params.outputToken);
_collectInputFee(params.inputToken, nativeInput, params.fee);
// Exact-input Motoswap swaps consume all of their input, so there is
// no refund to forward: input left behind fails the residual check.
if (nativeInput) {
MOTO_ROUTER.swapExactETHForTokensSupportingFeeOnTransferTokens{
value: params.amountIn
}(
params.amountOutMinimum, path, address(this), params.deadline
);
} else {
uint256 swapInput =
_pullMotoswapInput(params.inputToken, params.amountIn, baselines.inputBalance);
if (params.outputToken == address(0)) {
MOTO_ROUTER.swapExactTokensForETHSupportingFeeOnTransferTokens(
swapInput, params.amountOutMinimum, path, address(this), params.deadline
);
} else {
MOTO_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(
swapInput, params.amountOutMinimum, path, address(this), params.deadline
);
}
}
amountOutReceived = _settleOutput(
params.outputToken, params.amountOutMinimum, params.recipient, params.fee, baselines
);
_assertNoResiduals(params.inputToken, baselines);
amountInSpent = params.amountIn + inputFee;
}
/**
* Builds the direct two-token Motoswap path, mapping native legs to WETH,
* and rejects pairs that collapse to the same asset.
*/
function _motoswapPath(address inputToken, address outputToken)
private
view
returns (address[] memory path)
{
address pathIn = inputToken == address(0) ? WETH : inputToken;
address pathOut = outputToken == address(0) ? WETH : outputToken;
if (pathIn == pathOut) {
revert InvalidTokenPair();
}
path = new address[](2);
path[0] = pathIn;
path[1] = pathOut;
}
function _validate(
uint256 deadline,
address recipient,
uint256 amountIn,
uint256 amountOutMinimum,
FeeConfig calldata fee
) private view {
if (block.timestamp > deadline) {
revert DeadlineExpired(deadline);
}
if (recipient == address(0) || recipient == address(this)) {
revert InvalidRecipient();
}
if (amountIn == 0 || amountOutMinimum == 0) {
revert InvalidAmount();
}
_validateFee(fee);
}
function _validateFee(FeeConfig calldata fee) private view {
if (fee.side == FeeSide.None) {
if (fee.amount != 0 || fee.bps != 0 || fee.recipient != address(0)) {
revert InvalidFee();
}
return;
}
if (
fee.recipient == address(0) || fee.recipient == address(this)
|| fee.recipient == address(CURVE) || fee.recipient == address(MOTO_ROUTER)
) {
revert InvalidFee();
}
if (fee.side == FeeSide.Input) {
if (fee.amount == 0 || fee.bps != 0) {
revert InvalidFee();
}
} else if (fee.amount != 0 || fee.bps == 0 || fee.bps >= FEE_BPS_BASE) {
revert InvalidFee();
}
}
function _validateNativeValue(bool nativeInput, uint256 expected) private view {
uint256 expectedValue = nativeInput ? expected : 0;
if (msg.value != expectedValue) {
revert InvalidNativeValue(expectedValue, msg.value);
}
}
/**
* Records balances before any transfer so pre-existing dust cannot fail
* the residual checks and mid-call deltas are measured exactly.
*/
function _snapshot(address inputToken, address outputToken)
private
view
returns (Baselines memory baselines)
{
baselines.nativeBalance = address(this).balance - msg.value;
if (inputToken != address(0)) {
baselines.inputBalance = IERC20(inputToken).balanceOf(address(this));
}
if (outputToken != address(0)) {
baselines.outputBalance = IERC20(outputToken).balanceOf(address(this));
}
}
function _collectInputFee(address inputToken, bool nativeInput, FeeConfig calldata fee)
private
{
if (fee.side != FeeSide.Input) {
return;
}
if (nativeInput) {
_sendNative(fee.recipient, fee.amount);
} else {
IERC20(inputToken).safeTransferFrom(msg.sender, fee.recipient, fee.amount);
}
emit SwapFeePaid(msg.sender, fee.recipient, inputToken, FeeSide.Input, fee.amount);
}
/**
* Pulls Motoswap ERC-20 input from the caller and returns the amount that
* actually arrived, which is what the venue is offered: a token that taxes
* the pull delivers less than `amount`. The input fee moves from the
* caller to the fee recipient directly, so the arrival is the balance
* increase over the pre-swap `baseline`.
*
* The Motoswap FeeRouter holds a standing maximum allowance per input
* token, re-granted only if a token has spent it below this swap's input.
* The router never holds tokens between swaps, so the allowance can only
* ever move what a swap just pulled.
*/
function _pullMotoswapInput(address inputToken, uint256 amount, uint256 baseline)
private
returns (uint256 swapInput)
{
IERC20 input = IERC20(inputToken);
input.safeTransferFrom(msg.sender, address(this), amount);
swapInput = input.balanceOf(address(this)) - baseline;
if (swapInput == 0) {
revert InvalidAmount();
}
if (input.allowance(address(this), address(MOTO_ROUTER)) < swapInput) {
input.forceApprove(address(MOTO_ROUTER), type(uint256).max);
}
}
/**
* Forwards the curve's refund of unspent ETH on a buy that reaches the
* floor to the caller. A buy's output is tokens, so any ETH the router
* holds above its baseline after the buy is that refund.
*/
function _forwardNativeRefund(uint256 nativeBaseline) private returns (uint256 refund) {
refund = address(this).balance - nativeBaseline;
if (refund != 0) {
_sendNative(msg.sender, refund);
}
}
/**
* Measures what the venue delivered, splits off an output fee, forwards
* the remainder to the recipient, and enforces the caller's minimum, net
* of that fee, against the amount forwarded.
*
* This check is the router's own guarantee, not a restatement of the
* venue's. Motoswap enforces the gross minimum on what the router
* received, so on that path the check adds the net-of-fee rounding. The
* curve scales its minimum by the share of the ETH it spent when a buy
* reaches the floor, so on such a partial fill this is the only check
* that holds the delivered output to the caller's minimum as an absolute
* amount. A token that taxes the forward delivers the recipient less than
* the amount checked here.
*/
function _settleOutput(
address outputToken,
uint256 grossMinimum,
address recipient,
FeeConfig calldata fee,
Baselines memory baselines
) private returns (uint256 amountOutReceived) {
bool nativeOutput = outputToken == address(0);
uint256 received = nativeOutput
? address(this).balance - baselines.nativeBalance
: IERC20(outputToken).balanceOf(address(this)) - baselines.outputBalance;
uint256 outputFee = fee.side == FeeSide.Output ? received * fee.bps / FEE_BPS_BASE : 0;
// Cannot underflow: `_validateFee` keeps `bps < FEE_BPS_BASE`, so
// `outputFee <= received`.
unchecked {
amountOutReceived = received - outputFee;
}
if (nativeOutput) {
if (outputFee != 0) {
_sendNative(fee.recipient, outputFee);
}
_sendNative(recipient, amountOutReceived);
} else {
if (outputFee != 0) {
IERC20(outputToken).safeTransfer(fee.recipient, outputFee);
}
IERC20(outputToken).safeTransfer(recipient, amountOutReceived);
}
if (outputFee != 0) {
emit SwapFeePaid(msg.sender, fee.recipient, outputToken, FeeSide.Output, outputFee);
}
uint256 minimumRecipientOutput = grossMinimum;
if (fee.side == FeeSide.Output) {
// Cannot underflow, for the same reason as the fee split above.
unchecked {
minimumRecipientOutput -= grossMinimum * fee.bps / FEE_BPS_BASE;
}
}
if (amountOutReceived < minimumRecipientOutput) {
revert InsufficientOutput(minimumRecipientOutput, amountOutReceived);
}
}
/**
* Proves the swap left nothing behind: the native balance is back at its
* baseline and the venue took all of the ERC-20 input the router pulled.
* The ERC-20 output needs no re-read: `_settleOutput` forwards exactly the
* balance increase it measured, and a transfer debits the router the full
* amount even when the token taxes it.
*/
function _assertNoResiduals(address inputToken, Baselines memory baselines) private view {
uint256 nativeBalance = address(this).balance;
if (nativeBalance != baselines.nativeBalance) {
revert ResidualBalance(address(0), baselines.nativeBalance, nativeBalance);
}
if (inputToken != address(0)) {
uint256 inputBalance = IERC20(inputToken).balanceOf(address(this));
if (inputBalance != baselines.inputBalance) {
revert ResidualBalance(inputToken, baselines.inputBalance, inputBalance);
}
}
}
function _sendNative(address recipient, uint256 amount) private {
(bool success,) = recipient.call{ value: amount }("");
if (!success) {
revert NativeTransferFailed(recipient, amount);
}
}
}
node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
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);
}
node_modules/@openzeppelin/contracts/interfaces/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";
node_modules/@openzeppelin/contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";
node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @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);
}
node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.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 {
if (!_safeTransfer(token, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 {
if (!_safeTransferFrom(token, from, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _safeTransfer(token, to, value, false);
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _safeTransferFrom(token, from, to, value, false);
}
/**
* @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 {
if (!_safeApprove(token, spender, value, false)) {
if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));
if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 relies 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 relies 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}.
* Oppositely, 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 `token.transfer(to, value)` call, 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 to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.transfer.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(to, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
/**
* @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, 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 from The sender of the tokens
* @param to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value,
bool bubble
) private returns (bool success) {
bytes4 selector = IERC20.transferFrom.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(from, shr(96, not(0))))
mstore(0x24, and(to, shr(96, not(0))))
mstore(0x44, value)
success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
mstore(0x60, 0)
}
}
/**
* @dev Imitates a Solidity `token.approve(spender, value)` call, 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 spender The spender of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.approve.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(spender, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
}
node_modules/@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuardTransient.sol)
pragma solidity ^0.8.24;
import {TransientSlot} from "./TransientSlot.sol";
/**
* @dev Variant of {ReentrancyGuard} that uses transient storage.
*
* NOTE: This variant only works on networks where EIP-1153 is available.
*
* _Available since v5.1._
*
* @custom:stateless
*/
abstract contract ReentrancyGuardTransient {
using TransientSlot for *;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
/**
* @dev A `view` only version of {nonReentrant}. Use to block view functions
* from being called, preventing reading from inconsistent contract state.
*
* CAUTION: This is a "view" modifier and does not change the reentrancy
* status. Use it only on view functions. For payable or non-payable functions,
* use the standard {nonReentrant} modifier instead.
*/
modifier nonReentrantView() {
_nonReentrantBeforeView();
_;
}
function _nonReentrantBeforeView() private view {
if (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, REENTRANCY_GUARD_STORAGE.asBoolean().tload() will be false
_nonReentrantBeforeView();
// Any calls to nonReentrant after this point will fail
_reentrancyGuardStorageSlot().asBoolean().tstore(true);
}
function _nonReentrantAfter() private {
_reentrancyGuardStorageSlot().asBoolean().tstore(false);
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _reentrancyGuardStorageSlot().asBoolean().tload();
}
function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {
return REENTRANCY_GUARD_STORAGE;
}
}
node_modules/@openzeppelin/contracts/utils/TransientSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/TransientSlot.sol)
// This file was procedurally generated from scripts/generate/templates/TransientSlot.js.
pragma solidity ^0.8.24;
/**
* @dev Library for reading and writing value-types to specific transient storage slots.
*
* Transient slots are often used to store temporary values that are removed after the current transaction.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* * Example reading and writing values using transient storage:
* ```solidity
* contract Lock {
* using TransientSlot for *;
*
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;
*
* modifier locked() {
* require(!_LOCK_SLOT.asBoolean().tload());
*
* _LOCK_SLOT.asBoolean().tstore(true);
* _;
* _LOCK_SLOT.asBoolean().tstore(false);
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library TransientSlot {
/**
* @dev UDVT that represents a slot holding an address.
*/
type AddressSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a AddressSlot.
*/
function asAddress(bytes32 slot) internal pure returns (AddressSlot) {
return AddressSlot.wrap(slot);
}
/**
* @dev UDVT that represents a slot holding a bool.
*/
type BooleanSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a BooleanSlot.
*/
function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) {
return BooleanSlot.wrap(slot);
}
/**
* @dev UDVT that represents a slot holding a bytes32.
*/
type Bytes32Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Bytes32Slot.
*/
function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) {
return Bytes32Slot.wrap(slot);
}
/**
* @dev UDVT that represents a slot holding a uint256.
*/
type Uint256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Uint256Slot.
*/
function asUint256(bytes32 slot) internal pure returns (Uint256Slot) {
return Uint256Slot.wrap(slot);
}
/**
* @dev UDVT that represents a slot holding a int256.
*/
type Int256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Int256Slot.
*/
function asInt256(bytes32 slot) internal pure returns (Int256Slot) {
return Int256Slot.wrap(slot);
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(AddressSlot slot) internal view returns (address value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(AddressSlot slot, address value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(BooleanSlot slot) internal view returns (bool value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(BooleanSlot slot, bool value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Bytes32Slot slot) internal view returns (bytes32 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Bytes32Slot slot, bytes32 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Uint256Slot slot) internal view returns (uint256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Uint256Slot slot, uint256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Int256Slot slot) internal view returns (int256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Int256Slot slot, int256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
}
node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @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);
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/=node_modules/@openzeppelin/",
"forge-std/=node_modules/forge-std/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.