Skip to content

Commit ddf7a8d

Browse files
committed
feat: COBE deployment, minDstGas fixes
1 parent 3903441 commit ddf7a8d

19 files changed

+9554
-56
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ The following command executes all necessary default setup for the contracts we'
142142
npx hardhat --network beam setupOFT --target-network ethereum --local-contract MyUsdcOFT --remote-contract MyUsdcProxyOFT
143143
# Ethereum
144144
npx hardhat --network ethereum setupOFT --target-network beam --local-contract MyUsdcProxyOFT --remote-contract MyUsdcOFT
145+
146+
# important: add "--skip-adapter true" when _not_ using upgradeable contracts
145147
```
146148

147149
All done, let's test our bridge by transferring 20 USDC from Ethereum to Beam:

constants/tokenConfig.js

+13-21
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ module.exports = {
1717
symbol: "EH",
1818
baseUri: "https://ipfs.io/ipfs/QmbHSG2Y14wy2mSF7L57fzE4evv1BhTtUWtkzUaSnUsacB/",
1919
royaltyBasePoints: 500,
20-
minGas: 100000,
2120
},
2221
UsdcOFT: {
2322
name: "USD Coin",
@@ -33,6 +32,7 @@ module.exports = {
3332
name: "Avalanche",
3433
symbol: "AVAX",
3534
withFee: true,
35+
minGas: 10000000,
3636
},
3737
GobOFT: {
3838
name: "Goons of Balatroon",
@@ -49,13 +49,19 @@ module.exports = {
4949
symbol: "FP",
5050
withFee: true,
5151
},
52+
CastleOfBlackwaterOFT: {
53+
name: "Castle of Blackwater",
54+
symbol: "COBE",
55+
withFee: true,
56+
},
5257
},
5358
"beam-testnet": {
5459
BeamNativeOFT: {
5560
name: "LayerZero Beam",
5661
symbol: "LZBEAM",
5762
withFee: true,
5863
isNative: true,
64+
minGas: 10000000,
5965
},
6066
NativeOFTWithFeeUpgradeable: {
6167
name: "LayerZero Wrapped Merit Circle",
@@ -73,7 +79,6 @@ module.exports = {
7379
symbol: "SNAKE",
7480
baseUri: "https://snake-on-a-chain-euppi.ondigitalocean.app/token/",
7581
royaltyBasePoints: 500,
76-
minGas: 100000,
7782
},
7883
UsdcOFT: {
7984
name: "USD Coin",
@@ -95,52 +100,44 @@ module.exports = {
95100
BeamProxyOFT: {
96101
address: "0x62D0A8458eD7719FDAF978fe5929C6D342B0bFcE", // BEAM
97102
withFee: true,
98-
minGas: 10000000,
99103
},
100104
ProxyOFTWithFeeUpgradeable: {
101105
address: "0x949D48EcA67b17269629c7194F4b727d4Ef9E5d6", // MC
102106
withFee: true,
103107
},
104108
ProxyONFT721Upgradeable: {
105109
address: "0x9eEAeCBE2884AA7e82f450E3Fc174F30Fc2a8de3", // Edenhorde Eclipse
106-
minGas: 10000000,
110+
minGas: 100000,
107111
},
108112
UsdcProxyOFT: {
109113
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
110114
withFee: true,
111-
minGas: 10000000,
112115
},
113116
UsdtProxyOFT: {
114117
address: "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT
115118
withFee: true,
116-
minGas: 10000000,
117119
},
118120
DomiProxyOFT: {
119121
address: "0x45C2F8c9B4c0bDC76200448cc26C48ab6ffef83F",
120122
withFee: true,
121-
minGas: 10000000,
122123
},
123124
ForgottenPlaylandProxyOFT: {
124125
address: "0xEeee2A2E650697d2A8e8BC990C2f3d04203bE06f",
125126
withFee: true,
126-
minGas: 10000000,
127127
},
128-
},
129-
goerli: {
130-
BeamProxyOFT: {
131-
address: "TODO", // BEAM
128+
CastleOfBlackwaterProxyOFT: {
129+
address: "0xc61eDB127f58f42F47a8bE8aeBe83cF602A53878",
132130
withFee: true,
133-
minGas: 10000000,
134131
},
132+
},
133+
goerli: {
135134
UsdcProxyOFT: {
136135
address: "0x2724A590fe9cC7c66A83204aa11D6ec7Aa8e7C58", // USDC
137136
withFee: true,
138-
minGas: 10000000,
139137
},
140138
UsdtProxyOFT: {
141139
address: "0x908C7A34a87FD8e207BC4585707E484Ed2c9E8aE", // USDT
142140
withFee: true,
143-
minGas: 10000000,
144141
},
145142
},
146143
avalanche: {
@@ -149,7 +146,6 @@ module.exports = {
149146
symbol: "LZAVAX",
150147
withFee: true,
151148
isNative: true,
152-
minGas: 10000000,
153149
},
154150
BeamOFT: {
155151
name: "Beam",
@@ -159,7 +155,6 @@ module.exports = {
159155
DomiProxyOFT: {
160156
address: "0xFc6Da929c031162841370af240dEc19099861d3B",
161157
withFee: true,
162-
minGas: 10000000,
163158
},
164159
},
165160
fuji: {
@@ -169,14 +164,13 @@ module.exports = {
169164
},
170165
ProxyONFT721: {
171166
address: "0x588348d84498d0689B76F89438bE58999a5434EE", // Snakes on a chain
172-
minGas: 10000000,
167+
minGas: 100000,
173168
},
174169
AvaxNativeOFT: {
175170
name: "LayerZero Avalanche",
176171
symbol: "LZAVAX",
177172
withFee: true,
178173
isNative: true,
179-
minGas: 10000000,
180174
},
181175
BeamOFT: {
182176
name: "Beam",
@@ -188,14 +182,12 @@ module.exports = {
188182
GobProxyOFT: {
189183
address: "0xa2f9ecf83a48b86265ff5fd36cdbaaa1f349916c", // USDT
190184
withFee: true,
191-
minGas: 10000000,
192185
},
193186
},
194187
bsc: {
195188
DomiProxyOFT: {
196189
address: "0xBBCA42c60b5290F2c48871A596492F93fF0Ddc82",
197190
withFee: true,
198-
minGas: 10000000,
199191
},
200192
},
201193
}

contracts/contracts-upgradable/examples/GOB.sol

-10
This file was deleted.

contracts/contracts-upgradable/examples/FP.sol renamed to contracts/contracts-upgradable/examples/OFTPermit.sol

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ import "../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol";
88
contract ForgottenPlaylandOFT is OFTWithFeePermitUpgradeable {}
99

1010
contract ForgottenPlaylandProxyOFT is ProxyOFTWithFeeUpgradeable {}
11+
12+
contract CastleOfBlackwaterOFT is OFTWithFeePermitUpgradeable {}
13+
14+
contract CastleOfBlackwaterProxyOFT is ProxyOFTWithFeeUpgradeable {}

contracts/contracts-upgradable/examples/Domi.sol renamed to contracts/contracts-upgradable/examples/OFTWithFee.sol

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ import "../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol";
88
contract DomiOFT is OFTWithFeeUpgradeable {}
99

1010
contract DomiProxyOFT is ProxyOFTWithFeeUpgradeable {}
11+
12+
contract GobOFT is OFTWithFeeUpgradeable {}
13+
14+
contract GobProxyOFT is ProxyOFTWithFeeUpgradeable {}

contracts/contracts-upgradable/examples/UsdtOFT.sol renamed to contracts/contracts-upgradable/examples/UsdOFT.sol

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ pragma solidity ^0.8.18;
55
import "../token/oft/v2/fee/OFTWithFeeUpgradeable.sol";
66
import "../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol";
77

8+
contract UsdcOFT is OFTWithFeeUpgradeable {
9+
function decimals() public view virtual override returns (uint8) {
10+
return 6;
11+
}
12+
}
13+
14+
contract UsdcProxyOFT is ProxyOFTWithFeeUpgradeable {}
15+
816
contract UsdtOFT is OFTWithFeeUpgradeable {
917
function decimals() public view virtual override returns (uint8) {
1018
return 6;

contracts/contracts-upgradable/examples/UsdcOFT.sol

-14
This file was deleted.

deploy/CastleOfBlackwaterOFT.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json")
2+
const TOKEN_CONFIG = require("../constants/tokenConfig")
3+
4+
const CONTRACT_NAME = "CastleOfBlackwaterOFT"
5+
6+
module.exports = async function ({ deployments, getNamedAccounts }) {
7+
const { deploy } = deployments
8+
const { deployer, proxyOwner } = await getNamedAccounts()
9+
10+
let lzEndpointAddress, lzEndpoint, LZEndpointMock
11+
if (hre.network.name === "hardhat") {
12+
LZEndpointMock = await ethers.getContractFactory("LZEndpointMock")
13+
lzEndpoint = await LZEndpointMock.deploy(1)
14+
lzEndpointAddress = lzEndpoint.address
15+
} else {
16+
lzEndpointAddress = LZ_ENDPOINTS[hre.network.name]
17+
}
18+
19+
const tokenConfig = TOKEN_CONFIG[hre.network.name][CONTRACT_NAME]
20+
if (!tokenConfig.name || !tokenConfig.symbol) {
21+
console.error("No configuration found for target network.")
22+
return
23+
}
24+
25+
await deploy(CONTRACT_NAME, {
26+
from: deployer,
27+
log: true,
28+
waitConfirmations: 1,
29+
proxy: {
30+
owner: proxyOwner,
31+
proxyContract: "OptimizedTransparentProxy",
32+
execute: {
33+
init: {
34+
methodName: "initialize",
35+
args: [
36+
tokenConfig.name,
37+
tokenConfig.symbol,
38+
tokenConfig.sharedDecimals != null ? tokenConfig.sharedDecimals : 6,
39+
lzEndpointAddress,
40+
],
41+
},
42+
},
43+
},
44+
})
45+
}
46+
47+
module.exports.tags = [CONTRACT_NAME]

deploy/CastleOfBlackwaterProxyOFT.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json")
2+
const TOKEN_CONFIG = require("../constants/tokenConfig")
3+
4+
const CONTRACT_NAME = "CastleOfBlackwaterProxyOFT"
5+
6+
module.exports = async function ({ deployments, getNamedAccounts }) {
7+
const { deploy } = deployments
8+
const { deployer, proxyOwner } = await getNamedAccounts()
9+
10+
let lzEndpointAddress, lzEndpoint, LZEndpointMock
11+
if (hre.network.name === "hardhat") {
12+
LZEndpointMock = await ethers.getContractFactory("LZEndpointMock")
13+
lzEndpoint = await LZEndpointMock.deploy(1)
14+
lzEndpointAddress = lzEndpoint.address
15+
} else {
16+
lzEndpointAddress = LZ_ENDPOINTS[hre.network.name]
17+
}
18+
19+
const tokenConfig = TOKEN_CONFIG[hre.network.name][CONTRACT_NAME]
20+
21+
if (!tokenConfig.address) {
22+
console.error("No configured token address found for target network.")
23+
return
24+
}
25+
26+
await deploy(CONTRACT_NAME, {
27+
from: deployer,
28+
log: true,
29+
waitConfirmations: 1,
30+
proxy: {
31+
owner: proxyOwner,
32+
proxyContract: "OptimizedTransparentProxy",
33+
execute: {
34+
init: {
35+
methodName: "initialize",
36+
args: [tokenConfig.address, tokenConfig.sharedDecimals != null ? tokenConfig.sharedDecimals : 6, lzEndpointAddress],
37+
},
38+
},
39+
},
40+
})
41+
}
42+
43+
module.exports.tags = [CONTRACT_NAME]

0 commit comments

Comments
 (0)