Skip to content

Commit

Permalink
feat: COBE deployment, minDstGas fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xtools-at committed Mar 27, 2024
1 parent 3903441 commit ddf7a8d
Show file tree
Hide file tree
Showing 19 changed files with 9,554 additions and 56 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ The following command executes all necessary default setup for the contracts we'
npx hardhat --network beam setupOFT --target-network ethereum --local-contract MyUsdcOFT --remote-contract MyUsdcProxyOFT
# Ethereum
npx hardhat --network ethereum setupOFT --target-network beam --local-contract MyUsdcProxyOFT --remote-contract MyUsdcOFT

# important: add "--skip-adapter true" when _not_ using upgradeable contracts
```

All done, let's test our bridge by transferring 20 USDC from Ethereum to Beam:
Expand Down
34 changes: 13 additions & 21 deletions constants/tokenConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
symbol: "EH",
baseUri: "https://ipfs.io/ipfs/QmbHSG2Y14wy2mSF7L57fzE4evv1BhTtUWtkzUaSnUsacB/",
royaltyBasePoints: 500,
minGas: 100000,
},
UsdcOFT: {
name: "USD Coin",
Expand All @@ -33,6 +32,7 @@ module.exports = {
name: "Avalanche",
symbol: "AVAX",
withFee: true,
minGas: 10000000,
},
GobOFT: {
name: "Goons of Balatroon",
Expand All @@ -49,13 +49,19 @@ module.exports = {
symbol: "FP",
withFee: true,
},
CastleOfBlackwaterOFT: {
name: "Castle of Blackwater",
symbol: "COBE",
withFee: true,
},
},
"beam-testnet": {
BeamNativeOFT: {
name: "LayerZero Beam",
symbol: "LZBEAM",
withFee: true,
isNative: true,
minGas: 10000000,
},
NativeOFTWithFeeUpgradeable: {
name: "LayerZero Wrapped Merit Circle",
Expand All @@ -73,7 +79,6 @@ module.exports = {
symbol: "SNAKE",
baseUri: "https://snake-on-a-chain-euppi.ondigitalocean.app/token/",
royaltyBasePoints: 500,
minGas: 100000,
},
UsdcOFT: {
name: "USD Coin",
Expand All @@ -95,52 +100,44 @@ module.exports = {
BeamProxyOFT: {
address: "0x62D0A8458eD7719FDAF978fe5929C6D342B0bFcE", // BEAM
withFee: true,
minGas: 10000000,
},
ProxyOFTWithFeeUpgradeable: {
address: "0x949D48EcA67b17269629c7194F4b727d4Ef9E5d6", // MC
withFee: true,
},
ProxyONFT721Upgradeable: {
address: "0x9eEAeCBE2884AA7e82f450E3Fc174F30Fc2a8de3", // Edenhorde Eclipse
minGas: 10000000,
minGas: 100000,
},
UsdcProxyOFT: {
address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
withFee: true,
minGas: 10000000,
},
UsdtProxyOFT: {
address: "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT
withFee: true,
minGas: 10000000,
},
DomiProxyOFT: {
address: "0x45C2F8c9B4c0bDC76200448cc26C48ab6ffef83F",
withFee: true,
minGas: 10000000,
},
ForgottenPlaylandProxyOFT: {
address: "0xEeee2A2E650697d2A8e8BC990C2f3d04203bE06f",
withFee: true,
minGas: 10000000,
},
},
goerli: {
BeamProxyOFT: {
address: "TODO", // BEAM
CastleOfBlackwaterProxyOFT: {
address: "0xc61eDB127f58f42F47a8bE8aeBe83cF602A53878",
withFee: true,
minGas: 10000000,
},
},
goerli: {
UsdcProxyOFT: {
address: "0x2724A590fe9cC7c66A83204aa11D6ec7Aa8e7C58", // USDC
withFee: true,
minGas: 10000000,
},
UsdtProxyOFT: {
address: "0x908C7A34a87FD8e207BC4585707E484Ed2c9E8aE", // USDT
withFee: true,
minGas: 10000000,
},
},
avalanche: {
Expand All @@ -149,7 +146,6 @@ module.exports = {
symbol: "LZAVAX",
withFee: true,
isNative: true,
minGas: 10000000,
},
BeamOFT: {
name: "Beam",
Expand All @@ -159,7 +155,6 @@ module.exports = {
DomiProxyOFT: {
address: "0xFc6Da929c031162841370af240dEc19099861d3B",
withFee: true,
minGas: 10000000,
},
},
fuji: {
Expand All @@ -169,14 +164,13 @@ module.exports = {
},
ProxyONFT721: {
address: "0x588348d84498d0689B76F89438bE58999a5434EE", // Snakes on a chain
minGas: 10000000,
minGas: 100000,
},
AvaxNativeOFT: {
name: "LayerZero Avalanche",
symbol: "LZAVAX",
withFee: true,
isNative: true,
minGas: 10000000,
},
BeamOFT: {
name: "Beam",
Expand All @@ -188,14 +182,12 @@ module.exports = {
GobProxyOFT: {
address: "0xa2f9ecf83a48b86265ff5fd36cdbaaa1f349916c", // USDT
withFee: true,
minGas: 10000000,
},
},
bsc: {
DomiProxyOFT: {
address: "0xBBCA42c60b5290F2c48871A596492F93fF0Ddc82",
withFee: true,
minGas: 10000000,
},
},
}
10 changes: 0 additions & 10 deletions contracts/contracts-upgradable/examples/GOB.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ import "../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol";
contract ForgottenPlaylandOFT is OFTWithFeePermitUpgradeable {}

contract ForgottenPlaylandProxyOFT is ProxyOFTWithFeeUpgradeable {}

contract CastleOfBlackwaterOFT is OFTWithFeePermitUpgradeable {}

contract CastleOfBlackwaterProxyOFT is ProxyOFTWithFeeUpgradeable {}
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ import "../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol";
contract DomiOFT is OFTWithFeeUpgradeable {}

contract DomiProxyOFT is ProxyOFTWithFeeUpgradeable {}

contract GobOFT is OFTWithFeeUpgradeable {}

contract GobProxyOFT is ProxyOFTWithFeeUpgradeable {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ pragma solidity ^0.8.18;
import "../token/oft/v2/fee/OFTWithFeeUpgradeable.sol";
import "../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol";

contract UsdcOFT is OFTWithFeeUpgradeable {
function decimals() public view virtual override returns (uint8) {
return 6;
}
}

contract UsdcProxyOFT is ProxyOFTWithFeeUpgradeable {}

contract UsdtOFT is OFTWithFeeUpgradeable {
function decimals() public view virtual override returns (uint8) {
return 6;
Expand Down
14 changes: 0 additions & 14 deletions contracts/contracts-upgradable/examples/UsdcOFT.sol

This file was deleted.

47 changes: 47 additions & 0 deletions deploy/CastleOfBlackwaterOFT.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json")
const TOKEN_CONFIG = require("../constants/tokenConfig")

const CONTRACT_NAME = "CastleOfBlackwaterOFT"

module.exports = async function ({ deployments, getNamedAccounts }) {
const { deploy } = deployments
const { deployer, proxyOwner } = await getNamedAccounts()

let lzEndpointAddress, lzEndpoint, LZEndpointMock
if (hre.network.name === "hardhat") {
LZEndpointMock = await ethers.getContractFactory("LZEndpointMock")
lzEndpoint = await LZEndpointMock.deploy(1)
lzEndpointAddress = lzEndpoint.address
} else {
lzEndpointAddress = LZ_ENDPOINTS[hre.network.name]
}

const tokenConfig = TOKEN_CONFIG[hre.network.name][CONTRACT_NAME]
if (!tokenConfig.name || !tokenConfig.symbol) {
console.error("No configuration found for target network.")
return
}

await deploy(CONTRACT_NAME, {
from: deployer,
log: true,
waitConfirmations: 1,
proxy: {
owner: proxyOwner,
proxyContract: "OptimizedTransparentProxy",
execute: {
init: {
methodName: "initialize",
args: [
tokenConfig.name,
tokenConfig.symbol,
tokenConfig.sharedDecimals != null ? tokenConfig.sharedDecimals : 6,
lzEndpointAddress,
],
},
},
},
})
}

module.exports.tags = [CONTRACT_NAME]
43 changes: 43 additions & 0 deletions deploy/CastleOfBlackwaterProxyOFT.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json")
const TOKEN_CONFIG = require("../constants/tokenConfig")

const CONTRACT_NAME = "CastleOfBlackwaterProxyOFT"

module.exports = async function ({ deployments, getNamedAccounts }) {
const { deploy } = deployments
const { deployer, proxyOwner } = await getNamedAccounts()

let lzEndpointAddress, lzEndpoint, LZEndpointMock
if (hre.network.name === "hardhat") {
LZEndpointMock = await ethers.getContractFactory("LZEndpointMock")
lzEndpoint = await LZEndpointMock.deploy(1)
lzEndpointAddress = lzEndpoint.address
} else {
lzEndpointAddress = LZ_ENDPOINTS[hre.network.name]
}

const tokenConfig = TOKEN_CONFIG[hre.network.name][CONTRACT_NAME]

if (!tokenConfig.address) {
console.error("No configured token address found for target network.")
return
}

await deploy(CONTRACT_NAME, {
from: deployer,
log: true,
waitConfirmations: 1,
proxy: {
owner: proxyOwner,
proxyContract: "OptimizedTransparentProxy",
execute: {
init: {
methodName: "initialize",
args: [tokenConfig.address, tokenConfig.sharedDecimals != null ? tokenConfig.sharedDecimals : 6, lzEndpointAddress],
},
},
},
})
}

module.exports.tags = [CONTRACT_NAME]
Loading

0 comments on commit ddf7a8d

Please sign in to comment.