-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathW10day2.sol
More file actions
41 lines (31 loc) · 870 Bytes
/
W10day2.sol
File metadata and controls
41 lines (31 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
contract Aay{
uint256 public x;
function setX(uint256 _x) external {
x = _x;
}
}
contract Bee{
address public aAddress;
constructor(address _aAddress){
aAddress = _aAddress;
}
function callA(uint256 _x) external payable {
(bool success,) = aAddress.call{value: msg.value}(
abi.encodeWithSignature("setX(uint256)", _x));
require(success);
}
}
contract Cee{
address public aAddress;
uint256 public x;
constructor(address _aAddress){
aAddress = _aAddress;
}
function callA(uint256 _x) external payable {
(bool success,) = aAddress.delegatecall(
abi.encodeWithSignature("setX(uint256)", _x));
require(success);
}
}