Skip to content

Commit

Permalink
set up abi-encoder for etherscan verification
Browse files Browse the repository at this point in the history
  • Loading branch information
aparnakr committed Feb 11, 2020
1 parent b0a62d0 commit 42ad2e6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
8 changes: 8 additions & 0 deletions abi-encode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var abi = require('ethereumjs-abi')

var parameterTypes = ["address", "int32", "address", "int32", "int32", "uint256", "int32", "address", "uint256", "address", "address", "uint256"];
var parameterValues = ["0x0000000000000000000000000000000000000000", "-18", "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", "-8", "-8", "2", "-10", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "1612915200", "0x5778f2824a114F6115dc74d432685d3336216017", "0x7054e08461e3eCb7718B63540adDB3c3A1746415", "1612915200"];

var encoded = abi.rawEncode(parameterTypes, parameterValues);

console.log(encoded.toString('hex'));
22 changes: 11 additions & 11 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ module.exports = function (deployer) {
// compoundOracle = await deployer.deploy(Oracle, compoundOracleAddress);
compoundOracle = await deployer.deploy(MockCompoundOracle);
} else if ((await web3.eth.net.getId()) == 1) {
// await deployer.deploy(StringComparator);
// await deployer.link(StringComparator, OptionsFactory);
// // Mainnet
// uniswapFactoryAddr = "0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95";
// compoundOracleAddress = "0x1D8aEdc9E924730DD3f9641CDb4D1B92B848b4bd";
// // compoundOracle = await deployer.deploy(Oracle, compoundOracleAddress);
await deployer.deploy(StringComparator);
await deployer.link(StringComparator, OptionsFactory);
// Mainnet
uniswapFactoryAddr = "0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95";
compoundOracleAddress = "0x1D8aEdc9E924730DD3f9641CDb4D1B92B848b4bd";
compoundOracle = await deployer.deploy(Oracle, compoundOracleAddress);
// compoundOracle = await Oracle.at('0x317166AB2bF19152D16871C8Cf1B33583e26932B');
// console.log("Oracle Address ", compoundOracle.address.toString());
console.log("Oracle Address ", compoundOracle.address.toString());
} else {
// For the local testnet
await deployer.deploy(StringComparator);
Expand All @@ -52,9 +52,9 @@ module.exports = function (deployer) {
}

// For all testnets / mainnets
// const optionsExchange = await deployer.deploy(OptionsExchange, uniswapFactoryAddr);
// console.log("Options Exchange ", optionsExchange.address.toString());
// await deployer.deploy(OptionsFactory, optionsExchange.address, compoundOracle.address);
// console.log("Options Factory ", OptionsFactory.address.toString());
const optionsExchange = await deployer.deploy(OptionsExchange, uniswapFactoryAddr);
console.log("Options Exchange ", optionsExchange.address.toString());
await deployer.deploy(OptionsFactory, optionsExchange.address, compoundOracle.address);
console.log("Options Factory ", OptionsFactory.address.toString());
})
};
20 changes: 10 additions & 10 deletions test/sell-and-buy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ contract('OptionsContract', accounts => {
cDaiAddress = '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643';
uniswapFactoryAddress = '0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95';

optionsExchangeAddress = '0x1460771B713E8e58e350F9d82F7b83ACB6b2e75f';
optionsFactoryAddress = '0x62F55E419D7cA4C34d607A42F6C3771918a1Ff90';
optionsExchangeAddress = '0x5778f2824a114F6115dc74d432685d3336216017';
optionsFactoryAddress = '0xb529964F86fbf99a6aA67f72a27e59fA3fa4FEaC';
optionsContractAddresses = [
'0x9aC585788C6A52caAc0f8cCdC1Df77Eb62f8aCC8',
'0x8413FC80aC9a43A85bdDDE99710f522fA30B005B'
'0xddaC4AED7c8F73032b388EFe2c778FC194BC81ed',
'0x8ED9f862363fFdFD3a07546e618214b6D59F03d4'
];
oracleAddress = '0x317166AB2bF19152D16871C8Cf1B33583e26932B';
oracleAddress = '0x7054e08461e3eCb7718B63540adDB3c3A1746415';
}
if (!contractsDeployed) {
oracle = await Oracle.deployed();
Expand Down Expand Up @@ -193,12 +193,12 @@ contract('OptionsContract', accounts => {
});

describe('set symbol + names', () => {
it('set the symbol, name and test it is non-null', async () => {
xit('set the symbol, name and test it is non-null', async () => {
// if(!contractsDeployed) {
let i;
const details = [
{name: 'Opyn Compound Dai', symbol: 'ocDai'},
{name: 'Opyn Compound USDC', symbol: 'ocUSDC'}
{name: 'Opyn cDai Insurance', symbol: 'ocDai'},
{name: 'Opyn cUSDC Insurance', symbol: 'ocUSDC'}
];
for (i = 0; i < optionsContracts.length; i++) {
optionsContracts[i].setDetails(details[i].name, details[i].symbol);
Expand Down Expand Up @@ -341,15 +341,15 @@ contract('OptionsContract', accounts => {
await optionsExchange.premiumToPay(
optionsContracts[0].address,
'0x0000000000000000000000000000000000000000',
'2'
'1'
)
).toString();

await optionsExchange.buyOTokens(
creatorAddress,
optionsContracts[0].address,
'0x0000000000000000000000000000000000000000',
'2',
'1',
{
value: premiumToPay
}
Expand Down

0 comments on commit 42ad2e6

Please sign in to comment.