Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address of OpenLaw smart contract #159

Open
javaadpatel opened this issue Oct 14, 2019 · 6 comments
Open

Address of OpenLaw smart contract #159

javaadpatel opened this issue Oct 14, 2019 · 6 comments
Labels
question Further information is requested

Comments

@javaadpatel
Copy link

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.

@jtrein
Copy link
Member

jtrein commented Oct 14, 2019

Hi @javaadpatel, thanks for the issue; let's see if we can be of assistance! @jdville03 is this possible?

@jtrein jtrein added the question Further information is requested label Oct 14, 2019
@javaadpatel
Copy link
Author

@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

@javaadpatel
Copy link
Author

javaadpatel commented Oct 21, 2019

@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:
image

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?

@Ro5s
Copy link

Ro5s commented Oct 21, 2019

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!

@javaadpatel
Copy link
Author

javaadpatel commented Oct 21, 2019

@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:
image

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?

@javaadpatel
Copy link
Author

javaadpatel commented Oct 21, 2019

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?

image

Seems like on my contract this button does not appear:
image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants