Skip to content

Commit

Permalink
chore(contracts): Switch 'is valid nfd' call from pre-ABI call to ABI…
Browse files Browse the repository at this point in the history
… call now that NFD registry has been updated as part of nfd v3.
  • Loading branch information
pbennett committed Sep 20, 2024
1 parent 5b708c6 commit 97eccd6
Show file tree
Hide file tree
Showing 8 changed files with 1,432 additions and 1,356 deletions.
91 changes: 46 additions & 45 deletions contracts/contracts/artifacts/ValidatorRegistry.approval.teal
Original file line number Diff line number Diff line change
Expand Up @@ -5858,48 +5858,49 @@ isNFDAppIDValid:
frame_bury 0 // userOfferedNFDName: string

// contracts/validatorRegistry.algo.ts:1323
// sendAppCall({
// return sendMethodCall<[string, uint64], boolean>({
// applicationID: AppID.fromUint64(this.nfdRegistryAppId),
// applicationArgs: ['is_valid_nfd_appid', userOfferedNFDName, itob(nfdAppID)],
// applications: [AppID.fromUint64(nfdAppID)],
// name: 'isValidNfdAppId',
// methodArgs: [userOfferedNFDName, nfdAppID],
// })
itxn_begin
int appl
itxn_field TypeEnum
method "isValidNfdAppId(string,uint64)bool"
itxn_field ApplicationArgs

// contracts/validatorRegistry.algo.ts:1324
// applicationID: AppID.fromUint64(this.nfdRegistryAppId)
load 200 // TMPL_nfdRegistryAppId
itxn_field ApplicationID

// contracts/validatorRegistry.algo.ts:1325
// applicationArgs: ['is_valid_nfd_appid', userOfferedNFDName, itob(nfdAppID)]
byte 0x69735f76616c69645f6e66645f6170706964 // "is_valid_nfd_appid"
itxn_field ApplicationArgs
// contracts/validatorRegistry.algo.ts:1326
// methodArgs: [userOfferedNFDName, nfdAppID]
frame_dig 0 // userOfferedNFDName: string
dup
len
itob
extract 6 2
swap
concat
itxn_field ApplicationArgs
frame_dig -1 // nfdAppID: uint64
itob
itxn_field ApplicationArgs

// contracts/validatorRegistry.algo.ts:1326
// applications: [AppID.fromUint64(nfdAppID)]
frame_dig -1 // nfdAppID: uint64
itxn_field Applications

// Fee field not set, defaulting to 0
int 0
itxn_field Fee

// Submit inner transaction
itxn_submit

// contracts/validatorRegistry.algo.ts:1328
// return btoi(this.itxn.lastLog) === 1
itxn LastLog
btoi
itxn NumLogs
int 1
==
-
itxnas Logs
extract 4 0
int 0
getbit

// set the subroutine return value
frame_bury 0
Expand All @@ -5920,7 +5921,7 @@ isAddressInNFDCAAlgoList:
byte 0x
dupn 2

// contracts/validatorRegistry.algo.ts:1340
// contracts/validatorRegistry.algo.ts:1339
// sendAppCall({
// applicationID: AppID.fromUint64(nfdAppID),
// applicationArgs: ['read_property', 'v.caAlgo.0.as'],
Expand All @@ -5929,12 +5930,12 @@ isAddressInNFDCAAlgoList:
int appl
itxn_field TypeEnum

// contracts/validatorRegistry.algo.ts:1341
// contracts/validatorRegistry.algo.ts:1340
// applicationID: AppID.fromUint64(nfdAppID)
frame_dig -1 // nfdAppID: uint64
itxn_field ApplicationID

// contracts/validatorRegistry.algo.ts:1342
// contracts/validatorRegistry.algo.ts:1341
// applicationArgs: ['read_property', 'v.caAlgo.0.as']
byte 0x726561645f70726f7065727479 // "read_property"
itxn_field ApplicationArgs
Expand All @@ -5948,26 +5949,26 @@ isAddressInNFDCAAlgoList:
// Submit inner transaction
itxn_submit

// contracts/validatorRegistry.algo.ts:1344
// contracts/validatorRegistry.algo.ts:1343
// caAlgoData = this.itxn.lastLog
itxn LastLog
frame_bury 0 // caAlgoData: byte[]

// contracts/validatorRegistry.algo.ts:1345
// contracts/validatorRegistry.algo.ts:1344
// for (let i = 0; i < caAlgoData.length; i += 32)
int 0
frame_bury 1 // i: uint64

*for_10:
// contracts/validatorRegistry.algo.ts:1345
// contracts/validatorRegistry.algo.ts:1344
// i < caAlgoData.length
frame_dig 1 // i: uint64
frame_dig 0 // caAlgoData: byte[]
len
<
bz *for_10_end

// contracts/validatorRegistry.algo.ts:1346
// contracts/validatorRegistry.algo.ts:1345
// addr = extract3(caAlgoData, i, 32)
frame_dig 0 // caAlgoData: byte[]
frame_dig 1 // i: uint64
Expand All @@ -5976,7 +5977,7 @@ isAddressInNFDCAAlgoList:
frame_bury 2 // addr: byte[]

// *if53_condition
// contracts/validatorRegistry.algo.ts:1347
// contracts/validatorRegistry.algo.ts:1346
// addr !== rawBytes(globals.zeroAddress) && addr === rawBytes(addrToFind)
frame_dig 2 // addr: byte[]
global ZeroAddress
Expand All @@ -5992,15 +5993,15 @@ isAddressInNFDCAAlgoList:
bz *if53_end

// *if53_consequent
// contracts/validatorRegistry.algo.ts:1348
// contracts/validatorRegistry.algo.ts:1347
// return true
int 1
b *isAddressInNFDCAAlgoList*return

*if53_end:

*for_10_continue:
// contracts/validatorRegistry.algo.ts:1345
// contracts/validatorRegistry.algo.ts:1344
// i += 32
frame_dig 1 // i: uint64
int 32
Expand All @@ -6009,7 +6010,7 @@ isAddressInNFDCAAlgoList:
b *for_10

*for_10_end:
// contracts/validatorRegistry.algo.ts:1351
// contracts/validatorRegistry.algo.ts:1350
// return false
int 0

Expand All @@ -6032,12 +6033,12 @@ algoSaturationLevel:
// Push empty bytes after the frame pointer to reserve space for local variables
byte 0x

// contracts/validatorRegistry.algo.ts:1360
// contracts/validatorRegistry.algo.ts:1359
// online = this.getCurrentOnlineStake()
callsub getCurrentOnlineStake
frame_bury 0 // online: uint64

// contracts/validatorRegistry.algo.ts:1362
// contracts/validatorRegistry.algo.ts:1361
// return wideRatio([online, MAX_VALIDATOR_SOFT_PCT_OF_ONLINE_1DECIMAL], [1000])
frame_dig 0 // online: uint64
int 100
Expand Down Expand Up @@ -6067,12 +6068,12 @@ maxAllowedStake:
// Push empty bytes after the frame pointer to reserve space for local variables
byte 0x

// contracts/validatorRegistry.algo.ts:1370
// contracts/validatorRegistry.algo.ts:1369
// online = this.getCurrentOnlineStake()
callsub getCurrentOnlineStake
frame_bury 0 // online: uint64

// contracts/validatorRegistry.algo.ts:1372
// contracts/validatorRegistry.algo.ts:1371
// return wideRatio([online, MAX_VALIDATOR_HARD_PCT_OF_ONLINE_1DECIMAL], [1000])
frame_dig 0 // online: uint64
int 150
Expand All @@ -6098,7 +6099,7 @@ maxAllowedStake:
maxAlgoAllowedPerPool:
proto 0 1

// contracts/validatorRegistry.algo.ts:1379
// contracts/validatorRegistry.algo.ts:1378
// return globals.payoutsMaxBalance
global PayoutsMaxBalance
retsub
Expand All @@ -6107,7 +6108,7 @@ maxAlgoAllowedPerPool:
getCurrentOnlineStake:
proto 0 1

// contracts/validatorRegistry.algo.ts:1383
// contracts/validatorRegistry.algo.ts:1382
// return onlineStake()
online_stake
retsub
Expand All @@ -6119,12 +6120,12 @@ minBalanceForAccount:
// Push empty bytes after the frame pointer to reserve space for local variables
byte 0x

// contracts/validatorRegistry.algo.ts:1395
// contracts/validatorRegistry.algo.ts:1394
// minBal = ALGORAND_ACCOUNT_MIN_BALANCE
int 100000
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1396
// contracts/validatorRegistry.algo.ts:1395
// minBal += contracts * APPLICATION_BASE_FEE
frame_dig 0 // minBal: uint64
frame_dig -1 // contracts: uint64
Expand All @@ -6133,7 +6134,7 @@ minBalanceForAccount:
+
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1397
// contracts/validatorRegistry.algo.ts:1396
// minBal += extraPages * APPLICATION_BASE_FEE
frame_dig 0 // minBal: uint64
frame_dig -2 // extraPages: uint64
Expand All @@ -6142,7 +6143,7 @@ minBalanceForAccount:
+
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1398
// contracts/validatorRegistry.algo.ts:1397
// minBal += assets * ASSET_HOLDING_FEE
frame_dig 0 // minBal: uint64
frame_dig -3 // assets: uint64
Expand All @@ -6151,7 +6152,7 @@ minBalanceForAccount:
+
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1399
// contracts/validatorRegistry.algo.ts:1398
// minBal += localInts * SSC_VALUE_UINT
frame_dig 0 // minBal: uint64
frame_dig -4 // localInts: uint64
Expand All @@ -6160,7 +6161,7 @@ minBalanceForAccount:
+
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1400
// contracts/validatorRegistry.algo.ts:1399
// minBal += globalInts * SSC_VALUE_UINT
frame_dig 0 // minBal: uint64
frame_dig -6 // globalInts: uint64
Expand All @@ -6169,7 +6170,7 @@ minBalanceForAccount:
+
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1401
// contracts/validatorRegistry.algo.ts:1400
// minBal += localBytes * SSC_VALUE_BYTES
frame_dig 0 // minBal: uint64
frame_dig -5 // localBytes: uint64
Expand All @@ -6178,7 +6179,7 @@ minBalanceForAccount:
+
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1402
// contracts/validatorRegistry.algo.ts:1401
// minBal += globalBytes * SSC_VALUE_BYTES
frame_dig 0 // minBal: uint64
frame_dig -7 // globalBytes: uint64
Expand All @@ -6187,7 +6188,7 @@ minBalanceForAccount:
+
frame_bury 0 // minBal: uint64

// contracts/validatorRegistry.algo.ts:1403
// contracts/validatorRegistry.algo.ts:1402
// return minBal
frame_dig 0 // minBal: uint64

Expand All @@ -6199,7 +6200,7 @@ minBalanceForAccount:
costForBoxStorage:
proto 1 1

// contracts/validatorRegistry.algo.ts:1410
// contracts/validatorRegistry.algo.ts:1409
// return SCBOX_PERBOX + totalNumBytes * SCBOX_PERBYTE
int 2500
frame_dig -1 // totalNumBytes: uint64
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/artifacts/ValidatorRegistry.arc32.json

Large diffs are not rendered by default.

Loading

0 comments on commit 97eccd6

Please sign in to comment.