@@ -47,6 +47,7 @@ pub contract FlowIDTableStaking {
47
47
pub event RewardsPaid (nodeID : String , amount : UFix64 )
48
48
pub event UnstakedTokensWithdrawn (nodeID : String , amount : UFix64 )
49
49
pub event RewardTokensWithdrawn (nodeID : String , amount : UFix64 )
50
+ pub event NetworkingAddressUpdated (nodeID : String , newAddress : String )
50
51
51
52
/// Delegator Events
52
53
pub event NewDelegatorCreated (nodeID : String , delegatorID : UInt32 )
@@ -163,7 +164,7 @@ pub contract FlowIDTableStaking {
163
164
FlowIDTableStaking.isValidNodeID (id): " The node ID must have only numbers and lowercase hex characters"
164
165
FlowIDTableStaking.nodes[id] == nil : " The ID cannot already exist in the record"
165
166
role > = UInt8 (1 ) && role < = UInt8 (5 ): " The role must be 1, 2, 3, 4, or 5"
166
- networkingAddress.length > 0 && networkingAddress.length < = 510 : " The networkingAddress must be less than 255 bytes ( 510 hex characters) "
167
+ networkingAddress.length > 0 && networkingAddress.length < = 510 : " The networkingAddress must be less than 510 characters"
167
168
networkingKey.length == 128 : " The networkingKey length must be exactly 64 bytes (128 hex characters)"
168
169
stakingKey.length == 192 : " The stakingKey length must be exactly 96 bytes (192 hex characters)"
169
170
! FlowIDTableStaking.getNetworkingAddressClaimed (address : networkingAddress): " The networkingAddress cannot have already been claimed"
@@ -417,6 +418,22 @@ pub contract FlowIDTableStaking {
417
418
self .id = id
418
419
}
419
420
421
+ /// Change the node's networking address to a new one
422
+ pub fun updateNetworkingAddress (_ newAddress : String ) {
423
+ pre {
424
+ FlowIDTableStaking.stakingEnabled (): " Cannot update networking address if the staking auction isn't in progress"
425
+ newAddress.length > 0 && newAddress.length < = 510 : " The networkingAddress must be less than 510 characters"
426
+ ! FlowIDTableStaking.getNetworkingAddressClaimed (address : newAddress): " The networkingAddress cannot have already been claimed"
427
+ }
428
+
429
+ // Borrow the node's record from the staking contract
430
+ let nodeRecord = FlowIDTableStaking.borrowNodeRecord (self .id)
431
+
432
+ nodeRecord.networkingAddress = newAddress
433
+
434
+ emit NetworkingAddressUpdated (nodeID : self .id, newAddress : newAddress)
435
+ }
436
+
420
437
/// Add new tokens to the system to stake during the next epoch
421
438
pub fun stakeNewTokens (_ tokens : @FungibleToken .Vault ) {
422
439
pre {
0 commit comments