Pact is a language for developing smart contracts to run on a fast deterministic blockchain.
Questions tagged [pact-lang]
71 questions
2
votes
0 answers
Module gaurds in Pact
With module gaurds, is it possible to insert to a table but not add a read function within that defined module that sits on a public chain (chainweb)...then subsequently define a module on scalableBFT (private chain) that allows an account defined…

mleafer
- 825
- 2
- 7
- 15
1
vote
1 answer
How do I use the resulting output of prepareContcmd to send a continuation transaction to the blockchain using /local or /send endpoints?
I've got the following code which produces a signed continuation command. I've tried to add the pactCode key to the contCmd and use Pact.fetch.local but that does not work, I get error TypeError: pactCode must be a string: undefined.
What is the…

Nexion21
- 309
- 2
- 7
1
vote
1 answer
How would I go about using a capability guard to make a function on module1 only callable by module2?
I want certain functions on module 1 to only be callable within the scope of module 2.
Is there a viable way to do that?

Nexion21
- 309
- 2
- 7
1
vote
1 answer
How do I declare global variables in Pact lang?
I'm writing a smart contract and I want to declare global variables. I want the functions in my smart contract to be able to access and update these variables.
For example, in Solidity I can do this as follows:
pragma solidity ^0.5.0;
contract…

Linda Ortega
- 71
- 4
1
vote
1 answer
Kadene transfer-create call fails
I'm trying to call transfer 10 K tokens to account k:81df193e0d913bc87e127150efdaaee39584abbd2d0223ed8c9afb0b31cf9db2, with transfer-create function. However it fails and the error message is here =>
Request key:…

att
- 617
- 8
- 17
1
vote
1 answer
Deploying contract to Kadena localdevnet error: "Cannot resolve 'validate-principle'"
I'm following https://github.com/thomashoneyman/real-world-pact/ to deploy my contract on local devnet.
I've updated the deployment script as
const deployK = async () => {
const detailArgs = ["--local", "k-contract-details"];
const…

att
- 617
- 8
- 17
1
vote
1 answer
Kadena Pact Property Check
The Pact Language has a property system.
The call to create-account should fail for accounts shorter than 3 and longer than 256 chars. However, I couldn't make it work.
This is the result of REPL unit test.
I was expecting the create-account call…

att
- 617
- 8
- 17
1
vote
1 answer
Kadene Pact Contract "Required Capability Not Granted" error
I'm getting following error, while crediting an account tuncatunc in the reply file.
There are 2 keysets, k-admin-keyset and k-player-keyset.
k-player-keyset is used to create account
(create-account "tuncatunc" (read-keyset…

att
- 617
- 8
- 17
1
vote
1 answer
Interface not defined: free.fungible-xchain-v1
Trying to deploy the contract on Kadena testnet chain 1 and errors with this message.
Error from (api.testnet.chainweb.com): : Failure: Interface not defined: free.fungible-xchain-v1
free.fungible-xchain-v1 is deployed and I can find it from the…

att
- 617
- 8
- 17
1
vote
1 answer
How do I add a user of my module to the coin contract with (coin.create-account) in a way that is similar to (coin.transfer-create)?
I have a module that some users may not have any KDA in their account, and thus don't exist on the coin contract. To prove ownership of a token, I am using (enforce-guard (at "guard" (coin.details account))) which returns "with-read: row not found:…

Nexion21
- 309
- 2
- 7
1
vote
1 answer
Is it possible to use (compose-capability) with the coin.TRANSFER capability?
My contract contains a function that transfers funds with coin.transfer if some conditions are met. It is guarded by a capability (let's call it TRANSFER_WRAPPER). However, when a user calls this function, they must scope their signature to both the…

trh
- 171
- 6
1
vote
1 answer
How do I run a function in Pact REPL without a keyset I defined
I defined a keyset (i.e. "my-admin-keyset") in the pact environment data.
I want to test a function without that keyset present.
However every function I run, signs with that keyset.
How do I exclude a keyset when running a function?

Kitty Kad
- 412
- 1
- 7
1
vote
1 answer
How to create an instance of a specific type in Pact-Lang (Smart Contracts)?
Pact's documentation says you can type objects with schemas. I have been unable to work out how to do this.
When creating an object, eg. in the REPL, with eg. {"a":1.0,"b":2.0}, it is of type object:*.
I have a schema of:
(defschema data
a :…

Joshua Scurr
- 11
- 1
1
vote
1 answer
How do Pact interfaces provide abstraction similar to Haskell type classes?
The Pact documentation mentions that interfaces in Pact allow for abstraction similar to Haskell's type classes:
When a module issues an implements, then that module is said to ‘implement’ said interface, and must provide an implementation . This…

trh
- 171
- 6
1
vote
1 answer
Are there any functions in the `fungible-v2` interface for minting/burning coins?
I'd like to create a function
(deposit-fungible-v2-burn (account:string amount:decimal token:module{fungible-v2}))
that burns amount tokens from the account.
Are there any functions in the fungible-v2 interface for minting/burning coins?
It is…

Dmytro Zakharov
- 13
- 2