Skip to content

Commit

Permalink
Merge pull request #38 from RGB-WG/v0.11
Browse files Browse the repository at this point in the history
Use automatic asset tags
  • Loading branch information
dr-orlovsky authored Nov 18, 2023
2 parents 52c047a + 2bebd6d commit 20be7b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 29 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

28 changes: 2 additions & 26 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::HashSet;
use std::fs;
use std::path::PathBuf;
use std::str::FromStr;
Expand All @@ -31,10 +30,10 @@ use rgb_rt::{DescriptorRgb, RuntimeError};
use rgbinvoice::{InvoiceState, RgbInvoice, RgbTransport};
use rgbstd::containers::{Bindle, Transfer, UniversalBindle};
use rgbstd::contract::{ContractId, GenesisSeal, GraphSeal, StateType};
use rgbstd::interface::{AssetTagExt, ContractBuilder, FilterExclude, SchemaIfaces};
use rgbstd::interface::{ContractBuilder, FilterExclude, SchemaIfaces};
use rgbstd::persistence::{Inventory, Stash};
use rgbstd::schema::SchemaId;
use rgbstd::{AssetTag, AssignmentType, SealDefinition};
use rgbstd::SealDefinition;
use seals::txout::{CloseMethod, ExplicitSeal, TxPtr};
use strict_types::encoding::{FieldName, TypeName};
use strict_types::StrictVal;
Expand Down Expand Up @@ -377,10 +376,6 @@ impl Exec for RgbArgs {
.as_mapping()
.expect("invalid YAML root-level structure");

let contract_domain = code
.get("domain")
.map(|val| val.as_str().expect("domain name must be a string"));

if let Some(globals) = code.get("globals") {
for (name, val) in globals
.as_mapping()
Expand Down Expand Up @@ -425,7 +420,6 @@ impl Exec for RgbArgs {
}
}

let mut asset_tags: HashSet<AssignmentType> = empty!();
if let Some(assignments) = code.get("assignments") {
for (name, val) in assignments
.as_mapping()
Expand Down Expand Up @@ -469,24 +463,6 @@ impl Exec for RgbArgs {
match state_schema.state_type() {
StateType::Void => todo!(),
StateType::Fungible => {
let assignment_type =
iface_impl.assignments_type(&field_name).expect(
"unknown assignment name, which is absent from the \
interface implementation",
);
if !asset_tags.contains(&assignment_type) {
let asset_tag = AssetTag::new_random(
contract_domain.expect(
"when issuing contracts using fungible state it is \
required to provide a contract domain",
),
assignment_type,
);
asset_tags.insert(assignment_type);
builder = builder
.add_asset_tag(field_name.clone(), asset_tag)
.expect("unable to register asset tag");
}
let amount = assign
.get("amount")
.expect("owned state must be a fungible amount")
Expand Down
1 change: 0 additions & 1 deletion examples/rgb20-demo.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
interface: RGB20
domain: examples.lnp-bp.org/rgb-wallet/RGB20

globals:
spec:
Expand Down

0 comments on commit 20be7b4

Please sign in to comment.