Questions tagged [scrypto]

Scrypto is the asset-oriented smart contract language of the Radix network and is designed to become the engine of DeFi.

Scrypto was designed to solve the problems with smart contracts today and to allow the next generation of DeFi products to be developed easily and securely.

Right now, building DeFi functionality is extremely complex. It takes multiple years of learning the language and its edge cases to become "DeFi ready", and even then, there are massive exploits happening every weeks. This is not because of bad developers, but a bad design of the platform and language. DeFi functionality relies massively on assets, but many smart contract platforms doesn't recognize tokens as first-class assets. On Ethereum and every EVM compatible DLTs, developers have to simulate assets by creating smart contracts holding a balance sheet and implement the whole logic of the token (like changing ownership, fetching balance, etc...) themself.

Scrypto solves this issue by making the concept of assets a core feature of the platform itself. Not something else that the developers have to implement themself. This makes developing DeFi functionality extremely simple and more secure.

You can get started learning Scrypto by reading the docs and looking at community-made examples. You can find our developer community on Discord and Telegram

26 questions
4
votes
1 answer

Scrypto Importing Structs from other folder

In Scrypto, I have folder structure like: src/ ├── lib.rs ├── script.rs ├── custom_types │ └── type.rs In type.rs, I have the following defined: use sbor::*; #[derive(TypeId, Encode, Decode, Describe)] pub struct Date { year: u8, day:…
M80
  • 191
  • 1
  • 14
4
votes
1 answer

How to get the ressources address of a badge

I'm trying to build an Auction web application based on a scrypto smartcontract. I have a register function that return a badge, from which I can build proof to call other methods that need authentication. To build the proof, I need the address of…
4
votes
1 answer

How to get image data into nft data

Assume I have a .jpg or .png file, I want to integrate this image data into a NonFungibleData in Scrypto, how can I do it? Should I use Decimal? HashMap?
PeterKim
  • 68
  • 5
2
votes
1 answer

Scrypto: ResourceCheckFailure when calling method

I have this method in my component that is supposed to return a GumBall tokens after the user sends a payment: pub fn buy_gumball(&self, payment: Bucket) -> Bucket { self.payments.put(payment.take(self.gumball_cost)); …
Clement
  • 212
  • 1
  • 8
2
votes
1 answer

Radix Scrypto: How to send Bucket or BucketRef through resim

I created a blueprint with a method accepting a Bucket and a BucketRef and I don't know how to call it with resim. How can I send buckets when calling a method of my components ?
Clement
  • 212
  • 1
  • 8
1
vote
1 answer

Scrypto test: how to burn tokens in bucket as a function argument

I have a function for the admin to burn tokens in a bucket. pub fn burn_in_bucket(&mut self, mut bucket: Bucket) { assert!(bucket.resource_address() == self.token_vault.resource_address(), "input token invalid"); let…
Russo
  • 2,186
  • 2
  • 26
  • 42
1
vote
1 answer

ERROR: [Radix Wallet Chrome Extension Load Unpack] : Manifest file is missing or unreadable. Could not load manifest

I am trying to follow the babylon gumball machine https://github.com/radixdlt/babylon-alphanet/tree/main/gumball-machine-example I tried to install Radix Wallet Chrome Extension from…
1
vote
2 answers

How to send signed manifest to the PTE to interact with a published package

I managed to publish a package to the PTE via resim publish. Now I am stuck as I have the following problem: How to send a signed manifest to the PTE (from my account as I need a badge that will be returned)?
1
vote
1 answer

How to call a method on a component protected by an authrule?

On my blueprint, I defined a method buy_hotdog(&mut self, payment: Bucket) and when instantiating my component, I defined the access rules like this: let access_rules = AccessRules::new() .method("buy_hotdog",…
Clement
  • 212
  • 1
  • 8
1
vote
1 answer

How to change ledger's epoch during unit test?

I am trying to change epoch in a single unit test: I run a method I switch to next epoch I run another method (on the same substate store) It seems like I can not mutate substate store's epoch if I use a TransactionExecutor on it: use…
Vincent C.
  • 607
  • 5
  • 18
1
vote
1 answer

Is Runtime::generate_uuid() safe in Scrypto?

I want to make a game in a Scrypto blueprint where users can play with their Gumball NFTs. My blueprint has a pub fn attack(&self, my_gumball: Proof, other_gumball_key: NonFungibleId) method that attacks another NFT by assigning it a random damage…
Clement
  • 212
  • 1
  • 8
1
vote
1 answer

Radix Scrypto transaction manifest multiple transfer from account

How do we do multiple transfers of tokens from an account in one manifest? For example: Account A -- Token A --> Account B Account A -- Token B --> Account B Account A -- Token A --> Account C Account A -- Token B --> Account C I did…
1
vote
1 answer

How to send specific NFT ids when calling Scrypto component with resim

I have the following resources in my account: I am able to create a bucket containing my three NFTs with the 3,036e1...e0144 syntax but how can I send only the NFT with id 4 ?
Clement
  • 212
  • 1
  • 8
1
vote
1 answer

What is the resource definition address of XRD in resim

I want to transfer XRD to another account in the simulator but I don't know its resource definition address. What is it ?
Clement
  • 212
  • 1
  • 8
0
votes
1 answer

Create a fungible resource using Scrypto ManifestBuilder.create_fungible_resource

I am struggling to get the .create_fungible_resource method on the ManifestBuilder working. I have the following: let manifest = ManifestBuilder::new() .lock_fee(FAUCET_COMPONENT, dec!("10")) .create_fungible_resource( OwnerRole::None, …
Fred Liebenberg
  • 101
  • 1
  • 5
1
2