-
Notifications
You must be signed in to change notification settings - Fork 13
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
Propose staking support #29
base: main
Are you sure you want to change the base?
Conversation
@@ -44,9 +59,11 @@ pub contract FlowColdStorageProxy { | |||
pub var lastNonce: Int64 | |||
access(self) let flowVault: @FungibleToken.Vault | |||
access(self) let publicKey: [UInt8] | |||
access(self) let nodeDelegator: @FlowIDTableStaking.NodeDelegator |
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.
Is this contract already deployed on a network? You aren't able to add fields in upgrades, so you'd need to find another way to do this if it is already deployed
|
||
init(publicKey: [UInt8]) { | ||
init(publicKey: [UInt8], stakingNodeID: String) { |
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.
It is right to register a delegator for the user by default, or should there be a different method to allow them the option to register only if they want to?
var data: [UInt8] = "delegate".toBytes() | ||
data = data.concat(amount.toBigEndianBytes()) | ||
data = data.concat(nonce.toBigEndianBytes()) | ||
|
||
// Verify the signature. | ||
let key = PublicKey( | ||
publicKey: self.publicKey, | ||
signatureAlgorithm: SignatureAlgorithm.ECDSA_secp256k1 | ||
) | ||
if !key.verify(signature: sig, signedData: data, domainSeparationTag: "FLOW-V0.0-user", hashAlgorithm: HashAlgorithm.SHA3_256) { | ||
panic("Invalid meta transaction signature") | ||
} |
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.
A lot of this code is boilerplate and is the same between the different methods. Would it be possible to split some of it out into utility methods to avoid boilerplate?
This is just for reference.
Basic and untested addition to the proxy vault which could be used to support staking for Custody