Provable: is there an equivalent to onlyOwner or is it doable?

Hi everyone,
I don’t know if this is the best place to ask, but I was wondering is someone looked into Provable (formerly Oraclize) in order to make functions that are only accessible to Provable’s server or to us. Basically, a modifier such as onlyOwner, but… onlyProvable.
The documentation doesn’t even mention the notion of privacy, so I guess all functions are public by default.

On a more personal note - if there is another alternative - my goal is to create a cron job and I would not like any person to call the functions called periodically.

Thanks!

1 Like

I’ve actually got the answer some place else ^^

The __callback() function actually does that in one of their [example][1].

The Provable’s server address can be accessed through provable_cbAddress(), defined in the Provable imported file. Therefore, a modifier could be written like this:

modifier onlyProvable() {
    require(msg.sender != provable_cbAddress(), "The sender is not Provable's server.");
    _;
}
1 Like

Hi @tnguyen42,

Glad you found the answer.

OpenZeppelin Contracts 3.0 includes new access controls that is worth looking at if you are implementing yourself:

1 Like