> Contract B should accept the two values from contract C & B, and > perform a swap between the two only if both contract C & B gives their consent to contract B Do you mean two values from C & A and only if C & A give their consent, not C & B? Assuming that's what you meant, I'd do something like this. contract B { // this mapping will store if address A has given permission for the // contract to swap with address C. mapping (address => (address => bool)) permissionGiven; mapping (address => uint) ethBalance; //ether balance mapping (address => uint) balances; //ERC20 token balance function () payable { ethBalance[msg.sender] = ethBalance[msg.sender].add(msg.value); } function givePermission (address _a) public { permissionGiven[msg.sender][a] = true; } function swap(address _c) public { if (permissionGiven[_c][msg.sender]) { _c.transfer(ethBalance[msg.sender]); transfer(msg.sender, balances[_c]); } } function transfer (address _to, uint _tokens) { // usual ERC20 transfer function } } In this implementation, contracts C and A can call givePermission, passing in the addresses of A and C respectively. Then, after depositing ether/ tokens and calling swap, the ether will be transferred to C and the tokens to A.