Skip to content

Instantly share code, notes, and snippets.

@pashius
pashius / unnamed_metadata.json
Last active December 3, 2022 11:01
Unnamed Token Metadata
{
"name": "unnamed v3",
"symbol": "UN3",
"description": "unnamed token v3",
"image": "https://htmlcolorcodes.com/assets/images/colors/red-color-solid-background-1920x1080.png"
}
@pashius
pashius / fa2-eng.ligo
Created September 23, 2021 19:08
FA2 token implementation with English comments
//ERRORS
const fa2_token_undefined = "FA2_TOKEN_UNDEFINED"
const fa2_insufficient_balance = "FA2_INSUFFICIENT_BALANCE"
const fa2_tx_denied = "FA2_TX_DENIED"
const fa2_not_owner = "FA2_NOT_OWNER"
const fa2_not_operator = "FA2_NOT_OPERATOR"
const fa2_operators_not_supported = "FA2_OPERATORS_UNSUPPORTED"
const fa2_receiver_hook_failed = "FA2_RECEIVER_HOOK_FAILED"
const fa2_sender_hook_failed = "FA2_SENDER_HOOK_FAILED"
{"symbol": "TZT", "name": "Tezzt Token", "decimals": 0}
@pashius
pashius / test_acc_activation
Created January 25, 2022 17:38
Активация тестового аккаунта в Hangzhou и +
import { TezosToolkit } from '@taquito/taquito'
//импортируем inMemorySigner. Он сохранит приватный ключ в оперативной памяти и будет подписывать им транзакции
import { InMemorySigner } from '@taquito/signer'
//объявляем константу acc, которая направит скрипт к файлу acc.json
const acc = require('./acc.json')
export class Tx {
private tezos: TezosToolkit
rpcUrl: string
constructor(rpcUrl: string) {
this.tezos = new TezosToolkit(rpcUrl)
//значение Storage для ide.ligolang. В token_metadata указываем 0n — дефолтный token_id, а дальше даем ссылку на метаданные
record [
metadata = big_map ["" -> 0x68747470733a2f2f636c6f7564666c6172652d697066732e636f6d2f697066732f6261666b72656967377262763579647334336232687a726e657466363370356f36336f336c726875736c6c64657463777536666974797877673265];
totalSupply = 1000n;
token_metadata = big_map [0n -> (0n, map ["" -> 0x68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f706173686975732f33356131346565646537353132333536383537613931326562356437323034632f7261772f373831396565376163333634623837386164373262613038623738643633373239663539656131322f6661312e325f746f6b656e5f6d657461646174612e6a736f6e])];
ledger = big_map [
("tz1g29sZpBTJyf6GpJeCTWvgutve4LJnAnbC" : address) -> record [
balance = 1000n;
allowances = map [
//оголошуємо псевдонім trusted типу address. Ми будемо використовувати його для позначення адрес, у яких є право відправляти токени
type trusted is address;
// оголошуємо псевдонім amt (amount) типу nat для зберігання балансів
type amt is nat;
(* Оголошуємо псевдонім account типу record. У ньому будемо зберігати дані користувачів, яким можна передавати токени.
*)
type account is
record [
balance: amt;
allowances: map (trusted, amt);
@pashius
pashius / fa2-ukr.ligo
Created September 23, 2021 19:06
FA2 token implementation with comments in Ukrainian
// ERRORS
const fa2_token_undefined = "FA2_TOKEN_UNDEFINED"
const fa2_insufficient_balance = "FA2_INSUFFICIENT_BALANCE"
const fa2_tx_denied = "FA2_TX_DENIED"
const fa2_not_owner = "FA2_NOT_OWNER"
const fa2_not_operator = "FA2_NOT_OPERATOR"
const fa2_operators_not_supported = "FA2_OPERATORS_UNSUPPORTED"
const fa2_receiver_hook_failed = "FA2_RECEIVER_HOOK_FAILED"
const fa2_sender_hook_failed = "FA2_SENDER_HOOK_FAILED"
@pashius
pashius / fa2-nft-implementation.ligo
Created September 16, 2021 20:03
Tezos FA2 NFT on pascaligo
//ERRORS
const fa2_token_undefined = "FA2_TOKEN_UNDEFINED"
const fa2_insufficient_balance = "FA2_INSUFFICIENT_BALANCE"
const fa2_tx_denied = "FA2_TX_DENIED"
const fa2_not_owner = "FA2_NOT_OWNER"
const fa2_not_operator = "FA2_NOT_OPERATOR"
const fa2_operators_not_supported = "FA2_OPERATORS_UNSUPPORTED"
const fa2_receiver_hook_failed = "FA2_RECEIVER_HOOK_FAILED"
const fa2_sender_hook_failed = "FA2_SENDER_HOOK_FAILED"
{
}
{
"symbol": "TAA",
"name": "TOKEn AAA",
"decimals": 1,
"interfaces": ["TZIP-007-2021-04-17","TZIP-016-2021-04-17"]
}