Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
TradingLibrary
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "../interfaces/IPosition.sol";
import "../interfaces/ITrading.sol";
struct PriceData {
address provider;
bool isClosed;
uint256 asset;
uint256 price;
uint256 spread;
uint256 timestamp;
bytes signature;
}
library TradingLibrary {
using ECDSA for bytes32;
uint256 constant DIVISION_CONSTANT = 1e10;
/**
* @notice returns position profit or loss
* @param _direction true if long
* @param _currentPrice current price
* @param _price opening price
* @param _leverage position leverage
* @param _margin collateral amount
* @param accInterest funding fees
* @return _positionSize position size
* @return _payout payout trader should get
*/
function pnl(bool _direction, uint256 _currentPrice, uint256 _price, uint256 _margin, uint256 _leverage, int256 accInterest) external pure returns (uint256 _positionSize, int256 _payout) {
uint256 _initPositionSize = _margin * _leverage / 1e18;
if (_direction && _currentPrice >= _price) {
_payout = int256(_margin) + int256(_initPositionSize * (1e18 * _currentPrice / _price - 1e18)/1e18) + accInterest;
} else if (_direction && _currentPrice < _price) {
_payout = int256(_margin) - int256(_initPositionSize * (1e18 - 1e18 * _currentPrice / _price)/1e18) + accInterest;
} else if (!_direction && _currentPrice <= _price) {
_payout = int256(_margin) + int256(_initPositionSize * (1e18 - 1e18 * _currentPrice / _price)/1e18) + accInterest;
} else {
_payout = int256(_margin) - int256(_initPositionSize * (1e18 * _currentPrice / _price - 1e18)/1e18) + accInterest;
}
_positionSize = _direction ? _initPositionSize * _currentPrice / _price : _initPositionSize * _price / _currentPrice;
}
/**
* @notice returns position liquidation price
* @param _direction true if long
* @param _tradePrice opening price
* @param _leverage position leverage
* @param _margin collateral amount
* @param _accInterest funding fees
* @param _liqPercent liquidation percent
* @return _liqPrice liquidation price
*/
function liqPrice(bool _direction, uint256 _tradePrice, uint256 _leverage, uint256 _margin, int256 _accInterest, uint256 _liqPercent) public pure returns (uint256 _liqPrice) {
if (_direction) {
_liqPrice = uint256(int256(_tradePrice) - int256(_tradePrice) * (int256(_margin) * int256(_liqPercent) / int256(DIVISION_CONSTANT) + _accInterest) * 1e18 / int256(_margin) / int256(_leverage));
} else {
_liqPrice = uint256(int256(_tradePrice) + int256(_tradePrice) * (int256(_margin) * int256(_liqPercent) / int256(DIVISION_CONSTANT) + _accInterest) * 1e18 / int256(_margin) / int256(_leverage));
}
}
/**
* @notice uses liqPrice() and returns position liquidation price
* @param _positions positions contract address
* @param _id position id
* @param _liqPercent liquidation percent
*/
function getLiqPrice(address _positions, uint256 _id, uint256 _liqPercent) external view returns (uint256) {
IPosition.Trade memory _trade = IPosition(_positions).trades(_id);
return liqPrice(_trade.direction, _trade.price, _trade.leverage, _trade.margin, _trade.accInterest, _liqPercent);
}
/**
* @notice verifies that price is signed by a whitelisted node
* @param _validSignatureTimer seconds allowed before price is old
* @param _asset position asset
* @param _priceData PriceData object
* @param _isNode mapping of allowed nodes
*/
function verifyPrice(
uint256 _validSignatureTimer,
uint256 _asset,
PriceData calldata _priceData,
mapping(address => bool) storage _isNode
)
external view
{
require(block.timestamp <= _priceData.timestamp + _validSignatureTimer, "Price has expired.");
require(block.timestamp >= _priceData.timestamp, "FutSig");
require(!_priceData.isClosed, "Market is closed.");
require(_asset == _priceData.asset, "!Asset");
require(_priceData.price != 0, "NoPrice");
address _provider = (
keccak256(abi.encode(
_priceData.provider,
_priceData.isClosed,
_priceData.asset,
_priceData.price,
_priceData.spread,
_priceData.timestamp
))
).toEthSignedMessageHash().recover(_priceData.signature);
require(_provider == _priceData.provider, "BadSig");
require(_isNode[_provider], "!Node");
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IPosition {
struct Trade {
uint256 margin;
uint256 leverage;
uint256 asset;
bool direction;
uint256 price;
uint256 tpPrice;
uint256 slPrice;
uint256 orderType;
address trader;
uint256 id;
address tigAsset;
int accInterest;
}
struct MintTrade {
address account;
uint256 margin;
uint256 leverage;
uint256 asset;
bool direction;
uint256 price;
uint256 tp;
uint256 sl;
uint256 orderType;
address tigAsset;
}
function trades(uint256) external view returns (Trade memory);
function executeLimitOrder(uint256 _id, uint256 _price, uint256 _newMargin) external;
function modifyMargin(uint256 _id, uint256 _newMargin, uint256 _newLeverage) external;
function addToPosition(uint256 _id, uint256 _newMargin, uint256 _newPrice) external;
function reducePosition(uint256 _id, uint256 _newMargin) external;
function assetOpenPositions(uint256 _asset) external view returns (uint256[] calldata);
function assetOpenPositionsIndexes(uint256 _asset, uint256 _id) external view returns (uint256);
function limitOrders(uint256 _asset) external view returns (uint256[] memory);
function limitOrderIndexes(uint256 _asset, uint256 _id) external view returns (uint256);
function assetOpenPositionsLength(uint256 _asset) external view returns (uint256);
function limitOrdersLength(uint256 _asset) external view returns (uint256);
function ownerOf(uint256 _id) external view returns (address);
function mint(MintTrade memory _mintTrade) external;
function burn(uint256 _id) external;
function modifyTp(uint256 _id, uint256 _tpPrice) external;
function modifySl(uint256 _id, uint256 _slPrice) external;
function getCount() external view returns (uint);
function updateFunding(uint256 _asset, address _tigAsset, uint256 _longOi, uint256 _shortOi, uint256 _baseFundingRate, uint256 _vaultFundingPercent) external;
function setAccInterest(uint256 _id) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/TradingLibrary.sol";
interface ITrading {
struct TradeInfo {
uint256 margin;
address marginAsset;
address stableVault;
uint256 leverage;
uint256 asset;
bool direction;
uint256 tpPrice;
uint256 slPrice;
address referrer;
}
struct ERC20PermitData {
uint256 deadline;
uint256 amount;
uint8 v;
bytes32 r;
bytes32 s;
bool usePermit;
}
struct Fees {
uint256 daoFees;
uint256 burnFees;
uint256 refDiscount;
uint256 botFees;
}
struct Delay {
uint256 delay; // Block timestamp where delay ends
bool actionType; // True for open, False for close
}
error LimitNotSet();
error OnlyEOA();
error NotLiquidatable();
error TradingPaused();
error OldPriceData();
error OrderNotFound();
error TooEarlyToCancel();
error BadDeposit();
error BadWithdraw();
error BadStopLoss();
error IsLimit();
error ValueNotEqualToMargin();
error BadLeverage();
error NotMargin();
error NotAllowedInVault();
error NotVault();
error NotOwner();
error NotAllowedPair();
error WaitDelay();
error NotProxy();
error BelowMinPositionSize();
error BadClosePercent();
error NoPrice();
error LiqThreshold();
error CloseToMaxPnL();
error BadSetter();
error BadConstructor();
error NotLimit();
error LimitNotMet();
error NotEnoughGas();
function marketOpen(
TradeInfo calldata _tradeInfo,
ERC20PermitData calldata _permitData,
address _trader,
PriceData calldata _priceData
) external;
function marketClose(
uint256 _id,
uint256 _percent,
address _stableVault,
address _outputToken,
address _trader,
PriceData calldata _priceData
) external;
function addMargin(
uint256 _id,
address _stableVault,
address _marginAsset,
uint256 _addMargin,
ERC20PermitData calldata _permitData,
address _trader,
PriceData calldata _priceData
) external;
function removeMargin(
uint256 _id,
address _stableVault,
address _outputToken,
uint256 _removeMargin,
address _trader,
PriceData calldata _priceData
) external;
function addToPosition(
uint256 _id,
address _stableVault,
address _marginAsset,
uint256 _addMargin,
ERC20PermitData calldata _permitData,
address _trader,
PriceData calldata _priceData
) external;
function createLimitOrder(
TradeInfo calldata _tradeInfo,
uint256 _orderType, // 1 limit, 2 momentum
uint256 _price,
ERC20PermitData calldata _permitData,
address _trader
) external;
function cancelLimitOrder(
uint256 _id,
address _trader
) external;
function updateTpSl(
bool _type, // true is TP
uint256 _id,
uint256 _limitPrice,
address _trader,
PriceData calldata _priceData
) external;
function executeLimitOrder(
uint256 _id,
PriceData calldata _priceData
) external;
function liquidatePosition(
uint256 _id,
PriceData calldata _priceData
) external;
function limitClose(
uint256 _id,
bool _tp,
PriceData calldata _priceData
) external;
function proxyApprovals(address _account) external view returns(address);
}{
"optimizer": {
"enabled": true,
"runs": 1000000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_positions","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_liqPercent","type":"uint256"}],"name":"getLiqPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_direction","type":"bool"},{"internalType":"uint256","name":"_tradePrice","type":"uint256"},{"internalType":"uint256","name":"_leverage","type":"uint256"},{"internalType":"uint256","name":"_margin","type":"uint256"},{"internalType":"int256","name":"_accInterest","type":"int256"},{"internalType":"uint256","name":"_liqPercent","type":"uint256"}],"name":"liqPrice","outputs":[{"internalType":"uint256","name":"_liqPrice","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bool","name":"_direction","type":"bool"},{"internalType":"uint256","name":"_currentPrice","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_margin","type":"uint256"},{"internalType":"uint256","name":"_leverage","type":"uint256"},{"internalType":"int256","name":"accInterest","type":"int256"}],"name":"pnl","outputs":[{"internalType":"uint256","name":"_positionSize","type":"uint256"},{"internalType":"int256","name":"_payout","type":"int256"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
6110d461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c806326d4e7751461005b578063360e8043146100815780635cf3eb44146100a9578063d63b3c7b146100be575b600080fd5b61006e610069366004610c10565b6100d1565b6040519081526020015b60405180910390f35b61009461008f366004610c53565b610194565b60408051928352602083019190915201610078565b6100bc6100b7366004610c9f565b61035d565b005b61006e6100cc366004610c53565b610800565b6040517f1e6c598e00000000000000000000000000000000000000000000000000000000815260048101839052600090819073ffffffffffffffffffffffffffffffffffffffff861690631e6c598e9060240161018060405180830381865afa158015610142573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101669190610d68565b905061018b816060015182608001518360200151846000015185610160015188610800565b95945050505050565b60008080670de0b6b3a76400006101ab8688610e46565b6101b59190610e8c565b90508880156101c45750868810155b156102225783670de0b6b3a764000080896101df8c83610e46565b6101e99190610e8c565b6101f39190610ea0565b6101fd9084610e46565b6102079190610e8c565b6102119088610eb3565b61021b9190610eb3565b915061031b565b88801561022e57508688105b156102825783670de0b6b3a7640000886102488b83610e46565b6102529190610e8c565b61026490670de0b6b3a7640000610ea0565b61026e9084610e46565b6102789190610e8c565b6102119088610edb565b881580156102905750868811155b156102c65783670de0b6b3a7640000886102aa8b83610e46565b6102b49190610e8c565b6101f390670de0b6b3a7640000610ea0565b83670de0b6b3a764000080896102dc8c83610e46565b6102e69190610e8c565b6102f09190610ea0565b6102fa9084610e46565b6103049190610e8c565b61030e9088610edb565b6103189190610eb3565b91505b8861033a578761032b8883610e46565b6103359190610e8c565b61034f565b866103458983610e46565b61034f9190610e8c565b925050965096945050505050565b61036b8460a0840135610f02565b4211156103d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f50726963652068617320657870697265642e000000000000000000000000000060448201526064015b60405180910390fd5b8160a00135421015610447576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f467574536967000000000000000000000000000000000000000000000000000060448201526064016103d0565b6104576040830160208401610f15565b156104be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4d61726b657420697320636c6f7365642e00000000000000000000000000000060448201526064016103d0565b8160400135831461052b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f214173736574000000000000000000000000000000000000000000000000000060448201526064016103d0565b8160600135600003610599576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f4e6f50726963650000000000000000000000000000000000000000000000000060448201526064016103d0565b60006106c76105ab60c0850185610f39565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506106c192506105f19150506020870187610f9e565b6106016040880160208901610f15565b6040805173ffffffffffffffffffffffffffffffffffffffff90931660208401529015158282015287013560608281019190915287013560808281019190915287013560a08281019190915287013560c082015260e001604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b906108de565b90506106d66020840184610f9e565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461076a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f426164536967000000000000000000000000000000000000000000000000000060448201526064016103d0565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020839052604090205460ff166107f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f214e6f646500000000000000000000000000000000000000000000000000000060448201526064016103d0565b5050505050565b60008615610870578484846402540be40061081b8684610fbb565b6108259190611007565b61082f9190610eb3565b6108399089610fbb565b61084b90670de0b6b3a7640000610fbb565b6108559190611007565b61085f9190611007565b6108699087610edb565b90506108d4565b8484846402540be4006108838684610fbb565b61088d9190611007565b6108979190610eb3565b6108a19089610fbb565b6108b390670de0b6b3a7640000610fbb565b6108bd9190611007565b6108c79190611007565b6108d19087610eb3565b90505b9695505050505050565b60008060006108ed8585610904565b915091506108fa81610949565b5090505b92915050565b600080825160410361093a5760208301516040840151606085015160001a61092e87828585610aff565b94509450505050610942565b506000905060025b9250929050565b600081600481111561095d5761095d61106f565b036109655750565b60018160048111156109795761097961106f565b036109e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103d0565b60028160048111156109f4576109f461106f565b03610a5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103d0565b6003816004811115610a6f57610a6f61106f565b03610afc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016103d0565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610b365750600090506003610be5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610b8a573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116610bde57600060019250925050610be5565b9150600090505b94509492505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610afc57600080fd5b600080600060608486031215610c2557600080fd5b8335610c3081610bee565b95602085013595506040909401359392505050565b8015158114610afc57600080fd5b60008060008060008060c08789031215610c6c57600080fd5b8635610c7781610c45565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b60008060008060808587031215610cb557600080fd5b8435935060208501359250604085013567ffffffffffffffff811115610cda57600080fd5b850160e08188031215610cec57600080fd5b9396929550929360600135925050565b604051610180810167ffffffffffffffff81118282101715610d47577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b8051610d5881610c45565b919050565b8051610d5881610bee565b60006101808284031215610d7b57600080fd5b610d83610cfc565b825181526020830151602082015260408301516040820152610da760608401610d4d565b60608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e0820152610100610de2818501610d5d565b908201526101208381015190820152610140610dff818501610d5d565b90820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820281158282048414176108fe576108fe610e17565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610e9b57610e9b610e5d565b500490565b818103818111156108fe576108fe610e17565b8082018281126000831280158216821582161715610ed357610ed3610e17565b505092915050565b8181036000831280158383131683831282161715610efb57610efb610e17565b5092915050565b808201808211156108fe576108fe610e17565b600060208284031215610f2757600080fd5b8135610f3281610c45565b9392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610f6e57600080fd5b83018035915067ffffffffffffffff821115610f8957600080fd5b60200191503681900382131561094257600080fd5b600060208284031215610fb057600080fd5b8135610f3281610bee565b808202600082127f800000000000000000000000000000000000000000000000000000000000000084141615610ff357610ff3610e17565b81810583148215176108fe576108fe610e17565b60008261101657611016610e5d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f80000000000000000000000000000000000000000000000000000000000000008314161561106a5761106a610e17565b500590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220fa85b8d49d3d55e1682965d6aeb6ed08f7a00ee0b7bc8108b02613bf38f6409b64736f6c63430008130033
Deployed Bytecode
0x73fd30d872b0eecbf0d12ddb957129ea8ff4d4ba3e30146080604052600436106100565760003560e01c806326d4e7751461005b578063360e8043146100815780635cf3eb44146100a9578063d63b3c7b146100be575b600080fd5b61006e610069366004610c10565b6100d1565b6040519081526020015b60405180910390f35b61009461008f366004610c53565b610194565b60408051928352602083019190915201610078565b6100bc6100b7366004610c9f565b61035d565b005b61006e6100cc366004610c53565b610800565b6040517f1e6c598e00000000000000000000000000000000000000000000000000000000815260048101839052600090819073ffffffffffffffffffffffffffffffffffffffff861690631e6c598e9060240161018060405180830381865afa158015610142573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101669190610d68565b905061018b816060015182608001518360200151846000015185610160015188610800565b95945050505050565b60008080670de0b6b3a76400006101ab8688610e46565b6101b59190610e8c565b90508880156101c45750868810155b156102225783670de0b6b3a764000080896101df8c83610e46565b6101e99190610e8c565b6101f39190610ea0565b6101fd9084610e46565b6102079190610e8c565b6102119088610eb3565b61021b9190610eb3565b915061031b565b88801561022e57508688105b156102825783670de0b6b3a7640000886102488b83610e46565b6102529190610e8c565b61026490670de0b6b3a7640000610ea0565b61026e9084610e46565b6102789190610e8c565b6102119088610edb565b881580156102905750868811155b156102c65783670de0b6b3a7640000886102aa8b83610e46565b6102b49190610e8c565b6101f390670de0b6b3a7640000610ea0565b83670de0b6b3a764000080896102dc8c83610e46565b6102e69190610e8c565b6102f09190610ea0565b6102fa9084610e46565b6103049190610e8c565b61030e9088610edb565b6103189190610eb3565b91505b8861033a578761032b8883610e46565b6103359190610e8c565b61034f565b866103458983610e46565b61034f9190610e8c565b925050965096945050505050565b61036b8460a0840135610f02565b4211156103d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f50726963652068617320657870697265642e000000000000000000000000000060448201526064015b60405180910390fd5b8160a00135421015610447576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f467574536967000000000000000000000000000000000000000000000000000060448201526064016103d0565b6104576040830160208401610f15565b156104be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4d61726b657420697320636c6f7365642e00000000000000000000000000000060448201526064016103d0565b8160400135831461052b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f214173736574000000000000000000000000000000000000000000000000000060448201526064016103d0565b8160600135600003610599576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f4e6f50726963650000000000000000000000000000000000000000000000000060448201526064016103d0565b60006106c76105ab60c0850185610f39565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506106c192506105f19150506020870187610f9e565b6106016040880160208901610f15565b6040805173ffffffffffffffffffffffffffffffffffffffff90931660208401529015158282015287013560608281019190915287013560808281019190915287013560a08281019190915287013560c082015260e001604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b906108de565b90506106d66020840184610f9e565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461076a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f426164536967000000000000000000000000000000000000000000000000000060448201526064016103d0565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020839052604090205460ff166107f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f214e6f646500000000000000000000000000000000000000000000000000000060448201526064016103d0565b5050505050565b60008615610870578484846402540be40061081b8684610fbb565b6108259190611007565b61082f9190610eb3565b6108399089610fbb565b61084b90670de0b6b3a7640000610fbb565b6108559190611007565b61085f9190611007565b6108699087610edb565b90506108d4565b8484846402540be4006108838684610fbb565b61088d9190611007565b6108979190610eb3565b6108a19089610fbb565b6108b390670de0b6b3a7640000610fbb565b6108bd9190611007565b6108c79190611007565b6108d19087610eb3565b90505b9695505050505050565b60008060006108ed8585610904565b915091506108fa81610949565b5090505b92915050565b600080825160410361093a5760208301516040840151606085015160001a61092e87828585610aff565b94509450505050610942565b506000905060025b9250929050565b600081600481111561095d5761095d61106f565b036109655750565b60018160048111156109795761097961106f565b036109e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103d0565b60028160048111156109f4576109f461106f565b03610a5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103d0565b6003816004811115610a6f57610a6f61106f565b03610afc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016103d0565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610b365750600090506003610be5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610b8a573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116610bde57600060019250925050610be5565b9150600090505b94509492505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610afc57600080fd5b600080600060608486031215610c2557600080fd5b8335610c3081610bee565b95602085013595506040909401359392505050565b8015158114610afc57600080fd5b60008060008060008060c08789031215610c6c57600080fd5b8635610c7781610c45565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b60008060008060808587031215610cb557600080fd5b8435935060208501359250604085013567ffffffffffffffff811115610cda57600080fd5b850160e08188031215610cec57600080fd5b9396929550929360600135925050565b604051610180810167ffffffffffffffff81118282101715610d47577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b8051610d5881610c45565b919050565b8051610d5881610bee565b60006101808284031215610d7b57600080fd5b610d83610cfc565b825181526020830151602082015260408301516040820152610da760608401610d4d565b60608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e0820152610100610de2818501610d5d565b908201526101208381015190820152610140610dff818501610d5d565b90820152610160928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820281158282048414176108fe576108fe610e17565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610e9b57610e9b610e5d565b500490565b818103818111156108fe576108fe610e17565b8082018281126000831280158216821582161715610ed357610ed3610e17565b505092915050565b8181036000831280158383131683831282161715610efb57610efb610e17565b5092915050565b808201808211156108fe576108fe610e17565b600060208284031215610f2757600080fd5b8135610f3281610c45565b9392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610f6e57600080fd5b83018035915067ffffffffffffffff821115610f8957600080fd5b60200191503681900382131561094257600080fd5b600060208284031215610fb057600080fd5b8135610f3281610bee565b808202600082127f800000000000000000000000000000000000000000000000000000000000000084141615610ff357610ff3610e17565b81810583148215176108fe576108fe610e17565b60008261101657611016610e5d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f80000000000000000000000000000000000000000000000000000000000000008314161561106a5761106a610e17565b500590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220fa85b8d49d3d55e1682965d6aeb6ed08f7a00ee0b7bc8108b02613bf38f6409b64736f6c63430008130033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.