-
Notifications
You must be signed in to change notification settings - Fork 279
feat(tip-1028): implement address-level receive policies #3800
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
Open
0xKitsune
wants to merge
33
commits into
main
Choose a base branch
from
kit/tip-1028-impl
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
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
79772c6
feat: escrow contract
0xKitsune b90d340
feat: escrow precompile
0xKitsune a8aea32
feat: tip403 logic
0xKitsune e9cbb0c
wip: simplify storage variables
0xKitsune be701cd
docs: comment
0xKitsune ebd6013
chore: cleanup validate policy
0xKitsune eab4a98
feat: tip20 transfer
0xKitsune 5057561
Merge branch 'main' into kit/tip-1028-impl
0xKitsune 00f0063
chore: move to t6
0xKitsune 4aa170b
feat: tip20 transfer logic
0xKitsune 4b4787c
feat: update transfer or escrow
0xKitsune 79cf39f
chore: simplify transfer_or_escrow
0xKitsune aa52cd0
feat: transfer_from
0xKitsune 3576f75
feat: memo functions
0xKitsune f6d0cc6
feat: mint paths
0xKitsune 794ac82
fix: transfer_from
0xKitsune b76e926
fix: update to call transfer_or_escrow
0xKitsune 84ff524
chore: simplify escrow address check, add docs
0xKitsune dd84248
docs: update comments
0xKitsune 5977a06
docs: update comments
0xKitsune c068a86
docs: simplify comments
0xKitsune 76511af
chore: remove redundant check
0xKitsune 8588ab4
chore: rename fn
0xKitsune faa88df
wip: simplify escrow logic
0xKitsune bf0ff93
wip: update mint checks
0xKitsune 54782ec
docs: comments
0xKitsune ec79af2
chore: rename function
0xKitsune cff7814
test: tip1028 tests
0xKitsune eed39a5
test: tip20 tests
0xKitsune c3b5f75
test: update 403 and tip20 tests
0xKitsune cfe48f5
test: invariant tests
0xKitsune 5914c67
fix: deploy escrow at t6 block, update genesis args, fix tests
0xKitsune c131127
fix: update TIP-1028 ABI and genesis fixture
0xKitsune File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| pub use ITIP1028Escrow::{ | ||
| ITIP1028EscrowErrors as TIP1028EscrowError, ITIP1028EscrowEvents as TIP1028EscrowEvent, | ||
| }; | ||
|
|
||
| crate::sol! { | ||
| #[derive(Debug, PartialEq, Eq)] | ||
| #[sol(abi)] | ||
| interface ITIP1028Escrow { | ||
| enum InboundKind { | ||
| TRANSFER, | ||
| MINT | ||
| } | ||
|
|
||
| struct ClaimReceiptV1 { | ||
| address originator; | ||
| address recipient; | ||
| uint64 blockedAt; | ||
| uint64 blockedNonce; | ||
| uint8 blockedReason; | ||
| InboundKind kind; | ||
| bytes32 memo; | ||
| } | ||
|
|
||
| function blockedReceiptBalance(address token, address recoveryContract, uint8 receiptVersion, bytes calldata receipt) external view returns (uint256 amount); | ||
| function claimBlocked(address token, address recoveryContract, uint8 receiptVersion, bytes calldata receipt, address to) external; | ||
|
|
||
| event TransferBlocked(address indexed token, address indexed from, address indexed receiver, uint8 receiptVersion, uint64 blockedNonce, uint64 blockedAt, address recipient, uint256 amount, uint8 blockedReason, address recoveryContract, bytes32 memo); | ||
| event BlockedReceiptClaimed(address indexed token, address indexed receiver, uint8 receiptVersion, uint64 indexed blockedNonce, uint64 blockedAt, address originator, address recipient, address recoveryContract, address caller, address to, uint256 amount); | ||
|
|
||
| error UnauthorizedClaimer(); | ||
| error InvalidReceiptClaim(); | ||
| error InsufficientEscrowBalance(); | ||
| error EscrowAddressReserved(); | ||
| error InvalidClaimAddress(); | ||
| error InvalidToken(); | ||
| } | ||
| } | ||
|
|
||
| impl TIP1028EscrowError { | ||
| pub const fn unauthorized_claimer() -> Self { | ||
| Self::UnauthorizedClaimer(ITIP1028Escrow::UnauthorizedClaimer {}) | ||
| } | ||
|
|
||
| pub const fn invalid_receipt_claim() -> Self { | ||
| Self::InvalidReceiptClaim(ITIP1028Escrow::InvalidReceiptClaim {}) | ||
| } | ||
|
|
||
| pub const fn insufficient_escrow_balance() -> Self { | ||
| Self::InsufficientEscrowBalance(ITIP1028Escrow::InsufficientEscrowBalance {}) | ||
| } | ||
|
|
||
| pub const fn escrow_address_reserved() -> Self { | ||
| Self::EscrowAddressReserved(ITIP1028Escrow::EscrowAddressReserved {}) | ||
| } | ||
|
|
||
| pub const fn invalid_claim_address() -> Self { | ||
| Self::InvalidClaimAddress(ITIP1028Escrow::InvalidClaimAddress {}) | ||
| } | ||
|
|
||
| pub const fn invalid_token() -> Self { | ||
| Self::InvalidToken(ITIP1028Escrow::InvalidToken {}) | ||
| } | ||
| } | ||
This file contains hidden or 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 file contains hidden or 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 file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
nit: should we rename to simply
claim?