You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can create the first sets of coin pair dynamic with it's names and everything but I want to make the struct Capabilities and coin creation part dynamic for every deploy_pool there should be a new pair of junior and senior tokens for that pool that maintains the supply as the total principal of the pool and junior and senior ratio and has an initial value of 1. And also how to define the coin capacity and its value and how to change the coin's value later with the function.
struct Capabilities has key {
burn_cap: BurnCapability<AptosXCoin>,
freeze_cap: FreezeCapability<AptosXCoin>,
mint_cap: MintCapability<AptosXCoin>,
}
struct AptosXCoin {}
struct SeniorCapabilities has key {
burn_cap: BurnCapability<SeniorXCoin>,
freeze_cap: FreezeCapability<SeniorXCoin>,
mint_cap: MintCapability<SeniorXCoin>,
}
struct SeniorXCoin {}
public entry fun initialize(
account: &signer,
coin_name: String,
) {
let account_addr = signer::address_of(account);
assert!(!exists<Capabilities>(account_addr), error::already_exists(EALREADY_COIN_CAP));
let (burn_cap, freeze_cap, mint_cap) = coin::initialize<AptosXCoin>(
account,
coin_name,
string::utf8(b"JT"),
8,
true
);
move_to(account, Capabilities {
burn_cap,
freeze_cap,
mint_cap,
});
}
public entry fun initializeSenior(
account: &signer,
coin_name: String,
) {
let account_addr = signer::address_of(account);
assert!(!exists<SeniorCapabilities>(account_addr), error::already_exists(EALREADY_COIN_CAP));
let (burn_cap, freeze_cap, mint_cap) = coin::initialize<SeniorXCoin>(
account,
coin_name,
string::utf8(b"ST"),
8,
true
);
move_to(account, SeniorCapabilities {
burn_cap,
freeze_cap,
mint_cap,
});
}
// Entry functions
//take all the details from the frontend of the pool details
public entry fun deploy_pool<CoinType>(account: &signer, financing_fee:u64, seeds: vector<u8>, funds:u64, deal_name: String, junior_coin_name:String, senior_coin_name:String) acquires LiquidityPools, TrancheMap, AdminEvents{
let account_addr = signer::address_of(account);
// junior tranche resource account
let (liquidity_pool, liquidity_pool_cap) = account::create_resource_account(account, seeds); //resource account
//create another resource account to manage senior tranche
let updateFunds=funds*BASE_APTOS_PRICE;
coin::register<CoinType>(&liquidity_pool);
coin::transfer<CoinType>(account, signer::address_of(&liquidity_pool), updateFunds);
//initialize the junior and senior tranche coin
initialize(account, junior_coin_name);
initializeSenior(account, senior_coin_name);
}
What error, if any, are you getting?
Due to defining the struct coin_name{} every time for the new coin. I cannot create multiple deploy_pools with multiple junior and senior tokens init. I need a way to develop junior and senior coin pair dynamics and also a way to limit their capacity define the value and later change the value of the coin.
What have you tried or looked at? Or how can we reproduce the error?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Discord user ID
itznisargthakkar
Describe your question in detail.
I can create the first sets of coin pair dynamic with it's names and everything but I want to make the struct Capabilities and coin creation part dynamic for every deploy_pool there should be a new pair of junior and senior tokens for that pool that maintains the supply as the total principal of the pool and junior and senior ratio and has an initial value of 1. And also how to define the coin capacity and its value and how to change the coin's value later with the function.
What error, if any, are you getting?
Due to defining the struct coin_name{} every time for the new coin. I cannot create multiple deploy_pools with multiple junior and senior tokens init. I need a way to develop junior and senior coin pair dynamics and also a way to limit their capacity define the value and later change the value of the coin.
What have you tried or looked at? Or how can we reproduce the error?
Call the deploy_pool function again.
Which operating system are you using?
Windows
Which SDK or tool are you using? (if any)
TypeScript SDK
Describe your environment or tooling in detail
No response
Beta Was this translation helpful? Give feedback.
All reactions