transaction(publicKeys: [String], contracts: {String: String}) {
prepare(signer: AuthAccount) {
let acct = AuthAccount(payer: signer)
for key in publicKeys {
acct.addPublicKey(key.decodeHex())
}
for contract in contracts.keys {
acct.contracts.add(name: contract, code: contracts[contract]!.decodeHex())
}
}
}
Taking this as a starting point and assuming we are only going to deploy one contract we can write the transaction to deploy our TestContract like this:
transaction(publicKeys: [String], contractName: String, contractCode: String, a: Int8, b: Int8) {
prepare(signer: AuthAccount) {
let acct = AuthAccount(payer: signer)
for key in publicKeys {
acct.addPublicKey(key.decodeHex())
}
acct.contracts.add(name: contractName, code: contractCode.decodeHex(), a, b)
}
}
It is very clear. Thanks.
I have another question about passing the argument into a script.
I have 2 argument with type UFix64, which alphabet should I use instead of %d? let minter <- self.tokenAdmin.createNewMinter(allowedAmount: %d) let mintedVault <- minter.mintTokens(amount: %d)
i have run this script and look like the argument problem has been solved. But the emulator come out with this error, I am not clear about this error. I set amount,_:= cadence.NewUFix64("50000")
before adding the argument to the transaction.