use of com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor in project radixdlt by radixdlt.
the class ResourceFeeTest method setup.
@Before
public void setup() throws Exception {
var cmAtomOS = new CMAtomOS();
cmAtomOS.load(new TokensConstraintScryptV3(Set.of("xrd"), Pattern.compile("[a-z0-9]+")));
cmAtomOS.load(new SystemConstraintScrypt());
var feeTable = FeeTable.create(Amount.zero(), Map.of(TokenResource.class, Amount.ofTokens(1)));
var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization(), UpSubstateFeeMeter.create(feeTable.getPerUpSubstateFee()));
var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
var serialization = cmAtomOS.buildSubstateSerialization();
this.store = new InMemoryEngineStore<>();
this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).put(TransferToken.class, new TransferTokensConstructorV2()).put(CreateMutableToken.class, new CreateMutableTokenConstructor(SystemConstraintScrypt.MAX_SYMBOL_LENGTH)).put(MintToken.class, new MintTokenConstructor()).put(FeeReservePut.class, new FeeReservePutConstructor()).put(FeeReserveComplete.class, new FeeReserveCompleteConstructor(feeTable)).build(), cm, store);
var txn = this.engine.construct(TxnConstructionRequest.create().action(new CreateSystem(0)).action(new CreateMutableToken(REAddr.ofNativeToken(), "xrd", "xrd", "", "", "", null)).action(new MintToken(REAddr.ofNativeToken(), accountAddr, Amount.ofTokens(4).toSubunits()))).buildWithoutSignature();
this.engine.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
use of com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor in project radixdlt by radixdlt.
the class TxnSizeFeeTest method setup.
@Before
public void setup() throws Exception {
var cmAtomOS = new CMAtomOS();
cmAtomOS.load(new TokensConstraintScryptV3(Set.of(), Pattern.compile("[a-z0-9]+")));
cmAtomOS.load(new SystemConstraintScrypt());
var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization(), TxnSizeFeeMeter.create(costPerByte.toSubunits(), MAX_SIZE));
var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
var serialization = cmAtomOS.buildSubstateSerialization();
this.store = new InMemoryEngineStore<>();
this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).put(TransferToken.class, new TransferTokensConstructorV2()).put(CreateMutableToken.class, new CreateMutableTokenConstructor(SystemConstraintScrypt.MAX_SYMBOL_LENGTH)).put(MintToken.class, new MintTokenConstructor()).put(FeeReservePut.class, new FeeReservePutConstructor()).put(FeeReserveComplete.class, new FeeReserveCompleteConstructor(FeeTable.create(costPerByte, Map.of()))).build(), cm, store);
var txn = this.engine.construct(TxnConstructionRequest.create().action(new CreateSystem(0)).action(new CreateMutableToken(REAddr.ofNativeToken(), "xrd", "xrd", "", "", "", null)).action(new MintToken(REAddr.ofNativeToken(), accountAddr, Amount.ofTokens(2).toSubunits()))).buildWithoutSignature();
this.engine.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
use of com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor in project radixdlt by radixdlt.
the class BurnTokensV3Test method setup.
@Before
public void setup() throws Exception {
var cmAtomOS = new CMAtomOS();
cmAtomOS.load(new SystemConstraintScrypt());
cmAtomOS.load(new TokensConstraintScryptV3(Set.of(), Pattern.compile("[a-z0-9]+")));
var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
var serialization = cmAtomOS.buildSubstateSerialization();
EngineStore<Void> store = new InMemoryEngineStore<>();
this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).put(CreateMutableToken.class, new CreateMutableTokenConstructor(SystemConstraintScrypt.MAX_SYMBOL_LENGTH)).put(MintToken.class, new MintTokenConstructor()).put(BurnToken.class, new BurnTokenConstructor()).build(), cm, store);
var genesis = this.engine.construct(new CreateSystem(0)).buildWithoutSignature();
this.engine.execute(List.of(genesis), null, PermissionLevel.SYSTEM);
}
use of com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor in project radixdlt by radixdlt.
the class NativeTokensTest method setup.
@Before
public void setup() throws Exception {
var cmAtomOS = new CMAtomOS();
cmAtomOS.load(scrypt);
cmAtomOS.load(new SystemConstraintScrypt());
var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
var serialization = cmAtomOS.buildSubstateSerialization();
this.store = new InMemoryEngineStore<>();
this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).put(TransferToken.class, transferTokensConstructor).put(CreateMutableToken.class, new CreateMutableTokenConstructor(SystemConstraintScrypt.MAX_SYMBOL_LENGTH)).put(MintToken.class, new MintTokenConstructor()).build(), cm, store);
var txn = this.engine.construct(TxnConstructionRequest.create().action(new CreateSystem(0)).action(new CreateMutableToken(REAddr.ofNativeToken(), "xrd", "xrd", "", "", "", null))).buildWithoutSignature();
this.engine.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
use of com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor in project radixdlt by radixdlt.
the class StakeTokensTest method setup.
@Before
public void setup() throws Exception {
var cmAtomOS = new CMAtomOS();
scrypts.forEach(cmAtomOS::load);
var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
var serialization = cmAtomOS.buildSubstateSerialization();
this.store = new InMemoryEngineStore<>();
this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).put(StakeTokens.class, stakeTokensConstructor).put(CreateMutableToken.class, new CreateMutableTokenConstructor(SystemConstraintScrypt.MAX_SYMBOL_LENGTH)).put(MintToken.class, new MintTokenConstructor()).build(), cm, store);
var genesis = this.engine.construct(new CreateSystem(0)).buildWithoutSignature();
this.engine.execute(List.of(genesis), null, PermissionLevel.SYSTEM);
}
Aggregations