lindy-labs / opus_contracts

Opus Source Code
https://opus.money
Other
0 stars 0 forks source link

feat: restricted transmuter #590

Closed tserg closed 5 months ago

tserg commented 5 months ago

This PR adds a variant of the Transmuter with the following changes:

  1. transmute and reverse require access control roles.
  2. The percentage cap limit is removed.
  3. The ceiling is hardcoded at deployment.

To preserve the same interface, set_ceiling() and set_percentage_cap() are simple returns.

I have also updated the devnet script to transmute 250,000 USDC at launch. Once approved, I will proceed with adding the deployment on Sepolia without the initial transmute. The mainnet script can be tackled in #589.

tserg commented 5 months ago

I have deployed this transmuter variant on Sepolia and performed a [transmute] (0x5d5bc2706cfbeeb91eb76a46be12b443f7ec1ec33b969f367d98f772c3a8bfe) of 5 USDC with the devnet script locally:

let transmute_amt: u128 = 5000000; // 5 (10**6)
    let _approve_usdc = invoke(
        addresses::sepolia::usdc(),
        selector!("approve"),
        array![usdc_transmuter_restricted.into(), transmute_amt.into(), 0],
        Option::Some(constants::MAX_FEE),
        Option::None,
    )
        .expect('approve USDC failed');
    let _transmute = invoke(
        usdc_transmuter_restricted,
        selector!("transmute"),
        array![transmute_amt.into()],
        Option::Some(constants::MAX_FEE),
        Option::None
    )
        .expect('transmute failed');