Skip to content

Commit

Permalink
add artifact for eth conversion proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
vrolland committed Sep 23, 2021
1 parent ee2bf26 commit 17cfc12
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/smart-contracts/scripts/3_deploy_chainlink_contract.ts
Expand Up @@ -2,6 +2,7 @@ import '@nomiclabs/hardhat-ethers';
import { CurrencyManager } from '@requestnetwork/currency';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import deployERC20ConversionProxy from './erc20-conversion-proxy';
import deployEthConversionProxy from './eth-conversion-proxy';
import deploySwapConversion from './erc20-swap-to-conversion';
import { deployOne } from './deploy-one';

Expand Down Expand Up @@ -65,6 +66,15 @@ export default async function deploy(args: any, hre: HardhatRuntimeEnvironment)
// FIXME: should try to retrieve information from artifacts instead
await erc20SwapConversion.approveRouterToSpend('0x9FBDa871d559710256a2502A2517b794B482Db40');

// EthConversion
const ethConversionProxyAddress = await deployEthConversionProxy(
{
...args,
chainlinkConversionPathAddress: conversionPathInstance.address,
ethFeeProxyAddress: '0x3d49d1eF2adE060a33c6E6Aa213513A7EE9a6241',
},
hre,
);
// ----------------------------------
console.log('Contracts deployed');
console.log(`
Expand All @@ -73,5 +83,6 @@ export default async function deploy(args: any, hre: HardhatRuntimeEnvironment)
ChainlinkConversionPath: ${conversionPathInstance.address}
Erc20ConversionProxy: ${erc20ConversionAddress}
Erc20SwapConversionProxy: ${erc20SwapConversionAddress}
EthConversionProxy: ${ethConversionProxyAddress}
`);
}
27 changes: 27 additions & 0 deletions packages/smart-contracts/scripts/eth-conversion-proxy.ts
@@ -0,0 +1,27 @@
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { deployOne } from './deploy-one';

export default async function deploy(
args: { chainlinkConversionPathAddress?: string; ethFeeProxyAddress?: string },
hre: HardhatRuntimeEnvironment,
) {
const contractName = 'EthConversionProxy';

if (!args.chainlinkConversionPathAddress) {
// FIXME: should try to retrieve information from artifacts instead
console.error(
`Missing ChainlinkConversionPath on ${hre.network.name}, cannot deploy ${contractName}.`,
);
return;
}
if (!args.ethFeeProxyAddress) {
// FIXME: should try to retrieve information from artifacts instead
console.error(`Missing EthereumFeeProxy on ${hre.network.name}, cannot deploy ${contractName}.`);
return;
}

return deployOne(args, hre, contractName, [
args.ethFeeProxyAddress,
args.chainlinkConversionPathAddress,
]);
}
@@ -0,0 +1,163 @@
{
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_paymentProxyAddress",
"type": "address"
},
{
"internalType": "address",
"name": "_chainlinkConversionPathAddress",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "currency",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes",
"name": "paymentReference",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "feeAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "maxRateTimespan",
"type": "uint256"
}
],
"name": "TransferWithConversionAndReference",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": true,
"internalType": "bytes",
"name": "paymentReference",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "feeAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "feeAddress",
"type": "address"
}
],
"name": "TransferWithReferenceAndFee",
"type": "event"
},
{
"inputs": [],
"name": "chainlinkConversionPath",
"outputs": [
{
"internalType": "contract ChainlinkConversionPath",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "paymentProxy",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_to",
"type": "address"
},
{
"internalType": "uint256",
"name": "_requestAmount",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "_path",
"type": "address[]"
},
{
"internalType": "bytes",
"name": "_paymentReference",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "_feeAmount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_feeAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "_maxRateTimespan",
"type": "uint256"
}
],
"name": "transferFromWithReferenceAndFee",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
]
}
@@ -0,0 +1,19 @@
import { ContractArtifact } from '../../ContractArtifact';

import { abi as ABI_0_1_0 } from './0.1.0.json';
import type { EthConversionProxy } from '../../../types/EthConversionProxy';

export const ethConversionArtifact = new ContractArtifact<EthConversionProxy>(
{
'0.1.0': {
abi: ABI_0_1_0,
deployment: {
private: {
address: '0x8273e4B8ED6c78e252a9fCa5563Adfcc75C91b2A',
creationBlockNumber: 0,
},
},
},
},
'0.1.0',
);

0 comments on commit 17cfc12

Please sign in to comment.