-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exchange Deployer #62
base: main
Are you sure you want to change the base?
Conversation
Contract comparison - from 6436375 to 66c1591
|
reward_token_id, | ||
farming_token_id, | ||
division_safety_constant, | ||
pair_contract_address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the pair contract needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, the farm requests it on deploy. My guess is it sends the tokens there instead of burning them if it can.
fn deployed_contracts( | ||
&self, | ||
user_address: &ManagedAddress, | ||
) -> UnorderedSetMapper<ManagedAddress>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the deployed contracts are stored here, but there is no info about the SC type. Should there be a info stored for each deployed address that specify the SC type?
.execute_on_dest_context(); | ||
} | ||
|
||
#[endpoint(proxyDexSetTransferRoleWrappedLpToken)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone can call these endpoints? Is this safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the deployer of the contract can call this:
self.require_deployed_contract(&caller, &proxy_dex_address);
/// `0` - SimpleFarm - rewards are fungible tokens | ||
/// `1` - FarmWithLockedRewards - rewards are META ESDT locked tokens | ||
#[endpoint(simpleLockAddFarmToWhitelist)] | ||
fn simple_lock_add_farm_to_whitelist( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same. Maybe some admin roles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
|
||
#[multiversx_sc::module] | ||
pub trait CommonModule { | ||
fn get_default_code_metadata(&self) -> CodeMetadata { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Receive the address as a parameter and use the new get_code_metadata()
framework function instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, no address as parameter, this is just the default value I use.
+ multiversx_sc_modules::pause::PauseModule | ||
{ | ||
#[init] | ||
fn init( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not store all these addresses unde the same storage, but using a DeployActionType
enum value as the key. You will remove a lot of different storages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like the customActionFee
storage.
#[view(getActionFee)] | ||
fn get_action_fee(&self, action_type: DeployActionType) -> BigUint { | ||
let custom_fee = self.custom_action_fee(action_type).get(); | ||
if custom_fee > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this a request? This means that you cannot have 0 fee, even if you wanted to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
} | ||
|
||
#[storage_mapper("deployedContracts")] | ||
fn deployed_contracts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, from what I saw from the general ProxyDeployer SC, having the information about all the deployed contracts of a specific type would be very helpful (for the microservice). Maybe add a new storage, as Costin suggested, having all the deployed contracts under a contract type key.
pub mod fee; | ||
|
||
#[multiversx_sc::contract] | ||
pub trait ExchangeDeployer: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have an only_owner
endpoint, that allows the owner of the exchange deployer to call any only_owner
endpoint of the deployed contracts. Right now you can only deploy SCs and maybe whitelist the deployer as an admin. But in case we want to remove the deployer from the admin whitelist (for being malicious let's say), you cannot do so. And this extends to all kinds of use cases, where we want to call owner endpoints.
No description provided.