Created
July 25, 2023 21:08
-
-
Save Neggia/283e80dd658acddf1c54e3fef10fb671 to your computer and use it in GitHub Desktop.
Test contract getting Error: the raw script cannot match the ASM template of contract Test for this.oraclePubKey = 1441..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
assert, | |
MethodCallOptions, | |
ContractTransaction, | |
ByteString, | |
hash256, | |
method, | |
prop, | |
PubKey, | |
Sig, | |
SmartContract, | |
Utils, | |
bsv, | |
hash160, | |
} from 'scrypt-ts' | |
import { RabinSig, RabinPubKey, RabinVerifierWOC } from 'scrypt-ts-lib' | |
export class Test extends SmartContract { | |
@prop() | |
userPK: PubKey | |
@prop() | |
amount: bigint | |
// Oracles Rabin public key. | |
@prop() | |
oraclePubKey: RabinPubKey | |
constructor(userPK: PubKey, amount: bigint) { | |
super(...arguments) | |
this.userPK = userPK | |
this.amount = amount | |
// Error: Execution failed, Oracle sig verify failed. | |
//this.oraclePubKey = 123n; | |
// Error: the raw script cannot match the ASM template of contract Test | |
this.oraclePubKey = 1441202650694552844614001501113940640820210571114064223822525895933328339991666504911217342541704753613883341728934570236007940885085326324351782260674593101024846604231384431614098181764303333412237583369470241701112665228752051148874990028379690626874356755677363068422930003887757775045023684129479316784837156104962865365129042643416636796904689587078240822359907859241510339138178400425035609812723517266508184042126185513611772407878113991390143306791962021773758215292850248003179175357659652713169491090455161982836195603331642606780298061422921614948846770007956525978072052380409608041661124384092466748634896620790248957487344161161085393737540037847324000614761722362768921727479999600603539018724109206958797240665548022146766222227501224380137348727849581087128860522534113390789956012610490534321314466676416837986885657294393709925129881179558801576215875101346229671886675251517399025833667617805987143884517n | |
} | |
@method() | |
public lockStep1( | |
userSig: Sig, | |
dataMessage: ByteString, | |
dataSig: RabinSig, | |
) { | |
assert(this.checkSig(userSig, this.userPK), 'User signature check failed') | |
assert( | |
RabinVerifierWOC.verifySig(dataMessage, dataSig, this.oraclePubKey), | |
'Oracle sig verify failed.' | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment