-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive function #73
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/sCrypt-Inc/boilerplate/tree/recurse
Writing is inconsistent with final_loop_main.scrypt
.
contracts/final_loop_import.scrypt
Outdated
library Aux { | ||
static const int fee = 5000; | ||
static const int SizeOfObject = 2; | ||
static function my_great_function(Object object): DoNotTouch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an empty line
contracts/final_loop_import.scrypt
Outdated
} | ||
|
||
//DO NOT MODIFY | ||
struct DoNotTouch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename DoNotTouch -> RecursiveReturn
contracts/final_loop_import.scrypt
Outdated
} | ||
return {{a, b}, recursion_call}; | ||
} | ||
static function bytes_to_object(bytes b): Object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to deserialized
contracts/final_loop_import.scrypt
Outdated
static function bytes_to_object(bytes b): Object { | ||
return {unpack(b[0:1]), unpack(b[1:2])}; | ||
} | ||
static function object_to_bytes(Object object): bytes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serialize
contracts/final_loop_import.scrypt
Outdated
} | ||
|
||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete dead code below
//Do what you want after | ||
require(true); | ||
} | ||
//Do not touch below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an empty line
//Return everything util.scriptCode except the space we need in this library | ||
return Util.readVarint(preimage[104:len(preimage)-Aux.SizeOfObject-1]); | ||
} | ||
static function buildOutput(SigHashPreimage preimage, bytes outputScript, int outputSatoshis): bytes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add empty line before each new function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xhliu would it make sense to automate some of these checks with a linter? Or is there already one in place as part of the build / test process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Will add one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 well done. This is huge.
No description provided.