Skip to content

Commit

Permalink
derive currency id, update token names, use approximate asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
AStox committed Aug 1, 2024
1 parent 05498a2 commit 3b202f3
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
12 changes: 9 additions & 3 deletions src/spell/MigrationSpellBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {IRoot} from "src/interfaces/IRoot.sol";
import {IPoolManager} from "src/interfaces/IPoolManager.sol";
import {RestrictionUpdate} from "src/interfaces/token/IRestrictionManager.sol";
import {ITranche} from "src/interfaces/token/ITranche.sol";
import {IInvestmentManager} from "src/interfaces/IInvestmentManager.sol";
import {InvestmentManager} from "src/InvestmentManager.sol";
import {CastLib} from "src/libraries/CastLib.sol";
import {IAuth} from "src/interfaces/IAuth.sol";

Expand All @@ -22,11 +22,15 @@ interface IVaultOld {
function asset() external view returns (address);
}

interface IPoolManagerOld {
function currencyAddressToId(address currency) external view returns (uint128);
}

contract MigrationSpellBase {
using CastLib for *;

string public NETWORK;
uint128 public CURRENCY_ID;
// uint128 public CURRENCY_ID;
address public ROOT_OLD;
address public ADMIN_MULTISIG;
address public GUARDIAN_OLD;
Expand Down Expand Up @@ -62,7 +66,9 @@ contract MigrationSpellBase {
IPoolManager poolManager = IPoolManager(address(POOLMANAGER_NEW));
ITranche trancheTokenOld = ITranche(vaultOld.share());
uint8 DECIMALS = trancheTokenOld.decimals();
IInvestmentManager investmentManagerOld = IInvestmentManager(vaultOld.manager());
InvestmentManager investmentManagerOld = InvestmentManager(vaultOld.manager());
IPoolManagerOld poolManagerOld = IPoolManagerOld(address(investmentManagerOld.poolManager()));
uint128 CURRENCY_ID = poolManagerOld.currencyAddressToId(vaultOld.asset());
rootOld.relyContract(address(investmentManagerOld), self);
rootOld.relyContract(address(trancheTokenOld), self);

Expand Down
7 changes: 3 additions & 4 deletions src/spell/ShareMigration_DYF_EVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ contract MigrationSpell is MigrationSpellBase {
constructor() {
NETWORK = "ethereum-mainnet";
// old deployment addresses
CURRENCY_ID = 242333941209166991950178742833476896417;
ROOT_OLD = 0x498016d30Cd5f0db50d7ACE329C07313a0420502;
ADMIN_MULTISIG = 0xD9D30ab47c0f096b0AA67e9B8B1624504a63e7FD;
GUARDIAN_OLD = 0x2559998026796Ca6fd057f3aa66F2d6ecdEd9028;
Expand All @@ -32,10 +31,10 @@ contract MigrationSpell is MigrationSpellBase {
RESTRICTIONMANAGER_NEW = 0x4737C3f62Cc265e786b280153fC666cEA2fBc0c0;

// information to deploy the new tranche token & liquidity pool to be able to migrate the tokens
NAME = "Anemoy DeFi Yield Fund 1 SP DeFi Yield Fund Token";
NAME = "Anemoy DeFi Yield Fund 1";
SYMBOL = "DYF";
NAME_OLD = "DEPRECATED";
SYMBOL_OLD = "DEPRECATED";
NAME_OLD = "DYF (deprecated)";
SYMBOL_OLD = "DYF-DEPRECATED";

memberlistMembers = [0xd595E1483c507E74E2E6A3dE8e7D08d8f6F74936, 0x30d3bbAE8623d0e9C0db5c27B82dCDA39De40997];
validUntil[0xd595E1483c507E74E2E6A3dE8e7D08d8f6F74936] = type(uint64).max;
Expand Down
5 changes: 2 additions & 3 deletions src/spell/ShareMigration_LTF_Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ contract MigrationSpell is MigrationSpellBase {
constructor() {
NETWORK = "base-mainnet";
// old deployment addresses
CURRENCY_ID = 242333941209166991950178742833476896418;
ROOT_OLD = 0x498016d30Cd5f0db50d7ACE329C07313a0420502;
ADMIN_MULTISIG = 0x8b83962fB9dB346a20c95D98d4E312f17f4C0d9b;
GUARDIAN_OLD = 0x2559998026796Ca6fd057f3aa66F2d6ecdEd9028;
Expand All @@ -28,8 +27,8 @@ contract MigrationSpell is MigrationSpellBase {
NAME = "Anemoy Liquid Treasury Fund 1";
SYMBOL = "LTF";

NAME_OLD = "DEPRECATED";
SYMBOL_OLD = "DEPRECATED";
NAME_OLD = "LTF (deprecated)";
SYMBOL_OLD = "LTF-DEPRECATED";

memberlistMembers = [
0xd595E1483c507E74E2E6A3dE8e7D08d8f6F74936,
Expand Down
5 changes: 2 additions & 3 deletions src/spell/ShareMigration_LTF_Celo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ contract MigrationSpell is MigrationSpellBase {
constructor() {
NETWORK = "celo-mainnet";
// old deployment addresses
CURRENCY_ID = 242333941209166991950178742833476896420;
ROOT_OLD = 0x498016d30Cd5f0db50d7ACE329C07313a0420502;
ADMIN_MULTISIG = 0x2464f95F6901233bF4a0130A3611d5B4CBd83195;
GUARDIAN_OLD = 0x2559998026796Ca6fd057f3aa66F2d6ecdEd9028;
Expand All @@ -28,8 +27,8 @@ contract MigrationSpell is MigrationSpellBase {
NAME = "Anemoy Liquid Treasury Fund 1";
SYMBOL = "LTF";

NAME_OLD = "DEPRECATED";
SYMBOL_OLD = "DEPRECATED";
NAME_OLD = "LTF (deprecated)";
SYMBOL_OLD = "LTF-DEPRECATED";

memberlistMembers = [
0xd595E1483c507E74E2E6A3dE8e7D08d8f6F74936,
Expand Down
5 changes: 2 additions & 3 deletions src/spell/ShareMigration_LTF_EVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ contract MigrationSpell is MigrationSpellBase {
constructor() {
NETWORK = "ethereum-mainnet";
// old deployment addresses
CURRENCY_ID = 242333941209166991950178742833476896417;
ROOT_OLD = 0x498016d30Cd5f0db50d7ACE329C07313a0420502;
ADMIN_MULTISIG = 0xD9D30ab47c0f096b0AA67e9B8B1624504a63e7FD;
GUARDIAN_OLD = 0x2559998026796Ca6fd057f3aa66F2d6ecdEd9028;
Expand All @@ -25,8 +24,8 @@ contract MigrationSpell is MigrationSpellBase {
NAME = "Anemoy Liquid Treasury Fund 1";
SYMBOL = "LTF";

NAME_OLD = "DEPRECATED";
SYMBOL_OLD = "DEPRECATED";
NAME_OLD = "LTF (deprecated)";
SYMBOL_OLD = "LTF-DEPRECATED";

memberlistMembers = [
0xd595E1483c507E74E2E6A3dE8e7D08d8f6F74936,
Expand Down
5 changes: 2 additions & 3 deletions src/spell/ShareMigration_NS3JR_EVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ contract MigrationSpell is MigrationSpellBase {
constructor() {
NETWORK = "ethereum-mainnet";
// old deployment addresses
CURRENCY_ID = 242333941209166991950178742833476896417;
ROOT_OLD = 0x498016d30Cd5f0db50d7ACE329C07313a0420502;
ADMIN_MULTISIG = 0xD9D30ab47c0f096b0AA67e9B8B1624504a63e7FD;
GUARDIAN_OLD = 0x2559998026796Ca6fd057f3aa66F2d6ecdEd9028;
Expand All @@ -28,8 +27,8 @@ contract MigrationSpell is MigrationSpellBase {
NAME = "New Silver Series 3 Junior";
SYMBOL = "NS3JR";

NAME_OLD = "DEPRECATED";
SYMBOL_OLD = "DEPRECATED";
NAME_OLD = "NS3JR (deprecated)";
SYMBOL_OLD = "NS3JR-DEPRECATED";

memberlistMembers = [0xd595E1483c507E74E2E6A3dE8e7D08d8f6F74936, 0x32f5eF78AA9C7b8882D748331AdcFe0dfA4f1a14];

Expand Down
5 changes: 2 additions & 3 deletions src/spell/ShareMigration_NS3SR_EVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ contract MigrationSpell is MigrationSpellBase {
constructor() {
NETWORK = "ethereum-mainnet";
// old deployment addresses
CURRENCY_ID = 242333941209166991950178742833476896417;
ROOT_OLD = 0x498016d30Cd5f0db50d7ACE329C07313a0420502;
ADMIN_MULTISIG = 0xD9D30ab47c0f096b0AA67e9B8B1624504a63e7FD;
GUARDIAN_OLD = 0x2559998026796Ca6fd057f3aa66F2d6ecdEd9028;
Expand All @@ -28,8 +27,8 @@ contract MigrationSpell is MigrationSpellBase {
NAME = "New Silver Series 3 Senior";
SYMBOL = "NS3SR";

NAME_OLD = "DEPRECATED";
SYMBOL_OLD = "DEPRECATED";
NAME_OLD = "NS3JR (deprecated)";
SYMBOL_OLD = "NS3JR-DEPRECATED";

memberlistMembers = [0xd595E1483c507E74E2E6A3dE8e7D08d8f6F74936, 0xbe19e6AdF267248beE015dd3fbBa363E12ca8cE6];

Expand Down
14 changes: 7 additions & 7 deletions test/fork/ShareMigration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,20 @@ contract ForkTest is Deployer, Test {
for (uint8 i; i < spell.getNumberOfMigratedMembers(); i++) {
uint256 balanceNew = trancheToken.balanceOf(spell.memberlistMembers(i));
totalSupplyNew += balanceNew;
assertEq(trancheTokenToMigrate.balanceOf(spell.memberlistMembers(i)), 0);
assertApproxEqAbs(trancheTokenToMigrate.balanceOf(spell.memberlistMembers(i)), 0, 1);
if (spell.memberlistMembers(i) != vaultOld.escrow()) {
assertEq(balanceNew, balancesOld[spell.memberlistMembers(i)]);
assertApproxEqAbs(balanceNew, balancesOld[spell.memberlistMembers(i)], 1);
}
}
assertEq(trancheTokenToMigrate.balanceOf(vaultOld.escrow()), 0, 1);
assertApproxEqAbs(trancheTokenToMigrate.balanceOf(vaultOld.escrow()), 0, 1);

// check total supply
assertEq(trancheToken.totalSupply(), totalSupplyNew);
assertEq(trancheToken.totalSupply(), totalSupplyOld);
assertEq(trancheTokenToMigrate.totalSupply(), 0);
assertApproxEqAbs(trancheToken.totalSupply(), totalSupplyNew, 1);
assertApproxEqAbs(trancheToken.totalSupply(), totalSupplyOld, 1);
assertApproxEqAbs(trancheTokenToMigrate.totalSupply(), 0, 1);

// check trancheToken metadata
assertEq(trancheTokenToMigrate.name(), spell.SYMBOL_OLD());
assertEq(trancheTokenToMigrate.name(), spell.NAME_OLD());
assertEq(trancheTokenToMigrate.symbol(), spell.SYMBOL_OLD());
assertEq(trancheToken.name(), spell.NAME());
assertEq(trancheToken.symbol(), spell.SYMBOL());
Expand Down

0 comments on commit 3b202f3

Please sign in to comment.