đBrian Typescript SDK
Do you need an API key? Discover how to get one!
Use the @brian-ai/sdk for interacting with Brian APIs in your Typescript project! The SDK is a wrapper of the Brian API.
If you're building a Typescript project and want to interact with the Brian APIs in a type-safe way, you can use our npm package @brian-ai/sdk. Make sure to always use the latest production version of the SDK in order to avoid any breaking changes.
You can install it using your package manager of choice:
đĻ Installation
# Using npm
npm install @brian-ai/sdk
# Using yarn
yarn add @brian-ai/sdk
# Using pnpm
pnpm add @brian-ai/sdk
# Using bun
bun add @brian-ai/sdk
âī¸ Usage
// Using ES6 imports
import { BrianSDK } from "@brian-ai/sdk";
const options = {
apiKey: process.env.BRIAN_API_KEY,
};
const brian = new BrianSDK(options);
// Using CommonJS imports
const { BrianSDK } = require("@brian-ai/sdk");
const brian = new BrianSDK(options);
The Brian ts SDK is meant to be used on the backend to not expose the Brian API key!
âī¸ SDK initialization options
The BrianSDK
constructor accepts an object with the following properties:
apiUrl
string
The API url you'll be calling. Default is https://api.brianknows.org
for EU based projects. YOu can change it with https://us-api.brianknows.org
for better latency in the US.
â
apiKey
string
The API key used to call the Brian APIs.
â
apiVersion
v0
The API version. Only v0
is available right now.
â
đ SDK methods
ask
Calls the Brian API /agent/knowledge method. Returns an AI-generated for the given prompt.
extract
Calls the Brian API /agent/parameters-extraction method. Returns the extracted parameters from the given prompt.
generateCode
Calls the Brian API /agent/smart-contracts method. Returns an AI-generated Solidity Smart Contract based on the prompt.
transact
Calls the Brian API /agent/transaction method. Returns one or more transactions ready to be executed, generated from the given prompt.
đ Usage Examples
transact
const brian = new BrianSDK(options);
const request = await brian.transact({
prompt: "swap 1 ETH for USDC on base",
address: "vitalik.eth",
});
console.log("transaction result:", request);
/*
transaction result: [
{
solver: "Enso",
action: "swap",
type: "write",
data: {
description: "You are about to swap 1.0 ETH ($3693.6) for 3695.0 USDC ($3693.9) on Base using Enso solver. The address receiver is 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045.",
steps: [
{
chainId: 8453,
blockNumber: 23526521,
from: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
to: "0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E",
gasLimit: "652920",
data: "0xb35d7e73000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000719198595a30081ffffffffff129b480ad625bcd1a5c3a1c10d708114726fa46719198595a30283ffffffff83111111125421ca6dc452d289314280a0f8842a659bd3b227018304ffffffff036675a323dedb77822fcf39eaa9d682f6abe72555ddcd52200103ffffffffff037e7d64d987cab6eed08a191c4c2459daf2f8ed0ba9059cbb010503ffffffffff833589fcd6edb6e08f4c7c32d4f71b54bda029136e7a43a3010306ffffffff037e7d64d987cab6eed08a191c4c2459daf2f8ed0b241c59120103ffffffffffff7e7d64d987cab6eed08a191c4c2459daf2f8ed0b000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000005e000000000000000000000000000000000000000000000000000000000000006200000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000ddd2935029d8000000000000000000000000000000000000000000000000000000000000000042807ed2379000000000000000000000000e37e799d5077682fa0a244d46e5649f71457bd09000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000e37e799d5077682fa0a244d46e5649f71457bd090000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c4769940000000000000000000000000000000000000000000000000ddd2935029d800000000000000000000000000000000000000000000000000000000000d595674f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000000000000000000000000000000000000002b200a0c9e75c4800000000000011110f010000000000000000000000000000000000000002840001e30001420000a100a007e5c0d200000000000000000000000000000000000000000000000000007d00001a40414200000000000000000000000000000000000006d0e30db000a0fbb7cd06804c42b5057a8663e2b1ac21685d1502c937a0381700020000000000000000019c4200000000000000000000000000000000000006833589fcd6edb6e08f4c7c32d4f71b54bda02913111111125421ca6dc452d289314280a0f8842a6500a007e5c0d200000000000000000000000000000000000000000000000000007d00001a40414200000000000000000000000000000000000006d0e30db002a0000000000000000000000000000000000000000000000000000000004011f510ee63c1e58172ab388e2e2f6facef59e3c3fa2c4e29011c2d384200000000000000000000000000000000000006111111125421ca6dc452d289314280a0f8842a6500a007e5c0d200000000000000000000000000000000000000000000000000007d00001a40414200000000000000000000000000000000000006d0e30db002a000000000000000000000000000000000000000000000000000000000489c2714ee63c1e58157713f7716e0b0f65ec116912f834e49805480d24200000000000000000000000000000000000006111111125421ca6dc452d289314280a0f8842a6500a007e5c0d200000000000000000000000000000000000000000000000000007d00001a40414200000000000000000000000000000000000006d0e30db002a00000000000000000000000000000000000000000000000000000000048a1b3faee63c1e581482fe995c4a52bc79271ab29a53591363ee30a894200000000000000000000000000000000000006111111125421ca6dc452d289314280a0f8842a650000000000000000000000000000000097864b91000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000d5a20080",
value: "1000000000000000000",
}
],
gasCostUSD: "",
fromChainId: 8453,
fromAmountUSD: "3693.6",
fromAmount: "1000000000000000000",
fromToken: {
address: "0x0000000000000000000000000000000000000000",
chainId: 8453,
symbol: "ETH",
decimals: 18,
name: "ETH",
coinKey: "ETH",
logoURI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
priceUSD: "3693.6",
},
fromAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
toChainId: 8453,
toAmountUSD: "3693.9062281315605",
toAmount: "3695014400",
toAmountMin: "3695014400",
toToken: {
address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
chainId: 8453,
symbol: "USDC",
decimals: 6,
name: "USD Coin",
coinKey: "USDC",
logoURI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
priceUSD: "0.9997000899730081",
},
toAddress: "0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E",
receiver: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
protocol: {
key: "enso",
name: "enso",
logoURI: "",
},
},
extractedParams: {
action: "swap",
chain: "base",
token1: "eth",
token2: "usdc",
address: "",
amount: "1",
},
conversationHistory: [
{
sender: "user",
content: "swap 1 ETH for USDC on base",
}, {
sender: "brian",
content: "You are about to swap 1.0 ETH ($3693.6) for 3695.0 USDC ($3693.9) on Base using Enso solver. The address receiver is 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045.",
}
],
}
]
*/
How to execute a transaction
Here you can find a page explaining the transaction flow using Brian API. It is an extended version of what is explained in this next paragraph for the SDK.
In the SDK response, you have:
one or more standard
transaction
object, in thesteps
array of the responsemultiple parameters for info/frontend/backend purpose
The libraries and tools available for executing the transaction will depend on the type of chain you intend to use (EVM or Non-EVM, such as Solana/Starknet).
In any case, the transactions returned by the Brian API are compatible with the most common development tools, such as Viem, Wagmi, Ethers for EVM chains, starknet.js, Starknet React for Starknet, and, Solana-Web3.js for Solana.
Check transaction execution examples from the API:
ask
const brian = new BrianSDK(options);
const request = await brian.ask({
prompt: "explain uniswap v4 compared to v3",
kb: "public-knowledge-box"
});
console.log("Knowledge result:", request);
/*
Knowledge result: {
input: "explain uniswap v4 compared to v3",
chat_history: [],
context: [
{
pageContent: "Two years ago, we released Uniswap v3, a watershed moment for onchain liquidity and DeFi. Today, the Uniswap Protocol is the largest decentralized exchange protocol, processing over $1.5 trillion in trading volume. As public infrastructure, it's a vital part of the crypto ecosystem.\nAs technology and markets evolve, so must the Uniswap Protocol. That's why we're thrilled to introduce our vision for Uniswap v4, which we believe will open up a world of possibilities for how liquidity is created and how tokens are traded onchain.\nWe are releasing the draft code now so that v4 can be built in public, with open feedback and meaningful community contribution. We expect this will be a months-long process. You can read the open-sourced, early version of the Uniswap v4 core and periphery repositories, read the draft technical whitepaper here, and learn more about how to contribute here.\nUniswap v3 took a powerful, opinionated approach to liquidity provision, balancing an incredibly complex tradeoff space. New features come at the expense of higher fees and code complexity. For example, v3 enshrined oracles, allowing builders to integrate real-time, onchain pricing data, but at the expense of some increased costs for swappers.\nOur vision with Uniswap v4 is to allow anyone to make these tradeoff decisions through the introduction of \"hooks.\" Hooks are contracts that run at various points of a pool action's lifecycle. Pools can make the same tradeoffs as v3, or they can add totally new functionality. For example, v4 will allow pools that natively support dynamic fees, add onchain limit orders, or act as a time-weighted average market maker (TWAMM) to spread out large orders over time.",
metadata: {
description: "All about our vision for Uniswap v4 and why we're building in public.",
language: "en",
source: "https://blog.uniswap.org/uniswap-v4",
title: "Our Vision for Uniswap v4 ",
},
}, {
pageContent: "License and Governance\nAs always, we strongly believe that core financial infrastructure should be open and transparent. We also believe that the Uniswap community â the people and teams that support, use, and build on the Protocol â should govern v4 of the Protocol, just as they govern prior versions.\nThe code will be released under a Business Source License 1.1, which limits the use of the v4 source code in a commercial or production setting for up to four years, at which point it will convert to a GPL license into perpetuity. Like v3, Uniswap Governance and Uniswap Labs can grant exceptions to the license.\nThe Protocol fee mechanism will also be modeled after v3. Governance will be able to vote to add a Protocol fee to any pool, up to a capped amount. More details on the fee mechanism can be found in the whitepaper.What is Uniswap v4Hooks & custom poolsImproved architecture and gas savingsLicense and GovernanceRelated posts March 23, 2021Introducing Uniswap v3 October 19, 2023Community Contributions to Uniswap v4 May 05, 2021Uniswap v3 Mainnet launch",
metadata: {
description: "All about our vision for Uniswap v4 and why we're building in public.",
language: "en",
source: "https://blog.uniswap.org/uniswap-v4",
title: "Our Vision for Uniswap v4 ",
},
}, {
pageContent: "Along with this customization, Uniswap v4's architecture reduces costs and ensures efficiency. It introduces a new \"singleton\" contract, where all pools live within a single smart contract. We believe the combination of hooks and singleton architecture creates an incredibly powerful platform â¸ē fast, safe pool customization and efficient routing across many pools. Uniswap v4 brings fast, expressive AMM innovation within one powerful ecosystem.\nWhat is Uniswap v4\nHooks & custom pools\nEach Uniswap liquidity pool has a lifecycle. During a poolâs lifecycle, several things happen. A pool is created with a default fee tier. Liquidity is added, removed, or readjusted. And, of course, users swap tokens. In Uniswap v3, these lifecycle events are tightly coupled and executed in a very strict sequence.\nTo create room for customizable liquidity in Uniswap v4, we want to create a way for pool deployers to introduce code that performs a designated action at key points throughout the poolâs lifecycle â like before or after a swap, or before or after an LP position is changed.\nEnter hooks, which are plugins to customize how pools, swaps, fees, and LP positions interact. Developers can innovate on top of the Uniswap Protocolâs liquidity and security to create customized AMM pools through hooks that integrate with v4âs smart contracts.\nSome experiments weâre excited about include:",
metadata: {
description: "All about our vision for Uniswap v4 and why we're building in public.",
language: "en",
source: "https://blog.uniswap.org/uniswap-v4",
title: "Our Vision for Uniswap v4 ",
},
}, {
pageContent: "Improved architecture and gas savings\nIn Uniswap v3, we deploy a new contract for every pool, making creating pools and performing multi-pool swaps more expensive. In v4, we hold all the pools in one singleton contract, which will provide important gas savings because swaps will no longer need to transfer tokens between pools held in different contracts. Early estimates show that v4 reduces pool creation gas costs by 99%. Hooks introduce a world with endless options and singleton allows you to efficiently route across all of them.\nThis singleton architecture is complemented by a new \"flash accounting\" system. Instead of transferring assets in and out of pools at the end of every swap in v3, this system transfers only on net balances -- meaning a far more efficient system that provides additional gas savings in Uniswap v4.\nWe believe the best design for flash accounting uses \"transient storage,\" which would be enabled by EIP-1153. This EIP is being considered as part of the Ethereum Cancun hardfork and will bring even bigger gas improvements and cleaner contract designs across a wide variety of applications.\nWith the efficiency of singleton and flash accounting, fee tiers no longer need to be limited. Pool creators can set them at the level that makes them most competitive or customize them with a dynamic fee hook. v4 also brings back support for native ETH, which offers additional gas savings.",
metadata: {
description: "All about our vision for Uniswap v4 and why we're building in public.",
language: "en",
source: "https://blog.uniswap.org/uniswap-v4",
title: "Our Vision for Uniswap v4 ",
},
}
],
answer: "Uniswap v4 represents a significant evolution from v3, allowing developers greater customization and efficiency while maintaining the core liquidity provision functionality. Hereâs a structured comparison of Uniswap v4 and v3:\n\n\"\n\n### 1. **Core Architecture**\n\n- **Uniswap v3**: Each liquidity pool operates as a separate smart contract, which leads to higher costs for deploying new pools and conducting multi-pool swaps due to multiple contract interactions.\n \n- **Uniswap v4**: Introduces a **singleton architecture**, where all pools are managed under a single smart contract. This design dramatically reduces the gas fees associated with creating new pools and executing swaps, estimated to reduce pool creation gas costs by 99%.\n\n\"\n\n### 2. **Customizability Through Hooks**\n\n- **Uniswap v3**: Liquidities are managed in a tightly coupled manner with limited customization. The lifecycle of pools and swaps follows a strict sequence, constraining developers in terms of pool functionalities.\n\n- **Uniswap v4**: Implements **hooks**, which are plugins that allow developers to execute custom logic at various points in the pool's lifecycle, such as before and after swaps or liquidity changes. This opens a plethora of innovative possibilities, allowing for customized AMM functionality and improved interaction between swaps and LP positions.\n\n\"\n\n### 3. **Dynamic Fee Structures**\n\n- **Uniswap v3**: Introduces fee tiers, but these are set initially and not easily adjustable post-deployment. While LPs could theoretically offer different fees, making them competitive would require deploying multiple pools.\n\n- **Uniswap v4**: Enhances fee customization by allowing pools to support **dynamic fees** with hooks, enabling the fee structure to adapt more responsively to market conditions or specific trading strategies.\n\n\"\n\n### 4. **Flash Accounting Efficiency**\n\n- **Uniswap v3**: Transfers assets at the end of every swap, resulting in significant transaction overhead and gas costs.\n\n- **Uniswap v4**: Employs a new **flash accounting** system that transfers only net balances after transactions, significantly improving efficiency. This is complemented by the anticipated benefits of **EIP-1153**, which may further streamline contract interactions and reduce operational overhead.\n\n\"\n\n### 5. **Gas Savings and Native Token Support**\n\n- **Uniswap v3**: Lacks substantial gas optimization features and does not support native ETH for liquidity provision, limiting options for LPs looking to minimize transaction costs.\n\n- **Uniswap v4**: Reintroduces support for **native ETH**, offering additional gas savings and providing LPs with an opportunity to optimize their capital efficiency.\n\n\"\n\n### 6. **License and Governance**\n\n- **Uniswap v3**: Governed by Uniswap governance procedures; the protocol fee mechanism allows for some fee adjustments based on community votes.\n\n- **Uniswap v4**: Continues the principle of decentralized governance under a **Business Source License 1.1**, which permits the community to effectively govern the protocol while restricting commercial use for a transitional period before converting to a GPL license.\n\n\"\n\n### Conclusion\n\nIn summary, Uniswap v4 is designed to empower developers and liquidity providers by enhancing customized features while optimizing overall gas efficiency and operational costs. The introduction of hooks and a singleton architecture not only paves the way for novel AMM functionalities but also supports a more sustainable economic ecosystem within decentralized finance.\n\nFor further information, you can access the open-source version of the [Uniswap v4 core and periphery repositories](https://github.com/Uniswap) or read the accompanying [draft technical whitepaper](https://uniswap.org/docs/v4).",
}
*/
extract
const brian = new BrianSDK(options);
const request = await brian.extract({
prompt: "swap 1 ETH for USDC",
});
console.log("Parameter extraction result:", request);
/*
Parameter extraction result: {
prompt: "swap 1 ETH for USDC",
completion: [
{
action: "swap",
chain: "",
token1: "ETH",
token2: "USDC",
address: "",
amount: "1",
}
],
}
*/
generateCode
const brian = new BrianSDK(options);
const request = await brian.generateCode({
prompt: "give me the code of an erc20 token called BRIANNOOO",
compile: true,
});
console.log("code result:", request);
/*
contract: "\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {ERC20} from \"@openzeppelin/contracts@5.1.0/token/ERC20/ERC20.sol\";\nimport {Ownable} from \"@openzeppelin/contracts@5.1.0/access/Ownable.sol\";\n\ncontract BriannoooToken is ERC20, Ownable {\n constructor() ERC20(\"BRIANNOOO\", \"BRIAN\") Ownable(msg.sender) {\n _mint(msg.sender, 1000000 * 10 ** decimals());\n }\n\n function mint(address to, uint256 amount) public onlyOwner {\n _mint(to, amount);\n }\n}\n",
contractName: "BriannoooToken",
abi: [
{
inputs: [],
stateMutability: "nonpayable",
type: "constructor",
}, {
inputs: [
{
internalType: "address",
name: "spender",
type: "address",
}, {
internalType: "uint256",
name: "allowance",
type: "uint256",
}, {
internalType: "uint256",
name: "needed",
type: "uint256",
}
],
name: "ERC20InsufficientAllowance",
type: "error",
}, {
inputs: [
{
internalType: "address",
name: "sender",
type: "address",
}, {
internalType: "uint256",
name: "balance",
type: "uint256",
}, {
internalType: "uint256",
name: "needed",
type: "uint256",
}
],
name: "ERC20InsufficientBalance",
type: "error",
}, {
inputs: [
{
internalType: "address",
name: "approver",
type: "address",
}
],
name: "ERC20InvalidApprover",
type: "error",
}, {
inputs: [
{
internalType: "address",
name: "receiver",
type: "address",
}
],
name: "ERC20InvalidReceiver",
type: "error",
}, {
inputs: [
{
internalType: "address",
name: "sender",
type: "address",
}
],
name: "ERC20InvalidSender",
type: "error",
}, {
inputs: [
{
internalType: "address",
name: "spender",
type: "address",
}
],
name: "ERC20InvalidSpender",
type: "error",
}, {
inputs: [
{
internalType: "address",
name: "owner",
type: "address",
}
],
name: "OwnableInvalidOwner",
type: "error",
}, {
inputs: [
{
internalType: "address",
name: "account",
type: "address",
}
],
name: "OwnableUnauthorizedAccount",
type: "error",
}, {
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "owner",
type: "address",
}, {
indexed: true,
internalType: "address",
name: "spender",
type: "address",
}, {
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256",
}
],
name: "Approval",
type: "event",
}, {
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
}, {
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
}
],
name: "OwnershipTransferred",
type: "event",
}, {
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "from",
type: "address",
}, {
indexed: true,
internalType: "address",
name: "to",
type: "address",
}, {
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256",
}
],
name: "Transfer",
type: "event",
}, {
inputs: [
{
internalType: "address",
name: "owner",
type: "address",
}, {
internalType: "address",
name: "spender",
type: "address",
}
],
name: "allowance",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
}
],
stateMutability: "view",
type: "function",
}, {
inputs: [
{
internalType: "address",
name: "spender",
type: "address",
}, {
internalType: "uint256",
name: "value",
type: "uint256",
}
],
name: "approve",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
}
],
stateMutability: "nonpayable",
type: "function",
}, {
inputs: [
{
internalType: "address",
name: "account",
type: "address",
}
],
name: "balanceOf",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
}
],
stateMutability: "view",
type: "function",
}, {
inputs: [],
name: "decimals",
outputs: [
{
internalType: "uint8",
name: "",
type: "uint8",
}
],
stateMutability: "view",
type: "function",
}, {
inputs: [
{
internalType: "address",
name: "to",
type: "address",
}, {
internalType: "uint256",
name: "amount",
type: "uint256",
}
],
name: "mint",
outputs: [],
stateMutability: "nonpayable",
type: "function",
}, {
inputs: [],
name: "name",
outputs: [
{
internalType: "string",
name: "",
type: "string",
}
],
stateMutability: "view",
type: "function",
}, {
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
}
],
stateMutability: "view",
type: "function",
}, {
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
}, {
inputs: [],
name: "symbol",
outputs: [
{
internalType: "string",
name: "",
type: "string",
}
],
stateMutability: "view",
type: "function",
}, {
inputs: [],
name: "totalSupply",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
}
],
stateMutability: "view",
type: "function",
}, {
inputs: [
{
internalType: "address",
name: "to",
type: "address",
}, {
internalType: "uint256",
name: "value",
type: "uint256",
}
],
name: "transfer",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
}
],
stateMutability: "nonpayable",
type: "function",
}, {
inputs: [
{
internalType: "address",
name: "from",
type: "address",
}, {
internalType: "address",
name: "to",
type: "address",
}, {
internalType: "uint256",
name: "value",
type: "uint256",
}
],
name: "transferFrom",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
}
],
stateMutability: "nonpayable",
type: "function",
}, {
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
}
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
}
],
bytecode: "0x608060405234801561000f575f80fd5b503360405180604001604052806009815260200168425249414e4e4f4f4f60b81b81525060405180604001604052806005815260200164212924a0a760d91b81525081600390816100609190610316565b50600461006d8282610316565b5050506001600160a01b03811661009e57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6100a7816100cf565b506100ca336100b86012600a6104c9565b6100c590620f42406104de565b610120565b610508565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b0382166101495760405163ec442f0560e01b81525f6004820152602401610095565b6101545f8383610158565b5050565b6001600160a01b038316610182578060025f82825461017791906104f5565b909155506101f29050565b6001600160a01b0383165f90815260208190526040902054818110156101d45760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610095565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661020e5760028054829003905561022c565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161027191815260200190565b60405180910390a3505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102a657607f821691505b6020821081036102c457634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561031157805f5260205f20601f840160051c810160208510156102ef5750805b601f840160051c820191505b8181101561030e575f81556001016102fb565b50505b505050565b81516001600160401b0381111561032f5761032f61027e565b6103438161033d8454610292565b846102ca565b6020601f821160018114610375575f831561035e5750848201515b5f19600385901b1c1916600184901b17845561030e565b5f84815260208120601f198516915b828110156103a45787850151825560209485019460019092019101610384565b50848210156103c157868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b6001815b600184111561041f57808504811115610403576104036103d0565b600184161561041157908102905b60019390931c9280026103e8565b935093915050565b5f82610435575060016104c3565b8161044157505f6104c3565b816001811461045757600281146104615761047d565b60019150506104c3565b60ff841115610472576104726103d0565b50506001821b6104c3565b5060208310610133831016604e8410600b84101617156104a0575081810a6104c3565b6104ac5f1984846103e4565b805f19048211156104bf576104bf6103d0565b0290505b92915050565b5f6104d760ff841683610427565b9392505050565b80820281158282048414176104c3576104c36103d0565b808201808211156104c3576104c36103d0565b610881806105155f395ff3fe608060405234801561000f575f80fd5b50600436106100cb575f3560e01c806370a082311161008857806395d89b411161006357806395d89b41146101a4578063a9059cbb146101ac578063dd62ed3e146101bf578063f2fde38b146101f7575f80fd5b806370a0823114610159578063715018a6146101815780638da5cb5b14610189575f80fd5b806306fdde03146100cf578063095ea7b3146100ed57806318160ddd1461011057806323b872dd14610122578063313ce5671461013557806340c10f1914610144575b5f80fd5b6100d761020a565b6040516100e491906106f1565b60405180910390f35b6101006100fb366004610741565b61029a565b60405190151581526020016100e4565b6002545b6040519081526020016100e4565b610100610130366004610769565b6102b3565b604051601281526020016100e4565b610157610152366004610741565b6102d6565b005b6101146101673660046107a3565b6001600160a01b03165f9081526020819052604090205490565b6101576102ec565b6005546040516001600160a01b0390911681526020016100e4565b6100d76102ff565b6101006101ba366004610741565b61030e565b6101146101cd3660046107c3565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6101576102053660046107a3565b61031b565b606060038054610219906107f4565b80601f0160208091040260200160405190810160405280929190818152602001828054610245906107f4565b80156102905780601f1061026757610100808354040283529160200191610290565b820191905f5260205f20905b81548152906001019060200180831161027357829003601f168201915b5050505050905090565b5f336102a781858561035d565b60019150505b92915050565b5f336102c085828561036f565b6102cb8585856103ea565b506001949350505050565b6102de610447565b6102e88282610474565b5050565b6102f4610447565b6102fd5f6104a8565b565b606060048054610219906107f4565b5f336102a78185856103ea565b610323610447565b6001600160a01b03811661035157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61035a816104a8565b50565b61036a83838360016104f9565b505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f1981146103e457818110156103d657604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610348565b6103e484848484035f6104f9565b50505050565b6001600160a01b03831661041357604051634b637e8f60e11b81525f6004820152602401610348565b6001600160a01b03821661043c5760405163ec442f0560e01b81525f6004820152602401610348565b61036a8383836105cb565b6005546001600160a01b031633146102fd5760405163118cdaa760e01b8152336004820152602401610348565b6001600160a01b03821661049d5760405163ec442f0560e01b81525f6004820152602401610348565b6102e85f83836105cb565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b0384166105225760405163e602df0560e01b81525f6004820152602401610348565b6001600160a01b03831661054b57604051634a1406b160e11b81525f6004820152602401610348565b6001600160a01b038085165f90815260016020908152604080832093871683529290522082905580156103e457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105bd91815260200190565b60405180910390a350505050565b6001600160a01b0383166105f5578060025f8282546105ea919061082c565b909155506106659050565b6001600160a01b0383165f90815260208190526040902054818110156106475760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610348565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166106815760028054829003905561069f565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516106e491815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b038116811461073c575f80fd5b919050565b5f8060408385031215610752575f80fd5b61075b83610726565b946020939093013593505050565b5f805f6060848603121561077b575f80fd5b61078484610726565b925061079260208501610726565b929592945050506040919091013590565b5f602082840312156107b3575f80fd5b6107bc82610726565b9392505050565b5f80604083850312156107d4575f80fd5b6107dd83610726565b91506107eb60208401610726565b90509250929050565b600181811c9082168061080857607f821691505b60208210810361082657634e487b7160e01b5f52602260045260245ffd5b50919050565b808201808211156102ad57634e487b7160e01b5f52601160045260245ffdfea26469706673582212204ceb436b1acd9f67ef19938d493a71aa230432de358d96a08d230e5e93fdee3e64736f6c634300081a0033",
version: "0.8.26+commit.8a97fa7a.Emscripten.clang",
standardJsonInput: "{\"language\":\"Solidity\",\"sources\":{\"BriannoooToken.sol\":{\"content\":\"\\n// SPDX-License-Identifier: MIT\\npragma solidity 0.8.26;\\n\\nimport \\\"ERC20.sol\\\";\\nimport \\\"Ownable.sol\\\";\\n\\ncontract BriannoooToken is ERC20, Ownable {\\n constructor() ERC20(\\\"BRIANNOOO\\\", \\\"BRNO\\\") Ownable(msg.sender) {\\n _mint(msg.sender, 1000000 * 10 ** decimals());\\n }\\n\\n function mint(address to, uint256 amount) public onlyOwner {\\n _mint(to, amount);\\n }\\n\\n function burn(uint256 amount) public {\\n _burn(msg.sender, amount);\\n }\\n\\n function burnFrom(address account, uint256 amount) public {\\n _spendAllowance(account, msg.sender, amount);\\n _burn(account, amount);\\n }\\n}\\n\"},\"IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\"},\"IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport \\\"IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\"},\"Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\"},\"draft-IERC6093.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Standard ERC-20 Errors\\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\\n */\\ninterface IERC20Errors {\\n /**\\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\\n * @param sender Address whose tokens are being transferred.\\n * @param balance Current balance for the interacting account.\\n * @param needed Minimum amount required to perform a transfer.\\n */\\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\\n\\n /**\\n * @dev Indicates a failure with the token `sender`. Used in transfers.\\n * @param sender Address whose tokens are being transferred.\\n */\\n error ERC20InvalidSender(address sender);\\n\\n /**\\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\\n * @param receiver Address to which tokens are being transferred.\\n */\\n error ERC20InvalidReceiver(address receiver);\\n\\n /**\\n * @dev Indicates a failure with the `spender`âs `allowance`. Used in transfers.\\n * @param spender Address that may be allowed to operate on tokens without being their owner.\\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\\n * @param needed Minimum amount required to perform a transfer.\\n */\\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\\n\\n /**\\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\\n * @param approver Address initiating an approval operation.\\n */\\n error ERC20InvalidApprover(address approver);\\n\\n /**\\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\\n * @param spender Address that may be allowed to operate on tokens without being their owner.\\n */\\n error ERC20InvalidSpender(address spender);\\n}\\n\\n/**\\n * @dev Standard ERC-721 Errors\\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\\n */\\ninterface IERC721Errors {\\n /**\\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\\n * Used in balance queries.\\n * @param owner Address of the current owner of a token.\\n */\\n error ERC721InvalidOwner(address owner);\\n\\n /**\\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\\n * @param tokenId Identifier number of a token.\\n */\\n error ERC721NonexistentToken(uint256 tokenId);\\n\\n /**\\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\\n * @param sender Address whose tokens are being transferred.\\n * @param tokenId Identifier number of a token.\\n * @param owner Address of the current owner of a token.\\n */\\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\\n\\n /**\\n * @dev Indicates a failure with the token `sender`. Used in transfers.\\n * @param sender Address whose tokens are being transferred.\\n */\\n error ERC721InvalidSender(address sender);\\n\\n /**\\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\\n * @param receiver Address to which tokens are being transferred.\\n */\\n error ERC721InvalidReceiver(address receiver);\\n\\n /**\\n * @dev Indicates a failure with the `operator`âs approval. Used in transfers.\\n * @param operator Address that may be allowed to operate on tokens without being their owner.\\n * @param tokenId Identifier number of a token.\\n */\\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\\n\\n /**\\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\\n * @param approver Address initiating an approval operation.\\n */\\n error ERC721InvalidApprover(address approver);\\n\\n /**\\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\\n * @param operator Address that may be allowed to operate on tokens without being their owner.\\n */\\n error ERC721InvalidOperator(address operator);\\n}\\n\\n/**\\n * @dev Standard ERC-1155 Errors\\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\\n */\\ninterface IERC1155Errors {\\n /**\\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\\n * @param sender Address whose tokens are being transferred.\\n * @param balance Current balance for the interacting account.\\n * @param needed Minimum amount required to perform a transfer.\\n * @param tokenId Identifier number of a token.\\n */\\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\\n\\n /**\\n * @dev Indicates a failure with the token `sender`. Used in transfers.\\n * @param sender Address whose tokens are being transferred.\\n */\\n error ERC1155InvalidSender(address sender);\\n\\n /**\\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\\n * @param receiver Address to which tokens are being transferred.\\n */\\n error ERC1155InvalidReceiver(address receiver);\\n\\n /**\\n * @dev Indicates a failure with the `operator`âs approval. Used in transfers.\\n * @param operator Address that may be allowed to operate on tokens without being their owner.\\n * @param owner Address of the current owner of a token.\\n */\\n error ERC1155MissingApprovalForAll(address operator, address owner);\\n\\n /**\\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\\n * @param approver Address initiating an approval operation.\\n */\\n error ERC1155InvalidApprover(address approver);\\n\\n /**\\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\\n * @param operator Address that may be allowed to operate on tokens without being their owner.\\n */\\n error ERC1155InvalidOperator(address operator);\\n\\n /**\\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\\n * Used in batch transfers.\\n * @param idsLength Length of the array of token identifiers\\n * @param valuesLength Length of the array of token amounts\\n */\\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\\n}\\n\"},\"ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport \\\"IERC20.sol\\\";\\nimport \\\"IERC20Metadata.sol\\\";\\nimport \\\"Context.sol\\\";\\nimport \\\"draft-IERC6093.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * The default value of {decimals} is 18. To change this, you should override\\n * this function so it returns a different value.\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC-20\\n * applications.\\n */\\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\\n mapping(address account => uint256) private _balances;\\n\\n mapping(address account => mapping(address spender => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the default value returned by this function, unless\\n * it's overridden.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `value`.\\n */\\n function transfer(address to, uint256 value) public virtual returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, value);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 value) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, value);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Skips emitting an {Approval} event indicating an allowance update. This is not\\n * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `value`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `value`.\\n */\\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, value);\\n _transfer(from, to, value);\\n return true;\\n }\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * NOTE: This function is not virtual, {_update} should be overridden instead.\\n */\\n function _transfer(address from, address to, uint256 value) internal {\\n if (from == address(0)) {\\n revert ERC20InvalidSender(address(0));\\n }\\n if (to == address(0)) {\\n revert ERC20InvalidReceiver(address(0));\\n }\\n _update(from, to, value);\\n }\\n\\n /**\\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\\n * this function.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _update(address from, address to, uint256 value) internal virtual {\\n if (from == address(0)) {\\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\\n _totalSupply += value;\\n } else {\\n uint256 fromBalance = _balances[from];\\n if (fromBalance < value) {\\n revert ERC20InsufficientBalance(from, fromBalance, value);\\n }\\n unchecked {\\n // Overflow not possible: value <= fromBalance <= totalSupply.\\n _balances[from] = fromBalance - value;\\n }\\n }\\n\\n if (to == address(0)) {\\n unchecked {\\n // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\\n _totalSupply -= value;\\n }\\n } else {\\n unchecked {\\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\\n _balances[to] += value;\\n }\\n }\\n\\n emit Transfer(from, to, value);\\n }\\n\\n /**\\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\\n * Relies on the `_update` mechanism\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * NOTE: This function is not virtual, {_update} should be overridden instead.\\n */\\n function _mint(address account, uint256 value) internal {\\n if (account == address(0)) {\\n revert ERC20InvalidReceiver(address(0));\\n }\\n _update(address(0), account, value);\\n }\\n\\n /**\\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\\n * Relies on the `_update` mechanism.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * NOTE: This function is not virtual, {_update} should be overridden instead\\n */\\n function _burn(address account, uint256 value) internal {\\n if (account == address(0)) {\\n revert ERC20InvalidSender(address(0));\\n }\\n _update(account, address(0), value);\\n }\\n\\n /**\\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n *\\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\\n */\\n function _approve(address owner, address spender, uint256 value) internal {\\n _approve(owner, spender, value, true);\\n }\\n\\n /**\\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\\n *\\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\\n * `Approval` event during `transferFrom` operations.\\n *\\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\\n * true using the following override:\\n *\\n * ```solidity\\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\\n * super._approve(owner, spender, value, true);\\n * }\\n * ```\\n *\\n * Requirements are the same as {_approve}.\\n */\\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\\n if (owner == address(0)) {\\n revert ERC20InvalidApprover(address(0));\\n }\\n if (spender == address(0)) {\\n revert ERC20InvalidSpender(address(0));\\n }\\n _allowances[owner][spender] = value;\\n if (emitEvent) {\\n emit Approval(owner, spender, value);\\n }\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\\n *\\n * Does not update the allowance value in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Does not emit an {Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n if (currentAllowance < value) {\\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\\n }\\n unchecked {\\n _approve(owner, spender, currentAllowance - value, false);\\n }\\n }\\n }\\n}\\n\"},\"Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport \\\"Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * The initial owner is set to the address provided by the deployer. This can\\n * later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\"}},\"settings\":{\"optimizer\":{\"enabled\":true,\"runs\":200},\"outputSelection\":{\"*\":{\"*\":[\"*\"]}}}}"
}
*/
đģ Check out the Github Repo to learn how to use the SDK.
Last updated