If we have a case where we have Two smart contracts. Contract A passes value to Contract B. the address of contract A is also passed to contract B in the smart contract. while compiling the contract B how can we access the address of contract A , if we are compiling in javascript.

closed as unclear what you're asking by Eli Drion, goodvibration, Achala Dissanayake, smarx, shane Apr 24 at 17:00

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    please add example code to clarify your scenario – Jaime Apr 24 at 10:24

Let's assume you have two contract A and contract B. When A calls a function of B, ie b.foo(1234), inside function foo msg.sender will be the address of contract A.

contract A {
    B public b;
    constructor(B _b) public {
        // We initialize b address somehow
        b = _b;
    function bar() public {
        // Make a call to a function foo of contract B

contract B {
    function foo(uint value) public {
        // Inside foo we have:
        // * msg.sender is address of A
        // * value is 1234

Not the answer you're looking for? Browse other questions tagged or ask your own question.