Skip to content

Commit

Permalink
updated snx adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolev-igor committed Mar 13, 2020
1 parent be2887c commit 0b57795
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
17 changes: 14 additions & 3 deletions contracts/adapters/SynthetixAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import { Adapter } from "./Adapter.sol";
import { Component } from "../Structs.sol";


/**
* @dev Proxy contract interface.
* Only the functions required for SynthetixAdapter contract are added.
* The Proxy contract is available here
* https://github.com/Synthetixio/synthetix/blob/master/contracts/Proxy.sol.
*/
interface Proxy {
function target() external view returns (address);
}


/**
* @dev Synthetix contract interface.
* Only the functions required for SynthetixAdapter contract are added.
Expand All @@ -25,8 +36,8 @@ interface Synthetix {
*/
contract SynthetixAdapter is Adapter {

address internal constant SNX = 0x153C3148A0a285A6f9F6d1996E1348832249bF7e;
address internal constant SUSD = 0x2A020C1ad728f1C12735bC4877CEECa4491A4a3D;
address internal constant SNX = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F;
address internal constant SUSD = 0x57Ab1ec28D129707052df4dF418D58a2D46d5f51;

/**
* @return Name of the protocol.
Expand All @@ -41,7 +52,7 @@ contract SynthetixAdapter is Adapter {
* @dev Implementation of Adapter function.
*/
function getAssetAmount(address asset, address user) external view override returns (int256) {
Synthetix synthetix = Synthetix(SNX);
Synthetix synthetix = Synthetix(Proxy(SNX).target());
if (asset == SNX) {
return int256(synthetix.balanceOf(user) - synthetix.transferableSynthetix(user));
} else if (asset == SUSD) {
Expand Down
4 changes: 1 addition & 3 deletions migrations_scripts/1_deploy_registry_and_all_adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = (deployer, network, accounts) => {
const mkrAddress = '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2';
const manaAddress = '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942';
const zrxAddress = '0xE41d2489571d322189246DaFA5ebDe1F4699F498';
const snxProxyAddress = '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F';
const snxAddress = '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F';
const wbtcAddress = '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599';

const cDAIAddress = '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643';
Expand All @@ -41,8 +41,6 @@ module.exports = (deployer, network, accounts) => {

const saiAddress = '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359';

const snxAddress = '0x7cB89c509001D25dA9938999ABFeA6740212E5f0';

const aaveAdapterAssets = [
daiAddress,
tusdAddress,
Expand Down
4 changes: 2 additions & 2 deletions test/SynthetixAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const AdapterRegistry = artifacts.require('./AdapterRegistry');
const SynthetixAdapter = artifacts.require('./SynthetixAdapter');

contract('SynthetixAdapter', () => {
const snxAddress = '0x153C3148A0a285A6f9F6d1996E1348832249bF7e';
const susdAddress = '0x2A020C1ad728f1C12735bC4877CEECa4491A4a3D';
const snxAddress = '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F';
const susdAddress = '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51';
const testAddress = '0xa5f7a39e55d7878bc5bd754ee5d6bd7a7662355b';
const incorrectAsset = '0x1C83501478f1320977047008496DACBD60Bb15ef';

Expand Down

0 comments on commit 0b57795

Please sign in to comment.