Skip to content

Commit

Permalink
Merge pull request #937 from multiversx/legacy-contracts-audit-fixes
Browse files Browse the repository at this point in the history
legacy contracts sc error text change
  • Loading branch information
psorinionut authored Aug 3, 2024
2 parents df928d2 + 57c06a5 commit e4432b9
Show file tree
Hide file tree
Showing 19 changed files with 406 additions and 482 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion legacy-contracts/factory-legacy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ path = "../../common/common_structs"
path = "../../common/common_errors"

[dependencies.token_merge_helper]
path = "../../common/modules/token_merge_helper"
path = "../../common/modules/token_merge_helper"

[dependencies.energy-factory]
path = "../../locked-asset/energy-factory"
20 changes: 2 additions & 18 deletions legacy-contracts/factory-legacy/src/migration.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
multiversx_sc::imports!();

use common_structs::UnlockEpochAmountPairs;

mod energy_factory_proxy {
use common_structs::UnlockEpochAmountPairs;

multiversx_sc::imports!();

#[multiversx_sc::proxy]
pub trait EnergyFactoryProxy {
#[endpoint(updateEnergyAfterOldTokenUnlock)]
fn update_energy_after_old_token_unlock(
&self,
original_caller: ManagedAddress,
initial_epoch_amount_pairs: UnlockEpochAmountPairs<Self::Api>,
final_epoch_amount_pairs: UnlockEpochAmountPairs<Self::Api>,
);
}
}
use energy_factory::migration::ProxyTrait as _;

#[multiversx_sc::module]
pub trait LockedTokenMigrationModule:
Expand Down Expand Up @@ -54,7 +38,7 @@ pub trait LockedTokenMigrationModule:
fn new_factory_proxy_builder(
&self,
sc_address: ManagedAddress,
) -> energy_factory_proxy::Proxy<Self::Api>;
) -> energy_factory::Proxy<Self::Api>;

#[storage_mapper("newFactoryAddress")]
fn new_factory_address(&self) -> SingleValueMapper<ManagedAddress>;
Expand Down
53 changes: 53 additions & 0 deletions legacy-contracts/factory-legacy/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 36 additions & 36 deletions legacy-contracts/farm-v12/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub trait FarmV12 {
#[payable("*")]
#[endpoint(acceptFee)]
fn accept_fee(&self, _token_in: TokenIdentifier, _amount: BigUint) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(calculateRewardsForGivenPosition)]
Expand All @@ -31,12 +31,12 @@ pub trait FarmV12 {
_amount: BigUint,
_attributes_raw: ManagedBuffer,
) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(end_produce_rewards_as_owner)]
fn end_produce_rewards_as_owner(&self) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[payable("*")]
Expand All @@ -45,167 +45,167 @@ pub trait FarmV12 {
&self,
_opt_accept_funds_func: OptionalValue<ManagedBuffer>,
) -> ExitFarmResultType<Self::Api> {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getBurnedTokenAmount)]
fn burned_tokens(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getCurrentBlockFee)]
fn current_block_fee_storage(&self) -> Option<(Nonce, BigUint)> {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getDivisionSafetyConstant)]
fn division_safety_constant(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getFarmTokenId)]
fn farm_token_id(&self) -> TokenIdentifier {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getFarmTokenSupply)]
fn get_farm_token_supply(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getFarmingTokenId)]
fn farming_token_id(&self) -> TokenIdentifier {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getFarmingTokenReserve)]
fn farming_token_reserve(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getLastErrorMessage)]
fn last_error_message(&self) -> ManagedBuffer {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getLastRewardBlockNonce)]
fn last_reward_block_nonce(&self) -> Nonce {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getLockedAssetFactoryManagedAddress)]
fn locked_asset_factory_address(&self) -> ManagedAddress {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getLockedRewardAprMuliplier)]
fn locked_rewards_apr_multiplier(&self) -> u8 {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getMinimumFarmingEpoch)]
fn minimum_farming_epoch(&self) -> u8 {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getOwner)]
fn owner(&self) -> ManagedAddress {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getPairContractManagedAddress)]
fn pair_contract_address(&self) -> ManagedAddress {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getPenaltyPercent)]
fn penalty_percent(&self) -> u64 {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getPerBlockRewardAmount)]
fn per_block_reward_amount(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getRewardPerShare)]
fn reward_per_share(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getRewardReserve)]
fn reward_reserve(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getRewardTokenId)]
fn reward_token_id(&self) -> TokenIdentifier {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getRouterManagedAddress)]
fn router_address(&self) -> ManagedAddress {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getState)]
fn state(&self) -> State {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getTransferExecGasLimit)]
fn transfer_exec_gas_limit(&self) -> u64 {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getUndistributedFees)]
fn undistributed_fee_storage(&self) -> BigUint {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(pause)]
fn pause(&self) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(resume)]
fn resume(&self) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(setPerBlockRewardAmount)]
fn set_per_block_reward_amount(&self, _per_block_amount: BigUint) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[only_owner]
#[endpoint(setTransferRoleFarmToken)]
fn set_transfer_role_farm_token(&self, _opt_address: OptionalValue<ManagedAddress>) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(set_locked_rewards_apr_multiplier)]
fn set_locked_rewards_apr_multiplier(&self, _muliplier: u8) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(set_minimum_farming_epochs)]
fn set_minimum_farming_epochs(&self, _epochs: u8) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(set_penalty_percent)]
fn set_penalty_percent(&self, _percent: u64) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(set_transfer_exec_gas_limit)]
fn set_transfer_exec_gas_limit(&self, _gas_limit: u64) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint(start_produce_rewards)]
fn start_produce_rewards(&self) {
sc_panic!("This is a legacy contract, should not be interacted with");
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}
}
Loading

0 comments on commit e4432b9

Please sign in to comment.