Skip to content

Commit

Permalink
intermediate
Browse files Browse the repository at this point in the history
  • Loading branch information
aalavandhan committed Nov 2, 2021
1 parent c5862a6 commit 528f4b3
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 54 deletions.
20 changes: 20 additions & 0 deletions contracts/_test/UFragmentsTestnet.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Importing uFragments contract dependencies to be compiled for integration tests
pragma solidity 0.7.6;

import {UFragments} from "uFragments/contracts/UFragments.sol";

contract UFragmentsTestnet is UFragments {
event Result(bool result, bytes reason);

function isArbitrumEnabled() external view returns (uint8) {
return uint8(0xa4b1);
}

// NOTE: this allows the token contarct to register itself with the bridge on testnet
// The AMPL contract on mainnet is immutable and this can't be used!
function externalCall(address destination, bytes calldata data, uint256 value) external payable {
(bool result, bytes memory reason) = destination.call{value: value}(data);
emit Result(result, reason);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ contract AMPLArbitrumGateway is
IERC20(_l1Token).safeTransferFrom(from, address(this), _amount);
IERC20(_l1Token).approve(vault, _amount);

ITokenVault(vault).lock(_l1Token, from, _amount);
ITokenVault(vault).lock(_l1Token, address(this), _amount);

emit XCTransferOut(from, address(0), _amount, recordedGlobalAMPLSupply);
}
Expand Down
1 change: 1 addition & 0 deletions helpers/contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ContractABIPaths = {
UFragmentsPolicy: 'uFragments/contracts',
Orchestrator: 'uFragments/contracts',
MedianOracle: 'market-oracle/contracts',
UFragmentsTestnet: 'contracts/_test',

// Chainbridge
Bridge: 'chainbridge-solidity/contracts',
Expand Down
6 changes: 3 additions & 3 deletions helpers/deploy/ampl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
deployProxyContract,
} = require('../contracts');

async function deployAMPLContracts(
async function deployAMPLTestnetContracts(
ethers,
deployer,
txParams = {},
Expand All @@ -18,7 +18,7 @@ async function deployAMPLContracts(

const ampl = await deployProxyContract(
ethers,
'UFragments',
'UFragmentsTestnet',
proxyAdmin,
deployer,
[deployerAddress],
Expand Down Expand Up @@ -164,6 +164,6 @@ async function deployXCAmpleContracts(
}

module.exports = {
deployAMPLContracts,
deployAMPLTestnetContracts,
deployXCAmpleContracts,
};
36 changes: 18 additions & 18 deletions sdk/deployments/dev3RinkebyArbitrumSatChain.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"proxyAdmin": {
"address": "0x7A3ce10573718e00F63187598b5BBe1D82931b28",
"address": "0xbAdBD05c2eC381B2DdF610E125A73baBda54fc7f",
"abi": [
"event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)",
"function changeProxyAdmin(address proxy, address newAdmin)",
Expand All @@ -13,11 +13,11 @@
"function upgrade(address proxy, address implementation)",
"function upgradeAndCall(address proxy, address implementation, bytes data) payable"
],
"hash": "0xabb51fb3c568f280ccdfb834c77be3837585f566a58007832cae22e37ea43467",
"blockNumber": 5974712
"hash": "0x800809255038a5d6659ff394b65b1334ac215c017d7ea8c43e16fa91c55ec753",
"blockNumber": 6019296
},
"xcAmple": {
"address": "0x9B76a1139bcE77399f88a0E397F044094c289a89",
"address": "0x4162aEE7665a2b8EafE5C257e600DEa7c4296f73",
"abi": [
"event Approval(address indexed owner, address indexed spender, uint256 value)",
"event ControllerUpdated(address controller)",
Expand Down Expand Up @@ -56,11 +56,11 @@
"function transferFrom(address from, address to, uint256 value) returns (bool)",
"function transferOwnership(address newOwner)"
],
"hash": "0x0eda762c735a4407c211a484aa6923359c0feb46e8f917ca4ce256b99eb44940",
"blockNumber": 5974717
"hash": "0xd14fd701a190ab766181adfeb5e94b94011cf6628672521b2e789f3066f5623d",
"blockNumber": 6019298
},
"xcAmpleController": {
"address": "0x6F1cE4B4B7C30c903A42FDc0D77c8671393101C0",
"address": "0xDFbE71D6D42284e9a28aA84304c4696dE0e89f99",
"abi": [
"event GatewayBurn(address indexed bridgeGateway, address indexed depositor, uint256 xcAmpleAmount)",
"event GatewayMint(address indexed bridgeGateway, address indexed recipient, uint256 xcAmpleAmount)",
Expand Down Expand Up @@ -88,11 +88,11 @@
"function whitelistedBridgeGateways(address) view returns (bool)",
"function xcAmple() view returns (address)"
],
"hash": "0xde8074129b911b6281faf4d8ea6e9c6649453a85837ee2ffa9afa5f318da5093",
"blockNumber": 5974726
"hash": "0x3081fdb2f1146254f743c8c4940b7fd6e6356927f94918227a07fc1ed4da4f9c",
"blockNumber": 6019305
},
"rebaseRelayer": {
"address": "0x91F2B10275A9C3F461ea19BB51ff960c3b933303",
"address": "0xBf1D78dEC7f1D82CCF0c45ab7Ee362e72BeE6f39",
"abi": [
"event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)",
"event TransactionFailed(address indexed destination, uint256 index, bytes data, bytes reason)",
Expand All @@ -108,12 +108,12 @@
"function transactionsSize() view returns (uint256)",
"function transferOwnership(address newOwner)"
],
"hash": "0x22d7267332c9dd172ddb8a02a9ad339418c2e6294eb756984ab690c49d1934a5",
"blockNumber": 5974731
"hash": "0x48788898957d483844e03f54f7eb6c330f32d59503872c7864b8fc5469390c21",
"blockNumber": 6019311
},
"isBaseChain": false,
"arbitrum/transferGateway": {
"address": "0x2eAb9dE5f87a4A3261f1e33Dc4DB3EC0a68Ae61c",
"address": "0x75c00CF8B6C932AaD2E20fa238a57D389aE3842d",
"abi": [
"constructor(address xcAmple_, address xcController_)",
"event DepositFinalized(address indexed l1Token, address indexed _from, address indexed _to, uint256 _amount)",
Expand All @@ -136,11 +136,11 @@
"function xcAmple() view returns (address)",
"function xcController() view returns (address)"
],
"hash": "0x30b6c6898fc57f20a835c7182051f3a92d68345bf97aa64c2afd3b683d1ec59c",
"blockNumber": 5975087
"hash": "0xb43520d64bc6ba1d1af688745608b7414e43457b484103f7f3f4a55c9bab2fe7",
"blockNumber": 6019546
},
"arbitrum/rebaseGateway": {
"address": "0x2eAb9dE5f87a4A3261f1e33Dc4DB3EC0a68Ae61c",
"address": "0x75c00CF8B6C932AaD2E20fa238a57D389aE3842d",
"abi": [
"constructor(address xcAmple_, address xcController_)",
"event DepositFinalized(address indexed l1Token, address indexed _from, address indexed _to, uint256 _amount)",
Expand All @@ -163,7 +163,7 @@
"function xcAmple() view returns (address)",
"function xcController() view returns (address)"
],
"hash": "0x30b6c6898fc57f20a835c7182051f3a92d68345bf97aa64c2afd3b683d1ec59c",
"blockNumber": 5975087
"hash": "0xb43520d64bc6ba1d1af688745608b7414e43457b484103f7f3f4a55c9bab2fe7",
"blockNumber": 6019546
}
}
57 changes: 30 additions & 27 deletions sdk/deployments/dev3RinkebyBaseChain.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"proxyAdmin": {
"address": "0x2E5D096ef6f134A89270e791F502bCbA099d6f68",
"address": "0x38fab7E342311cF384f76d1Ea31c4AFcc565c55c",
"abi": [
"event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)",
"function changeProxyAdmin(address proxy, address newAdmin)",
Expand All @@ -13,17 +13,18 @@
"function upgrade(address proxy, address implementation)",
"function upgradeAndCall(address proxy, address implementation, bytes data) payable"
],
"hash": "0x664201f2c6b027c92fc8de997fef95f3d8aca0a8936d5e7bf80ff36f569f0f5d",
"blockNumber": 9528020
"hash": "0x0c4d620b0220a581f617919b347f7a078f312bcc51c047a042b2a63fecb10835",
"blockNumber": 9535696
},
"ampl": {
"address": "0xBb6ae64dAeE2264708cFc6c62100027c0bAB5a67",
"address": "0x244E12361f488adFa757E706466023673a96Fa3d",
"abi": [
"event Approval(address indexed owner, address indexed spender, uint256 value)",
"event LogMonetaryPolicyUpdated(address monetaryPolicy)",
"event LogRebase(uint256 indexed epoch, uint256 totalSupply)",
"event OwnershipRenounced(address indexed previousOwner)",
"event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)",
"event Result(bool result, bytes reason)",
"event Transfer(address indexed from, address indexed to, uint256 value)",
"function DOMAIN_SEPARATOR() view returns (bytes32)",
"function EIP712_DOMAIN() view returns (bytes32)",
Expand All @@ -34,9 +35,11 @@
"function balanceOf(address who) view returns (uint256)",
"function decimals() view returns (uint8)",
"function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)",
"function externalCall(address destination, bytes data, uint256 value) payable",
"function increaseAllowance(address spender, uint256 addedValue) returns (bool)",
"function initialize(string name, string symbol, uint8 decimals)",
"function initialize(address owner_)",
"function isArbitrumEnabled() view returns (uint8)",
"function isOwner() view returns (bool)",
"function monetaryPolicy() view returns (address)",
"function name() view returns (string)",
Expand All @@ -56,11 +59,11 @@
"function transferFrom(address from, address to, uint256 value) returns (bool)",
"function transferOwnership(address newOwner)"
],
"hash": "0xbc9e7e26e329f0d0f2fa203a849f20ab4f8f39762fd40816a3cef15926480720",
"blockNumber": 9528020
"hash": "0x4dc164878c11e4bd6ba0986435d68a013dfb1dcf762ac2624db4632802b58aa0",
"blockNumber": 9535696
},
"policy": {
"address": "0xa5520E5bED964560d2B5d75A025B0FB78C97b1D4",
"address": "0x4964610919942c8680A0717b342c2A6176FE16b2",
"abi": [
"event LogRebase(uint256 indexed epoch, uint256 exchangeRate, uint256 cpi, int256 requestedSupplyAdjustment, uint256 timestampSec)",
"event OwnershipRenounced(address indexed previousOwner)",
Expand Down Expand Up @@ -92,11 +95,11 @@
"function transferOwnership(address newOwner)",
"function uFrags() view returns (address)"
],
"hash": "0x2f5bd869e28d941e588d56fde87a6e8c97b613f4b64099a6c9dcc245a6d1e2cb",
"blockNumber": 9528041
"hash": "0xfbf40d4e2e276af206825e29bab48824a267fd9baec2822c60ab79321fdd4bc8",
"blockNumber": 9535712
},
"orchestrator": {
"address": "0x058c1c118373d2291adF21CB4C395698Ae2552E6",
"address": "0x90dE686Ba9289A2978B23Bf199299A33eA3ef036",
"abi": [
"constructor(address policy_)",
"event OwnershipRenounced(address indexed previousOwner)",
Expand All @@ -114,11 +117,11 @@
"function transactionsSize() view returns (uint256)",
"function transferOwnership(address newOwner)"
],
"hash": "0xcde9d28067494e5512e1430388ca2da66869f2c43204ee9c1de8beda9ac94216",
"blockNumber": 9528057
"hash": "0xe7bd741ac56bbbcaee274b1261f237864b537f2dfba5ac86ed696132fc72409d",
"blockNumber": 9535726
},
"rateOracle": {
"address": "0x89Fb2e35cEf8480342d441702a82ED041135202d",
"address": "0x7156F72425C0D6A729b0016F7DC1E00050f6DA6E",
"abi": [
"function reportDelaySec() view returns (uint256)",
"function pushReport(uint256 payload)",
Expand All @@ -145,11 +148,11 @@
"event ProviderReportPushed(address indexed provider, uint256 payload, uint256 timestamp)",
"event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)"
],
"hash": "0x656950a4690a21fbc0fde59312a7c94c7f0cd1d95dc22690dbcb2f70dd7e0ee0",
"blockNumber": 9528029
"hash": "0x9f2e3ef3361cbce993f5dafc6bff2223164b6b75d61a842e721db1224577b3fc",
"blockNumber": 9535700
},
"cpiOracle": {
"address": "0x21e9d1FfE15991dD27256ff42963C86374d97B0E",
"address": "0x6e31D7Ea7176238392c07d58Fb9e3c6D78ae8910",
"abi": [
"function reportDelaySec() view returns (uint256)",
"function pushReport(uint256 payload)",
Expand All @@ -176,12 +179,12 @@
"event ProviderReportPushed(address indexed provider, uint256 payload, uint256 timestamp)",
"event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)"
],
"hash": "0xbfa768aa20932344396b3d93fda79bf5269f7c3d0415194e8aac9def55e44124",
"blockNumber": 9528035
"hash": "0x62577b74d7b88b0a748651998d134af4de3cc692b95145430b24ff7fd7c9e721",
"blockNumber": 9535706
},
"isBaseChain": true,
"arbitrum/tokenVault": {
"address": "0xf704fCA2fd138E31760aa242240B78b7Ba89d2d2",
"address": "0x02C04C9DF6F994BFd54C66e770e5945f444A9526",
"abi": [
"event GatewayLocked(address indexed bridgeGateway, address indexed token, address indexed depositor, uint256 amount)",
"event GatewayUnlocked(address indexed bridgeGateway, address indexed token, address indexed recipient, uint256 amount)",
Expand All @@ -197,11 +200,11 @@
"function unlock(address token, address recipient, uint256 amount)",
"function whitelistedBridgeGateways(address) view returns (bool)"
],
"hash": "0x0c4060895cab3e4693fc5d6ba0924ff864cb188639fef0d3501415d2cda5ccd1",
"blockNumber": 9349617
"hash": "0x773e193e00f36636c7bb633e31e6acecc2b428b54f0543ee8c698be60110d7c1",
"blockNumber": 9535747
},
"arbitrum/transferGateway": {
"address": "0x60CcDea1Ba997e2D781C13b5E6B4f7Fec94eE691",
"address": "0xbAb60bb39D6f086CA2e7e578fbF945E61a12cE3a",
"abi": [
"constructor(address ampl_, address policy_, address vault_)",
"event DepositInitiated(address l1Token, address indexed _from, address indexed _to, uint256 indexed _sequenceNumber, uint256 _amount)",
Expand All @@ -225,11 +228,11 @@
"function vault() view returns (address)",
"function xcAmple() view returns (address)"
],
"hash": "0x6bdcd4aadb75b28a76e6c166e5d25ac982788e8500855ab809b9d8dd5c02115c",
"blockNumber": 9528225
"hash": "0xbb5bda37bdd726212b9c9cc5c08045d8b4eeec3631d24ba4a3293b8f34362b54",
"blockNumber": 9535779
},
"arbitrum/rebaseGateway": {
"address": "0x60CcDea1Ba997e2D781C13b5E6B4f7Fec94eE691",
"address": "0xbAb60bb39D6f086CA2e7e578fbF945E61a12cE3a",
"abi": [
"constructor(address ampl_, address policy_, address vault_)",
"event DepositInitiated(address l1Token, address indexed _from, address indexed _to, uint256 indexed _sequenceNumber, uint256 _amount)",
Expand All @@ -253,7 +256,7 @@
"function vault() view returns (address)",
"function xcAmple() view returns (address)"
],
"hash": "0x6bdcd4aadb75b28a76e6c166e5d25ac982788e8500855ab809b9d8dd5c02115c",
"blockNumber": 9528225
"hash": "0xbb5bda37bdd726212b9c9cc5c08045d8b4eeec3631d24ba4a3293b8f34362b54",
"blockNumber": 9535779
}
}
5 changes: 3 additions & 2 deletions tasks/deploy/ampleforth.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
} = require('../../helpers/contracts');

const {
deployAMPLContracts,
deployAMPLTestnetContracts,
deployXCAmpleContracts,
deployTokenVault,
} = require('../../helpers/deploy');
Expand Down Expand Up @@ -103,7 +103,7 @@ txTask('testnet:deploy:ampleforth', 'Deploy ampleforth contract suite')
console.log('Deployer:', deployerAddress);

const { proxyAdmin, ampl, policy, orchestrator, rateOracle, cpiOracle } =
await deployAMPLContracts(hre.ethers, deployer, txParams, 2);
await deployAMPLTestnetContracts(hre.ethers, deployer, txParams, 2);
for (const w in args.fundingWallets) {
await ampl.transfer(args.fundingWallets[w], toAmplFixedPt(args.amount));
}
Expand Down Expand Up @@ -149,6 +149,7 @@ txTask('deploy:ampleforth_xc', 'Deploy cross chain ampleforth contract suite')
if (txParams.gasPrice == 0) {
txParams.gasPrice = await hre.ethers.provider.getGasPrice();
}
// const txParams = {}

const deployer = await loadSignerSync(args, hre.ethers.provider);
const deployerAddress = await deployer.getAddress();
Expand Down
Loading

0 comments on commit 528f4b3

Please sign in to comment.