Skip to content

Commit

Permalink
update staking collection error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Oct 16, 2024
1 parent 541e2ff commit 0f697ad
Show file tree
Hide file tree
Showing 23 changed files with 272 additions and 220 deletions.
186 changes: 137 additions & 49 deletions contracts/FlowStakingCollection.cdc

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/go/contracts/internal/assets/assets.go

Large diffs are not rendered by default.

108 changes: 54 additions & 54 deletions lib/go/templates/internal/assets/assets.go

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions lib/go/templates/manifest.mainnet.json

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions lib/go/templates/manifest.testnet.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions transactions/stakingCollection/close_stake.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ transaction(nodeID: String, delegatorID: UInt32?) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/create_machine_account.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ transaction(nodeID: String,

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))

if let machineAccount = self.stakingCollectionRef.createMachineAccountForExistingNode(nodeID: nodeID, payer: account) {
let sigAlgo = SignatureAlgorithm(rawValue: machineAccountKeySignatureAlgorithm)
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/register_delegator.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ transaction(id: String, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first in order to register!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ transaction(ids: [String], amounts: [UFix64]) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/register_multiple_nodes.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ transaction(ids: [String],

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))

var i = 0

Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/register_node.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ transaction(id: String,

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first in order to register!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))

if let machineAccount = self.stakingCollectionRef.registerNode(
id: id,
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/request_unstaking.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ transaction(nodeID: String, delegatorID: UInt32?, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/restake_all_stakers.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ transaction {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/stake_new_tokens.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ transaction(nodeID: String, delegatorID: UInt32?, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/stake_rewarded_tokens.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ transaction(nodeID: String, delegatorID: UInt32?, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/stake_unstaked_tokens.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ transaction(nodeID: String, delegatorID: UInt32?, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/transfer_delegator.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ transaction(nodeID: String, delegatorID: UInt32, to: Address) {

// Get a reference to the authorizers StakingCollection
self.fromStakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))

// Get the PublicAccount of the account to transfer the NodeDelegator to.
let toAccount = getAccount(to)
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/transfer_node.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ transaction(nodeID: String, to: Address) {

// Get a reference to the authorizers StakingCollection
self.fromStakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))

// Get the PublicAccount of the account to transfer the NodeStaker to.
let toAccount = getAccount(to)
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/unstake_all.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ transaction(nodeID: String) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/update_networking_address.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ transaction(nodeID: String, newAddress: String) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ transaction(nodeID: String, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/withdraw_rewarded_tokens.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ transaction(nodeID: String, delegatorID: UInt32?, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down
4 changes: 1 addition & 3 deletions transactions/stakingCollection/withdraw_unstaked_tokens.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ transaction(nodeID: String, delegatorID: UInt32?, amount: UFix64) {

prepare(account: auth(BorrowValue) &Account) {
self.stakingCollectionRef = account.storage.borrow<auth(FlowStakingCollection.CollectionOwner) &FlowStakingCollection.StakingCollection>(from: FlowStakingCollection.StakingCollectionStoragePath)
?? panic("The signer does not store a Staking Collection object at the path "
.concat(FlowStakingCollection.StakingCollectionStoragePath.toString())
.concat(". The signer must initialize their account with this object first!"))
?? panic(FlowStakingCollection.getCollectionMissingError(nil))
}

execute {
Expand Down

0 comments on commit 0f697ad

Please sign in to comment.