Omar Hamdan
Omar Hamdan

Reputation: 11

How can I call a pact module on chain using passed in module+defun name

I have a contract that is able to call another module on chain from within itself, and it is working as follows:

(defun call-other(nft-id)
    (mod-2.defun-name ...params)

I am trying to do it dynamically by passing module name of "mod-2" to the defun, and hopefully using a symbol to call mod-2 dynamically but it cant resolve mod.

Ideal:

(defun call-other(nft-id:string mod:string)

  ('mod.defun-name ...params )

Any ideas would be greatly appreciated

Upvotes: 0

Views: 77

Answers (1)

Omar Hamdan
Omar Hamdan

Reputation: 11

You can pass modules as params and call them as follows :

(From Babena marm implementations; awesome job folks and thanks!)

calling from defun

passing through env-data

Upvotes: 1

Related Questions