Install Requirements Packages
opkg update && opkg install ca-certificates zsh curl git-http
Install oh-my-zsh
use "collections" | |
use "time" | |
primitive Factorial | |
""" Factorial | |
""" | |
fun fac(n:U64): U64 => | |
var f : U64 = 1 | |
var i : U64 = 1 | |
if n == 0 then |
type exists<V> = <Y>(p: (v: V) => Y) => Y; | |
// module interface | |
type Unique_S<T> = { | |
next: () => T, | |
equal: (a: T, b: T) => boolean, | |
compare: (a: T, b: T) => number, | |
show: (t: T) => string, | |
}; |
Here is the complete implementation of Interface
for Token
:
impl Interface for Token {
fn allowance(&self, from: Address, spender: Address) -> i128 {
self.allowances.get(&(from, spender)).unwrap_or(0)
}
fn increase_allowance(&mut self, from: Address, spender: Address, amount: i128) {
from.require_auth();