Address of OpenLaw smart contract
Hi, firstly thanks for the amazing project, I was reading the documentation about how an OpenLaw legal agreement once signed can call a smart contract.
I would like to expose a function on my smart contact which will only be called when the participants have signed the openlaw contract, so the function would need a restriction like msg.sender == openLawCallerAddress. I read this part of the doc
by default, the Ethereum address initiating the call to the smart contract is an OpenLaw account)
but i'm not sure where to find the address of the OpenLaw account so that I can restrict the function to only be called by that address.
Hi @javaadpatel, thanks for the issue; let's see if we can be of assistance! @jdville03 is this possible?
@jdville03 @jtrein thanks for the help with this, if the address OpenLaw uses stays constant then I can possibly write something to capture what that address is and then hardcode it into my contract
@jtrein I tried delegating the signature, using the from field in the EthereumCall Markup element, as shown below:
[[Test Call:EthereumCall(
contract:"0xdFfF2cD55eA4b30244ad6074bF4B64c18741D4C3";
interface:[
{
"constant": false,
"inputs": [],
"name": "authCall",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "testCall",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "_openLawCallerAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getHasExecuted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
];
network:"Rinkeby";
from: "0xF6f6dcc08Fca5532429049d1e6646f288013f5b9";
function:"authCall"
)]]
[[Test Call]]
Test the contract address that openlaw initiates the call from.1
INVESTMENT MANAGER:
[[Investment Manager Signatory Email: Identity | Signature]]
________________
and then I made a simple function in my contract:
contract TestOpenLawContractAddress{
address public _openLawCallerAddress;
bool public _hasExecuted = false;
function authCall() public {
_openLawCallerAddress = msg.sender;
if(msg.sender == address(0xF6f6dcc08Fca5532429049d1e6646f288013f5b9)){
_hasExecuted = true;
}
}
}
I then sign it using "Sign with Metamask" in the OpenLaw portal and get this response:

but the function does not pass? Is there something I am missing on how to make the smart contract call come from a particular address?
hey @javaadpatel thank you for reaching out here // I believe our latest upgrade to the main OpenLaw website may have caused an issue with delegated calls appearing correctly - we are looking into this now and appreciate your help!
@Ro5s thanks for the response, and I'm happy to help debug anything to get this resolved or clear up any misunderstanding I'm having.
One thing I noticed was that when I use the "Sign with metaMask" option and I have specified the "from" field in the EthereumCall element:

Then the Openlaw contract does not fire off the call to the smart contract? I can see this because I am recording the msg.sender property as _openLawCallerAddress and it is all 0, so nothing has tried to call the function in my contract. I am most likely missing something that needs to be done?
I just read this article (https://medium.com/@OpenLawOfficial/making-smart-contracts-simpler-learn-how-to-delegate-smart-contract-calls-with-openlaw-6e0c7aa8464c) and in the video it seems like the delegated call is supposed to render a button "Execute" (first screenshot below) that is clickable to send the transaction?

Seems like on my contract this button does not appear:

I called the endpoint /contracts/sign/status/{contractId} and from the documentation it seems that the pendingCall object is supposed to be populated but the response I have, shows null.
...
"ethereumCalls": [
{
"startDate": null,
"endDate": null,
"network": "Rinkeby",
"networkId": 4,
"description": "Test Call",
"pendingCall": null,
"calls": []
}
],
...
Maybe this could be why the button does not render as it maybe looks at pendingCall property? I can't seem to find the repo for the website so can't confirm this.