Skip to content

Commit

Permalink
choose addresses within allowed range
Browse files Browse the repository at this point in the history
  • Loading branch information
atvanguard committed Oct 2, 2023
1 parent 03e10e5 commit 5ab7541
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 44 deletions.
10 changes: 5 additions & 5 deletions constants/hubble.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package constants

const OrderBookContractAddress = "0x0420000000000000000000000000000000000000"
const MarginAccountContractAddress = "0x0420000000000000000000000000000000000001"
const ClearingHouseContractAddress = "0x0420000000000000000000000000000000000002"
const LimitOrderBookContractAddress = "0x0420000000000000000000000000000000000003"
const IOCOrderBookContractAddress = "0x0420000000000000000000000000000000000004"
const OrderBookContractAddress = "0x03000000000000000000000000000000000000f0"
const MarginAccountContractAddress = "0x03000000000000000000000000000000000000f1"
const ClearingHouseContractAddress = "0x03000000000000000000000000000000000000f2"
const LimitOrderBookContractAddress = "0x03000000000000000000000000000000000000f3"
const IOCOrderBookContractAddress = "0x03000000000000000000000000000000000000f4"
2 changes: 1 addition & 1 deletion contracts/test/hubble-v2/OrderBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BigNumber } from "ethers"

// make sure this is always an admin for minter precompile
const adminAddress: string = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC"
const GENESIS_ORDERBOOK_ADDRESS = '0x0420000000000000000000000000000000000000'
const GENESIS_ORDERBOOK_ADDRESS = '0x03000000000000000000000000000000000000f0'

describe.only('Order Book', function () {
let orderBook, alice, bob, longOrder, shortOrder, domain, orderType, signature
Expand Down
2 changes: 1 addition & 1 deletion core/vm/evm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestIsProhibited(t *testing.T) {
assert.True(t, IsProhibited(common.HexToAddress("0x02000000000000000000000000000000000000f0")))
assert.True(t, IsProhibited(common.HexToAddress("0x02000000000000000000000000000000000000ff")))
// reserved addresses (custom precompiles)
assert.True(t, IsProhibited(common.HexToAddress("0x0420000000000000000000000000000000000000")))
assert.True(t, IsProhibited(common.HexToAddress("0x0300000000000000000000000000000000000000")))
assert.True(t, IsProhibited(common.HexToAddress("0x0300000000000000000000000000000000000010")))
assert.True(t, IsProhibited(common.HexToAddress("0x03000000000000000000000000000000000000f0")))
assert.True(t, IsProhibited(common.HexToAddress("0x03000000000000000000000000000000000000ff")))
Expand Down
10 changes: 5 additions & 5 deletions genesis.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions network-configs/aylin/genesis.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions plugin/evm/orderbook/tx_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"github.com/ethereum/go-ethereum/log"
)

var OrderBookContractAddress = common.HexToAddress("0x0420000000000000000000000000000000000000")
var MarginAccountContractAddress = common.HexToAddress("0x0420000000000000000000000000000000000001")
var ClearingHouseContractAddress = common.HexToAddress("0x0420000000000000000000000000000000000002")
var LimitOrderBookContractAddress = common.HexToAddress("0x0420000000000000000000000000000000000003")
var IOCOrderBookContractAddress = common.HexToAddress("0x0420000000000000000000000000000000000004")
var OrderBookContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000f0")
var MarginAccountContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000f1")
var ClearingHouseContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000f2")
var LimitOrderBookContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000f3")
var IOCOrderBookContractAddress = common.HexToAddress("0x03000000000000000000000000000000000000f4")

type LimitOrderTxProcessor interface {
GetOrderBookTxsCount() uint64
Expand Down
4 changes: 2 additions & 2 deletions plugin/evm/orderbook_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/clearing_house.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
CLEARING_HOUSE_GENESIS_ADDRESS = "0x0420000000000000000000000000000000000002"
CLEARING_HOUSE_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000f2"
MAINTENANCE_MARGIN_SLOT int64 = 1
MIN_ALLOWABLE_MARGIN_SLOT int64 = 2
TAKER_FEE_SLOT int64 = 3
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/ioc_order_book.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

const (
IOC_ORDERBOOK_ADDRESS = "0x0420000000000000000000000000000000000004"
IOC_ORDERBOOK_ADDRESS = "0x03000000000000000000000000000000000000f4"
IOC_ORDER_INFO_SLOT int64 = 1
IOC_EXPIRATION_CAP_SLOT int64 = 2
)
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/limit_order_book.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
LIMIT_ORDERBOOK_GENESIS_ADDRESS = "0x0420000000000000000000000000000000000003"
LIMIT_ORDERBOOK_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000f3"
ORDER_INFO_SLOT int64 = 1
REDUCE_ONLY_AMOUNT_SLOT int64 = 2
LONG_OPEN_ORDERS_SLOT int64 = 4
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/margin_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
MARGIN_ACCOUNT_GENESIS_ADDRESS = "0x0420000000000000000000000000000000000001"
MARGIN_ACCOUNT_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000f1"
ORACLE_SLOT int64 = 4
SUPPORTED_COLLATERAL_SLOT int64 = 8
MARGIN_MAPPING_SLOT int64 = 10
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/bibliophile/orderbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const (
ORDERBOOK_GENESIS_ADDRESS = "0x0420000000000000000000000000000000000000"
ORDERBOOK_GENESIS_ADDRESS = "0x03000000000000000000000000000000000000f0"
IS_VALIDATOR_SLOT int64 = 1
IS_TRADING_AUTHORITY_SLOT int64 = 2
)
Expand Down
2 changes: 1 addition & 1 deletion precompile/modules/registerer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
End: common.HexToAddress("0x02000000000000000000000000000000000000ff"),
},
{
Start: common.HexToAddress("0x0420000000000000000000000000000000000000"),
Start: common.HexToAddress("0x0300000000000000000000000000000000000000"),
End: common.HexToAddress("0x03000000000000000000000000000000000000ff"),
},
}
Expand Down
12 changes: 6 additions & 6 deletions precompile/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// These start at the address: 0x0100000000000000000000000000000000000000 and will increment by 1.
// Optional precompiles implemented in subnet-evm start at 0x0200000000000000000000000000000000000000 and will increment by 1
// from here to reduce the risk of conflicts.
// For forks of subnet-evm, users should start at 0x0420000000000000000000000000000000000000 to ensure
// For forks of subnet-evm, users should start at 0x03000000000000000000000000000000000000f0 to ensure
// that their own modifications do not conflict with stateful precompiles that may be added to subnet-evm
// in the future.
// ContractDeployerAllowListAddress = common.HexToAddress("0x0200000000000000000000000000000000000000")
Expand All @@ -48,10 +48,10 @@ import (
// ticks = common.HexToAddress("0x0300000000000000000000000000000000000001")

// GenesisAddress
// OrderBook = common.HexToAddress("0x0420000000000000000000000000000000000000")
// MarginAccount = common.HexToAddress("0x0420000000000000000000000000000000000001")
// ClearingHouse = common.HexToAddress("0x0420000000000000000000000000000000000002")
// limitOrderBook = common.HexToAddress("0x0420000000000000000000000000000000000003")
// iocOrderBook = common.HexToAddress("0x0420000000000000000000000000000000000004")
// OrderBook = common.HexToAddress("0x03000000000000000000000000000000000000f0")
// MarginAccount = common.HexToAddress("0x03000000000000000000000000000000000000f1")
// ClearingHouse = common.HexToAddress("0x03000000000000000000000000000000000000f2")
// limitOrderBook = common.HexToAddress("0x03000000000000000000000000000000000000f3")
// iocOrderBook = common.HexToAddress("0x03000000000000000000000000000000000000f4")

// {YourPrecompile}Address = common.HexToAddress("0x03000000000000000000000000000000000000??")
6 changes: 3 additions & 3 deletions tests/orderbook/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const axios = require('axios');
const { expect } = require('chai');
const { randomInt } = require('crypto');

const OrderBookContractAddress = "0x0420000000000000000000000000000000000000"
const MarginAccountContractAddress = "0x0420000000000000000000000000000000000001"
const OrderBookContractAddress = "0x03000000000000000000000000000000000000f0"
const MarginAccountContractAddress = "0x03000000000000000000000000000000000000f1"
const MarginAccountHelperContractAddress = "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
const ClearingHouseContractAddress = "0x0420000000000000000000000000000000000002"
const ClearingHouseContractAddress = "0x03000000000000000000000000000000000000f2"

let provider, domain, orderType, orderBook, marginAccount, marginAccountHelper, clearingHouse
let alice, bob, charlie, aliceAddress, bobAddress, charlieAddress
Expand Down
10 changes: 5 additions & 5 deletions tests/orderbook/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ alice = new ethers.Wallet('0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f
bob = new ethers.Wallet('0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', provider); // 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc
charlie = new ethers.Wallet('15614556be13730e9e8d6eacc1603143e7b96987429df8726384c2ec4502ef6e', provider); // 0x55ee05df718f1a5c1441e76190eb1a19ee2c9430

const OrderBookContractAddress = "0x0420000000000000000000000000000000000000"
const MarginAccountContractAddress = "0x0420000000000000000000000000000000000001"
const ClearingHouseContractAddress = "0x0420000000000000000000000000000000000002"
const OrderBookContractAddress = "0x03000000000000000000000000000000000000f0"
const MarginAccountContractAddress = "0x03000000000000000000000000000000000000f1"
const ClearingHouseContractAddress = "0x03000000000000000000000000000000000000f2"
const JurorPrecompileAddress = "0x0300000000000000000000000000000000000000"
const TicksPrecompileAddress = "0x0300000000000000000000000000000000000001"
const LimitOrderBookContractAddress = "0x0420000000000000000000000000000000000003"
const IOCContractAddress = "0x0420000000000000000000000000000000000004"
const LimitOrderBookContractAddress = "0x03000000000000000000000000000000000000f3"
const IOCContractAddress = "0x03000000000000000000000000000000000000f4"

orderBook = new ethers.Contract(OrderBookContractAddress, require('./abi/OrderBook.json'), provider);
limitOrderBook = new ethers.Contract(LimitOrderBookContractAddress, require('./abi/LimitOrderBook.json'), provider);
Expand Down

0 comments on commit 5ab7541

Please sign in to comment.