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

[SC-1313] Add USDS wrapper #198

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ If no direct liquidity pair exists between two tokens, the spot price aggregator
* CHAI - [0x6fE4926a0fCc78ab764b39f2738e1Dea145d7AC0](https://etherscan.io/address/0x6fE4926a0fCc78ab764b39f2738e1Dea145d7AC0)
* Erc4626 - [0xE2B06CDBB6128347B11DE676DA8b51e1e1f7F76E](https://etherscan.io/address/0xE2B06CDBB6128347B11DE676DA8b51e1e1f7F76E)
* [sUSDe](https://etherscan.io/address/0x9D39A5DE30e57443BfF2A8307A4256c8797A3497), [sDAI](https://etherscan.io/address/0x83F20F44975D03b1b09e64809B757c47f942BEeA), [xrETH](https://etherscan.io/address/0xBB22d59B73D7a6F3A8a83A214BECc67Eb3b511fE), [scrvUSD](https://etherscan.io/address/0x0655977FEb2f289A4aB78af67BAB0d17aAb84367), [sENA](https://etherscan.io/address/0x8bE3460A480c80728a8C4D7a5D5303c85ba7B3b9)
* USDS - [0x18645943628cf0FdCD1A9FF3a5b56d71203CFc22](https://etherscan.io/address/0x18645943628cf0FdCD1A9FF3a5b56d71203CFc22)

</details>

Expand Down
125 changes: 125 additions & 0 deletions deployments/mainnet/BaseCoinWrapper_USDS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"address": "0x18645943628cf0FdCD1A9FF3a5b56d71203CFc22",
"abi": [
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "base",
"type": "address"
},
{
"internalType": "contract IERC20",
"name": "wBase",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "NotAddedMarket",
"type": "error"
},
{
"inputs": [],
"name": "NotRemovedMarket",
"type": "error"
},
{
"inputs": [],
"name": "NotSupportedToken",
"type": "error"
},
{
"inputs": [],
"name": "BASE",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "WBASE",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "token",
"type": "address"
}
],
"name": "wrap",
"outputs": [
{
"internalType": "contract IERC20",
"name": "wrappedToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "rate",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"transactionHash": "0x285f97d66a073ccd389f2b342a431eb6d76e184e15bad8d7be6b7687cd781d9e",
"receipt": {
"to": null,
"from": "0x56E44874F624EbDE6efCc783eFD685f0FBDC6dcF",
"contractAddress": "0x18645943628cf0FdCD1A9FF3a5b56d71203CFc22",
"transactionIndex": 22,
"gasUsed": "195851",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x6e3032a5f58670465dacf2ad2993bcd21ddb23624e2923dede604929218fa863",
"transactionHash": "0x285f97d66a073ccd389f2b342a431eb6d76e184e15bad8d7be6b7687cd781d9e",
"logs": [],
"blockNumber": 21243724,
"cumulativeGasUsed": "4866960",
"status": 1,
"byzantium": true
},
"args": [
"0x6B175474E89094C44Da98b954EedeAC495271d0F",
"0xdC035D45d973E3EC169d2276DDab16f1e407384F"
],
"numDeployments": 1,
"solcInputHash": "8040a3e71109d305ac56c5e7ce078c26",
"metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"base\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"wBase\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"NotAddedMarket\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotRemovedMarket\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSupportedToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BASE\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WBASE\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"wrap\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"wrappedToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrappers/BaseCoinWrapper.sol\":\"BaseCoinWrapper\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xe06a3f08a987af6ad2e1c1e774405d4fe08f1694b67517438b467cecf0da0ef7\",\"license\":\"MIT\"},\"contracts/interfaces/IWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.23;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ninterface IWrapper {\\n error NotSupportedToken();\\n error NotAddedMarket();\\n error NotRemovedMarket();\\n\\n function wrap(IERC20 token) external view returns (IERC20 wrappedToken, uint256 rate);\\n}\\n\",\"keccak256\":\"0x1d3cefe7c67b9f9750823be723dd0b00f9894ec4e0cd078eac321a2cff8f7da2\",\"license\":\"MIT\"},\"contracts/wrappers/BaseCoinWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.23;\\n\\nimport \\\"./Wrapper.sol\\\";\\n\\ncontract BaseCoinWrapper is Wrapper {\\n constructor(IERC20 base, IERC20 wBase) Wrapper(base, wBase) {} // solhint-disable-line no-empty-blocks\\n\\n function _wrap() internal view virtual override returns (IERC20 wrappedToken, uint256 rate) {\\n return (WBASE, 1e18);\\n }\\n\\n function _unwrap() internal view virtual override returns (IERC20 unwrappedToken, uint256 rate) {\\n return (BASE, 1e18);\\n }\\n}\\n\",\"keccak256\":\"0x14ed8197ec69f43f64245d3a1dfabf7e1ff61456e037cf3dc934ed5c31c21fc8\",\"license\":\"MIT\"},\"contracts/wrappers/Wrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.23;\\n\\nimport \\\"../interfaces/IWrapper.sol\\\";\\n\\nabstract contract Wrapper is IWrapper {\\n IERC20 public immutable BASE;\\n IERC20 public immutable WBASE;\\n\\n constructor(IERC20 base, IERC20 wBase) {\\n BASE = base;\\n WBASE = wBase;\\n }\\n\\n function wrap(IERC20 token) external view override returns (IERC20 wrappedToken, uint256 rate) {\\n if(token == BASE) {\\n return _wrap();\\n } else if (token == WBASE) {\\n return _unwrap();\\n } else {\\n revert NotSupportedToken();\\n }\\n }\\n\\n function _wrap() internal view virtual returns (IERC20 wrappedToken, uint256 rate) {} // solhint-disable-line no-empty-blocks\\n\\n function _unwrap() internal view virtual returns (IERC20 unwrappedToken, uint256 rate) {} // solhint-disable-line no-empty-blocks\\n}\\n\",\"keccak256\":\"0xfcd599a5fd47efb91353766756707072756da2f2682f6e54b2ae525a71fc1ffb\",\"license\":\"MIT\"}},\"version\":1}",
"bytecode": "0x60c03461008d57601f61034738819003918201601f19168301916001600160401b0383118484101761009157808492604094855283398101031261008d57610052602061004b836100a5565b92016100a5565b9060805260a05260405161028d90816100ba823960805181818160840152610186015260a05181818160f6015281816101cd01526101fb0152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b038216820361008d5756fe60806040526004361015610011575f80fd5b5f3560e01c8063023276f01461011a5780638e0b3bf2146100ac5763ec342ad01461003a575f80fd5b346100a8575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100a857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5f80fd5b346100a8575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100a857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346100a85760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100a85760043573ffffffffffffffffffffffffffffffffffffffff80821682036100a857610175604092610184565b90918351921682526020820152f35b7f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff9081169080831682036101f9575050507f000000000000000000000000000000000000000000000000000000000000000090670de0b6b3a764000090565b7f0000000000000000000000000000000000000000000000000000000000000000160361022d5790670de0b6b3a764000090565b60046040517fc8a08d6f000000000000000000000000000000000000000000000000000000008152fdfea2646970667358221220c965bd0e385da8a57bda1f0d846db9d146caf2dc9272b7d79f224933b0d6a4df64736f6c63430008170033",
"deployedBytecode": "0x60806040526004361015610011575f80fd5b5f3560e01c8063023276f01461011a5780638e0b3bf2146100ac5763ec342ad01461003a575f80fd5b346100a8575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100a857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5f80fd5b346100a8575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100a857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346100a85760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100a85760043573ffffffffffffffffffffffffffffffffffffffff80821682036100a857610175604092610184565b90918351921682526020820152f35b7f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff9081169080831682036101f9575050507f000000000000000000000000000000000000000000000000000000000000000090670de0b6b3a764000090565b7f0000000000000000000000000000000000000000000000000000000000000000160361022d5790670de0b6b3a764000090565b60046040517fc8a08d6f000000000000000000000000000000000000000000000000000000008152fdfea2646970667358221220c965bd0e385da8a57bda1f0d846db9d146caf2dc9272b7d79f224933b0d6a4df64736f6c63430008170033",
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
},
"storageLayout": {
"storage": [],
"types": null
}
}
Loading