Skip to content

Commit

Permalink
Inomurko/v0.2.0 Tiger (#368)
Browse files Browse the repository at this point in the history
* feat: add metaforra.com futuructa game into a project list (#299)

(cherry picked from commit 4948d37)

* Sentry Update: (#305)

0. update sentry packages.
1. Setup sentry as wrapper
2. Added React Errorboundry to capture the react errors.
3. Sentry inititions will be block if there is no env pass
4. Ignore error from MM, JsonRPC, Chrome, Extension, Browser Console
5. Filtering http breadcrum from event before sending
6. disable sentry on localhost.

(cherry picked from commit bb97d7f)

* Support bobascan (#300)

(cherry picked from commit 454eaa4)

* [Gateway] : URL subpages  (#322)

Url Subpages so we can provide the link to the subpages and SEO specific improvement,

(cherry picked from commit 3b96718)

* Layer Zero monitor (#337)

* cherry pick

* Add AltL1 listen

* only monitor current chain

* Change to yarn try

* Add layer zero addresses

* Adjust with new addresss file

* Update table name

Co-authored-by: cby3149 <[email protected]>
(cherry picked from commit 572be9b)

* Add unpause function (#344)

(cherry picked from commit 5edb00e)

* Add CGT token in gateway (#345)

(cherry picked from commit a8b22db)

* Improve monitor service (#167)

* Improve monitor

* Reduce logs

* Fix bug

* Fix error

* Reduce log

* Fix timestamp issue

* Add BobaStraw record

* Fix bug

* Fix BigNumber

* Export logs

* Update variable names and add them to docs

* Store data into MySQL

* Fix db query

* Update variable names

* Fix a special case caused by across bridge

* Update submission time

* Add logs

* Stabilize integration tests

* Update batch serialization test

* Simplified code

Co-authored-by: CAPtheorem <[email protected]>
(cherry picked from commit bdf1c39)

* Add Rabby Wallet (#311)

(cherry picked from commit 9284d63)

* Adding Beamer to the Boba ecosystem page (#290)

Co-authored-by: Sahil K <[email protected]>
Co-authored-by: Boyuan-Chen <[email protected]>
(cherry picked from commit 04b95a7)

* Update gas estimation account (#356)

(cherry picked from commit 53d25c2)

* Add Layer Zero bridge audit (#321)

(cherry picked from commit abadae0)

* Update Witnet Oracle (#323)

update ecosystem project list for Witnet
replace .svg
update price-feed developer documentation for Witnet

(cherry picked from commit 778851b)

* harden stress test - cannot commit to miner (#266)

* harden stress test - cannot commit to miner

* harden stress test - nonces

Co-authored-by: Ino Murko <[email protected]>
(cherry picked from commit 728db7b)

* Watcher API for LayerZero HistoryTab and Update Layer Zero monitor (#346)

* Support multiple bridges

* Fix env variables

* Update mainnet layer zero address

* Add watcher API

* Add reference url

* Remove scan-client

* Remove checking status

* Return reference

Co-authored-by: Sahil K <[email protected]>
(cherry picked from commit 4865f37)

* fixes for proposal and lock record fetch & image import (#358)

(cherry picked from commit ddafe33)

* Gateway specific identifier to sentry and exporting all env from constant file. (#347)

1. update sentry package.
2. Env identifier to sentry setup
3. export all env params from constants
4. Fix for GraphQL module import
6. Fix for crash of toString console error for fetchProposal

(cherry picked from commit 4649b44)

Co-authored-by: sterswift <[email protected]>
Co-authored-by: Sahil K <[email protected]>
Co-authored-by: Boyuan-Chen <[email protected]>
Co-authored-by: trangtran-enya <[email protected]>
Co-authored-by: vvvvvv1vvvvvv <[email protected]>
Co-authored-by: DBecane <[email protected]>
Co-authored-by: parodyBit <[email protected]>
  • Loading branch information
8 people authored Sep 20, 2022
1 parent 2d7ec5e commit bfbf2b4
Show file tree
Hide file tree
Showing 72 changed files with 2,199 additions and 771 deletions.
Binary file not shown.
88 changes: 85 additions & 3 deletions boba_documentation/developer/price-feeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,95 @@ To get the latest timestamp call **`latestTimestamp(base, quote)`**.

## 2. Witnet Price Feeds

Witnet is a decentralized oracle network, with multiple price feeds currently live on Boba. The price feed is backed by several witnesses/witnet nodes whose data are aggregated and averaged to provide a decentralized and reliable price. It easy to listen to Witnet's price feed. Please refer to Witnet's official guide at [https://docs.witnet.io](https://docs.witnet.io).
The Witnet multichain decentralized oracle enables smart contracts to realize their true potential by giving them access to all sorts of valuable data sets, and by attesting and delivering that information securely thanks to its strong cryptoeconomic guarantees.

Witnet can power most DeFi primitives like price feeds, stablecoins, synthetics, etc., as well as acting as a reliable source of randomness for creating uniqueness in NFTs.

### Feeds supported
A complete list of publicly available Witnet data feeds on Boba can be found in the Witnet Data Feeds website: [https://feeds.witnet.io/boba](https://feeds.witnet.io/boba)

[Request a new price feed on Boba](https://tally.so/r/wMZDAn) or [Create your own data feed](https://docs.witnet.io/smart-contracts/witnet-web-oracle/make-a-get-request).

### How To Use Witnet Price Feeds

Witnet price feeds can be integrated into your own Boba Mainnet contracts in two different ways:

1. [Integrate through proxy](https://docs.witnet.io/smart-contracts/witnet-data-feeds/using-witnet-data-feeds#reading-multiple-currency-pairs-from-the-router) Recommended for testing and upgradability.
This is the preferred way to consume the Witnet-powered price feeds. Through using the ***Price Feeds Router***.

2. [Integrate directly](https://docs.witnet.io/smart-contracts/witnet-data-feeds/using-witnet-data-feeds#reading-last-price-and-timestamp-from-a-price-feed-contract-serving-a-specific-pair) Optimized for gas cost and decentralization

The ***WitnetPriceRouter*** smart contract is deployed in all the [supported chains](https://docs.witnet.io/smart-contracts/witnet-data-feeds/addresses) and allows your own smart contracts and Web3 applications to get the latest price of any of the [supported currency pairs](https://docs.witnet.io/smart-contracts/witnet-data-feeds/price-feeds-registry#currency-pairs) by providing the identifier of the pair to a single Solidity method. This removes the need to know the actual contract addresses handling the price updates from the Witnet oracle.

### Reading multiple price pairs from the router

**WitnetPriceRouter**

*Mainnet*: [0x93f61D0D5F623144e7C390415B70102A9Cc90bA5](https://bobascan.com/address/0x93f61D0D5F623144e7C390415B70102A9Cc90bA5/read-contract)

*Rinkeby*: [0x36928Aeedaaf7D85bcA39aDfB2A39ec529ce221a](https://testnet.bobascan.com/address/0x36928Aeedaaf7D85bcA39aDfB2A39ec529ce221a/read-contract)

The Price Router contract is the easiest and most convenient way to consume Witnet price feeds on any of the [supported chains](/smart-contracts/supported-chains).

#### Solidity example

The example below shows how to read the price of two different assets from the Witnet Price Router:

```javascript
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

import "witnet-solidity-bridge/contracts/interfaces/IWitnetPriceRouter.sol";

contract MyContract {
IWitnetPriceRouter immutable public router;

/**
* IMPORTANT: pass the WitnetPriceRouter address depending on
* the network you are using! Please find available addresses here:
* https://docs.witnet.io/smart-contracts/price-feeds/contract-addresses
*/
constructor(IWitnetPriceRouter _router))
router = _router;
}

/// Returns the BTC / USD price (6 decimals), ultimately provided by the Witnet oracle.
function getBtcUsdPrice() public view returns (int256 _price) {
(_price,,) = router.valueFor(bytes4(0x24beead4));
}

/// Returns the ETH / USD price (6 decimals), ultimately provided by the Witnet oracle.
function getEthUsdPrice() public view returns (int256 _price) {
(_price,,) = router.valueFor(bytes4(0x3d15f701));
}

/// Returns the BTC / ETH price (6 decimals), derived from the ETH/USD and
/// the BTC/USD pairs that were ultimately provided by the Witnet oracle.
function getBtcEthPrice() public view returns (int256 _price) {
return (1000000 * getBtcUsdPrice()) / getEthUsdPrice();
}
}
```

#### Javascript example

You may also read the latest price of any of the supported currency pairs from your **Web3** application by interacting directly with the Price Router contract:

```javascript
web3 = Web3(Web3.HTTPProvider('https://mainnet.boba.network'))
abi = '[{ "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "valueFor", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }, { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }]'
addr = '0x36928Aeedaaf7D85bcA39aDfB2A39ec529ce221a'
contract = web3.eth.contract(address=addr, abi=abi)
// get last value for "Price-BOBA/USDT-6"
valueFor = contract.functions.valueFor().call("0xf723bde1")
print("Price-BOBA/USDT-6:", valueFor[0])
print("> lastTimestamp:", valueFor[1])
print("> latestUpdateStatus:", valueFor[2])
```

*Mainnet*: [BOBA/USDT, BTC/USD, ETH/USD, FRAX/USDT, USDC/USD, USDT/USD]
For more information about Witnet please refer to:

*Rinkeby*: [BOBA/USDT, BTC/USD, ETH/USD, FRAX/USDT, FXS/USDT, OMG/BTC, OMG/ETH, OMG/USDT, USDC/USD, USDT/USD]
[website](https://witnet.io/) | [docs](https://docs.witnet.io/) | [github](https://github.com/witnet) | [twitter](https://twitter.com/witnet_io) | [telegram](https://t.me/witnetio) | [discord](https://discord.gg/witnet)

## 3. Turing

Expand Down
8 changes: 5 additions & 3 deletions integration-tests/test/stress-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('stress tests', () => {
})

describe('C-C-C-Combo breakers', () => {
it(`{tag:boba} ${numTransactions} L2 transactions, L1 => L2 transactions, L2 => L1 transactions (txs serial, suites parallel)`, async () => {
it(`{numTransactions} L2 transactions, L1 => L2 transactions, L2 => L1 transactions (txs serial, suites parallel)`, async () => {
await Promise.all([
executeRepeatedL1ToL2Transactions(env, wallets, {
contract: L2SimpleStorage,
Expand All @@ -173,9 +173,11 @@ describe('stress tests', () => {
expect((await L1SimpleStorage.totalCount()).toNumber()).to.equal(
wallets.length
)
}).timeout(STRESS_TEST_TIMEOUT)
})
.timeout(STRESS_TEST_TIMEOUT)
.retries(3)

it(`{tag:boba} ${numTransactions} L2 transactions, L1 => L2 transactions, L2 => L1 transactions (all parallel)`, async () => {
it(`${numTransactions} L2 transactions, L1 => L2 transactions, L2 => L1 transactions (all parallel)`, async () => {
await Promise.all([
executeL1ToL2TransactionsParallel(env, wallets, {
contract: L2SimpleStorage,
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/test/turing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('Turing 256 Bit Random Number Test', async () => {
' Test contract whitelisted in TuringHelper (1 = yes)?',
result
)
})
}).retries(3)

it('Should register and fund your Turing helper contract in turingCredit', async () => {
env = await OptimismEnv.new()
Expand Down Expand Up @@ -175,5 +175,7 @@ describe('Turing 256 Bit Random Number Test', async () => {
const numberHexString = '0x' + rawData.slice(-64)
const result = BigInt(numberHexString)
console.log(' Turing VRF 256 =', result)
}).timeout(100000)
})
.timeout(100000)
.retries(3)
})
5 changes: 4 additions & 1 deletion integration-tests/test/z-brotli-batch-serialization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ describe('Batch Serialization', () => {

// make sure that bacth submitter submits all L2 block data to L1 CTC contract
const lastestL2Block = await env.l2Provider.getBlockNumber()
while (_prevTotalElements + _batchSize < lastestL2Block) {
while (
_prevTotalElements + _batchSize < lastestL2Block &&
logs.length === 0
) {
await sleep(1000)
tip = await env.l1Provider.getBlockNumber()
logs = await ctc.queryFilter(
Expand Down
17 changes: 17 additions & 0 deletions ops_boba/api/watcher-api/serverless-rinkeby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,20 @@ functions:
cors: true
layers:
- ${file(env-rinkeby.yml):LAYERS}
watcher_getLayerZeroTransactions:
handler: watcher_getLayerZeroTransactions.watcher_getLayerZeroTransactions
memorySize: 10240 # optional, in MB, default is 1024
timeout: 60 # optional, in seconds, default is 6
vpc:
securityGroupIds:
- ${file(env-rinkeby.yml):SECURITY_GROUPS}
subnetIds:
- ${file(env-rinkeby.yml):SUBNET_ID_1}
- ${file(env-rinkeby.yml):SUBNET_ID_2}
events:
- http:
path: get.layerzero.transactions
method: post
cors: true
layers:
- ${file(env-rinkeby.yml):LAYERS}
67 changes: 67 additions & 0 deletions ops_boba/api/watcher-api/watcher_getLayerZeroTransactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import json
import yaml
import pymysql


def watcher_getLayerZeroTransaction(event, context):
# Parse incoming event
body = json.loads(event["body"])
address = body.get("address")
fromRange = int(body.get("fromRange"))
toRange = int(body.get("toRange"))

# Read YML
with open("env.yml", 'r') as ymlfile:
config = yaml.load(ymlfile, Loader=yaml.FullLoader)

# Get MySQL host and port
endpoint = config.get('RDS_ENDPOINT')
user = config.get('RDS_MYSQL_NAME')
dbpassword = config.get('RDS_MYSQL_PASSWORD')
dbname = config.get('RDS_DBNAME')

con = pymysql.connect(host=endpoint, user=user, db=dbname,
passwd=dbpassword, connect_timeout=5)

transactionData = []
with con.cursor() as cur:
try:
cur.execute("""SELECT
chainID, targetChainID, hash, blockNumber, amount, event, timestamp, reference
FROM layerZeroTx
WHERE `crossTxFrom`=%s AND blockNumber <= %s AND blockNumber >= %s ORDER BY blockNumber""", (address, toRange, fromRange))
transactionsDataRaw = cur.fetchall()
print("total", len(transactionsDataRaw))
for transactionDataRaw in transactionsDataRaw:
print("FOUND")
transactionData.append({
"tx_hash": transactionDataRaw[2],
"amount": transactionDataRaw[4],
"event_type": transactionDataRaw[5],
"destination_chain": transactionDataRaw[1],
"timestamp": transactionDataRaw[6],
"block_number": transactionDataRaw[3],
"reference": transactionDataRaw[7]
})

except Exception as e:
print(e)
transactionData = []

con.close()

response = {
"statusCode": 201,
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": True,
"Strict-Transport-Security": "max-age=63072000; includeSubdomains; preload",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "same-origin",
"Permissions-Policy": "*",
},
"body": json.dumps(transactionData),
}
return response
13 changes: 13 additions & 0 deletions ops_boba/monitor/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MYSQL_HOST_URL=127.0.0.1
MYSQL_PORT=3306
MYSQL_USERNAME=admin
MYSQL_PASSWORD=password
MYSQL_DATABASE_NAME=omg_xv1
MYSQL_DBNAME_TX=omg_tx
MYSQL_DBNAME_RECEIPT=omg_receipts
ADDRESS_MANAGER_ADDRESS=
L1_NODE_WEB3_URL=
LAYER_ZERO_ENABLE_TEST=true
LAYER_ZERO_CHAIN=Testnet
LAYER_ZERO_BRIDGES=EthBridgeToAvalanche,EthBridgeToFantom
LAYER_ZERO_LATEST_BLOCK=1000
Loading

0 comments on commit bfbf2b4

Please sign in to comment.