Skip to main content

Factory

Github: packages/nftanvil_canisters/mo/type/Cluster.mo

import Cluster "mo:anvil/type/Cluster"
module {
...

public func router(conf : Config) : Router.Interface {
actor(Principal.toText(conf.router)) : Router.Interface;
};

public func profits_address(conf : Config) : Nft.AccountIdentifier {
Nft.AccountIdentifier.fromPrincipal(Nft.APrincipal.fromSlot(conf.space, conf.anvil), null);
};

public func treasury(conf : Config) : Treasury.Interface {
actor(Principal.toText(Nft.APrincipal.fromSlot(conf.space, conf.treasury))) : Treasury.Interface;
};

public func treasury_address(conf : Config) : Nft.AccountIdentifier {
Nft.AccountIdentifier.fromPrincipal(Nft.APrincipal.fromSlot(conf.space, conf.treasury), null);
};

public func nft_address(conf : Config, slot : CanisterSlot) : Nft.AccountIdentifier {
Nft.AccountIdentifier.fromPrincipal(Nft.APrincipal.fromSlot(conf.space, slot), null);
};

public func pwr(conf : Config, slot : CanisterSlot) : Pwr.Interface {
actor(Principal.toText(Nft.APrincipal.fromSlot(conf.space, slot))) : Pwr.Interface;
};

public func history(conf : Config) : History.Interface {
actor(Principal.toText(Nft.APrincipal.fromSlot(conf.space, conf.history))) : History.Interface;
};

public func nft(conf : Config, slot : CanisterSlot) : Nft.Interface {
actor(Principal.toText(Nft.APrincipal.fromSlot(conf.space, slot))) : Nft.Interface;
};

public func account(conf : Config, slot : CanisterSlot) : Account.Interface {
actor(Principal.toText(Nft.APrincipal.fromSlot(conf.space, slot))) : Account.Interface;
};

public func nftFromTid(conf : Config, tid : Nft.TokenIdentifier) : Nft.Interface {
let (slot, _) = Nft.TokenIdentifier.decode(tid);
actor (Principal.toText(Nft.APrincipal.fromSlot(conf.space, slot))) : Nft.Interface;
};

public func accountFromAid(conf : Config, aid : Nft.AccountIdentifier) : Account.Interface {
account(conf, aid2slot(conf, aid));
};

public func pwrFromAid(conf : Config, aid : Nft.AccountIdentifier) : Pwr.Interface {
pwr(conf, pwr2slot(conf, aid));
};


public func ledger(conf: Config): Ledger.Interface {
actor("ryjl3-tyaaa-aaaaa-aaaba-cai") : Ledger.Interface;
};


...
}