Skip to content

Commit

Permalink
Merge pull request #200 from 1inch/deploy/linea
Browse files Browse the repository at this point in the history
[SC-1319] Deploy SpotPriceAggregator on linea
  • Loading branch information
zZoMROT authored Dec 8, 2024
2 parents e823c2e + 6385927 commit 097d867
Show file tree
Hide file tree
Showing 10 changed files with 1,791 additions and 12 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,37 @@ If no direct liquidity pair exists between two tokens, the spot price aggregator

</details>

### Linea

#### Oracle [0x00000000000D6FFc74A8feb35aF5827bf57f6786](https://lineascan.build/address/0x00000000000D6FFc74A8feb35aF5827bf57f6786)

<details><summary>Supported DEXes</summary>

* DodoV2 - [0x03aA019F3B78110e030c34e9fA98047A1f62859A](https://lineascan.build/address/0x03aA019F3B78110e030c34e9fA98047A1f62859A)
* PancakeV3 - [0x7e72b1e0e6DD6F71e3b98f768E814613C2097e61](https://lineascan.build/address/0x7e72b1e0e6DD6F71e3b98f768E814613C2097e61)
* SushiSwap - [0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa](https://lineascan.build/address/0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa)

</details>

<details><summary>Supported wrappers</summary>

* WETH - [0xCC54299Fc291B261B2bF5552E7F0E5d2F8613E8C](https://lineascan.build/address/0xCC54299Fc291B261B2bF5552E7F0E5d2F8613E8C)

</details>

<details><summary>Supported connectors</summary>

* NONE - [0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF](https://lineascan.build/address/0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF)
* WETH - [0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f](https://lineascan.build/address/0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f)

</details>

<details><summary>Prev oracle versions (legacy)</summary>

* Dec-08-2024 - [0x00000000000D6FFc74A8feb35aF5827bf57f6786](https://lineascan.build/address/0x00000000000D6FFc74A8feb35aF5827bf57f6786) - <i><b>current implementation</b></i>

</details>

## Examples

* [Single token-to-ETH price usage](https://github.com/1inch-exchange/offchain-oracle/blob/master/examples/single-price.js)
Expand Down
1 change: 1 addition & 0 deletions deployments/linea/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
59144
125 changes: 125 additions & 0 deletions deployments/linea/BaseCoinWrapper.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"address": "0xCC54299Fc291B261B2bF5552E7F0E5d2F8613E8C",
"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": "0x12e2e8ac5f92703a139d777861345eb3a77a8c58226343b53c3fedf58d403ce9",
"receipt": {
"to": null,
"from": "0x56E44874F624EbDE6efCc783eFD685f0FBDC6dcF",
"contractAddress": "0xCC54299Fc291B261B2bF5552E7F0E5d2F8613E8C",
"transactionIndex": 1,
"gasUsed": "197257",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x15064234f74aeb3b606fa5eab7a6f04b118df89272366e4f545d3b93b08c1591",
"transactionHash": "0x12e2e8ac5f92703a139d777861345eb3a77a8c58226343b53c3fedf58d403ce9",
"logs": [],
"blockNumber": 13064445,
"cumulativeGasUsed": "218257",
"status": 1,
"byzantium": true
},
"args": [
"0x0000000000000000000000000000000000000000",
"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"
],
"numDeployments": 1,
"solcInputHash": "253d7d12c3173e72e91ece3cb92e0838",
"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\":\"london\",\"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": "0x60c03461008d57601f61035238819003918201601f19168301916001600160401b0383118484101761009257808492604094855283398101031261008d57610052602061004b836100a8565b92016100a8565b9060805260a05260405161029590816100bd82396080518181816088015261018e015260a05181818160fa015281816101d501526102030152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361008d5756fe6080604052600436101561001257600080fd5b6000803560e01c8063023276f01461011e5780638e0b3bf2146100af5763ec342ad01461003e57600080fd5b346100ac57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100ac57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b80fd5b50346100ac57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100ac57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346100ac5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100ac576004359073ffffffffffffffffffffffffffffffffffffffff9081831683036100ac575061017d60409261018c565b90918351921682526020820152f35b7f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff908116908083168203610201575050507f000000000000000000000000000000000000000000000000000000000000000090670de0b6b3a764000090565b7f000000000000000000000000000000000000000000000000000000000000000016036102355790670de0b6b3a764000090565b60046040517fc8a08d6f000000000000000000000000000000000000000000000000000000008152fdfea2646970667358221220d2a52daa7cac464289c3810d457ca8fd49cecfeba3f64706347b4a53780e2d7964736f6c63430008170033",
"deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c8063023276f01461011e5780638e0b3bf2146100af5763ec342ad01461003e57600080fd5b346100ac57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100ac57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b80fd5b50346100ac57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100ac57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346100ac5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100ac576004359073ffffffffffffffffffffffffffffffffffffffff9081831683036100ac575061017d60409261018c565b90918351921682526020820152f35b7f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff908116908083168203610201575050507f000000000000000000000000000000000000000000000000000000000000000090670de0b6b3a764000090565b7f000000000000000000000000000000000000000000000000000000000000000016036102355790670de0b6b3a764000090565b60046040517fc8a08d6f000000000000000000000000000000000000000000000000000000008152fdfea2646970667358221220d2a52daa7cac464289c3810d457ca8fd49cecfeba3f64706347b4a53780e2d7964736f6c63430008170033",
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
},
"storageLayout": {
"storage": [],
"types": null
}
}
Loading

0 comments on commit 097d867

Please sign in to comment.