Skip to content

Commit

Permalink
Update more cadence codes
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Sep 13, 2023
1 parent 6cc5681 commit f4efd4c
Show file tree
Hide file tree
Showing 164 changed files with 1,295 additions and 1,272 deletions.
948 changes: 474 additions & 474 deletions lib/go/templates/internal/assets/assets.go

Large diffs are not rendered by default.

140 changes: 70 additions & 70 deletions lib/go/templates/manifest.mainnet.json

Large diffs are not rendered by default.

140 changes: 70 additions & 70 deletions lib/go/templates/manifest.testnet.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions lib/go/test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ go 1.18
require (
github.com/coreos/go-semver v0.3.0
github.com/onflow/cadence v0.41.0-stable-cadence.1.0.20230908213403-8f1134670ed0
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230912211318-8bc39ac51e11
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20230912211318-8bc39ac51e11
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230913165100-6cc568171e6a
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20230913165100-6cc568171e6a
github.com/onflow/flow-emulator v0.54.1-0.20230815221351-758e3a5bb92a
github.com/onflow/flow-go v0.31.1-0.20230908222556-1f376cc4392c
github.com/onflow/flow-go-sdk v0.44.0-stable-cadence.1.0.20230908221325-06f28e649c30
github.com/onflow/flow-go v0.31.1-0.20230912223233-26a5aeb2636a
github.com/onflow/flow-go-sdk v0.44.0-stable-cadence.1.0.20230912230115-25ad6f515ce6
github.com/onflow/flow-go/crypto v0.24.9
github.com/rs/zerolog v1.29.0
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -87,10 +87,10 @@ require (
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230906165834-daca6600a634 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20230906170014-ac628577704c // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230913160646-09adc7d3b513 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20230913160722-e4f5f3f4b87a // indirect
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230628215638-83439d22e0ce // indirect
github.com/onflow/sdks v0.5.0 // indirect
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
Expand Down
13 changes: 13 additions & 0 deletions lib/go/test/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpx
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
Expand Down Expand Up @@ -859,6 +860,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down Expand Up @@ -918,10 +921,13 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM=
Expand Down Expand Up @@ -1024,6 +1030,8 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
Expand All @@ -1050,6 +1058,7 @@ github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS
github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8=
github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
Expand All @@ -1061,6 +1070,7 @@ github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f h1:Z8/PgTqOgOg02MTR
github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230906165834-daca6600a634 h1:9qHRlxEK3Q/qPEyzANXIBM8w5UIVveUqdG2gWH7HBOs=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230906165834-daca6600a634/go.mod h1:B27qWoolugkAEGuT9VJ7tn7UsOMI88ihHqcpEMqoncc=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230913160646-09adc7d3b513/go.mod h1:aXUwTDXnzpBPNMvYPyeItFv/64Yv0GmYffAj8KFbu4s=
github.com/onflow/flow-go/crypto v0.24.7/go.mod h1:fqCzkIBBMRRkciVrvW21rECKq1oD7Q6u+bCI78lfNX0=
github.com/onflow/flow-go/crypto v0.24.9 h1:0EQp+kSZYJepMIiSypfJVe7tzsPcb6UXOdOtsTCDhBs=
github.com/onflow/flow-go/crypto v0.24.9/go.mod h1:fqCzkIBBMRRkciVrvW21rECKq1oD7Q6u+bCI78lfNX0=
Expand All @@ -1069,6 +1079,7 @@ github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230628215638-83439d22e0ce h1:
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230628215638-83439d22e0ce/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/sdks v0.5.0 h1:2HCRibwqDaQ1c9oUApnkZtEAhWiNY2GTpRD5+ftdkN8=
github.com/onflow/sdks v0.5.0/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d h1:gAEqYPn3DS83rHIKEpsajnppVD1+zwuYPFyeDVFaQvg=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down Expand Up @@ -1228,6 +1239,7 @@ github.com/vmihailenco/msgpack/v4 v4.3.11 h1:Q47CePddpNGNhk4GCnAx9DDtASi2rasatE0
github.com/vmihailenco/msgpack/v4 v4.3.11/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
Expand Down Expand Up @@ -1981,6 +1993,7 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
2 changes: 1 addition & 1 deletion lib/go/test/node_version_beacon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func deployContract(b emulator.Emulator, address flow.Address, signer crypto.Sig

addAccountContractTemplate := `
transaction(name: String, code: String %s) {
prepare(signer: AuthAccount) {
prepare(signer: auth(AddContract) &Account) {
signer.contracts.add(name: name, code: code.decodeHex() %s)
}
}`
Expand Down
4 changes: 2 additions & 2 deletions transactions/FlowServiceAccount/add_account_creator.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ transaction(accountCreator: Address) {

let serviceAccountAdmin: &FlowServiceAccount.Administrator

prepare(signer: AuthAccount) {
prepare(signer: auth(BorrowValue) &Account) {
// Borrow reference to FlowServiceAccount Administrator resource.
//
self.serviceAccountAdmin = signer.borrow<&FlowServiceAccount.Administrator>(from: /storage/flowServiceAdmin)
self.serviceAccountAdmin = signer.storage.borrow<&FlowServiceAccount.Administrator>(from: /storage/flowServiceAdmin)
?? panic("Unable to borrow reference to administrator resource")
}
execute {
Expand Down
4 changes: 2 additions & 2 deletions transactions/FlowServiceAccount/deposit_fees.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ transaction(amount: UFix64) {
// The Vault resource that holds the tokens that are being transferred
let sentVault: @{FungibleToken.Vault}

prepare(signer: AuthAccount) {
prepare(signer: auth(BorrowValue) &Account) {

// Get a reference to the signer's stored vault
let vaultRef = signer.borrow<auth(FungibleToken.Withdrawable) &FlowToken.Vault>(from: /storage/flowTokenVault)
let vaultRef = signer.storage.borrow<auth(FungibleToken.Withdrawable) &FlowToken.Vault>(from: /storage/flowTokenVault)
?? panic("Could not borrow reference to the owner's Vault!")

// Withdraw tokens from the signer's stored vault
Expand Down
4 changes: 2 additions & 2 deletions transactions/FlowServiceAccount/remove_account_creator.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ transaction(accountCreator: Address) {

let serviceAccountAdmin: &FlowServiceAccount.Administrator

prepare(signer: AuthAccount) {
prepare(signer: auth(BorrowValue) &Account) {
// Borrow reference to FlowServiceAccount Administrator resource.
//
self.serviceAccountAdmin = signer.borrow<&FlowServiceAccount.Administrator>(from: /storage/flowServiceAdmin)
self.serviceAccountAdmin = signer.storage.borrow<&FlowServiceAccount.Administrator>(from: /storage/flowServiceAdmin)
?? panic("Unable to borrow reference to administrator resource")
}
execute {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
// ]
// ```
transaction(newWeights: {UInt64: UInt64}) {
prepare(signer: AuthAccount) {
signer.load<{UInt64: UInt64}>(from: /storage/executionEffortWeights)
signer.save(newWeights, to: /storage/executionEffortWeights)
prepare(signer: auth(Storage) &Account) {
signer.storage.load<{UInt64: UInt64}>(from: /storage/executionEffortWeights)
signer.storage.save(newWeights, to: /storage/executionEffortWeights)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This transactions sets a new execution memory limit.
transaction(newLimit: UInt64) {
prepare(signer: AuthAccount) {
signer.load<UInt64>(from: /storage/executionMemoryLimit)
signer.save(newLimit, to: /storage/executionMemoryLimit)
prepare(signer: auth(Storage) &Account) {
signer.storage.load<UInt64>(from: /storage/executionMemoryLimit)
signer.storage.save(newLimit, to: /storage/executionMemoryLimit)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This transactions sets new execution memory weights.
transaction(newWeights: {UInt64: UInt64}) {
prepare(signer: AuthAccount) {
signer.load<{UInt64: UInt64}>(from: /storage/executionMemoryWeights)
signer.save(newWeights, to: /storage/executionMemoryWeights)
prepare(signer: auth(Storage) &Account) {
signer.storage.load<{UInt64: UInt64}>(from: /storage/executionMemoryWeights)
signer.storage.save(newWeights, to: /storage/executionMemoryWeights)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ transaction(restricted: Bool) {

let serviceAccountAdmin: &FlowServiceAccount.Administrator

prepare(signer: AuthAccount) {
prepare(signer: auth(BorrowValue) &Account) {
// Borrow reference to FlowServiceAccount Administrator resource.
//
self.serviceAccountAdmin = signer.borrow<&FlowServiceAccount.Administrator>(from: /storage/flowServiceAdmin)
self.serviceAccountAdmin = signer.storage.borrow<&FlowServiceAccount.Administrator>(from: /storage/flowServiceAdmin)
?? panic("Unable to borrow reference to administrator resource")
}
execute {
Expand Down
4 changes: 2 additions & 2 deletions transactions/FlowServiceAccount/set_tx_fee_parameters.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import FlowFees from 0xFLOWFEESADDRESS
transaction(surgeFactor: UFix64, inclusionEffortCost: UFix64, executionEffortCost: UFix64) {
let flowFeesAccountAdmin: &FlowFees.Administrator

prepare(signer: AuthAccount) {
self.flowFeesAccountAdmin = signer.borrow<&FlowFees.Administrator>(from: /storage/flowFeesAdmin)
prepare(signer: auth(BorrowValue) &Account) {
self.flowFeesAccountAdmin = signer.storage.borrow<&FlowFees.Administrator>(from: /storage/flowFeesAdmin)
?? panic("Unable to borrow reference to administrator resource")
}
execute {
Expand Down
4 changes: 2 additions & 2 deletions transactions/FlowServiceAccount/set_tx_fee_surge_factor.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import FlowFees from 0xFLOWFEESADDRESS
transaction(surgeFactor: UFix64) {
let flowFeesAccountAdmin: &FlowFees.Administrator

prepare(signer: AuthAccount) {
self.flowFeesAccountAdmin = signer.borrow<&FlowFees.Administrator>(from: /storage/flowFeesAdmin)
prepare(signer: auth(BorrowValue) &Account) {
self.flowFeesAccountAdmin = signer.storage.borrow<&FlowFees.Administrator>(from: /storage/flowFeesAdmin)
?? panic("Unable to borrow reference to administrator resource")
}
execute {
Expand Down
11 changes: 3 additions & 8 deletions transactions/dkg/admin/force_stop_dkg.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ transaction {

let dkgAdmin: &FlowDKG.Admin

prepare(signer: AuthAccount) {

self.dkgAdmin = signer.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
prepare(signer: auth(BorrowValue) &Account) {
self.dkgAdmin = signer.storage.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
?? panic("Could not borrow DKG Admin reference")

}

execute {

self.dkgAdmin.forceEndDKG()

}

}
}
10 changes: 4 additions & 6 deletions transactions/dkg/admin/publish_participant.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import FlowDKG from 0xDKGADDRESS
transaction {

prepare(signer: AuthAccount) {

signer.link<&FlowDKG.Admin>(/public/dkgAdmin, target: FlowDKG.AdminStoragePath)

prepare(signer: auth(Capabilities) &Account) {
let adminCap = signer.capabilities.storage.issue<&FlowDKG.Admin>(FlowDKG.AdminStoragePath)
signer.capabilities.publish(adminCap, at: /public/dkgAdmin)
}

}
}
11 changes: 3 additions & 8 deletions transactions/dkg/admin/set_safe_threshold.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ transaction(newThresholdPercentage: UFix64?) {

let dkgAdmin: &FlowDKG.Admin

prepare(signer: AuthAccount) {

self.dkgAdmin = signer.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
prepare(signer: auth(BorrowValue) &Account) {
self.dkgAdmin = signer.storage.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
?? panic("Could not borrow DKG Admin reference")

}

execute {

self.dkgAdmin.setSafeSuccessThreshold(newThresholdPercentage: newThresholdPercentage)

}

}
}
11 changes: 3 additions & 8 deletions transactions/dkg/admin/start_dkg.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ transaction(nodeIDs: [String]) {

let dkgAdmin: &FlowDKG.Admin

prepare(signer: AuthAccount) {

self.dkgAdmin = signer.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
prepare(signer: auth(BorrowValue) &Account) {
self.dkgAdmin = signer.storage.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
?? panic("Could not borrow DKG Admin reference")

}

execute {

self.dkgAdmin.startDKG(nodeIDs: nodeIDs)

}

}
}
11 changes: 3 additions & 8 deletions transactions/dkg/admin/stop_dkg.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ transaction {

let dkgAdmin: &FlowDKG.Admin

prepare(signer: AuthAccount) {

self.dkgAdmin = signer.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
prepare(signer: auth(BorrowValue) &Account) {
self.dkgAdmin = signer.storage.borrow<&FlowDKG.Admin>(from: FlowDKG.AdminStoragePath)
?? panic("Could not borrow DKG Admin reference")

}

execute {

self.dkgAdmin.endDKG()

}

}
}
6 changes: 3 additions & 3 deletions transactions/dkg/create_participant.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import FlowDKG from 0xDKGADDRESS

transaction(address: Address, nodeID: String) {

prepare(signer: AuthAccount) {
let admin = getAccount(address).getCapability<&FlowDKG.Admin>(/public/dkgAdmin)
prepare(signer: auth(SaveValue) &Account) {
let admin = getAccount(address).capabilities.get<&FlowDKG.Admin>(/public/dkgAdmin)!
.borrow() ?? panic("Could not borrow admin reference")

let dkgParticipant <- admin.createParticipant(nodeID: nodeID)

signer.save(<-dkgParticipant, to: FlowDKG.ParticipantStoragePath)
signer.storage.save(<-dkgParticipant, to: FlowDKG.ParticipantStoragePath)
}

}
7 changes: 2 additions & 5 deletions transactions/dkg/send_final_submission.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ transaction(submission: [String?]) {

let dkgParticipant: &FlowDKG.Participant

prepare(signer: AuthAccount) {
self.dkgParticipant = signer.borrow<&FlowDKG.Participant>(from: FlowDKG.ParticipantStoragePath)
prepare(signer: auth(BorrowValue) &Account) {
self.dkgParticipant = signer.storage.borrow<&FlowDKG.Participant>(from: FlowDKG.ParticipantStoragePath)
?? panic("Cannot borrow dkg participant reference")
}

execute {

self.dkgParticipant.sendFinalSubmission(submission)

}

}
7 changes: 2 additions & 5 deletions transactions/dkg/send_whiteboard_message.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ transaction(content: String) {

let dkgParticipant: &FlowDKG.Participant

prepare(signer: AuthAccount) {
self.dkgParticipant = signer.borrow<&FlowDKG.Participant>(from: FlowDKG.ParticipantStoragePath)
prepare(signer: auth(BorrowValue) &Account) {
self.dkgParticipant = signer.storage.borrow<&FlowDKG.Participant>(from: FlowDKG.ParticipantStoragePath)
?? panic("Cannot borrow dkg participant reference")
}

execute {

self.dkgParticipant.postMessage(content)

}

}
Loading

0 comments on commit f4efd4c

Please sign in to comment.