pub fn ramp_amplification(&mut self, future_amp_factor: u128, future_amp_time: Timestamp) {
        let current_time = env::block_timestamp();
        assert!(
            current_time >= self.init_amp_time + MIN_RAMP_DURATION,
            "{}",
            ERR81_AMP_IN_LOCK
        );
        assert!(
            future_amp_time >= current_time + MIN_RAMP_DURATION,
            "{}",
            ERR82_INSUFFICIENT_RAMP_TIME
        );
        let invariant = StableSwap::new(
            self.init_amp_factor,
            self.target_amp_factor,
            current_time,
            self.init_amp_time,
            self.stop_amp_time,
        );
        let amp_factor = invariant
            .compute_amp_factor()
            .expect(ERR66_INVARIANT_CALC_ERR);
        assert!(
            future_amp_factor > 0 && future_amp_factor < MAX_AMP,
            "{}",
            ERR83_INVALID_AMP_FACTOR
        );
        assert!(
            (future_amp_factor >= amp_factor && future_amp_factor <= amp_factor * MAX_AMP_CHANGE)
                || (future_amp_factor < amp_factor
                    && future_amp_factor * MAX_AMP_CHANGE >= amp_factor),
            "{}",
            ERR84_AMP_LARGE_CHANGE
        );
        self.init_amp_factor = amp_factor;
        self.init_amp_time = current_time;
        self.target_amp_factor = future_amp_factor;
        self.stop_amp_time = future_amp_time;
    }
/// [Admin function] increase the amplification factor.
[Admin function] increase the amplification factor.
[ Admin function ] increase the amplification factor .
pub fn ramp_amplification(&mut self, future_amp_factor: u128, future_amp_time: Timestamp) {
        let current_time = env::block_timestamp();
        assert!(
            current_time >= self.init_amp_time + MIN_RAMP_DURATION,
            "{}",
            ERR81_AMP_IN_LOCK
        );
        assert!(
            future_amp_time >= current_time + MIN_RAMP_DURATION,
            "{}",
            ERR82_INSUFFICIENT_RAMP_TIME
        );
        let invariant = StableSwap::new(
            self.init_amp_factor,
            self.target_amp_factor,
            current_time,
            self.init_amp_time,
            self.stop_amp_time,
        );
        let amp_factor = invariant
            .compute_amp_factor()
            .expect(ERR66_INVARIANT_CALC_ERR);
        assert!(
            future_amp_factor > 0 && future_amp_factor < MAX_AMP,
            "{}",
            ERR83_INVALID_AMP_FACTOR
        );
        assert!(
            (future_amp_factor >= amp_factor && future_amp_factor <= amp_factor * MAX_AMP_CHANGE)
                || (future_amp_factor < amp_factor
                    && future_amp_factor * MAX_AMP_CHANGE >= amp_factor),
            "{}",
            ERR84_AMP_LARGE_CHANGE
        );
        self.init_amp_factor = amp_factor;
        self.init_amp_time = current_time;
        self.target_amp_factor = future_amp_factor;
        self.stop_amp_time = future_amp_time;
    }
pub fn ramp_amplification ( & mut self , future_amp_factor : u128 , future_amp_time : Timestamp ) { let current_time = env :: block_timestamp ( ) ; assert ! ( current_time self init_amp_time MIN_RAMP_DURATION " " ERR81_AMP_IN_LOCK ) ; assert ! ( future_amp_time current_time MIN_RAMP_DURATION " " ERR82_INSUFFICIENT_RAMP_TIME ) ; let invariant = StableSwap :: new ( self . init_amp_factor , self . target_amp_factor , current_time , self . init_amp_time , self . stop_amp_time , ) ; let amp_factor = invariant . compute_amp_factor ( ) . expect ( ERR66_INVARIANT_CALC_ERR ) ; assert ! ( future_amp_factor 0 future_amp_factor MAX_AMP " " ERR83_INVALID_AMP_FACTOR ) ; assert ! ( ( future_amp_factor amp_factor future_amp_factor amp_factor MAX_AMP_CHANGE ) ( future_amp_factor amp_factor future_amp_factor MAX_AMP_CHANGE amp_factor ) " " ERR84_AMP_LARGE_CHANGE ) ; self . init_amp_factor = amp_factor ; self . init_amp_time = current_time ; self . target_amp_factor = future_amp_factor ; self . stop_amp_time = future_amp_time ; }
[Admin function] increase the amplification factor.
[ Admin function ] increase the amplification factor .
&mut self
future_amp_factor
u128
future_amp_time
Timestamp
&mut self
future_amp_factor
u128
future_amp_time
Timestamp