Skip to content
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
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ jobs:
- image: cimg/go:1.19
steps:
- checkout
- run:
command: |
curl -L https://foundry.paradigm.xyz | SHELL=/usr/bin/bash bash
~/.foundry/bin/foundryup
- run:
command: make geth
- run:
command: PATH="~/.foundry/bin:${PATH}" e2e_test/run_all_tests.sh
- run:
command: go run build/ci.go test
lint-geth:
Expand Down
3 changes: 3 additions & 0 deletions contracts/celo/celo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ import _ "embed"
//go:embed compiled/Registry.bin-runtime
var RegistryBytecodeRaw []byte

//go:embed compiled/GoldToken.bin-runtime
var GoldTokenBytecodeRaw []byte

//go:embed compiled/Proxy.bin-runtime
var ProxyBytecodeRaw []byte
34 changes: 30 additions & 4 deletions core/celo_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common"
contracts "github.com/ethereum/go-ethereum/contracts/celo"
contracts_config "github.com/ethereum/go-ethereum/contracts/config"
"github.com/ethereum/go-ethereum/crypto"
)

// Decode 0x prefixed hex string from file (including trailing newline)
Expand All @@ -25,6 +26,10 @@ func DecodeHex(hexbytes []byte) ([]byte, error) {
return bytes, nil
}

var DevPrivateKey, _ = crypto.HexToECDSA("2771aff413cac48d9f8c114fabddd9195a2129f3c2c436caa07e27bb7f58ead5")
var DevAddr = common.BytesToAddress(DevAddr32.Bytes())
var DevAddr32 = common.HexToHash("0x42cf1bbc38BaAA3c4898ce8790e21eD2738c6A4a")

func celoGenesisAccounts() map[common.Address]GenesisAccount {
// As defined in ERC-1967: Proxy Storage Slots (https://eips.ethereum.org/EIPS/eip-1967)
var (
Expand All @@ -36,25 +41,46 @@ func celoGenesisAccounts() map[common.Address]GenesisAccount {
if err != nil {
panic(err)
}
goldTokenBytecode, err := DecodeHex(contracts.GoldTokenBytecodeRaw)
if err != nil {
panic(err)
}
proxyBytecode, err := DecodeHex(contracts.ProxyBytecodeRaw)
if err != nil {
panic(err)
}
registry_owner := common.HexToHash("0x42cf1bbc38BaAA3c4898ce8790e21eD2738c6A4a")
devBalance, ok := new(big.Int).SetString("100000000000000000000", 10)
if !ok {
panic("Could not set devBalance!")
}
return map[common.Address]GenesisAccount{
// Celo Contracts
contracts_config.RegistrySmartContractAddress: { // Registry Proxy
Code: proxyBytecode,
Storage: map[common.Hash]common.Hash{
common.HexToHash("0x0"): registry_owner, // `_owner` slot in Registry contract
common.HexToHash("0x0"): DevAddr32, // `_owner` slot in Registry contract
proxy_implementation_slot: common.HexToHash("0xce11"),
proxy_owner_slot: registry_owner,
proxy_owner_slot: DevAddr32,
},
Balance: big.NewInt(0),
},
common.HexToAddress("0xce11"): { // Registry Implementation
Code: registryBytecode,
Balance: big.NewInt(0),
},
common.HexToAddress("0xce12"): { // GoldToken Proxy
Code: proxyBytecode,
Storage: map[common.Hash]common.Hash{
proxy_implementation_slot: common.HexToHash("0xce13"),
proxy_owner_slot: DevAddr32,
},
Balance: big.NewInt(0),
},
common.HexToAddress("0xce13"): { // GoldToken Implementation
Code: goldTokenBytecode,
Balance: big.NewInt(0),
},
DevAddr: {
Balance: devBalance,
},
}
}
3 changes: 1 addition & 2 deletions e2e_test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
cache
out
geth.log
Loading