-
Notifications
You must be signed in to change notification settings - Fork 12
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
noto: add "lock" functionality #483
Open
awrichar
wants to merge
56
commits into
main
Choose a base branch
from
noto-lock
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
This was referenced Dec 19, 2024
should |
another observation after some further discussions with @awrichar is whether the |
Allows a domain to directly trigger a new transaction, such as in response to an event. Signed-off-by: Andrew Richardson <[email protected]>
Change Noto to ensure notary name is fully qualified during deploy, and to check on contract init if the current node is the notary. Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Allows a domain to look up specific states, regardless of whether they've been spent or not. Signed-off-by: Andrew Richardson <[email protected]>
This PR is stale because it has been open 30 days with no activity. |
Signed-off-by: Andrew Richardson <[email protected]>
This variant isn't fully proved out, and may begin causing confusion. We can bring it back at the time we're able to work through all of the flows in detail. Signed-off-by: Andrew Richardson <[email protected]>
Allows an owner to "lock" some portion of value such that it cannot be spent except when specific conditions are met. Signed-off-by: Andrew Richardson <[email protected]>
Currently you can only unlock to return the value to yourself (additional work needed to allow specifying and executing a transfer). Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Also gather two separate sender signatures for transfer + lock, so that they can be emitted separately in the two blockchain events. Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Use shorter names "restrictMint" and "allowBurn". Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Rather than storing all input/outputs states on the smart contract, store an EIP-712 hash of the prepared unlock. Allow extracting the input/output states from the state receipt (as info/read states) so that they can be passed in to the final "unlockWithApproval" transaction. Signed-off-by: Andrew Richardson <[email protected]>
Get states by ID, regardless of whether they are available. Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
This helper is actually making the code more confusing. Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
This makes it easier to separate locked/unlocked states. Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
This PR is stale because it has been open 30 days with no activity. |
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #455
In a chain with #490
Allows an owner to "lock" some portion of value such that it cannot be spent except when specific conditions are met. This provides a programmable way to set aside some value for a specific purpose and to prepare value transfers to be completed by other public smart contracts (such as escrow and swap contracts).
New methods on Noto private ABI:
lock(uint256 amount, bytes calldata data)
- lock some amount of my Noto value and assign it a unique lock IDunlock(bytes32 lockId, string calldata from, UnlockRecipient[] calldata recipients, bytes calldata data)
- unlock some value that I previously locked, and send it to one or more recipientsprepareUnlock(bytes32 lockId, string calldata from, UnlockRecipient[] calldata recipients, bytes calldata data)
- prepare to unlock some value that I previously locked, and record the prepared transition on the base ledger (but do not actually unlock)delegateLock(bytes32 lockId, address delegate, bytes calldata data)
- delegate to another address that will be able to execute the prepared unlock operation (requiresprepareUnlock
to have been called)Where the
UnlockRecipient
struct used here is defined as:Some notes about these methods:
lock + prepareUnlock
orprepareUnlock + delegateLock
or evenlock + prepareUnlock + delegateLock
, but for the moment I've left them all as separate transactions.transfer
variants for multiple recipients or batching, to match what is now possible with locking.unlock
by default only allows the original lock owner to unlock the states, more complex flows can be implemented via Pente hooks. Particularly something like Exploration on contracts for NotoDepositWithdraw #485 should be possible, where one party locks some value and spawns a separate contract to track it (such as an ERC20), and then various other parties are able to claim portions of the locked value by presenting proofs of their entitlement to unlock it.The
unlock
method on the Noto public ABI can be called via the notary, or may be called directly via a public transaction if an unlock operation has been prepared and delegated.Domain receipts have now been implemented for Noto, allowing easy extraction of the following:
unlock
function call that can be used to run a prepared unlock (for prepareUnlock only)This PR also removes the "NotoSelfSubmit" variant. This contract was not fully proved out, and it doesn't seem useful to continue adding features to it at this time. We can always bring it back in the future if needed.