forked from Synthetixio/synthetix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExchangerWithVirtualSynth.sol
35 lines (28 loc) · 1.06 KB
/
ExchangerWithVirtualSynth.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pragma solidity ^0.5.16;
// Inheritance
import "./Exchanger.sol";
// Internal references
import "./interfaces/IVirtualSynth.sol";
import "./VirtualSynth.sol";
// https://docs.synthetix.io/contracts/source/contracts/exchangerwithvirtualsynth
contract ExchangerWithVirtualSynth is Exchanger {
constructor(address _owner, address _resolver) public Exchanger(_owner, _resolver) {}
function _createVirtualSynth(
IERC20 synth,
address recipient,
uint amount,
bytes32 currencyKey
) internal returns (IVirtualSynth vSynth) {
// prevent inverse synths from being allowed due to purgeability
require(currencyKey[0] != 0x69, "Cannot virtualize this synth");
vSynth = new VirtualSynth(synth, resolver, recipient, amount, currencyKey);
emit VirtualSynthCreated(address(synth), recipient, address(vSynth), currencyKey, amount);
}
event VirtualSynthCreated(
address indexed synth,
address indexed recipient,
address vSynth,
bytes32 currencyKey,
uint amount
);
}