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

Add sonic deployment addresses #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- FTM Bridge (LayerZero) - [`0x7ce8aF75A9180B602445bE230860DDcb4cAc3E42`](https://etherscan.io/address/0x7ce8aF75A9180B602445bE230860DDcb4cAc3E42#code)
- BNB Bridge (LayerZero) - [`0xC91113B4Dd89dd20FDEECDAC82477Bc99A840355`](https://etherscan.io/address/0xC91113B4Dd89dd20FDEECDAC82477Bc99A840355#code)
- KAVA Bridge (LayerZero) - [`0x3C8D2A033131551a3f09E7b5c07DB01d547311CC`](https://etherscan.io/address/0x3C8D2A033131551a3f09E7b5c07DB01d547311CC#code)
- S Bridge (LayerZero)- [`0x5A537a46D780B1C70138aB98eDce69e7a53177ba`](https://etherscan.io/address/0x5A537a46D780B1C70138aB98eDce69e7a53177ba#code)
<!-- - Polygon Bridge (LayerZero) - [`0x708eA72651cDE801979d0305A6b88F9E4d6FC6Cc`](https://etherscan.io/address/0x708eA72651cDE801979d0305A6b88F9E4d6FC6Cc#code) -->

#### crvUSD Bridges
Expand All @@ -20,13 +21,15 @@
- BNB Bridge (LayerZero) - [`0x0A92Fd5271dB1C41564BD01ef6b1a75fC1db4d4f`](https://etherscan.io/address/0x0A92Fd5271dB1C41564BD01ef6b1a75fC1db4d4f#code)
- FTM Bridge (LayerZero) - [`0x76EAfda658C54548B460B3f190386699DE3827d8`](https://etherscan.io/address/0x76EAfda658C54548B460B3f190386699DE3827d8#code)
- KAVA Bridge (LayerZero) - [`0x1C4e4553F95C28bc529233Cc35D550befE7B83Fc`](https://etherscan.io/address/0x1C4e4553F95C28bc529233Cc35D550befE7B83Fc#code)
- S Bridge (LayerZero)- [`0xf6F07B393e4cEE82EFBcD502Db2903f28aA0472e`](https://etherscan.io/address/0xf6F07B393e4cEE82EFBcD502Db2903f28aA0472e#code)
<!-- - Polygon Bridge (LayerZero) - [`0x4782965BB280A8A6CA7dAEB31BEb25E181F66994`](https://etherscan.io/address/0x4782965BB280A8A6CA7dAEB31BEb25E181F66994#code) -->

#### scrvUSD Bridges

- AVAX Bridge (LayerZero) - [`0x26E91B1f142b9bF0bB37e82959bA79D2Aa6b99b8`](https://etherscan.io/address/0x26E91B1f142b9bF0bB37e82959bA79D2Aa6b99b8#code)
- BNB Bridge (LayerZero) - [`0xAE0666C978500f2C05784242B79B08C478Dd999c`](https://etherscan.io/address/0xAE0666C978500f2C05784242B79B08C478Dd999c#code)
- FTM Bridge (LayerZero) - [`0x08132eA9b02750E118cF5F5C640B7c46A8E638E8`](https://etherscan.io/address/0x08132eA9b02750E118cF5F5C640B7c46A8E638E8#code)
- S Bridge (LayerZero)- [`0x6F8012b70ba1fb7F40873CD7f1b03c6fb5bf666C`](https://etherscan.io/address/0x6F8012b70ba1fb7F40873CD7f1b03c6fb5bf666C#code)

#### Keepers (Block Hash Sender)

Expand All @@ -48,7 +51,7 @@
- CRV Minter - [`0xcaf4969dAb56C20fCb89ceC041079AB02158fE3E`](https://snowscan.xyz/address/0xcaf4969dAb56C20fCb89ceC041079AB02158fE3E#code)
- CRVUSD Minter - [`0x4765288DE2672A961cc5A9f52bE75005cAF005a5`](https://snowscan.xyz/address/0x4765288DE2672A961cc5A9f52bE75005cAF005a5#code)
- SCRVUSD Minter - [`0x47ca04Ee05f167583122833abfb0f14aC5677Ee4`](https://snowscan.xyz/address/0x47ca04Ee05f167583122833abfb0f14aC5677Ee4#code)
- Token (CRV20) - [`0xEEbC562d445F4bC13aC75c8caABb438DFae42A1B`](https://snowscan.xyz/address/0xEEbC562d445F4bC13aC75c8caABb438DFae42A1B#code)
- Token (CRV) - [`0xEEbC562d445F4bC13aC75c8caABb438DFae42A1B`](https://snowscan.xyz/address/0xEEbC562d445F4bC13aC75c8caABb438DFae42A1B#code)
- Token (CRVUSD) - [`0xCb7c161602d04C4e8aF1832046EE08AAF96d855D`](https://snowscan.xyz/address/0xCb7c161602d04C4e8aF1832046EE08AAF96d855D#code)
- Token (SCRVUSD) - [`0xA3ea433509F7941df3e33857D9c9f212Ad4A4e64`](https://snowscan.xyz/address/0xA3ea433509F7941df3e33857D9c9f212Ad4A4e64#code)
- Gauge Type Oracle - [`0x01689FE734D0aA98be3A9a761aE11a20Dd968E41`](https://snowscan.xyz/address/0x01689FE734D0aA98be3A9a761aE11a20Dd968E41#code)
Expand All @@ -66,7 +69,7 @@
- CRV Minter - [`0x444D6B4d7Ad9521FbFB563B4f896ace22DDB70c6`](https://ftmscan.com/address/0x444D6B4d7Ad9521FbFB563B4f896ace22DDB70c6#code)
- CRVUSD Minter - [`0x01689FE734D0aA98be3A9a761aE11a20Dd968E41`](https://ftmscan.com/address/0x01689FE734D0aA98be3A9a761aE11a20Dd968E41#code)
- SCRVUSD Minter - [`0xF830b9E88f994BbB069aC884d40fA2E09d050BB8`](https://ftmscan.com/address/0xF830b9E88f994BbB069aC884d40fA2E09d050BB8#code)
- Token (CRV20) - [`0xE6c259bc0FCE25b71fE95A00361D3878E16232C3`](https://ftmscan.com/address/0xE6c259bc0FCE25b71fE95A00361D3878E16232C3#code)
- Token (CRV) - [`0xE6c259bc0FCE25b71fE95A00361D3878E16232C3`](https://ftmscan.com/address/0xE6c259bc0FCE25b71fE95A00361D3878E16232C3#code)
- Token (CRVUSD) - [`0xD823D2a2B5AF77835e972A0D5B77f5F5A9a003A6`](https://ftmscan.com/address/0xD823D2a2B5AF77835e972A0D5B77f5F5A9a003A6#code)
- Token (SCRVUSD) - [`0x5191946500e75f0A74476F146dF7d386e52961d9`](https://ftmscan.com/address/0x5191946500e75f0A74476F146dF7d386e52961d9#code)
- Gauge Type Oracle - [`0x898Cd2cCE27CE3eb7eACBDD85FEd8181379f0F46`](https://ftmscan.com/address/0x898Cd2cCE27CE3eb7eACBDD85FEd8181379f0F46#code)
Expand All @@ -82,25 +85,43 @@

- Block Hash Oracle - [`0x7cDe6Ef7e2e2FD3B6355637F1303586D7262ba37`](https://bscscan.com/address/0x7cDe6Ef7e2e2FD3B6355637F1303586D7262ba37#code)
- Minter - [`0x458599F83764aE9D0528301c1b6CB18dE63726bF`](https://bscscan.com/address/0x458599F83764aE9D0528301c1b6CB18dE63726bF#code)
- Token (CRV20) - [`0x9996D0276612d23b35f90C51EE935520B3d7355B`](https://bscscan.com/address/0x9996D0276612d23b35f90C51EE935520B3d7355B#code)
- Token (CRVUSD) - [`0xe2fb3F127f5450DeE44afe054385d74C392BdeF4`](https://bscscan.com/address/0xe2fb3F127f5450DeE44afe054385d74C392BdeF4#code)
- Token (SCRVUSD) - [`0x0094Ad026643994c8fB2136ec912D508B15fe0E5`](https://bscscan.com/address/0x0094Ad026643994c8fB2136ec912D508B15fe0E5#code)
- Minter (CRVUSD) - [`0xc417E91098402Dd4F677782a2eC204C429CE513A`](https://bscscan.com/address/0xc417E91098402Dd4F677782a2eC204C429CE513A#code)
- Minter (SCRVUSD) - [`0x4C62AC3F6088E882C9B2a315056bc298D22128bd`](https://bscscan.com/address/0x4C62AC3F6088E882C9B2a315056bc298D22128bd#code)
- Token (CRV) - [`0x9996D0276612d23b35f90C51EE935520B3d7355B`](https://bscscan.com/address/0x9996D0276612d23b35f90C51EE935520B3d7355B#code)
- Token (CRVUSD) - [`0xe2fb3F127f5450DeE44afe054385d74C392BdeF4`](https://bscscan.com/address/0xe2fb3F127f5450DeE44afe054385d74C392BdeF4#code)
- Token (SCRVUSD) - [`0x0094Ad026643994c8fB2136ec912D508B15fe0E5`](https://bscscan.com/address/0x0094Ad026643994c8fB2136ec912D508B15fe0E5#code)
- Gauge Type Oracle - [`0x60dcc21869C6De55b50a196bE3c6D2Da189efD18`](https://bscscan.com/address/0x60dcc21869C6De55b50a196bE3c6D2Da189efD18#code)
- Gauge Type Prover - [`0xd7454AEbf1C37661dfb5d2857F6aF7a2E09975bc`](https://bscscan.com/address/0xd7454AEbf1C37661dfb5d2857F6aF7a2E09975bc#code)
- Message Digest Prover - [`0xbfF1f56c8e48e2F2F52941e16FEecc76C49f1825`](https://bscscan.com/address/0xbfF1f56c8e48e2F2F52941e16FEecc76C49f1825#code)

### S

- CRV ETH Bridge (LayerZero) - [`0x5A537a46D780B1C70138aB98eDce69e7a53177ba`](https://sonicscan.org/address/0x5A537a46D780B1C70138aB98eDce69e7a53177ba#code)
- crvUSD ETH Bridge (LayerZero) - [`0xf6F07B393e4cEE82EFBcD502Db2903f28aA0472e`](https://sonicscan.org/address/0xf6F07B393e4cEE82EFBcD502Db2903f28aA0472e#code)
- scrvUSD ETH Bridge (LayerZero) - [`0x6F8012b70ba1fb7F40873CD7f1b03c6fb5bf666C`](https://sonicscan.org/address/0x6F8012b70ba1fb7F40873CD7f1b03c6fb5bf666C#code)


- Block Hash Oracle - [`0xe35A879E5EfB4F1Bb7F70dCF3250f2e19f096bd8`](https://sonicscan.org/address/0xe35A879E5EfB4F1Bb7F70dCF3250f2e19f096bd8#code)
- Minter - [`0x5De4EF4879F4fe3bBADF2227D2aC5d0E2D76C895`](https://sonicscan.org/address/0x5De4EF4879F4fe3bBADF2227D2aC5d0E2D76C895#code)
- Minter (CRVUSD) - [`0xF830b9E88f994BbB069aC884d40fA2E09d050BB8`](https://sonicscan.org/address/0xF830b9E88f994BbB069aC884d40fA2E09d050BB8#code)
- Minter (SCRVUSD) - [`0xc0b338DA0fDD43Dc48539837594cf6363795FEeA`](https://sonicscan.org/address/0xc0b338DA0fDD43Dc48539837594cf6363795FEeA#code)
- Token (CRV) - [`0x5Af79133999f7908953E94b7A5CF367740Ebee35`](https://sonicscan.org/address/0x5Af79133999f7908953E94b7A5CF367740Ebee35#code)
- Token (CRVUSD) - [`0x5191946500e75f0A74476F146dF7d386e52961d9`](https://sonicscan.org/address/0x5191946500e75f0A74476F146dF7d386e52961d9#code)
- Token (SCRVUSD) - [`0x8Fb3Ec8f2d1Dc089E70CD61f1E49496d443B2124`](https://sonicscan.org/address/0x8Fb3Ec8f2d1Dc089E70CD61f1E49496d443B2124#code)
- Gauge Type Oracle - [`0x74d6aABD6197E83d963F0B48be9C034F93E8E66d`](https://sonicscan.org/address/0x74d6aABD6197E83d963F0B48be9C034F93E8E66d#code)
- Gauge Type Verifier - [`0x47ca04Ee05f167583122833abfb0f14aC5677Ee4`](https://sonicscan.org/address/0x47ca04Ee05f167583122833abfb0f14aC5677Ee4#code)
- Message Digest Verifier - [`0x3d8EADb739D1Ef95dd53D718e4810721837c69c1`](https://sonicscan.org/address/0x3d8EADb739D1Ef95dd53D718e4810721837c69c1#code)

### KAVA

- CRV ETH Bridge (LayerZero) - [`0x3C8D2A033131551a3f09E7b5c07DB01d547311CC`](https://kavascan.com/address/0x3C8D2A033131551a3f09E7b5c07DB01d547311CC#code)
- crvUSD ETH Bridge (LayerZero) - [`0x1C4e4553F95C28bc529233Cc35D550befE7B83Fc`](https://kavascan.com/address/0x1C4e4553F95C28bc529233Cc35D550befE7B83Fc#code)

- Block Hash Oracle - [`0x05d4E2Ed7216A204e5FB4e3F5187eCfaa5eF3Ef7`](https://kavascan.com/address/0x05d4E2Ed7216A204e5FB4e3F5187eCfaa5eF3Ef7#code)
- Minter - [`0x65a0b01756E837e6670634816E4F5B3a3fF21107`](https://kavascan.com/address/0x65a0b01756E837e6670634816E4F5B3a3fF21107#code)
- Minter (CRVUSD) - [`0xEfDE221f306152971D8e9f181bFe998447975810`](https://kavascan.com/address/0xEfDE221f306152971D8e9f181bFe998447975810#code)
- Token (CRV20) - [`0x7736C61F00c72e868AA9904c9063e8445A1eF5DD`](https://kavascan.com/address/0x7736C61F00c72e868AA9904c9063e8445A1eF5DD#code)
- Token (CRVUSD) - [`0x98B4029CaBEf7Fd525A36B0BF8555EC1d42ec0B6`](https://kavascan.com/address/0x98B4029CaBEf7Fd525A36B0BF8555EC1d42ec0B6#code)
- Minter (CRVUSD) - [`0xEfDE221f306152971D8e9f181bFe998447975810`](https://kavascan.com/address/0xEfDE221f306152971D8e9f181bFe998447975810#code)
- Gauge Type Oracle - [`0x1E7B1Bd0490ddE12F6E3d09766Beb05552AFe27A`](https://kavascan.com/address/0x1E7B1Bd0490ddE12F6E3d09766Beb05552AFe27A#code)
- Gauge Type Prover - [`0x64ed8CfF5Ad3DaEb217abE03a00Ff2D90b86456b`](https://kavascan.com/address/0x64ed8CfF5Ad3DaEb217abE03a00Ff2D90b86456b#code)
- Message Digest Prover - [`0x5373E1B9f2781099f6796DFe5D68DE59ac2F18E3`](https://kavascan.com/address/0x5373E1B9f2781099f6796DFe5D68DE59ac2F18E3#code)
Expand Down
16 changes: 8 additions & 8 deletions contracts/oracles/GaugeTypeOracle.vy
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ event SetGaugeType:
gauge: indexed(address)
type: uint256

event SetProver:
prover: address
event SetVerifier:
verifier: address

event TransferOwnership:
owner: indexed(address)


gauge_type: HashMap[address, uint256] # a value of 0 signifies the account is not a valid gauge

prover: public(address)
verifier: public(address)

owner: public(address)
future_owner: public(address)
Expand Down Expand Up @@ -47,21 +47,21 @@ def set_gauge_type(_gauge: address, _type: uint256):
@dev This method will increment the value of `_type` by 1 prior to storing,
since a value of 0 signifies an invalid gauge.
"""
assert msg.sender in [self.owner, self.prover] # dev: only owner
assert msg.sender in [self.owner, self.verifier] # dev: only owner

self.gauge_type[_gauge] = _type + 1
log SetGaugeType(_gauge, _type)


@external
def set_prover(_prover: address):
def set_verifier(_verifier: address):
"""
@notice Set the account with prover permissions.
@notice Set the account with verifier permissions.
"""
assert msg.sender == self.owner

self.prover = _prover
log SetProver(_prover)
self.verifier = _verifier
log SetVerifier(_verifier)


@external
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import {StateProofVerifier as Verifier} from "../libs/StateProofVerifier.sol";

interface IBlockHashOracle {
function get_block_hash(uint256 _number) external view returns (bytes32);
function get_state_root(uint256 _number) external view returns (bytes32);
}

interface IGaugeTypeOracle {
function set_gauge_type(address _gauge, uint256 _type) external;
}

/// @title Gauge Type Prover
/// @title Gauge Type Verifier
/// @author Curve Finance
contract GaugeTypeProver {
contract GaugeTypeVerifier {
using RLPReader for bytes;
using RLPReader for RLPReader.RLPItem;

Expand All @@ -31,11 +32,11 @@ contract GaugeTypeProver {
GAUGE_TYPE_ORACLE = _gauge_type_oracle;
}

/// Prove the type of a gauge.
/// @param _gauges List of gauges to prove the type of.
/// Verify the type of a gauge.
/// @param _gauges List of gauges to verify the type of.
/// @param _block_header_rlp The block header of any block in which the gauge has its type set.
/// @param _proof_rlp The state proof of the gauge types.
function prove(
function verifyGaugeTypeByBlockHash(
address[] memory _gauges,
bytes memory _block_header_rlp,
bytes memory _proof_rlp
Expand All @@ -51,14 +52,36 @@ contract GaugeTypeProver {
)
); // dev: blockhash mismatch

return _verifyGaugeType(_gauges, block_header.stateRootHash, _proof_rlp);
}

/// Verify the type of a gauge.
/// @param _gauges List of gauges to verify the type of.
/// @param _block_number Number of the block to use state root hash
/// @param _proof_rlp The state proof of the gauge types.
function verifyGaugeTypeByStateRoot(
address[] memory _gauges,
uint256 _block_number,
bytes memory _proof_rlp
) external {
bytes32 state_root = IBlockHashOracle(BLOCK_HASH_ORACLE).get_state_root(_block_number);

return _verifyGaugeType(_gauges, state_root, _proof_rlp);
}

function _verifyGaugeType(
address[] memory gauges,
bytes32 state_root,
bytes memory proof_rlp
) internal {
// convert _proof_rlp into a list of `RLPItem`s
RLPReader.RLPItem[] memory proofs = _proof_rlp.toRlpItem().toList();
require(proofs.length >= 2 && proofs.length - 1 == _gauges.length); // dev: invalid number of proofs
RLPReader.RLPItem[] memory proofs = proof_rlp.toRlpItem().toList();
require(proofs.length >= 2 && proofs.length - 1 == gauges.length); // dev: invalid number of proofs

// 0th proof is the account proof for the Gauge Controller contract
Verifier.Account memory account = Verifier.extractAccountFromProof(
GAUGE_CONTROLLER_HASH, // position of the account is the hash of its address
block_header.stateRootHash,
state_root,
proofs[0].toList()
);
require(account.exists); // dev: Gauge Controller account does not exist
Expand All @@ -68,15 +91,15 @@ contract GaugeTypeProver {
for (uint256 idx = 1; idx < proofs.length; idx++) {
slot = Verifier.extractSlotValueFromProof(
keccak256(
abi.encode(keccak256(abi.encode(8, _gauges[idx - 1])))
abi.encode(keccak256(abi.encode(8, gauges[idx - 1])))
),
account.storageRoot,
proofs[idx].toList()
);
require(slot.exists && slot.value != 0);

IGaugeTypeOracle(GAUGE_TYPE_ORACLE).set_gauge_type(
_gauges[idx - 1],
gauges[idx - 1],
slot.value - 1 // the true gauge type is the slot value - 1
);
}
Expand Down