-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow one admin to make another (#25)
- Loading branch information
1 parent
ccd39a8
commit 1bb3721
Showing
8 changed files
with
64 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import "FlowtyWrapped" | ||
|
||
transaction(name: String, provider: Address) { | ||
prepare(acct: AuthAccount) { | ||
let providerAdmin = acct.inbox.claim<&FlowtyWrapped.Admin>(name, provider: provider) | ||
?? panic("capabiltiy not found") | ||
|
||
let admin <- providerAdmin.borrow()!.createAdmin() | ||
acct.save(<-admin, to: FlowtyWrapped.AdminStoragePath) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import "FlowtyWrapped" | ||
|
||
transaction(receiver: Address) { | ||
prepare(acct: AuthAccount) { | ||
let identifier = "FlowtyWrapped_Admin_".concat(receiver.toString()) | ||
let p = PrivatePath(identifier: identifier)! | ||
|
||
acct.unlink(p) | ||
let cap = acct.link<&FlowtyWrapped.Admin>(p, target: FlowtyWrapped.AdminStoragePath) | ||
?? panic("failed to link admin capability") | ||
|
||
acct.inbox.publish(cap, name: "flowty-wrapped-minter", recipient: receiver) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Crypto | ||
|
||
/* | ||
[ | ||
ac915cf356a8da0adbd6fb7bed6e4d7c6b3a6a5a3afd933aadb09bddda246acc7700ebcac5aa113646e5c6b0409890ebafa14b9160cdde0b7f96fde2e1ab72d3: String, | ||
1: UInt8, | ||
3: UInt8, | ||
1000.00000000: UFix64 | ||
] | ||
*/ | ||
|
||
transaction(publicKey: String, signatureAlgorithm: UInt8, hashAlgorithm: UInt8, weight: UFix64) { | ||
prepare(signer: AuthAccount) { | ||
let key = PublicKey( | ||
publicKey: publicKey.decodeHex(), | ||
signatureAlgorithm: SignatureAlgorithm(rawValue: signatureAlgorithm)! | ||
) | ||
|
||
signer.keys.add( | ||
publicKey: key, | ||
hashAlgorithm: HashAlgorithm(rawValue: hashAlgorithm)!, | ||
weight: weight | ||
) | ||
} | ||
} |