algorand: Ensure optin transaction is the current transaction (#3131)

* Ensure optin transaction is the current transaction and address the algo_seed transaction in a relative manner.

* Added core_approve.teal based on previous change.

* Fixed admin.py to make the tests pass.
This commit is contained in:
Marcos Nuñez Cortes 2023-08-16 13:55:26 -03:00 committed by GitHub
parent 19b0c6d423
commit 0dcc53cbf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 416 additions and 297 deletions

View File

@ -1151,7 +1151,7 @@ class PortalCore:
off += 2
ret["Fee"] = vaa[off:(off + 32)].hex()
if int.from_bytes((vaa[off:off+1]), "big") == 3:
if len(vaa[off:]) > 133 and int.from_bytes((vaa[off:off+1]), "big") == 3:
ret["Meta"] = "TokenBridge Transfer With Payload"
ret["Type"] = int.from_bytes((vaa[off:off+1]), "big")
off += 1

File diff suppressed because it is too large Load Diff

View File

@ -126,8 +126,8 @@ def getCoreContracts( genTeal, approve_name, clear_name,
@Subroutine(TealType.uint64)
def optin():
# Alias for readability
algo_seed = Gtxn[0]
optin = Gtxn[1]
algo_seed = Gtxn[Txn.group_index() - Int(1)]
optin = Txn
well_formed_optin = And(
# Check that we're paying it