Skip to content

Commit

Permalink
feat: deploy gOHM/DAI otcOffer (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
frontier159 authored Nov 27, 2023
1 parent d389945 commit 8c3989a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// mainnet: OTC_OFFER.DAI_GOHM=0x2c4b131BEf9d676877Ae0b5b2B46914b07FB9272
// yarn hardhat verify --network mainnet 0x2c4b131BEf9d676877Ae0b5b2B46914b07FB9272 --constructor-args scripts/deploys/mainnet/deploymentArgs/0x2c4b131BEf9d676877Ae0b5b2B46914b07FB9272.js
module.exports = [
"0x0ab87046fBb341D058F17CBC4c1133F25a20a52f",
"0x6b175474e89094c44da98b954eedeac495271d0f",
"0x5C8898f8E0F9468D4A677887bC03EE2659321012",
"3096000000000000000000",
0,
"2900000000000000000000",
"3300000000000000000000"
];
38 changes: 38 additions & 0 deletions protocol/scripts/deploys/mainnet/otcOffer/03-otcOffer-dai-gohm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import '@nomiclabs/hardhat-ethers';
import { ethers } from 'hardhat';
import { OtcOffer__factory } from '../../../../typechain';
import {
deployAndMine,
ensureExpectedEnvvars,
} from '../../helpers';
import { getDeployedContracts } from './contract-addresses';

async function main() {
ensureExpectedEnvvars();
const [owner] = await ethers.getSigners();
const CORE_ADDRESSES = getDeployedContracts();

const factory = new OtcOffer__factory(owner);
await deployAndMine(
'OTC_OFFER.DAI_GOHM',
factory,
factory.deploy,
CORE_ADDRESSES.EXTERNAL.OLYMPUS.GOHM_TOKEN, // user sell token
CORE_ADDRESSES.EXTERNAL.MAKER_DAO.DAI_TOKEN, // user buy token
CORE_ADDRESSES.OTC_OFFER.FUNDS_OWNER, // fundsOwner
ethers.utils.parseEther("3096"), // initial offerPrice -- always 18 dp
0, // offerPricingToken == DAI (USER_BUY_TOKEN)
ethers.utils.parseEther("2900"), // minOfferPrice
ethers.utils.parseEther("3300"), // maxOfferPrice
);

}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async function main() {

// Transfer ownership to the multisig
await mine(CORE_INSTANCES.OTC_OFFER.DAI_OHM.transferOwnership(CORE_ADDRESSES.CORE.CORE_MULTISIG));
await mine(CORE_INSTANCES.OTC_OFFER.DAI_GOHM.transferOwnership(CORE_ADDRESSES.CORE.CORE_MULTISIG));
}

// We recommend this pattern to be able to use async/await everywhere
Expand Down
10 changes: 9 additions & 1 deletion protocol/scripts/deploys/mainnet/otcOffer/contract-addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface ContractAddresses {

OTC_OFFER: {
DAI_OHM: string,
DAI_GOHM: string,
FUNDS_OWNER: string,
}

Expand All @@ -19,6 +20,7 @@ export interface ContractAddresses {
},
OLYMPUS: {
OHM_TOKEN: string,
GOHM_TOKEN: string,
},
}
}
Expand All @@ -31,6 +33,7 @@ const CORE_DEPLOYED_CONTRACTS: {[key: string]: ContractAddresses} = {
},
OTC_OFFER: {
DAI_OHM: '0x687A4B0Ac18Ed3796D55E6A1d747bD75591a8bac',
DAI_GOHM: '0x2c4b131BEf9d676877Ae0b5b2B46914b07FB9272',
FUNDS_OWNER: '0x5C8898f8E0F9468D4A677887bC03EE2659321012',
},
EXTERNAL: {
Expand All @@ -39,6 +42,7 @@ const CORE_DEPLOYED_CONTRACTS: {[key: string]: ContractAddresses} = {
},
OLYMPUS: {
OHM_TOKEN: '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5',
GOHM_TOKEN: '0x0ab87046fBb341D058F17CBC4c1133F25a20a52f',
},
}
},
Expand All @@ -59,13 +63,15 @@ export interface ContractInstances {
},
OTC_OFFER: {
DAI_OHM: OtcOffer,
DAI_GOHM: OtcOffer,
},
EXTERNAL: {
MAKER_DAO: {
DAI_TOKEN: FakeERC20,
},
OLYMPUS: {
OHM_TOKEN: FakeERC20CustomDecimals,
OHM_TOKEN: FakeERC20CustomDecimals, // 9DP
GOHM_TOKEN: FakeERC20, // 18DP
},
},
}
Expand All @@ -79,13 +85,15 @@ export function connectToContracts(owner: Signer): ContractInstances {
},
OTC_OFFER: {
DAI_OHM: OtcOffer__factory.connect(CORE_ADDRESSES.OTC_OFFER.DAI_OHM, owner),
DAI_GOHM: OtcOffer__factory.connect(CORE_ADDRESSES.OTC_OFFER.DAI_GOHM, owner),
},
EXTERNAL: {
MAKER_DAO: {
DAI_TOKEN: FakeERC20__factory.connect(CORE_ADDRESSES.EXTERNAL.MAKER_DAO.DAI_TOKEN, owner),
},
OLYMPUS: {
OHM_TOKEN: FakeERC20CustomDecimals__factory.connect(CORE_ADDRESSES.EXTERNAL.OLYMPUS.OHM_TOKEN, owner),
GOHM_TOKEN: FakeERC20__factory.connect(CORE_ADDRESSES.EXTERNAL.OLYMPUS.GOHM_TOKEN, owner),
},
},
}
Expand Down

0 comments on commit 8c3989a

Please sign in to comment.