Skip to content

Commit c0f4106

Browse files
authored
Merge pull request #62 from aave/fix/mpsc0x/migr-1
fix: moved to dfa in coin_migrator
2 parents a8d3cc3 + 4aa193d commit c0f4106

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

aave-core/sources/aave-periphery/coin_migrator.move

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module aave_pool::coin_migrator {
88
use std::string::String;
99
use aptos_std::type_info::Self;
1010
use aptos_framework::fungible_asset::{Self, Metadata};
11+
use aptos_framework::dispatchable_fungible_asset::Self;
1112
use aptos_framework::primary_fungible_store;
1213
use aptos_framework::object;
1314
use aptos_framework::coin::{Self};
@@ -55,7 +56,7 @@ module aave_pool::coin_migrator {
5556
primary_fungible_store::ensure_primary_store_exists(
5657
signer::address_of(account), wrapped_fa_meta
5758
);
58-
fungible_asset::deposit(account_wallet, wrapped_fa);
59+
dispatchable_fungible_asset::deposit(account_wallet, wrapped_fa);
5960

6061
event::emit(
6162
CoinToFaConvertion {

aave-core/tests/aave-periphery/coin_migrator_tests.move

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module aave_pool::coin_migrator_tests {
77
use aptos_framework::account::{Self};
88
use aptos_framework::coin::{Self};
99
use aptos_framework::fungible_asset::{Self, Metadata};
10+
use aptos_framework::dispatchable_fungible_asset::Self;
1011
use aptos_framework::aggregator_factory::initialize_aggregator_factory_for_test;
1112
use aptos_framework::event::emitted_events;
1213
use aptos_framework::object;
@@ -142,7 +143,7 @@ module aave_pool::coin_migrator_tests {
142143
);
143144

144145
// deposit the wrapped FungibleAsset into Alice wallet
145-
fungible_asset::deposit(alice_wallet, wrapped_fa);
146+
dispatchable_fungible_asset::deposit(alice_wallet, wrapped_fa);
146147

147148
// assert alice has both equal balances of coins and the converted fas as they are the same
148149
assert!(
@@ -151,7 +152,8 @@ module aave_pool::coin_migrator_tests {
151152
TEST_SUCCESS
152153
);
153154
assert!(
154-
fungible_asset::balance(alice_wallet) == alice_init_balance,
155+
dispatchable_fungible_asset::derived_balance(alice_wallet)
156+
== alice_init_balance,
155157
TEST_SUCCESS
156158
);
157159

@@ -171,7 +173,7 @@ module aave_pool::coin_migrator_tests {
171173
TEST_SUCCESS
172174
);
173175
assert!(
174-
fungible_asset::balance(alice_wallet)
176+
dispatchable_fungible_asset::derived_balance(alice_wallet)
175177
== alice_init_balance - transfer_amount,
176178
TEST_SUCCESS
177179
);
@@ -182,7 +184,7 @@ module aave_pool::coin_migrator_tests {
182184
TEST_SUCCESS
183185
);
184186
assert!(
185-
fungible_asset::balance(bob_wallet) == transfer_amount,
187+
dispatchable_fungible_asset::derived_balance(bob_wallet) == transfer_amount,
186188
TEST_SUCCESS
187189
);
188190

@@ -192,14 +194,18 @@ module aave_pool::coin_migrator_tests {
192194
coin::balance<GenericAptosCoin>(signer::address_of(bob)) == 0,
193195
TEST_SUCCESS
194196
);
195-
assert!(fungible_asset::balance(bob_wallet) == 0, TEST_SUCCESS);
197+
assert!(
198+
dispatchable_fungible_asset::derived_balance(bob_wallet) == 0, TEST_SUCCESS
199+
);
196200
assert!(
197201
coin::balance<GenericAptosCoin>(signer::address_of(alice))
198202
== alice_init_balance,
199203
TEST_SUCCESS
200204
);
201205
assert!(
202-
fungible_asset::balance(alice_wallet) == alice_init_balance, TEST_SUCCESS
206+
dispatchable_fungible_asset::derived_balance(alice_wallet)
207+
== alice_init_balance,
208+
TEST_SUCCESS
203209
);
204210
}
205211

@@ -279,7 +285,9 @@ module aave_pool::coin_migrator_tests {
279285
TEST_SUCCESS
280286
);
281287
assert!(
282-
fungible_asset::balance(alice_wallet) == alice_init_balance, TEST_SUCCESS
288+
dispatchable_fungible_asset::derived_balance(alice_wallet)
289+
== alice_init_balance,
290+
TEST_SUCCESS
283291
);
284292
}
285293

@@ -425,7 +433,7 @@ module aave_pool::coin_migrator_tests {
425433
primary_fungible_store::ensure_primary_store_exists(
426434
alice_address, wrapped_fa_meta
427435
);
428-
let alice_fa_balance = fungible_asset::balance(alice_wallet);
436+
let alice_fa_balance = dispatchable_fungible_asset::derived_balance(alice_wallet);
429437
assert!(alice_fa_balance == alice_init_balance, TEST_SUCCESS);
430438
}
431439

0 commit comments

Comments
 (0)