Skip to content

Instantly share code, notes, and snippets.

@chadoh
Created July 7, 2022 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadoh/d738fefcc19da30e837daa4dc6fde75c to your computer and use it in GitHub Desktop.
Save chadoh/d738fefcc19da30e837daa4dc6fde75c to your computer and use it in GitHub Desktop.
sketching out what different Riffs sort of look like, conceptually
class Owner {
storage: string
get_owner(): string {
return this.storage
}
set_owner(account_id: string): void {
this.storage = account_id
}
is_owner(account_id: string): boolean {
return this.storage === account_id
}
}
class ACL {
storage: Record<string, {
adminRole: string[],
members: string[],
}>
constructor() {
this.storage = {
council: { adminRole: ['council'], members: [ 'chad', 'ollie' ] },
writers: { adminRole: ['council'], members: [ 'willem' ] },
readers: { adminRole: ['council'], members: [ 'cameron' ] },
}
}
add_member(role: string, account_id: string) {
const struct = this.storage[role]
if (!struct) throw new Error('oh no')
this.storage[role].members.push(account_id)
}
}
class Deploy {
storage: undefined
deploy(address: string) {
console.log(`fetch bytes at contract address "${address}" and deploy them to self`)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment