Skip to content

Commit 1ebd3db

Browse files
authored
Add TargetWeightWrapExtension (#182)
* add TargetWeightWrapExtension
1 parent 1e0aa13 commit 1ebd3db

23 files changed

+3471
-7
lines changed

contracts/adapters/TargetWeightWrapExtension.sol

Lines changed: 440 additions & 0 deletions
Large diffs are not rendered by default.

contracts/interfaces/IController.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface IController {
2020
function isModule(address _module) external view returns(bool);
2121
function isSet(address _setToken) external view returns(bool);
2222
function isSystemContract(address _contractAddress) external view returns (bool);
23+
function isResource(address _resource) external view returns(bool);
2324
function resourceId(uint256 _id) external view returns(address);
2425
function owner() external view returns(address);
2526
function addFactory(address _factory) external;

contracts/interfaces/ISetToken.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ interface ISetToken is IERC20 {
7272

7373
/* ============ Functions ============ */
7474

75+
function controller() external view returns (address);
76+
7577
function addComponent(address _component) external;
7678
function removeComponent(address _component) external;
7779
function editDefaultPositionUnit(address _component, int256 _realUnit) external;
@@ -115,4 +117,4 @@ interface ISetToken is IERC20 {
115117
function isInitializedModule(address _module) external view returns(bool);
116118
function isPendingModule(address _module) external view returns(bool);
117119
function isLocked() external view returns (bool);
118-
}
120+
}

contracts/interfaces/ISetValuer.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ import { ISetToken } from "../interfaces/ISetToken.sol";
2121

2222
interface ISetValuer {
2323
function calculateSetTokenValuation(ISetToken _setToken, address _quoteAsset) external view returns (uint256);
24+
function calculateComponentValuation(ISetToken _setToken, address _component, address _quoteAsset) external view returns (uint256);
2425
}
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
{
2+
"_format": "hh-sol-artifact-1",
3+
"contractName": "AaveV2WrapV2Adapter",
4+
"sourceName": "contracts/protocol/integration/wrap-v2/AaveV2WrapV2Adapter.sol",
5+
"abi": [
6+
{
7+
"inputs": [
8+
{
9+
"internalType": "contract ILendingPool",
10+
"name": "_lendingPool",
11+
"type": "address"
12+
}
13+
],
14+
"stateMutability": "nonpayable",
15+
"type": "constructor"
16+
},
17+
{
18+
"inputs": [
19+
{
20+
"internalType": "address",
21+
"name": "",
22+
"type": "address"
23+
},
24+
{
25+
"internalType": "address",
26+
"name": "",
27+
"type": "address"
28+
}
29+
],
30+
"name": "getSpenderAddress",
31+
"outputs": [
32+
{
33+
"internalType": "address",
34+
"name": "",
35+
"type": "address"
36+
}
37+
],
38+
"stateMutability": "view",
39+
"type": "function",
40+
"gas": "0xa7d8c0"
41+
},
42+
{
43+
"inputs": [
44+
{
45+
"internalType": "address",
46+
"name": "_underlyingToken",
47+
"type": "address"
48+
},
49+
{
50+
"internalType": "address",
51+
"name": "_wrappedToken",
52+
"type": "address"
53+
},
54+
{
55+
"internalType": "uint256",
56+
"name": "_wrappedTokenUnits",
57+
"type": "uint256"
58+
},
59+
{
60+
"internalType": "address",
61+
"name": "_to",
62+
"type": "address"
63+
},
64+
{
65+
"internalType": "bytes",
66+
"name": "",
67+
"type": "bytes"
68+
}
69+
],
70+
"name": "getUnwrapCallData",
71+
"outputs": [
72+
{
73+
"internalType": "address",
74+
"name": "",
75+
"type": "address"
76+
},
77+
{
78+
"internalType": "uint256",
79+
"name": "",
80+
"type": "uint256"
81+
},
82+
{
83+
"internalType": "bytes",
84+
"name": "",
85+
"type": "bytes"
86+
}
87+
],
88+
"stateMutability": "view",
89+
"type": "function",
90+
"gas": "0xa7d8c0"
91+
},
92+
{
93+
"inputs": [
94+
{
95+
"internalType": "address",
96+
"name": "_underlyingToken",
97+
"type": "address"
98+
},
99+
{
100+
"internalType": "address",
101+
"name": "_wrappedToken",
102+
"type": "address"
103+
},
104+
{
105+
"internalType": "uint256",
106+
"name": "_underlyingUnits",
107+
"type": "uint256"
108+
},
109+
{
110+
"internalType": "address",
111+
"name": "_to",
112+
"type": "address"
113+
},
114+
{
115+
"internalType": "bytes",
116+
"name": "",
117+
"type": "bytes"
118+
}
119+
],
120+
"name": "getWrapCallData",
121+
"outputs": [
122+
{
123+
"internalType": "address",
124+
"name": "",
125+
"type": "address"
126+
},
127+
{
128+
"internalType": "uint256",
129+
"name": "",
130+
"type": "uint256"
131+
},
132+
{
133+
"internalType": "bytes",
134+
"name": "",
135+
"type": "bytes"
136+
}
137+
],
138+
"stateMutability": "view",
139+
"type": "function",
140+
"gas": "0xa7d8c0"
141+
},
142+
{
143+
"inputs": [],
144+
"name": "lendingPool",
145+
"outputs": [
146+
{
147+
"internalType": "contract ILendingPool",
148+
"name": "",
149+
"type": "address"
150+
}
151+
],
152+
"stateMutability": "view",
153+
"type": "function",
154+
"gas": "0xa7d8c0"
155+
}
156+
],
157+
"bytecode": "0x608060405234801561001057600080fd5b506040516105e33803806105e383398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610552806100916000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806390f0f93814610051578063a59a99731461007c578063d91462ca14610091578063de68a3da146100a4575b600080fd5b61006461005f3660046102ea565b6100b7565b6040516100739392919061040c565b60405180910390f35b61008461014f565b60405161007391906103a9565b61006461009f3660046102ea565b61015e565b6100846100b23660046102b2565b6101f0565b600080606087876100c88282610201565b6100ed5760405162461bcd60e51b81526004016100e490610476565b60405180910390fd5b60608a8989604051602401610104939291906103bd565b60408051601f198184030181529190526020810180516001600160e01b0316631a4ca37b60e21b179052600080546001600160a01b0316975095509350505050955095509592505050565b6000546001600160a01b031681565b6000806060878761016f8282610201565b61018b5760405162461bcd60e51b81526004016100e490610476565b60608a898960006040516024016101a594939291906103e0565b60408051601f198184030181529190526020810180516001600160e01b031663e8eda9df60e01b179052600080546001600160a01b0316975095509350505050955095509592505050565b50506000546001600160a01b031690565b6000826001600160a01b0316826001600160a01b031663b16a19de6040518163ffffffff1660e01b815260040160206040518083038186803b15801561024657600080fd5b505afa15801561025a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027e919061028f565b6001600160a01b0316149392505050565b6000602082840312156102a0578081fd5b81516102ab81610504565b9392505050565b600080604083850312156102c4578081fd5b82356102cf81610504565b915060208301356102df81610504565b809150509250929050565b600080600080600060a08688031215610301578081fd5b853561030c81610504565b9450602086013561031c81610504565b935060408601359250606086013561033381610504565b9150608086013567ffffffffffffffff81111561034e578182fd5b80870188601f82011261035f578283fd5b8035915061037461036f836104d4565b6104ad565b828152896020848401011115610388578384fd5b6103998360208301602085016104f8565b8093505050509295509295909350565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681526020810192909252909116604082015260600190565b6001600160a01b03948516815260208101939093529216604082015260ff909116606082015260800190565b600060018060a01b038516825260208481840152606060408401528351806060850152825b8181101561044d57858101830151858201608001528201610431565b8181111561045e5783608083870101525b50601f01601f19169290920160800195945050505050565b6020808252601a908201527f4d75737420626520612076616c696420746f6b656e2070616972000000000000604082015260600190565b60405181810167ffffffffffffffff811182821017156104cc57600080fd5b604052919050565b600067ffffffffffffffff8211156104ea578081fd5b50601f01601f191660200190565b82818337506000910152565b6001600160a01b038116811461051957600080fd5b5056fea26469706673582212200ff3a4107a04cf8c9239c38dce04978f06ca975a86cac2782a262fb3f3828db064736f6c634300060a0033",
158+
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806390f0f93814610051578063a59a99731461007c578063d91462ca14610091578063de68a3da146100a4575b600080fd5b61006461005f3660046102ea565b6100b7565b6040516100739392919061040c565b60405180910390f35b61008461014f565b60405161007391906103a9565b61006461009f3660046102ea565b61015e565b6100846100b23660046102b2565b6101f0565b600080606087876100c88282610201565b6100ed5760405162461bcd60e51b81526004016100e490610476565b60405180910390fd5b60608a8989604051602401610104939291906103bd565b60408051601f198184030181529190526020810180516001600160e01b0316631a4ca37b60e21b179052600080546001600160a01b0316975095509350505050955095509592505050565b6000546001600160a01b031681565b6000806060878761016f8282610201565b61018b5760405162461bcd60e51b81526004016100e490610476565b60608a898960006040516024016101a594939291906103e0565b60408051601f198184030181529190526020810180516001600160e01b031663e8eda9df60e01b179052600080546001600160a01b0316975095509350505050955095509592505050565b50506000546001600160a01b031690565b6000826001600160a01b0316826001600160a01b031663b16a19de6040518163ffffffff1660e01b815260040160206040518083038186803b15801561024657600080fd5b505afa15801561025a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027e919061028f565b6001600160a01b0316149392505050565b6000602082840312156102a0578081fd5b81516102ab81610504565b9392505050565b600080604083850312156102c4578081fd5b82356102cf81610504565b915060208301356102df81610504565b809150509250929050565b600080600080600060a08688031215610301578081fd5b853561030c81610504565b9450602086013561031c81610504565b935060408601359250606086013561033381610504565b9150608086013567ffffffffffffffff81111561034e578182fd5b80870188601f82011261035f578283fd5b8035915061037461036f836104d4565b6104ad565b828152896020848401011115610388578384fd5b6103998360208301602085016104f8565b8093505050509295509295909350565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681526020810192909252909116604082015260600190565b6001600160a01b03948516815260208101939093529216604082015260ff909116606082015260800190565b600060018060a01b038516825260208481840152606060408401528351806060850152825b8181101561044d57858101830151858201608001528201610431565b8181111561045e5783608083870101525b50601f01601f19169290920160800195945050505050565b6020808252601a908201527f4d75737420626520612076616c696420746f6b656e2070616972000000000000604082015260600190565b60405181810167ffffffffffffffff811182821017156104cc57600080fd5b604052919050565b600067ffffffffffffffff8211156104ea578081fd5b50601f01601f191660200190565b82818337506000910152565b6001600160a01b038116811461051957600080fd5b5056fea26469706673582212200ff3a4107a04cf8c9239c38dce04978f06ca975a86cac2782a262fb3f3828db064736f6c634300060a0033",
159+
"linkReferences": {},
160+
"deployedLinkReferences": {}
161+
}
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
{
2+
"_format": "hh-sol-artifact-1",
3+
"contractName": "AaveV3WrapV2Adapter",
4+
"sourceName": "contracts/protocol/integration/wrap-v2/AaveV3WrapV2Adapter.sol",
5+
"abi": [
6+
{
7+
"inputs": [
8+
{
9+
"internalType": "contract IPool",
10+
"name": "_pool",
11+
"type": "address"
12+
}
13+
],
14+
"stateMutability": "nonpayable",
15+
"type": "constructor"
16+
},
17+
{
18+
"inputs": [
19+
{
20+
"internalType": "address",
21+
"name": "",
22+
"type": "address"
23+
},
24+
{
25+
"internalType": "address",
26+
"name": "",
27+
"type": "address"
28+
}
29+
],
30+
"name": "getSpenderAddress",
31+
"outputs": [
32+
{
33+
"internalType": "address",
34+
"name": "",
35+
"type": "address"
36+
}
37+
],
38+
"stateMutability": "view",
39+
"type": "function",
40+
"gas": "0xa7d8c0"
41+
},
42+
{
43+
"inputs": [
44+
{
45+
"internalType": "address",
46+
"name": "_underlyingToken",
47+
"type": "address"
48+
},
49+
{
50+
"internalType": "address",
51+
"name": "_wrappedToken",
52+
"type": "address"
53+
},
54+
{
55+
"internalType": "uint256",
56+
"name": "_wrappedTokenUnits",
57+
"type": "uint256"
58+
},
59+
{
60+
"internalType": "address",
61+
"name": "_to",
62+
"type": "address"
63+
},
64+
{
65+
"internalType": "bytes",
66+
"name": "",
67+
"type": "bytes"
68+
}
69+
],
70+
"name": "getUnwrapCallData",
71+
"outputs": [
72+
{
73+
"internalType": "address",
74+
"name": "",
75+
"type": "address"
76+
},
77+
{
78+
"internalType": "uint256",
79+
"name": "",
80+
"type": "uint256"
81+
},
82+
{
83+
"internalType": "bytes",
84+
"name": "",
85+
"type": "bytes"
86+
}
87+
],
88+
"stateMutability": "view",
89+
"type": "function",
90+
"gas": "0xa7d8c0"
91+
},
92+
{
93+
"inputs": [
94+
{
95+
"internalType": "address",
96+
"name": "_underlyingToken",
97+
"type": "address"
98+
},
99+
{
100+
"internalType": "address",
101+
"name": "_wrappedToken",
102+
"type": "address"
103+
},
104+
{
105+
"internalType": "uint256",
106+
"name": "_underlyingUnits",
107+
"type": "uint256"
108+
},
109+
{
110+
"internalType": "address",
111+
"name": "_to",
112+
"type": "address"
113+
},
114+
{
115+
"internalType": "bytes",
116+
"name": "",
117+
"type": "bytes"
118+
}
119+
],
120+
"name": "getWrapCallData",
121+
"outputs": [
122+
{
123+
"internalType": "address",
124+
"name": "",
125+
"type": "address"
126+
},
127+
{
128+
"internalType": "uint256",
129+
"name": "",
130+
"type": "uint256"
131+
},
132+
{
133+
"internalType": "bytes",
134+
"name": "",
135+
"type": "bytes"
136+
}
137+
],
138+
"stateMutability": "view",
139+
"type": "function",
140+
"gas": "0xa7d8c0"
141+
},
142+
{
143+
"inputs": [],
144+
"name": "pool",
145+
"outputs": [
146+
{
147+
"internalType": "contract IPool",
148+
"name": "",
149+
"type": "address"
150+
}
151+
],
152+
"stateMutability": "view",
153+
"type": "function",
154+
"gas": "0xa7d8c0"
155+
}
156+
],
157+
"bytecode": "0x608060405234801561001057600080fd5b506040516105e33803806105e383398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610552806100916000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806316f0115b1461005157806390f0f9381461006f578063d91462ca14610091578063de68a3da146100a4575b600080fd5b6100596100b7565b60405161006691906103a9565b60405180910390f35b61008261007d3660046102ea565b6100c6565b6040516100669392919061040c565b61008261009f3660046102ea565b61015e565b6100596100b23660046102b2565b6101f0565b6000546001600160a01b031681565b600080606087876100d78282610201565b6100fc5760405162461bcd60e51b81526004016100f390610476565b60405180910390fd5b60608a8989604051602401610113939291906103bd565b60408051601f198184030181529190526020810180516001600160e01b0316631a4ca37b60e21b179052600080546001600160a01b0316975095509350505050955095509592505050565b6000806060878761016f8282610201565b61018b5760405162461bcd60e51b81526004016100f390610476565b60608a898960006040516024016101a594939291906103e0565b60408051601f198184030181529190526020810180516001600160e01b031663e8eda9df60e01b179052600080546001600160a01b0316975095509350505050955095509592505050565b50506000546001600160a01b031690565b6000826001600160a01b0316826001600160a01b031663b16a19de6040518163ffffffff1660e01b815260040160206040518083038186803b15801561024657600080fd5b505afa15801561025a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027e919061028f565b6001600160a01b0316149392505050565b6000602082840312156102a0578081fd5b81516102ab81610504565b9392505050565b600080604083850312156102c4578081fd5b82356102cf81610504565b915060208301356102df81610504565b809150509250929050565b600080600080600060a08688031215610301578081fd5b853561030c81610504565b9450602086013561031c81610504565b935060408601359250606086013561033381610504565b9150608086013567ffffffffffffffff81111561034e578182fd5b80870188601f82011261035f578283fd5b8035915061037461036f836104d4565b6104ad565b828152896020848401011115610388578384fd5b6103998360208301602085016104f8565b8093505050509295509295909350565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681526020810192909252909116604082015260600190565b6001600160a01b03948516815260208101939093529216604082015260ff909116606082015260800190565b600060018060a01b038516825260208481840152606060408401528351806060850152825b8181101561044d57858101830151858201608001528201610431565b8181111561045e5783608083870101525b50601f01601f19169290920160800195945050505050565b6020808252601a908201527f4d75737420626520612076616c696420746f6b656e2070616972000000000000604082015260600190565b60405181810167ffffffffffffffff811182821017156104cc57600080fd5b604052919050565b600067ffffffffffffffff8211156104ea578081fd5b50601f01601f191660200190565b82818337506000910152565b6001600160a01b038116811461051957600080fd5b5056fea2646970667358221220127b5d1a1b388561ca64d848031c6035d93d01a4c93e479e5acb5d307cdbc6e964736f6c634300060a0033",
158+
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806316f0115b1461005157806390f0f9381461006f578063d91462ca14610091578063de68a3da146100a4575b600080fd5b6100596100b7565b60405161006691906103a9565b60405180910390f35b61008261007d3660046102ea565b6100c6565b6040516100669392919061040c565b61008261009f3660046102ea565b61015e565b6100596100b23660046102b2565b6101f0565b6000546001600160a01b031681565b600080606087876100d78282610201565b6100fc5760405162461bcd60e51b81526004016100f390610476565b60405180910390fd5b60608a8989604051602401610113939291906103bd565b60408051601f198184030181529190526020810180516001600160e01b0316631a4ca37b60e21b179052600080546001600160a01b0316975095509350505050955095509592505050565b6000806060878761016f8282610201565b61018b5760405162461bcd60e51b81526004016100f390610476565b60608a898960006040516024016101a594939291906103e0565b60408051601f198184030181529190526020810180516001600160e01b031663e8eda9df60e01b179052600080546001600160a01b0316975095509350505050955095509592505050565b50506000546001600160a01b031690565b6000826001600160a01b0316826001600160a01b031663b16a19de6040518163ffffffff1660e01b815260040160206040518083038186803b15801561024657600080fd5b505afa15801561025a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027e919061028f565b6001600160a01b0316149392505050565b6000602082840312156102a0578081fd5b81516102ab81610504565b9392505050565b600080604083850312156102c4578081fd5b82356102cf81610504565b915060208301356102df81610504565b809150509250929050565b600080600080600060a08688031215610301578081fd5b853561030c81610504565b9450602086013561031c81610504565b935060408601359250606086013561033381610504565b9150608086013567ffffffffffffffff81111561034e578182fd5b80870188601f82011261035f578283fd5b8035915061037461036f836104d4565b6104ad565b828152896020848401011115610388578384fd5b6103998360208301602085016104f8565b8093505050509295509295909350565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681526020810192909252909116604082015260600190565b6001600160a01b03948516815260208101939093529216604082015260ff909116606082015260800190565b600060018060a01b038516825260208481840152606060408401528351806060850152825b8181101561044d57858101830151858201608001528201610431565b8181111561045e5783608083870101525b50601f01601f19169290920160800195945050505050565b6020808252601a908201527f4d75737420626520612076616c696420746f6b656e2070616972000000000000604082015260600190565b60405181810167ffffffffffffffff811182821017156104cc57600080fd5b604052919050565b600067ffffffffffffffff8211156104ea578081fd5b50601f01601f191660200190565b82818337506000910152565b6001600160a01b038116811461051957600080fd5b5056fea2646970667358221220127b5d1a1b388561ca64d848031c6035d93d01a4c93e479e5acb5d307cdbc6e964736f6c634300060a0033",
159+
"linkReferences": {},
160+
"deployedLinkReferences": {}
161+
}

0 commit comments

Comments
 (0)