Skip to content

Commit

Permalink
iface: add support for inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Mar 24, 2024
1 parent 1935188 commit 875c6d0
Show file tree
Hide file tree
Showing 20 changed files with 1,189 additions and 40 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions RGB21.con
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,53 @@ interface RGB21
public inflationAllowance(*): RGB21.ItemsCount
public updateRight(?): Rights

error fractionOverflow: 1
"the amount of fractional token in outputs exceeds 1"
error nonEqualValues: 2
"the sum of spent token fractions doesn't equal to the sum of token fractions in outputs"
error invalidProof: 3
"the provided proof is invalid"
error insufficientReserves: 4
"reserve is insufficient to cover the issued assets"
error issueExceedsAllowance: 6
"you try to issue more assets than allowed by the contract terms"
error nonFractionalToken: 7
"attempt to transfer a fraction of non-fractionable token"
error nonEngravableToken: 8
"attempt to engrave on a token which prohibit engraving"
error invalidAttachmentType: 9
"attachment has a type which is not allowed for the token"

genesis
errors: fractionOverflow, invalidProof, insufficientReserves, invalidAttachmentType
meta: RGBContract.IssueMeta
globals: attachmentTypes(*), spec, terms, tokens(*)
assigns: assetOwner(*), inflationAllowance(*), updateRight(?)

transition engrave:
errors: fractionOverflow, nonEqualValues, nonFractionalToken, nonEngravableToken
globals: engravings
assigns: assetOwner(+)
default: assetOwner
inputs: assetOwner(+)

transition issue:
errors: fractionOverflow, invalidProof, insufficientReserves, issueExceedsAllowance, invalidAttachmentType
meta: RGBContract.IssueMeta
globals: attachmentTypes(*), tokens(*)
assigns: assetOwner(*), inflationAllowance(*)
default: assetOwner
inputs: inflationAllowance(+)

transition rename:
errors:
globals: spec
assigns: updateRight
default: updateRight
inputs: updateRight

transition transfer: required, default
errors: fractionOverflow, nonEqualValues, nonFractionalToken
assigns: assetOwner(+)
default: assetOwner
inputs: assetOwner(+)
Expand Down
48 changes: 48 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
-----BEGIN STRICT TYPE LIB-----
Id: urn:ubideco:stl:9GETUAH3q2Aw4JSiCzGy4Z8bTuagKQvPa4hH4mDxcX9d#type-economy-shannon
Name: RGB21
Dependency: pvPyTM1N1rG9HEAvvEgqKonnMdakHreYrvGWfFff8q6#atlanta-adrian-sonata
Dependency: DzTvt9gGhPUKD8Dkkjk9PDBhkJ4gtWxXWQjxnmUYLNrs#voyage-kimono-disco
Dependency: HX2UBak8vPsTokug1DGMDvTpzns3xUdwZ7QJdyt4qBA9#speed-atlanta-trilogy
Checksum-SHA256: facfa1880a6adbd9e1ab28c4f22b8eb03d28f763aa6263b930737ff60497ba0b

1yV;sGBE=TMyyqiM?p8!jNDm;%M^9TR7RT9MDn!3%{^){AA<1<Qb$5VZ*FvQVPkZ
`1k6TWEM#tEO?YD!yU6acy5+5>Uo2?YlHei-0Jn$(Q*>nYY!hN5_Bp3Y36tDMM#=
e#tGI($UA5U3KNx<*C>ja}LTPkkZ)t7=2SRCdV{d700{|i8K10Q-T=FR=Q=>S+XY
D&<oK4xzy{V5hX&1W5Lv;jJZ*_E|f<p7l*U`|S655U7U@unG_-_ux#CFBNXjx241
Z7qPRCsA*=xRXCTqXIv;)MTcr4cfxK`S9uy$)6q!N22#m0-mN2v2o%aBpdDbPG~P
LPKwEbaG*1bO-<r(i%G%h4}Sf8vn;89aSG|t4s0*&BRFk%a^yrND0jkP;zf?W>02
PWpib6c4c!s(W0Hqt(%d1CNN)#sHFQL7%(bMbH%I*cn#*O0A6zlO=)dqLug@gKPz
&##IG7-47St%2#c>Z5R>jkTb_MKDq#SE<Vn}$2SjCbVQFl0P!tef3_vEz605E^ed
2G9JfL8W(`-mS*AGV-T+=kv1WsXXWoI3^w`Ujm!)rYGQ#W1hvW_Q!3DRP(_-Z5Hf
z)k2p$Sc8WNBekd2nTbSFQ*2dy+cL#Wo+$K-npR=t1{a-C411d)vtBzL}*4RB2;t
Wpa#prNR=v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VZ*FA(00035b8l^B00jX83`VR~jz>W^(~R6%h07Fm$5cj|(?s
&L!OcBtF&~2QP!tef3_vEz605E^ed2G9JfL8W(`-mS*AGV-T+=kv2V`Y*VQFl000
aU61a5C`WdHyG0R(ezZDjxj0Rjw0tW}OjK{wNk+*yUo6m`c`Mw-(^^0dLtJ!&x@g
7H5qa<{~<8e<H$)BgyIuQd>p?nYaleMc%`0D|O6*W?Fqa%FaDWp@As0ssVVZ*FA(
00035b8l^B00jX7E81FMki)7Y5nvfyjp1hxc-vF?U);Akf4m#x|B<R=1#M+yX<+~
a0ssVVZ*FA(00035b8l^B00jX83`VR~jz>W^(~R6%h07Fm$5cj|(?s&L!OcBtF&~
2QwjbwLPT+#;sbOYcX0EacFqRS{kd{p#WSb|o=g4&w3t@D0VPj}*Wo~qH015yA0R
jw0tW}OjK{wNk+*yUo6m`c`Mw-(^^0dLtJ!&x@g7LN==T}bPg6pYaW?yEmvI#Jj5
+jh7O(0~OC$;Cubrb*q00000000yK00000000PbWpib6c4cz_1OfmAZf|a700001
1aog~WdH>M0t`m1RgOnNH`9#VS%u3Kb;ndjn$tw`w870iYB3*z@ea}&I~j%e^<Nt
Q$0i+BA8V^i@&?VsNd3!~x5P*Z%?ea+Yh`XpZe(S61pxp61O

-----END STRICT TYPE LIB-----

Binary file added [email protected]
Binary file not shown.
68 changes: 68 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{-
Id: urn:ubideco:stl:9GETUAH3q2Aw4JSiCzGy4Z8bTuagKQvPa4hH4mDxcX9d#type-economy-shannon
Name: RGB21
Version: 0.1.0
Description: Types for RGB21 interface
Author: Dr Maxim Orlovsky <[email protected]>
Copyright (C) 2023-2024-2024 LNP/BP Standards Association. All rights reserved.
License: Apache-2.0
-}

@context
typelib RGB21

import RGBContract#pvPyTM1N1rG9HEAvvEgqKonnMdakHreYrvGWfFff8q6#atlanta-adrian-sonata
use ProofOfReserves#liquid-owner-london
use MimeChar#golf-antonio-courage
use Details#network-kayak-adam
use Name#crystal-visitor-tribune
use MediaType#pixel-venice-grille
use Ticker#mike-atlas-store
use MediaRegName#sulfur-chant-vampire
use Attachment#giraffe-carol-carrot

import Std#DzTvt9gGhPUKD8Dkkjk9PDBhkJ4gtWxXWQjxnmUYLNrs#voyage-kimono-disco
use AsciiPrintable#diet-oxford-window
use AlphaCapsNum#magnet-section-latin

import Bitcoin#HX2UBak8vPsTokug1DGMDvTpzns3xUdwZ7QJdyt4qBA9#speed-atlanta-trilogy
use Vout#chrome-robin-gallop
use Txid#cowboy-diego-betty
use Outpoint#dinner-yoga-danube


@mnemonic(break-tunnel-gray)
data Allocation : TokenIndex, OwnedFraction

@mnemonic(source-change-period)
data AttachmentName : [Std.AsciiPrintable#diet-oxford-window ^ 1..0x14]

@mnemonic(boston-cake-susan)
data AttachmentType : id U8, name AttachmentName

@mnemonic(castle-dynamic-lemon)
data EmbeddedMedia : type RGBContract.MediaType#pixel-venice-grille, data [Byte]

@mnemonic(royal-career-axiom)
data EngravingData : appliedTo TokenIndex, content EmbeddedMedia

@mnemonic(capital-conduct-aspect)
data ItemsCount : U32

@mnemonic(vital-edgar-quota)
data OwnedFraction : U64

@mnemonic(cinema-gordon-judo)
data TokenData : index TokenIndex
, ticker RGBContract.Ticker#mike-atlas-store?
, name RGBContract.Name#crystal-visitor-tribune?
, details RGBContract.Details#network-kayak-adam?
, preview EmbeddedMedia?
, media RGBContract.Attachment#giraffe-carol-carrot?
, attachments {U8 -> ^ ..0x14 RGBContract.Attachment#giraffe-carol-carrot}
, reserves RGBContract.ProofOfReserves#liquid-owner-london?

@mnemonic(connect-farmer-havana)
data TokenIndex : U32


47 changes: 47 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
-----BEGIN STRICT TYPE LIB-----
Id: urn:ubideco:stl:pvPyTM1N1rG9HEAvvEgqKonnMdakHreYrvGWfFff8q6#atlanta-adrian-sonata
Name: RGBContract
Dependency: DzTvt9gGh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=85;2xMhrX;5inZw(1!Wo~q7P-$at4h3dqZFFxB31nqsX+~vjbZ-y}V`Xl1X+~v
jbZ-#^VRUqF5)V*vZ*OK#W>RHyWpZ|9a|Qwgb#!=d0`+VYVk7oBr%DNv+($;q`HH
K!gIHa)*%m(-e#9sm3g~J;&0Hn<z2b!bX{8Y|r$H+rRlN>Y62ZUYgq2{$1_f|(Z*
OJ*2mk;;0000000000|Nj60000005mISmVRB??VQxcjZgg^CV{`=p00;m9000000
0000|Nj600000022^QdYh`i;0RRXB!34}kUMys8WKDQu6}!mpvbyE1r(Y~+*plEP
2LQK-U=_gU2V|-Aisv2FNXqmBTmS3ZV(<42$azAB_>m7m0RR91000002mk;80000
0

-----END STRICT TYPE LIB-----

Binary file added [email protected]
Binary file not shown.
91 changes: 91 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{-
Id: urn:ubideco:stl:pvPyTM1N1rG9HEAvvEgqKonnMdakHreYrvGWfFff8q6#atlanta-adrian-sonata
Name: RGBContract
Version: 0.1.0
Description: Types for writing RGB contracts and interfaces
Author: Dr Maxim Orlovsky <[email protected]>
Copyright (C) 2023-2024-2024 LNP/BP Standards Association. All rights reserved.
License: Apache-2.0
-}

@context
typelib RGBContract

import Std#DzTvt9gGhPUKD8Dkkjk9PDBhkJ4gtWxXWQjxnmUYLNrs#voyage-kimono-disco
use AsciiPrintable#diet-oxford-window
use AlphaCapsNum#magnet-section-latin

import Bitcoin#HX2UBak8vPsTokug1DGMDvTpzns3xUdwZ7QJdyt4qBA9#speed-atlanta-trilogy
use Vout#chrome-robin-gallop
use Txid#cowboy-diego-betty
use Outpoint#dinner-yoga-danube


@mnemonic(burma-picasso-granite)
data Amount : U64

@mnemonic(xray-giant-nina)
data AssetSpec : ticker Ticker
, name Name
, details Details?
, precision Precision

@mnemonic(flower-anita-austin)
data AssetTerms : text RicardianContract, media Attachment?

@mnemonic(flame-unicorn-fruit)
data Attachment : type MediaType, digest [Byte ^ 32]

@mnemonic(gabriel-fiber-oregano)
data BurnMeta : burnProofs {ProofOfReserves}

@mnemonic(network-kayak-adam)
data Details : [Unicode ^ 1..0xff]

@mnemonic(alcohol-moral-needle)
data IssueMeta : reserves {ProofOfReserves}

@mnemonic(memphis-bicycle-roof)
data MediaRegName : [MimeChar ^ 1..0x40]

@mnemonic(robert-decide-dispute)
data MediaType : type MediaRegName
, subtype MediaRegName?
, charset MediaRegName?

@mnemonic(golf-antonio-courage)
data MimeChar : excl#33 | hash#35 | dollar | amp#38
| plus#43 | dash#45 | dot | zero#48
| one | two | three | four
| five | six | seven | eight
| nine | caret#94 | lodash | a#97
| b | c | d | e
| f | g | h | i
| j | k | l | m
| n | o | p | q
| r | s | t | u
| v | w | x | y
| z


@mnemonic(crystal-visitor-tribune)
data Name : [Std.AsciiPrintable#diet-oxford-window ^ 1..0x28]

@mnemonic(union-drum-public)
data Precision : indivisible | deci | centi | milli
| deciMilli | centiMilli | micro | deciMicro
| centiMicro | nano | deciNano | centiNano
| pico | deciPico | centiPico | femto
| deciFemto | centiFemto | atto


@mnemonic(liquid-owner-london)
data ProofOfReserves : utxo Bitcoin.Outpoint#dinner-yoga-danube, proof [Byte]

@mnemonic(bundle-turbo-verona)
data RicardianContract : [Unicode]

@mnemonic(mike-atlas-store)
data Ticker : [Std.AlphaCapsNum#magnet-section-latin ^ 1..0x8]


Loading

0 comments on commit 875c6d0

Please sign in to comment.